blob: 9452c8ef654fdeb6879fa6b13c8c5dba01a7a7ad [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2008, 2011 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:
* Bjorn Feeman-Benson (Eclipse Foundation) - initial API and implementation
* Wayne Beaton (Eclipse Foundation) - Bug 345906
*******************************************************************************/
$serverRoot = dirname(__FILE__) . '/..';
require_once("$serverRoot/eclipse.org-common/system/app.class.php");
require_once("$serverRoot/eclipse.org-common/system/nav.class.php");
require_once("$serverRoot/eclipse.org-common/system/menu.class.php");
$App = new App();
$Nav = null;
$Menu = new Menu();
include($App->getProjectCommon());
require_once("$serverRoot/projects/classes/Project.class.php");
require_once("$serverRoot/projects/classes/common.php");
require_once("$serverRoot/projects/classes/debug.php");
$projects = getTopLevelProjects();
$selected = getSelectedProjects();
if (isset($_REQUEST['Generate']) && $selected) {
header('Location: ip_log.php?projectid=' . implode(',', $selected));
}
$pageTitle = "IP Log Selector";
$pageKeywords = 'IP Log, CQ, ';
$pageAuthor = 'Wayne Beaton';
function getSelectedProjects() {
global $_REQUEST;
$selected = array();
if (isset($_REQUEST['projectid'])) {
$ids = explode(',', $_REQUEST['projectid']);
foreach ($ids as $id) {
if (getProject($id)) $selected[] = $id;
}
}
foreach ($_REQUEST as $key=>$value) {
$id = strtr( $key, '_', '.' );
//if (!$value == 'on') continue;
if (getProject($id)) $selected[] = $id;
}
return $selected;
}
function dumpProjectTree($projects, $selected) {
if (!$projects) return;
echo "<div style=\"margin-left:25px\">";
foreach ($projects as $project) {
if ($project->isComponent()) continue;
$id = $project->getId();
$title = $project->getName();
$checked = in_array($id, $selected) ? "checked" : "";
$control = "<input type=\"checkbox\" name=\"$id\" value=\"on\" $checked/>";
echo "<p>$control $id <b>$title</b></p>";
dumpProjectTree($project->getChildren(), $selected);
}
echo "</div>";
}
ob_start();
?>
<div id="maincontent">
<h1><?php echo $pageTitle; ?></h1>
<p>Select the set of projects to be included in the IP Log and click &quot;Generate&quot;.</p>
<form method="GET">
<?php dumpProjectTree($projects, $selected); ?>
<?php echo "<input type=\"submit\" name=\"Generate\" value=\"Generate\"/>"; ?>
</form>
</div><!-- maincontent -->
<?php
# Paste your HTML content between the EOHTML markers!
$html = ob_get_contents();
ob_end_clean();
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>