| <?php | |
| /******************************************************************************* | |
| * Copyright (c) 2010 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 - initial API and implementation | |
| *******************************************************************************/ | |
| // FIXME Work in progress. Currently works only on Wayne's desktop. | |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/common.php"); | |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/debug.php"); | |
| trace_file_info(__FILE__); | |
| 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(); | |
| $scans_path = '/home/wayne/downloads_scan/'; | |
| $projectid = $App->getHttpParameter('id'); | |
| if (!preg_match('/^[a-zA-Z0-9]+(.[a-zA-Z0-9]+)*$/', $projectid) > 0) { | |
| $projectid = null; | |
| } | |
| ob_start(); | |
| $pageKeywords = ""; | |
| $pageTitle = "Project Downloads Scan"; | |
| $pageAuthor = "Wayne Beaton"; | |
| ?> | |
| <div id="midcolumn"> | |
| <h1><?= $pageTitle ?></h1> | |
| <div> | |
| <form method="get"> | |
| <p>Select a project: | |
| <select name="id"> | |
| <?php | |
| $directory = opendir($scans_path); | |
| while($file = readdir($directory)) { | |
| if (preg_match('/^(.*)\.xml$/', $file, $matches)) { | |
| $ids[] = $matches[1]; | |
| } | |
| $dirArray[] = $entryName; | |
| } | |
| closedir($directory); | |
| sort($ids); | |
| foreach($ids as $id) { | |
| $selected = $id == $projectid ? ' selected="true"' : ''; | |
| echo "<option value=\"$id\"$selected>$id</OPTION>"; | |
| } | |
| ?> | |
| </select> | |
| <input type="submit" value="Go!"/> | |
| </p> | |
| </form> | |
| <?php | |
| $files = array(); | |
| $xml = simplexml_load_file($scans_path . $projectid . '.xml'); | |
| foreach($xml->path as $path) { | |
| $location = $path['path']; | |
| foreach($path->file as $file) { | |
| $name = (String)$file['name']; | |
| $bundle = extract_bundle_name_and_version($name); | |
| if ($bundle) { | |
| $name = $bundle; | |
| } else { | |
| if (preg_match('/(.*)\\.jar$/', $name, $matches)) { | |
| $name = $matches[1]; | |
| } | |
| } | |
| $files[$name][] = $location; | |
| } | |
| } | |
| foreach ($files as $file => $locations) { | |
| echo "<h3>$file</h3>"; | |
| echo "<ul>"; | |
| foreach ($locations as $path) { | |
| echo "<li>$path</li>"; | |
| } | |
| echo "</ul>"; | |
| } | |
| echo get_trace_html(); | |
| ?> | |
| </div> | |
| </div> | |
| <?php | |
| $html = ob_get_contents(); | |
| ob_end_clean(); | |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); | |
| ?> |