From 172dbf696bb40f29992b9916343de5eae84a61d3 Mon Sep 17 00:00:00 2001 From: Callan Barrett Date: Fri, 22 Feb 2008 22:44:05 +0900 Subject: Fixed broken search results Quick fix for my friggin crazy more and less link patch that was swapping the search results order every click and not remembering how to sort, my bad This could probably use improvement but it means the search actually works now Signed-off-by: Callan Barrett Signed-off-by: Simo Leone --- web/lib/pkgfuncs.inc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index c559750..9612c73 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -854,18 +854,23 @@ function pkg_search_page($SID="") { switch ($_REQUEST["SB"]) { case 'c': $q.= "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC "; + $SB = 'c'; break; case 'l': $q.= "ORDER BY LocationID ".$order.", Name ASC, CategoryID DESC "; + $SB = 'l'; break; case 'v': $q.= "ORDER BY NumVotes ".$order.", Name ASC, CategoryID DESC "; + $SB = 'v'; break; case 'm': $q.= "ORDER BY Username ".$order.", Name ASC, LocationID ASC "; + $SB = 'm'; break; case 'a': $q.= "ORDER BY GREATEST(SubmittedTS,ModifiedTS) ".$order.", Name ASC, LocationID ASC "; + $SB = 'a'; break; default: $q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC "; @@ -905,8 +910,10 @@ function pkg_search_page($SID="") { # SO_next used to change sort order on header click if ($_REQUEST["SO"] == "d"){ $SO_next="a"; + $SO = 'd'; } else { $SO_next="d"; + $SO = 'a'; } print "\n"; if ($SID) { @@ -1088,6 +1095,7 @@ function pkg_search_page($SID="") { # print number of results # ok this styling sucks + # patches welcome! print ""; print __("Showing results %s - %s of %s", array($first, $last, $allresults)); print ""; @@ -1107,15 +1115,15 @@ function pkg_search_page($SID="") { print " "; print " "; if (($O-$PP) >= 0) { - print "" . __("Less") . ""; + print "" . __("Less") . ""; } else if ($O<$PP && $O>0) { - print "" . __("Less") . ""; + print "" . __("Less") . ""; } print " "; # RIGHT print " "; if (mysql_num_rows(db_query($qnext, $dbh))) { - print "" . __("More") . ""; + print "" . __("More") . ""; } print " \n"; print " \n"; -- cgit v1.2.3-54-g00ecf