| <?php |
| /******************************************************************************* |
| * Copyright (c) 2011, 2012 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Wayne Beaton (Eclipse Foundation) - initial API and implementation |
| *******************************************************************************/ |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); |
| |
| $App = new App(); |
| $Nav = new Nav(); |
| $Menu = new Menu(); |
|
|
| include($App->getProjectCommon()); |
|
|
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/Project.class.php");
|
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/SimultaneousReleaseInfo.class.php");
|
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/debug.php");
|
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/common.php");
|
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/images.inc"); |
| |
| $releases = getSimultaneousReleaseNames();
|
| $release = getCurrentSimultaneousReleaseName();
|
| if (isset($_GET['release'])) {
|
| $target = $_GET['release'];
|
| if (in_array($target, $releases)) $release = $target;
|
| }
|
| $releaseName = ucfirst($release);
|
|
|
| $pageTitle = "Eclipse $releaseName Release";
|
| $pageKeywords = "";
|
| $pageAuthor = "Wayne Beaton";
|
| |
| function getProjectStatusData($release) {
|
| $projects = array(); |
| foreach(getAllProjectsInSimultaneousRelease($release) as $project) {
|
| $id = $project->getId();
|
| $info = $project->getSimultaneousReleaseInfo($release);
|
| if (!$info) continue;
|
| $offset = $info->getOffset();
|
| |
| if ($releases = $info->getReleases()) {
|
| foreach($releases as $projectRelease) {
|
| $version = $projectRelease->getName() ? $projectRelease->getName() : null;
|
| if (!$version) $version = "??";
|
|
|
| $review = $projectRelease->getReview();
|
| |
| $projects[] = array( |
| 'top' => $project->getTopLevelProject()->getId(), |
| 'topName' => $project->getTopLevelProject()->getName(), |
| 'id' => $id, |
| 'name' => $project->getName(), |
| 'offset' => $offset, |
| 'version' => $version, |
| 'download' => $projectRelease->getDownload(), |
| 'plan' => $projectRelease->getPlan(), |
| 'doc' => $review ? $review->getSlidesUrl() : null, |
| 'iplog' => $review ? $review->getIplogUrl() : null, |
| 'review' => $review ? date('Y-m-d', $review->getReviewDate()) : null, |
| 'graduate' => $review ? $review->isGraduation() : false |
| );
|
| } |
| } else { |
| $projects[] = array( |
| 'top' => $project->getTopLevelProject()->getId(), |
| 'topName' => $project->getTopLevelProject()->getName(),
|
| 'id' => $id, |
| 'name' => $project->getName(),
|
| 'offset' => $offset,
|
| 'version' => null,
|
| 'download' => null,
|
| 'plan' => null,
|
| 'doc' => null,
|
| 'iplog' => null, |
| 'review' => null, |
| 'graduate' => false,
|
| ); |
| }
|
| } |
| return $projects; |
| } |
| |
| function isValidKey($key) { |
| return in_array($key, getValidSortKeys()); |
| } |
| |
| function getValidSortKeys() { |
| return array('top', 'id', 'name', 'offset', 'version', 'download', 'plan', 'doc', 'iplog', 'review', 'graduate'); |
| } |
| |
| function getSortKeys() { |
| global $_sortKeys; |
| if (!$_sortKeys) { |
| $keys = preg_split('/,/',isset($_GET['sort']) ? $_GET['sort'] : 'id,version'); |
| $_sortKeys = array(); |
| foreach($keys as $key) { |
| if (isValidKey($key) && !in_array($key, $_sortKeys)) |
| $_sortKeys[] = $key; |
| } |
| } |
| return $_sortKeys; |
| } |
| |
| function filter($info) { |
| foreach($_GET as $key=>$value) { |
| if (!isValidKey($key)) continue; |
| if (!isset($info[$key])) return true; |
| if ($info[$key] != $value) return true; |
| } |
| return false; |
| } |
| |
| function getSortParameter($main) { |
| $parameters = array($main); |
| foreach(getSortKeys() as $key) |
| if (!in_array($key, $parameters)) |
| $parameters[] = $key; |
| return implode(',', $parameters); |
| } |
| |
| function getHttpParameters($sort=null, $top=null) { |
| $parameters = array(); |
| foreach($_GET as $key=>$value) $parameters[$key] = $value; |
| if ($sort) $parameters['sort'] = getSortParameter($sort); |
| if ($top) $parameters['top'] = $top; |
| |
| $out = ''; $separator = ''; |
| foreach($parameters as $key => $value) { |
| $out = "$out$separator$key=$value"; |
| $separator = '&'; |
| } |
| return $out; |
| } |
| |
| function dumpStatus($projects) { |
| global $images; |
| |
| echo "<table>"; |
| |
| echo "<tr>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('top') . "\">Top Level</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('name') . "\">Name</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('offset') . "\">Offset</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('version') . "\">Version</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('download') . "\">Download</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('plan') . "\">Plan</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('iplog') . "\">IP Log</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('doc') . "\">Doc</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('review') . "\">Review Date</a></div></th>"; |
| echo "<th><div style=\"width:2em;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-90deg);\"><a href=\"?" . getHttpParameters('graduate') . "\">Graduation?</a></div></th>"; |
| echo "</tr>"; |
| |
| usort($projects, 'sort_projects'); |
| |
| $count = 0; |
| $colour = true; |
| foreach($projects as $project) { |
| if (filter($project)) continue; |
| $count++; |
| $top = $project['topName']; |
| $id = $project['id']; |
| $name = $project['name']; |
| $offset = $project['offset'] ? $project['offset'] : ' '; |
| $version = $project['version'] ? $project['version'] : ' '; |
| $download = $project['download'] ? "<a href=\"${project['download']}\"<img src=\"$images->check\"/></a>" : ' '; |
| $plan = $project['plan'] ? "<a href=\"${project['plan']}\"><img src=\"$images->check\"/></a>" : ' '; |
| $iplog = $project['iplog'] ? "<a href=\"${project['iplog']}\"><img src=\"$images->check\"/></a>" : ' '; |
| $doc = $project['doc'] ? "<a href=\"${project['doc']}\"><img src=\"$images->check\"/></a>" : ' '; |
| $date = $project['review']; |
| $graduate = $project['graduate'] ? "<img src=\"$images->check\"/>" : ' '; |
| |
| $style = $colour ? ' style="background-color:#E2E2E2"' : ''; |
| $colour = !$colour; |
| |
| echo "<tr$style>"; |
| echo "<td>$top</td>"; |
| echo "<td><a href=\"/projects/project.php?id=$id\">$name</a></td>"; |
| echo "<td>$offset</td>"; |
| echo "<td>$version</td>"; |
| echo "<td>$download</td>"; |
| echo "<td>$plan</td>"; |
| echo "<td>$iplog</td>"; |
| echo "<td>$doc</td>"; |
| echo "<td>$date</td>"; |
| echo "<td>$graduate</td>"; |
| |
| echo "</tr>"; |
| |
| } |
| echo "</table>"; |
| |
| echo "<p>$count projects.</p>"; |
| } |
| |
| function sort_projects($projectA, $projectB) { |
| foreach(getSortKeys() as $key) { |
| $a = $projectA[$key]; |
| $b = $projectB[$key]; |
| |
| // Make sure that empty values end up on the bottom. |
| if (!$a && !$b) return 0; |
| if (!$a) return 1; |
| if (!$b) return -1; |
| |
| $cmp = strcasecmp($a, $b); |
| if ($cmp !== 0) return $cmp; |
| } |
| return 0; |
| } |
| |
| if (isset($_GET['json'])) { |
| header("Content-type: application/json"); |
| echo json_encode(getProjectStatus()); |
| exit; |
| } |
| |
| ob_start(); |
| ?> |
| <div id="maincontent"> |
| <div id="midcolumn"> |
| <h1><?php echo $pageTitle; ?></h1> |
| <?php dumpStatus(getProjectStatusData($release)); ?> |
| </div> |
| </div> |
| <div id="rightcolumn"> |
| <div class="sideitem"> |
| <h6>Filter by Top Level</h6> |
| |
| <ul> |
| <?php |
| foreach(getTopLevelProjects() as $project) { |
| $id = $project->getId(); |
| $name = $project->getName(); |
| $link = "?" . getHttpParameters(null, $id); |
| echo "<li><a href=\"$link\">$name</a></li>"; |
| } |
| ?> |
| |
| </ul> |
| |
| </div> |
| |
| </div> |
| <?php |
| $html = ob_get_contents(); |
| ob_end_clean(); |
| $App->generatePage('Nova', $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| ?> |