From d4b07f2b334dada626e4743951cdd6adab87f62e Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Sat, 12 Jan 2008 18:18:43 +0900 Subject: Tweaks of various page layouts and handling of data This is a patch that fixes a lot of little things: * We no longer have pkgsearch or pkgdetails link functions and all references to them are gone, that's what a back button is for and if we really need it we can come up with something better * No longer have do_Details variable, this means links on the package search are simply ?ID=foo * On the pkgdetails pages when there are either no deps, deps by, sources or comments for a package the list for each will display "None" instead of nothing at all (ruining the layout) * Fixed a bug where if a package had no sources or no deps pkgsubmit.php would submit an empty one * Translation of the word "Search'" has been changed to "Search" Most of these relate to each other. Signed-off-by: Callan Barrett --- web/lib/pkgfuncs.inc | 343 +++++++++++++++++++++++---------------------------- 1 file changed, 156 insertions(+), 187 deletions(-) (limited to 'web/lib/pkgfuncs.inc') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index f560ef9..46bc522 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -6,42 +6,6 @@ include_once("config.inc"); # $pkgsearch_vars = array("O", "L", "C", "K", "SB", "SO", "PP", "do_MyPackages", "do_Orphans", "SeB"); - -# print out the 'return to package details' link -# -function pkgdetails_link($id=0) { - $url_data = ""; - print __("Go back to %hpackage details view%h.", - array($url_data, "")); - print "\n
\n"; - return; -} - - -# print out the 'return to search results' link -# -function pkgsearch_results_link() { - global $_REQUEST; - global $pkgsearch_vars; - - $url_data = ""; - print "
"; - print __("Go back to %hsearch results%h.", - array($url_data, "")); - print "
"; - print "\n
\n"; - - return; -} - # Make sure this visitor can delete the requested package comment # They can delete if they were the comment submitter, or if they are a TU/Dev # @@ -387,21 +351,25 @@ function package_details($id=0, $SID="") { echo __("Dependencies")."\n"; echo " "; $deps = package_dependencies($row["ID"]); # $deps[0] = array('id','name', 'dummy'); - while (list($k, $darr) = each($deps)) { - $url = "".$darr[1].$darr[3]."
\n"; + else echo "".$darr[1].$darr[3]."
\n"; } - reset($pkgsearch_vars); - - // $darr[3] is the DepCondition - - if ($darr[2] == 0) echo $url."'>".$darr[1].$darr[3]."
\n"; - else echo "".$darr[1].$darr[3]."
\n"; } echo "\n"; echo ""; @@ -413,58 +381,66 @@ function package_details($id=0, $SID="") { echo __("Required by")."\n"; echo ""; $deps = package_required($row["ID"]); - while (list($k, $darr) = each($deps)) { - $url = "".$darr[1].$darr[3]."
\n"; + else print "".$darr[1].$darr[3]."
\n"; } - reset($pkgsearch_vars); - - // $darr[3] is the DepCondition - - if ($darr[2] == 0) print $url."'>".$darr[1].$darr[3]."
\n"; - else print "".$darr[1].$darr[3]."
\n"; } - echo "\n"; - echo " \n"; - echo " \n"; + echo "\n"; + echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; - echo "
"; echo __("Sources")."
"; $sources = package_sources($row["ID"]); # $sources[0] = 'src'; - while (list($k, $src) = each($sources)) { - $parsed_url = parse_url($src); - if ($parsed_url['scheme']) - { - //It is an external source - echo "".$src."
\n"; - } - else - { - //It is presumably an internal source - if ($row["LocationID"] == 2) { - echo "".$src."
\n"; - } elseif ($row["LocationID"] == 3) { - echo ""; - echo $src."
\n"; + if (count($sources) == 0) { + print "None\n"; + } else { + while (list($k, $src) = each($sources)) { + $parsed_url = parse_url($src); + if ($parsed_url['scheme']) + { + //It is an external source + echo "".$src."
\n"; + } + else + { + //It is presumably an internal source + if ($row["LocationID"] == 2) { + echo "".$src."
\n"; + } elseif ($row["LocationID"] == 3) { + echo ""; + echo $src."
\n"; + } } } } echo "
\n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " \n"; - echo " \n"; - echo "\n\n"; - echo "
\n\n"; + echo " \n"; + echo "\n\n"; + echo "
\n\n"; # Actions Bar @@ -534,19 +510,20 @@ function package_details($id=0, $SID="") { # Comments # - echo "
\n"; - echo "
".__("Comments")."
\n"; - echo "
\n"; + echo "
\n"; + echo "
".__("Comments")."
\n"; + echo "
\n"; echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + if (isset($_COOKIE['AURSID'])) { + echo ""; + //echo "
\n"; + } $comments = package_comments($row["ID"]); if (!empty($comments)) { while (list($indx, $carr) = each($comments)) { @@ -554,8 +531,8 @@ function package_details($id=0, $SID="") { echo " \n"; echo " \n"; echo " \n"; } + } else { + print "\n"; } - echo "
\n"; - echo "
\n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; - echo " \n"; + echo "\n"; + echo " \n"; echo "
"; + echo "
"; if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) { $durl = ""; + echo "
"; echo "\n"; echo nl2br(htmlspecialchars($carr["Comments"])); - echo "
\n"; echo "
None
\n"; - echo "
\n"; - echo "
\n"; - + echo "
\n"; + echo "
\n"; } } return; @@ -942,61 +919,77 @@ function pkg_search_page($SID="") { $q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC "; break; } + $qnext = $q."LIMIT ".($O+$PP).", ".$PP; //next page's worth $q.= "LIMIT ".$O.", ".$PP; - print "\n"; + if ($SID) { + # The 'Actions' table + # + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "
\n"; + print " ".__("Actions")."\n"; + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + print "
"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
\n"; + print "
\n"; + print "
\n"; + print "
\n"; + } + + // Why? + // print "\n"; + $result = db_query($q, $dbh); + + print "
\n"; + print "\n"; + print "\n"; + print " \n"; + print "\n"; + print "\n"; + print "
\n"; + print " ".__("Package Listing")."\n"; + print "
\n"; + print "\n"; + if (!$result) { + print "
"; print __("Error retrieving package list."); - + print "
"; } elseif (!mysql_num_rows($result)) { + print "
"; print __("No packages matched your search criteria."); - + print "
"; } else { - - if ($SID) { - # The 'Actions' table - # - print "
\n"; - print "
\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " ".__("Actions")."\n"; - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print " \n"; - print "
"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "
\n"; - print "
\n"; - print "\n"; - print "
\n"; - } - # print out package search results # @@ -1006,17 +999,6 @@ function pkg_search_page($SID="") { } else { $SO_next="d"; } - - print "
\n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "\n"; - print " \n"; - print "\n"; - print "
\n"; - print " ".__("Package Listing")."\n"; - print "
\n"; - print "\n"; print "\n"; if ($SID) { print " \n"; print " \n"; print " \n"; - - print "
"; if ($row["OutOfDate"]) { $c = "outofdate"; } + print " "; print ""; # if ($i == 0) { # $all_ids = $row["ID"]; @@ -1085,20 +1067,8 @@ function pkg_search_page($SID="") { print $cats[$row["CategoryID"]].""; $url = ""; $url.=""; $url.=$row["Name"]; @@ -1210,13 +1180,12 @@ function pkg_search_page($SID="") { } print "
\n"; - print "
\n"; - print "
\n"; } + print "
\n"; + print " \n"; + print "\n"; + print "\n"; + print "
\n"; print "\n"; return; -- cgit v1.2.3-54-g00ecf