Added dsa's sorting improvement patch (closes #3370, #4091, #4097 and #4098).

This commit is contained in:
swiergot 2006-08-22 13:58:36 +00:00
parent d0da4199ae
commit 18dc7c783e
3 changed files with 105 additions and 33 deletions

View file

@ -141,4 +141,10 @@ $_t["en"]["Search by"] = "Search by";
$_t["en"]["Submitter"] = "Submitter"; $_t["en"]["Submitter"] = "Submitter";
$_t["en"]["All"] = "All";
$_t["en"]["Unsafe"] = "Unsafe";
$_t["en"]["Status"] = "Status";
?> ?>

View file

@ -81,7 +81,7 @@ $_t["pt"]["Manage"] = "Gerenciar";
$_t["pt"]["Sort by"] = "Ordenar por"; $_t["pt"]["Sort by"] = "Ordenar por";
$_t["pt"]["Sort order"] = "Ordem de Ordenação"; $_t["pt"]["Sort order"] = "Ordem";
$_t["pt"]["Ascending"] = "Ascendente"; $_t["pt"]["Ascending"] = "Ascendente";
@ -139,4 +139,12 @@ $_t["pt"]["Last Updated"] = "Últimos Pacotes Atualizados";
$_t["pt"]["Search by"] = "Pesquisar por"; $_t["pt"]["Search by"] = "Pesquisar por";
$_t["pt"]["Submitter"] = "Colaborador";
$_t["pt"]["All"] = "Todos";
$_t["pt"]["Unsafe"] = "Não Seguro";
$_t["pt"]["Status"] = "Status";
?> ?>

View file

@ -726,7 +726,41 @@ function pkg_search_page($SID="") {
print " </select>\n"; print " </select>\n";
print "</td>\n"; print "</td>\n";
/* print "<td align='right'>\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 <dsandrade@gmail.com> "Happily breaking the lang files ;oD" (Joking)
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Status");
print "</span></span><br />\n";
print " <select name='PaS'>\n";
# Flagged Safe
print " <option value=all";
$_REQUEST["PaS"] == "all" ? print " selected> " : print "> ";
print __("All")."</option>\n";
# Flagged Safe
print " <option value=fs";
$_REQUEST["PaS"] == "fs" ? print " selected> " : print "> ";
print __("Safe")."</option>\n";
# Unflagged Safe
print " <option value=us";
$_REQUEST["PaS"] == "us" ? print " selected> " : print "> ";
print __("Unsafe")."</option>\n";
print " </select>\n";
print "</td>\n";
/* End of Package Status */
/* Sort by */
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Sort by"); print " <span class='f5'><span class='blue'>".__("Sort by");
print "</span></span><br />\n"; print "</span></span><br />\n";
print " <select name='SB'>\n"; print " <select name='SB'>\n";
@ -773,7 +807,9 @@ function pkg_search_page($SID="") {
print " </select>\n"; print " </select>\n";
print "</td>\n"; print "</td>\n";
*/
/* End of Sort by */
print "<td align='right'>\n"; print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Per page"); print " <span class='f5'><span class='blue'>".__("Per page");
print "</span></span><br />\n"; print "</span></span><br />\n";
@ -869,6 +905,7 @@ 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 # list packages that the user is a AUR Maintainer of, or if it the
# vistior is a registered user, if they are the Maintainer. # vistior is a registered user, if they are the Maintainer.
@ -896,7 +933,33 @@ function pkg_search_page($SID="") {
$q.= "MaintainerUID = 0) "; $q.= "MaintainerUID = 0) ";
} }
} }
# 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 <dsandrade@gmail.com>
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'; $order = $_REQUEST["SO"] == 'd' ? 'DESC' : 'ASC';
switch ($_REQUEST["SB"]) { switch ($_REQUEST["SB"]) {
case 'c': case 'c':
$q.= "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC "; $q.= "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC ";
@ -1033,12 +1096,6 @@ function pkg_search_page($SID="") {
# } # }
print "</tr>\n"; print "</tr>\n";
# Solve the sorting problem, so we can force the
# passage of the sorting params to the next pages.
# Added by: dsa <dsandrade@gmail.com>
print "<input type='hidden' name='SB' value='".$_REQUEST['SB']."' >";
print "<input type='hidden' name='SO' value='".$_REQUEST['SO']."' >";
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"; (($i % 2) == 0) ? $c = "data1" : $c = "data2";
print "<tr>\n"; print "<tr>\n";
@ -1079,6 +1136,7 @@ function pkg_search_page($SID="") {
} }
reset($pkgsearch_vars); reset($pkgsearch_vars);
$url.= "'>"; $url.= "'>";
if ($row["Safe"] == 1 || $locs[$row["LocationID"]] == "community") { if ($row["Safe"] == 1 || $locs[$row["LocationID"]] == "community") {
$url.="<span class='green'>"; $url.="<span class='green'>";
} }