Update of /cvsroot/fink/web/pdb
In directory sc8-pr-cvs17:/tmp/cvs-serv24906/web/pdb

Modified Files:
      Tag: redesign_pdb
        browse.php package.php 
Log Message:
Don't show 10.5 by default (set in the distribution table of the db)
Add a hidden flag 'showall' that shows 10.5 packages as well if 'showall'
is set to 'on'


Index: package.php
===================================================================
RCS file: /cvsroot/fink/web/pdb/package.php,v
retrieving revision 1.43.2.23
retrieving revision 1.43.2.24
diff -u -d -r1.43.2.23 -r1.43.2.24
--- package.php 28 Aug 2007 21:36:16 -0000      1.43.2.23
+++ package.php 31 Aug 2007 19:39:56 -0000      1.43.2.24
@@ -23,6 +23,7 @@
 list($release, $inv_p) = get_safe_param('release', 
'/^[0-9.]{3,}$|^unstable$|^stable$/');
 list($architecture, $inv_p) = get_safe_param('architecture', 
'/^powerpc$|^i386$/');
 list($rel_id, $inv_p) = get_safe_param('rel_id', '/^[0-9]+$/');
+list($showall, $inv_p) = get_safe_param('showall', '/^on$/');
 
 // TODO/FIXME: Do we really need all the params above? On the other hand --
 // if the user clicks on a specific package version, shouldn't we select
@@ -38,6 +39,8 @@
 $qtodisplay_sel .= "FROM package AS p ";
 $qtodisplay_sel .= "INNER JOIN distribution_releases r ON r.rel_id = p.rel_id 
";
 $qtodisplay_sel .= "INNER JOIN distribution d ON r.dist_id = d.dist_id ";
+if (!$showall)
+  $qtodisplay_sel .= "AND d.visible='1' ";
 
 $qtodisplay_where .= "WHERE p.name='$package' ";
 if ($version) {
@@ -169,7 +172,10 @@
  print "</tr>\n";
 
  // Fetch list of all distributions
- $q = "SELECT * FROM distribution WHERE active='1' ORDER BY priority DESC";
+ $q = "SELECT * FROM distribution WHERE active='1' ";
+ if (!$showall)
+   $q .= "AND visible='1' ";
+ $q .= "ORDER BY priority DESC";
  $qdist = mysql_query($q, $dbh);
  if (!$qdist) {
    die('<p><b>error during query:</b> '.mysql_error().'</p>');

Index: browse.php
===================================================================
RCS file: /cvsroot/fink/web/pdb/browse.php,v
retrieving revision 1.1.2.24
retrieving revision 1.1.2.25
diff -u -d -r1.1.2.24 -r1.1.2.25
--- browse.php  28 Aug 2007 21:36:16 -0000      1.1.2.24
+++ browse.php  31 Aug 2007 19:39:56 -0000      1.1.2.25
@@ -28,6 +28,7 @@
   addGETParam($getparams, 'nochildren');
   addGETParam($getparams, 'noshlibsdev');
   addGETParam($getparams, 'sort');
+  addGETParam($getparams, 'showall');
   $redirect_url = '?';
   foreach ($getparams as $key => $value) {
     $redirect_url .= "$key=$value&";
@@ -104,9 +105,14 @@
        echo "<br>";
 }
 
+list($showall, $inv_p) = get_safe_param('showall', '/^on$/');
+
 // Distribution values
 $dist_values = array();
-$q = "SELECT * FROM distribution WHERE active='1' ORDER BY priority DESC";
+$q = "SELECT * FROM distribution WHERE active='1' ";
+if (!$showall)
+  $q .= "AND visible='1' ";
+$q .= "ORDER BY priority DESC";
 $qdist = mysql_query($q, $dbh);
 if (!$qdist) {
   die('<p><b>error during query:</b> '.mysql_error().'</p>');
@@ -184,6 +190,7 @@
 ?>
 
 <form action="browse.php" method="get" name="pdb_browser" id="pdb_browser" 
onreset="resetForm();return false;">
+<?if ($showall) print '<input name="showall" type="hidden" value="on">';?>
 <br>
 Summary:
 <input name="summary" type="text" 
value="<?=stripslashes(stripslashes($summary))?>"> (Leave empty to list all)
@@ -299,8 +306,10 @@
   // The only additions are the '$tree' specifiers.
   $query .= "FROM package p, distribution_releases r, distribution d ".
             "WHERE p.rel_id = r.rel_id ".
-            "  AND r.dist_id = d.dist_id ".
-            "  AND r.type = '$tree' ".
+            "  AND r.dist_id = d.dist_id ";
+  if (!$showall)
+    $query .= "AND d.visible='1' ";
+  $query .= "  AND r.type = '$tree' ".
             "  AND d.priority = (SELECT MAX(dX.priority) ".
             "    FROM package pX, ".
             "         distribution_releases rX, ".
@@ -308,8 +317,10 @@
             "    WHERE p.name = pX.name ".
             "      AND pX.rel_id = rX.rel_id ".
             "      AND rX.dist_id = dX.dist_id ".
-            "      AND rX.type = '$tree' ".
-            "    GROUP BY pX.name) ".
+            "      AND rX.type = '$tree' ";
+  if (!$showall)
+    $query .= "    AND dX.visible='1' ";
+    $query ."    GROUP BY pX.name) ".
             "  AND r.priority = (SELECT MAX(rX.priority) ".
             "    FROM package pX, ".
             "         distribution_releases rX ".
@@ -322,15 +333,19 @@
   // show latest if no specifc dist/tree
   $query .= "FROM package p, distribution_releases r, distribution d ".
             "WHERE p.rel_id = r.rel_id ".
-            "  AND r.dist_id = d.dist_id ".
-            "  AND d.priority = (SELECT MAX(dX.priority) ".
+            "  AND r.dist_id = d.dist_id ";
+  if (!$showall)
+    $query .= "AND d.visible='1' ";
+  $query .= "  AND d.priority = (SELECT MAX(dX.priority) ".
             "    FROM package pX, ".
             "         distribution_releases rX, ".
             "         distribution dX ".
             "    WHERE p.name = pX.name ".
             "      AND pX.rel_id = rX.rel_id ".
-            "      AND rX.dist_id = dX.dist_id ".
-            "    GROUP BY pX.name) ".
+            "      AND rX.dist_id = dX.dist_id ";
+  if (!$showall)
+    $query .= "    AND dX.visible='1' ";
+  $query .= "    GROUP BY pX.name) ".
             "  AND r.priority = (SELECT MAX(rX.priority) ".
             "    FROM package pX, ".
             "         distribution_releases rX ".
@@ -408,9 +423,9 @@
   while ($row = mysql_fetch_array($rs)) {
     print '<tr class="package">';
     if ($tree || $dist)
-      $rel_id_str = '?rel_id='.$row["rel_id"];
+      $rel_id_str = '?rel_id='.$row["rel_id"].($showall ? '&showall=on' : '');
     else
-      $rel_id_str = '';
+      $rel_id_str = ($showall ? '?showall=on' : '');
     print '<td class="packageName"><a 
href="package.php/'.$row["name"].$rel_id_str.'">'.$row["name"].'</a></td>';
     if ($tree == 'testing') {
       print '<td>'.$row['version_unstable'].'</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
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to