summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCallan Barrett <wizzomafizzo@gmail.com>2008-01-15 10:59:48 +0100
committerDan McGee <dan@archlinux.org>2008-01-20 07:21:21 +0100
commit14ecbf5fd577995a93f4437ce5d60069fd7cc771 (patch)
treeb2be8012d6e6769cefc620225a0a75bfb49778b3
parent8ab823728c729e9780820bf15aad3585078c8342 (diff)
downloadaur-14ecbf5fd577995a93f4437ce5d60069fd7cc771.tar.gz
aur-14ecbf5fd577995a93f4437ce5d60069fd7cc771.tar.xz
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>
-rw-r--r--web/lang/en/pkgfuncs_po.inc2
-rw-r--r--web/lib/pkgfuncs.inc66
2 files changed, 38 insertions, 30 deletions
diff --git a/web/lang/en/pkgfuncs_po.inc b/web/lang/en/pkgfuncs_po.inc
index 2f6a62e8..3e7d318a 100644
--- a/web/lang/en/pkgfuncs_po.inc
+++ b/web/lang/en/pkgfuncs_po.inc
@@ -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"]["Showing results %s - %s of %s"] = "Showing results %s - %s of %s";
+
?>
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index a6086f80..713eb6b2 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -712,24 +712,24 @@ function pkg_search_page($SID="") {
print "</td>\n";
print "<td align='right'>\n";
- print " <span class='f5'><span class='blue'>".__("Search by");
- 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 "</td>\n";
+ print " <span class='f5'><span class='blue'>".__("Search by");
+ 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 "</td>\n";
print "<td align='right'>\n";
print " <span class='f5'><span class='blue'>".__("Per page");
@@ -754,17 +754,6 @@ function pkg_search_page($SID="") {
print " value='".__("Go")."'>\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'>&nbsp;\n";
- print " <input type='submit' class='button' name='do_MyPackages'";
- print " value='".__("My Packages")."'>\n";
- print "</td>\n";
- }*/
-
print "<td align='right' valign='bottom'>&nbsp;\n";
print " <input type='submit' style='width:80px' class='button' name='do_Orphans'";
print " value='".__("Orphans")."'>\n";
@@ -884,7 +873,9 @@ function pkg_search_page($SID="") {
$q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC ";
break;
}
-
+
+ $allresults = mysql_num_rows(db_query($q, $dbh));
+
$qnext = $q."LIMIT ".($O+$PP).", ".$PP; //next page's worth
$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 " <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
print " <td colspan='2' align='center'>";
print " <span class='f5'>\n";