Update of /cvsroot/fink/web/pdb In directory sc8-pr-cvs17:/tmp/cvs-serv24685/pdb
Modified Files: Tag: redesign_pdb browse.php Log Message: On the redesign_pdb branch: - Hide advanced search/browse options in a collapsable div tag, controled via javascript - Add the release id to the package links, if a tree or section is chosen in the search options. Index: browse.php =================================================================== RCS file: /cvsroot/fink/web/pdb/browse.php,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -u -d -r1.1.2.16 -r1.1.2.17 --- browse.php 15 Aug 2007 16:28:52 -0000 1.1.2.16 +++ browse.php 17 Aug 2007 20:33:12 -0000 1.1.2.17 @@ -6,15 +6,18 @@ function addGETParam(&$params, $param_name) { - $value = $_GET[$param_name]; + $value = stripslashes($_GET[$param_name]); if ($value) - $params[$param_name] = $value; + $params[$param_name] = urlencode($value); } -if (isset($_GET['submit']) && $_GET['submit'] == 'Browse') { +if (isset($_GET['submit']) && $_GET['submit'] == 'Search') { // Re-direct to clean out empty params $getparams = array(); + $value = $_GET['nomaintainer']; + if ($value == 'on') + $_GET['maintainer'] = 'None'; addGETParam($getparams, 'maintainer'); addGETParam($getparams, 'name'); addGETParam($getparams, 'summary'); @@ -33,6 +36,14 @@ header("Location: browse.php$redirect_url"); } +// are there any advanced search options? If no, collapse advanced search div +if ($_GET['maintainer'] || $_GET['name'] || $_GET['dist'] || $_GET['tree'] || $_GET['section'] || $_GET['nochildren'] || $_GET['noshlibsdev'] || $_GET['sort']) + $pdb_has_adv_searchoptions = true; +else + $pdb_has_adv_searchoptions = false; + +// load javascript for pdb in header.inc +$pdb_scripts = true; include "header.inc"; ?> @@ -79,10 +90,9 @@ return ((float)$usec + (float)$sec); } -// This function generates a form popup, with the given label, +// This function generates a form popup, with the given // variable name, current value, and list of possible values. -function genFormSelect($label, $var_name, $cur_val, $values, $description = '') { - echo $label; +function genFormSelect($var_name, $cur_val, $values, $description = '') { echo "<select NAME='$var_name'>\n"; foreach ($values as $key => $val) { echo " <option value='$key' "; @@ -134,8 +144,8 @@ // Read url parameters // NOTE: You have to change the parameter list at the top of this file as well -$maintainer = get_safe_param('maintainer', '/[EMAIL PROTECTED] ]+$/'); -$name = get_safe_param('name', '/^[a-z0-9+\-.]+$/'); +$maintainer = get_safe_param('maintainer', '/[EMAIL PROTECTED]&\'\\\ ]+$/'); +$name = get_safe_param('name', '/^[a-z0-9+\-.%]+$/'); $summary = get_safe_param('summary', '/.*/'); $nolist = get_safe_param('nolist', '/on/'); @@ -169,28 +179,33 @@ ?> <form action="browse.php" method="get" name="pdb_browser" id="pdb_browser"> - -<script language="javascript" type="text/javascript"> -<!-- -function list_unmaintained_packages() { - document.pdb_browser.elements.maintainer.value="None" -} -//--> -</script> - -Maintainer: -<input name="maintainer" type="text" value="<?=$maintainer?>"> -(<a href="javascript:list_unmaintained_packages()">list packages without maintainer</a>) +<br> +Summary: +<input name="summary" type="text" value="<?=stripslashes(stripslashes($summary))?>"> (Leave empty to list all) <br> -Name: -<input name="name" type="text" value="<?=$name?>"> +<input name="submit" type="submit" value="Search"> +<input type="reset" value="Clear Form"> +<br> <br> -Summary: -<input name="summary" type="text" value="<?=$summary?>"> +<a href="javascript:switchMenu('avancedsearch','triangle');" title="Advanced search options" id="expand_adv_options"><img src="<? echo $root ?>img/collapse.png" alt="" id="triangle" width="9" height="8"> Advanced search options</a> <br> +<div id="avancedsearch"> + +<table><tr> +<td>Package Name:</td> +<td><input name="name" type="text" value="<?=$name?>"> (Exact match. Use '%' as wildcard.)</td> +</tr><tr> +<td>Maintainer:</td> +<td> +<input name="maintainer" type="text" value="<?=stripslashes(stripslashes($maintainer))?>" onChange="set_list_nomaintainer(this.value)"> +<input name="nomaintainer" type="checkbox" onchange="list_unmaintained_packages(this.checked)" <? if ($maintainer == "None") echo "checked";?>> +No maintainer +</td> +</tr> + <? // We need to set a specific distribution if showing packages in "testing" @@ -200,13 +215,22 @@ next($dist_values); $dist = key($dist_values); } - -genFormSelect("Distribution: ", "dist", $dist, $dist_values, 'Please test!'); -genFormSelect("Tree: ", "tree", $tree, $tree_values, 'Please test!'); -genFormSelect("Section: ", "section", $section, $section_values); -genFormSelect("Sort: ", "sort", $sort, $sort_values); ?> +<tr> +<td>Distribution:</td> +<td><?genFormSelect("dist", $dist, $dist_values);?></td> +</tr><tr> +<td>Tree:</td> +<td><?genFormSelect("tree", $tree, $tree_values);?></td> +</tr><tr> +<td>Section:</td> +<td><?genFormSelect("section", $section, $section_values);?></td> +</tr><tr> +<td>Sort order:</td> +<td><?genFormSelect("sort", $sort, $sort_values);?></td> +</tr></table> + <input name="nochildren" type="checkbox" <? if ($nochildren == "on") echo "checked";?>> Exclude packages with parent (includes most "-dev", "-shlibs", ... splitoffs) <br> @@ -215,8 +239,8 @@ Exclude -shlibs, -dev, -bin, -common, -doc packages <br> -<input name="submit" type="submit" value="Browse"> -<input type="reset" value="Clear Form"> +</div> + </form> @@ -228,7 +252,7 @@ // Build the big query string // $query = - "SELECT p.name, p.version, p.revision, p.descshort "; + "SELECT p.name, p.version, p.revision, p.descshort, r.rel_id "; if ($dist && $tree) { // show pkg of specifc dist/tree if ($tree == 'testing') { @@ -318,7 +342,7 @@ $query .= "AND p.maintainer LIKE '%$maintainer%' "; if ($name != "") - $query .= "AND p.name LIKE '%$name%' "; + $query .= "AND p.name LIKE '$name' "; if ($summary != "") $query .= "AND (p.name LIKE '%$summary%' OR p.descshort LIKE '%$summary%' OR p.desclong LIKE '%$summary%' OR p.descusage LIKE '%$summary%') "; @@ -368,8 +392,12 @@ print '<tr><th>Name</th><th>Latest Version</th><th>Description</th></tr>'; } while ($row = mysql_fetch_array($rs)) { - print '<tr>'. - '<td><a href="package.php/'.$row["name"].'">'.$row["name"].'</a></td>'; + print '<tr>'; + if ($tree || $dist) + $rel_id_str = '?rel_id='.$row["rel_id"]; + else + $rel_id_str = ''; + print '<td><a href="package.php/'.$row["name"].$rel_id_str.'">'.$row["name"].'</a></td>'; if ($tree == 'testing') { print '<td>'.$row['version_unstable'].'</td>'. '<td>'.$row['version_stable'].'</td>'; ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fink-commits