From 18dc7c783e80ab7ed8dc137a0b36317b49d7c073 Mon Sep 17 00:00:00 2001 From: swiergot Date: Tue, 22 Aug 2006 13:58:36 +0000 Subject: Added dsa's sorting improvement patch (closes #3370, #4091, #4097 and #4098). --- web/lang/en/pkgfuncs_po.inc | 6 +++ web/lang/pt/pkgfuncs_po.inc | 12 ++++- web/lib/pkgfuncs.inc | 120 ++++++++++++++++++++++++++++++++------------ 3 files changed, 105 insertions(+), 33 deletions(-) diff --git a/web/lang/en/pkgfuncs_po.inc b/web/lang/en/pkgfuncs_po.inc index 0707a87..74697a8 100644 --- a/web/lang/en/pkgfuncs_po.inc +++ b/web/lang/en/pkgfuncs_po.inc @@ -141,4 +141,10 @@ $_t["en"]["Search by"] = "Search by"; $_t["en"]["Submitter"] = "Submitter"; +$_t["en"]["All"] = "All"; + +$_t["en"]["Unsafe"] = "Unsafe"; + +$_t["en"]["Status"] = "Status"; + ?> \ No newline at end of file diff --git a/web/lang/pt/pkgfuncs_po.inc b/web/lang/pt/pkgfuncs_po.inc index 4c08a0f..0339b8f 100644 --- a/web/lang/pt/pkgfuncs_po.inc +++ b/web/lang/pt/pkgfuncs_po.inc @@ -81,7 +81,7 @@ $_t["pt"]["Manage"] = "Gerenciar"; $_t["pt"]["Sort by"] = "Ordenar por"; -$_t["pt"]["Sort order"] = "Ordem de Ordenação"; +$_t["pt"]["Sort order"] = "Ordem"; $_t["pt"]["Ascending"] = "Ascendente"; @@ -139,4 +139,12 @@ $_t["pt"]["Last Updated"] = "Últimos Pacotes Atualizados"; $_t["pt"]["Search by"] = "Pesquisar por"; -?> +$_t["pt"]["Submitter"] = "Colaborador"; + +$_t["pt"]["All"] = "Todos"; + +$_t["pt"]["Unsafe"] = "Não Seguro"; + +$_t["pt"]["Status"] = "Status"; + +?> \ No newline at end of file diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 6fd8ad9..950de71 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -707,26 +707,60 @@ function pkg_search_page($SID="") { print "\n"; print "\n"; - print " ".__("Search by"); - print "
\n"; + print " ".__("Search by"); + print "
\n"; + + print " \n"; + print "\n"; + + /* Status Safe-Unsafe */ + + # Added the code below to handle the safe package flag. + # So we can search for then for 'all' packages, 'safe' + # packages and 'unsafe' packages. + # Added by: dsa "Happily breaking the lang files ;oD" (Joking) + + print "\n"; + print " ".__("Status"); + print "
\n"; + + print " \n"; + print "\n"; + + /* End of Package Status */ - print " \n"; - print "\n"; + /* Sort by */ -/* print "\n"; + print "\n"; print " ".__("Sort by"); print "
\n"; print " \n"; print "\n"; -*/ + + /* End of Sort by */ + print "\n"; print " ".__("Per page"); print "
\n"; @@ -850,7 +886,7 @@ function pkg_search_page($SID="") { } else { $q.= "AND Username = '".mysql_escape_string($K)."' "; } - } elseif ($_REQUEST["SeB"] == "s") { + } elseif ($_REQUEST["SeB"] == "s") { if (!$has_where) { $q.= "WHERE SubmitterUID = ".uid_from_username($K)." "; $has_where = 1; @@ -869,7 +905,8 @@ function pkg_search_page($SID="") { } } } - if ($_REQUEST["do_MyPackages"] && $SID) { + + if ($_REQUEST["do_MyPackages"] && $SID) { # list packages that the user is a AUR Maintainer of, or if it the # vistior is a registered user, if they are the Maintainer. # @@ -896,8 +933,34 @@ function pkg_search_page($SID="") { $q.= "MaintainerUID = 0) "; } } - $order = $_REQUEST["SO"] == 'd' ? 'DESC' : 'ASC'; - switch ($_REQUEST["SB"]) { + + # Added the code below to handle the safe package flag. + # So we can search for then for 'all' packages, 'safe' + # packages and 'unsafe' packages. + # Added by: dsa + if ($_REQUEST["PaS"] <> "all") { + # Flagged Safe + if ($_REQUEST["PaS"] == "fs") + if (!$has_where) { + $q.= "WHERE Safe = 1 "; + $has_where = 1; + } else { + $q.= "AND Safe = 1 "; + } + + # Unflagged Safe + if ($_REQUEST["PaS"] == "us") + if (!$has_where) { + $q.= "WHERE Safe = 0 "; + $has_where = 1; + } else { + $q.= "AND Safe = 0 "; + } + } + + $order = $_REQUEST["SO"] == 'd' ? 'DESC' : 'ASC'; + + switch ($_REQUEST["SB"]) { case 'c': $q.= "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC "; break; @@ -920,7 +983,7 @@ function pkg_search_page($SID="") { $qnext = $q."LIMIT ".($O+$PP).", ".$PP; //next page's worth $q.= "LIMIT ".$O.", ".$PP; - print "\n"; + print "\n"; $result = db_query($q, $dbh); if (!$result) { print __("Error retrieving package list."); @@ -1033,13 +1096,7 @@ function pkg_search_page($SID="") { # } print "\n"; - # Solve the sorting problem, so we can force the - # passage of the sorting params to the next pages. - # Added by: dsa - print ""; - print ""; - - for ($i=0; $row = mysql_fetch_assoc($result); $i++) { + for ($i=0; $row = mysql_fetch_assoc($result); $i++) { (($i % 2) == 0) ? $c = "data1" : $c = "data2"; print "\n"; if ($SID) { @@ -1079,6 +1136,7 @@ function pkg_search_page($SID="") { } reset($pkgsearch_vars); $url.= "'>"; + if ($row["Safe"] == 1 || $locs[$row["LocationID"]] == "community") { $url.=""; } -- cgit v1.2.3-70-g09d2