| <?php |
| /******************************************************************************* |
| * Copyright (c) 2007-2015 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: |
| * Denis Roy (Eclipse Foundation)- initial API and implementation |
| *******************************************************************************/ |
| |
| include("../html/header_popup.php"); |
| |
| # build recordset for for projects drop-down |
| $sql = "SELECT PRJ.project_id, PRJ.download_stat_regexp, COUNT(IDX.file_id) AS FileCount |
| FROM projects AS PRJ INNER JOIN download_file_index AS IDX ON IDX.file_name LIKE CONCAT(CONCAT('%', PRJ.download_stat_regexp), '%') |
| WHERE PRJ.download_stat_regexp <> '' |
| GROUP BY PRJ.project_id, PRJ.download_stat_regexp ORDER BY PRJ.project_id"; |
| |
| $rs_project_list = mysql_query($sql, $dbh); |
| |
| ?> |
| <font class="normal"> |
| <h2>File selector</h2> |
| |
| <table width="100%" cellpadding="2" cellspacing="2" border="0"> |
| <tr> |
| <td colspan="3" class="head_section"> |
| <b>Search Criteria</b> |
| </td> |
| </tr> |
| </table> |
| |
| <form method="post" action="stats_file_pick.php" name="form1"> |
| <table width="100%" cellpadding="2" cellspacing="2" border="0"> |
| <tr> |
| <td valign="top" width="50%"> |
| <table border="0"> |
| <tr> |
| <td>Files in</td> |
| <td> |
| <select name="project_id" onchange="document.form1.filename.value = this[this.selectedIndex].value;"> |
| <option value=""></option> |
| <?php |
| while($myrow = mysql_fetch_assoc($rs_project_list)) { |
| echo "<option value=\"" . $myrow['download_stat_regexp'] . "\">" . $myrow['project_id'] . " (" . $myrow['FileCount'] . " files)</option>"; |
| } |
| ?> |
| </select> |
| </td> |
| </tr> |
| <tr> |
| <td> </td> |
| <td><input name="gobutton" type="submit" value="Display" /></td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| |
| <input type="hidden" name="filename" value="" /> |
| </form> |
| |
| <table width="100%"> |
| <tr class="datahdr"> |
| <td>File (click to pick)</td> |
| </tr> |
| <?php |
| $i = 0; |
| while($myrow = mysql_fetch_assoc($rs)) { |
| $i++; |
| ?> |
| |
| <tr class="data<?= $i % 2 ?>"> |
| <td><a href="javascript:fnSelect('<?= $myrow['file_name'] ?>');"><?= $myrow['file_name'] ?></a></td> |
| </tr> |
| |
| |
| <?php |
| } |
| ?> |
| <tr> |
| <td height="7"></td> |
| <td align="right"></td> |
| </tr> |
| |
| <tr class="datahdr"> |
| <td><?= $i ?> record<?= $i > 1 ? "s" : "" ?> found.</td> |
| </tr> |
| </table> |
| |
| |
| |
| <script language="javascript"> |
| function fnSelect(_file){ |
| window.opener.document.form1.filename.value = _file; |
| window.close(); |
| } |
| </script> |
| </font> |
| |
| |
| <?php |
| include("../html/footer.php"); |
| ?> |
| |