mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 09:43:03 +00:00
Add search result information
This adds search results numbers to the bottom of pages when searching based on tardo's repository, ex. Showing results 1 - 42 of 42 Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com>
This commit is contained in:
parent
8ab823728c
commit
14ecbf5fd5
2 changed files with 37 additions and 29 deletions
|
@ -159,4 +159,6 @@ $_t["en"]["This package has been flagged out of date."] = "This package has been
|
||||||
|
|
||||||
$_t["en"]["Toggle Notify"] = "Toggle Notify";
|
$_t["en"]["Toggle Notify"] = "Toggle Notify";
|
||||||
|
|
||||||
|
$_t["en"]["Showing results %s - %s of %s"] = "Showing results %s - %s of %s";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -712,24 +712,24 @@ function pkg_search_page($SID="") {
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
print "<td align='right'>\n";
|
print "<td align='right'>\n";
|
||||||
print " <span class='f5'><span class='blue'>".__("Search by");
|
print " <span class='f5'><span class='blue'>".__("Search by");
|
||||||
print "</span></span><br />\n";
|
print "</span></span><br />\n";
|
||||||
|
|
||||||
print " <select name='SeB'>\n";
|
|
||||||
# by name/description
|
|
||||||
print " <option value=nd";
|
|
||||||
$_REQUEST["SeB"] == "nd" ? print " selected> " : print "> ";
|
|
||||||
print __("Name")."</option>\n";
|
|
||||||
# by maintainer
|
|
||||||
print " <option value=m";
|
|
||||||
$_REQUEST["SeB"] == "m" ? print " selected> " : print "> ";
|
|
||||||
print __("Maintainer")."</option>\n";
|
|
||||||
print " <option value=s";
|
|
||||||
$_REQUEST["SeB"] == "s" ? print " selected> " : print "> ";
|
|
||||||
print __("Submitter")."</option>\n";
|
|
||||||
|
|
||||||
print " </select>\n";
|
print " <select name='SeB'>\n";
|
||||||
print "</td>\n";
|
# by name/description
|
||||||
|
print " <option value=nd";
|
||||||
|
$_REQUEST["SeB"] == "nd" ? print " selected> " : print "> ";
|
||||||
|
print __("Name")."</option>\n";
|
||||||
|
# by maintainer
|
||||||
|
print " <option value=m";
|
||||||
|
$_REQUEST["SeB"] == "m" ? print " selected> " : print "> ";
|
||||||
|
print __("Maintainer")."</option>\n";
|
||||||
|
print " <option value=s";
|
||||||
|
$_REQUEST["SeB"] == "s" ? print " selected> " : print "> ";
|
||||||
|
print __("Submitter")."</option>\n";
|
||||||
|
|
||||||
|
print " </select>\n";
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
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");
|
||||||
|
@ -754,17 +754,6 @@ function pkg_search_page($SID="") {
|
||||||
print " value='".__("Go")."'>\n";
|
print " value='".__("Go")."'>\n";
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
/*
|
|
||||||
* Commented the My Packages button because there is no need for it
|
|
||||||
* cause we already have a link.
|
|
||||||
*
|
|
||||||
if ($SID) {
|
|
||||||
print "<td align='right' valign='bottom'> \n";
|
|
||||||
print " <input type='submit' class='button' name='do_MyPackages'";
|
|
||||||
print " value='".__("My Packages")."'>\n";
|
|
||||||
print "</td>\n";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
print "<td align='right' valign='bottom'> \n";
|
print "<td align='right' valign='bottom'> \n";
|
||||||
print " <input type='submit' style='width:80px' class='button' name='do_Orphans'";
|
print " <input type='submit' style='width:80px' class='button' name='do_Orphans'";
|
||||||
print " value='".__("Orphans")."'>\n";
|
print " value='".__("Orphans")."'>\n";
|
||||||
|
@ -884,7 +873,9 @@ function pkg_search_page($SID="") {
|
||||||
$q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC ";
|
$q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$allresults = mysql_num_rows(db_query($q, $dbh));
|
||||||
|
|
||||||
$qnext = $q."LIMIT ".($O+$PP).", ".$PP; //next page's worth
|
$qnext = $q."LIMIT ".($O+$PP).", ".$PP; //next page's worth
|
||||||
$q.= "LIMIT ".$O.", ".$PP;
|
$q.= "LIMIT ".$O.", ".$PP;
|
||||||
|
|
||||||
|
@ -1116,6 +1107,21 @@ function pkg_search_page($SID="") {
|
||||||
print " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
print " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||||
print " <tr>\n";
|
print " <tr>\n";
|
||||||
|
|
||||||
|
# figure out the results to use
|
||||||
|
$first = $O + 1;
|
||||||
|
|
||||||
|
if (($PP+$O) > $allresults) {
|
||||||
|
$last = $allresults;
|
||||||
|
} else {
|
||||||
|
$last = $PP + $O;
|
||||||
|
}
|
||||||
|
|
||||||
|
# print number of results
|
||||||
|
# ok this styling sucks
|
||||||
|
print "<tr><td align='center' colspan='0'><span class='f4'><span class='blue'>";
|
||||||
|
print __("Showing results %s - %s of %s", array($first, $last, $allresults));
|
||||||
|
print "</span></span></td></tr>";
|
||||||
|
|
||||||
# first print the legend
|
# first print the legend
|
||||||
print " <td colspan='2' align='center'>";
|
print " <td colspan='2' align='center'>";
|
||||||
print " <span class='f5'>\n";
|
print " <span class='f5'>\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue