summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-06-11 18:48:36 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-11 19:15:44 +0200
commit15ee85b456a4dd227d3c59f67bdef87f24efc391 (patch)
tree4ac5dc78133e48ae834901e021c7eef36ad14a5f /web
parent824744f1d20614c25e972dda7a0b7ac9506dd46f (diff)
downloadaurweb-15ee85b456a4dd227d3c59f67bdef87f24efc391.tar.xz
Show package popularity in search results
Display the popularity score (weighted votes) in the package search results. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r--web/lib/pkgfuncs.inc.php7
-rw-r--r--web/template/pkg_search_form.php1
-rw-r--r--web/template/pkg_search_results.php2
3 files changed, 8 insertions, 2 deletions
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index a5f24ba..f527578 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -545,8 +545,8 @@ function pkg_search_page($SID="") {
$q_select .= "Users.Username AS Maintainer,
PackageCategories.Category,
Packages.Name, Packages.Version, Packages.Description,
- PackageBases.NumVotes, Packages.ID, Packages.PackageBaseID,
- PackageBases.OutOfDateTS ";
+ PackageBases.NumVotes, PackageBases.Popularity, Packages.ID,
+ Packages.PackageBaseID, PackageBases.OutOfDateTS ";
$q_from = "FROM Packages
LEFT JOIN PackageBases ON (PackageBases.ID = Packages.PackageBaseID)
@@ -663,6 +663,9 @@ function pkg_search_page($SID="") {
case 'v':
$q_sort .= "NumVotes " . $order . ", ";
break;
+ case 'p':
+ $q_sort .= "Popularity " . $order . ", ";
+ break;
case 'w':
if ($SID) {
$q_sort .= "Voted " . $order . ", ";
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 7428250..b4b88bd 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -21,6 +21,7 @@ $sortby = array(
'n' => __('Name'),
'c' => __('Category'),
'v' => __('Votes'),
+ 'p' => __('Popularity'),
'w' => __('Voted'),
'o' => __('Notify'),
'm' => __('Maintainer'),
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index 7ab3eb9..5289b78 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -36,6 +36,7 @@ if (!$result): ?>
<th><a href="?<?= mkurl('SB=n&SO=' . $SO_next) ?>"><?= __("Name") ?></a></th>
<th><?= __("Version") ?></th>
<th><a href="?<?= mkurl('SB=v&SO=' . $SO_next) ?>"><?= __("Votes") ?></a></th>
+ <th><a href="?<?= mkurl('SB=p&SO=' . $SO_next) ?>"><?= __("Popularity") ?></a></th>
<?php if ($SID): ?>
<th><a href="?<?= mkurl('SB=w&SO=' . $SO_next) ?>"><?= __("Voted") ?></a></th>
<th><a href="?<?= mkurl('SB=o&SO=' . $SO_next) ?>"><?= __("Notify") ?></a></th>
@@ -55,6 +56,7 @@ if (!$result): ?>
<td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
<td<?php if ($row["OutOfDateTS"]): ?> class="flagged"<?php endif; ?>><?= htmlspecialchars($row["Version"]) ?></td>
<td><?= $row["NumVotes"] ?></td>
+ <td><?= $row["Popularity"] ?></td>
<?php if ($SID): ?>
<td>
<?php if (isset($row["Voted"])): ?>