mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
824744f1d2
commit
15ee85b456
3 changed files with 8 additions and 2 deletions
|
@ -545,8 +545,8 @@ function pkg_search_page($SID="") {
|
||||||
$q_select .= "Users.Username AS Maintainer,
|
$q_select .= "Users.Username AS Maintainer,
|
||||||
PackageCategories.Category,
|
PackageCategories.Category,
|
||||||
Packages.Name, Packages.Version, Packages.Description,
|
Packages.Name, Packages.Version, Packages.Description,
|
||||||
PackageBases.NumVotes, Packages.ID, Packages.PackageBaseID,
|
PackageBases.NumVotes, PackageBases.Popularity, Packages.ID,
|
||||||
PackageBases.OutOfDateTS ";
|
Packages.PackageBaseID, PackageBases.OutOfDateTS ";
|
||||||
|
|
||||||
$q_from = "FROM Packages
|
$q_from = "FROM Packages
|
||||||
LEFT JOIN PackageBases ON (PackageBases.ID = Packages.PackageBaseID)
|
LEFT JOIN PackageBases ON (PackageBases.ID = Packages.PackageBaseID)
|
||||||
|
@ -663,6 +663,9 @@ function pkg_search_page($SID="") {
|
||||||
case 'v':
|
case 'v':
|
||||||
$q_sort .= "NumVotes " . $order . ", ";
|
$q_sort .= "NumVotes " . $order . ", ";
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
$q_sort .= "Popularity " . $order . ", ";
|
||||||
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
if ($SID) {
|
if ($SID) {
|
||||||
$q_sort .= "Voted " . $order . ", ";
|
$q_sort .= "Voted " . $order . ", ";
|
||||||
|
|
|
@ -21,6 +21,7 @@ $sortby = array(
|
||||||
'n' => __('Name'),
|
'n' => __('Name'),
|
||||||
'c' => __('Category'),
|
'c' => __('Category'),
|
||||||
'v' => __('Votes'),
|
'v' => __('Votes'),
|
||||||
|
'p' => __('Popularity'),
|
||||||
'w' => __('Voted'),
|
'w' => __('Voted'),
|
||||||
'o' => __('Notify'),
|
'o' => __('Notify'),
|
||||||
'm' => __('Maintainer'),
|
'm' => __('Maintainer'),
|
||||||
|
|
|
@ -36,6 +36,7 @@ if (!$result): ?>
|
||||||
<th><a href="?<?= mkurl('SB=n&SO=' . $SO_next) ?>"><?= __("Name") ?></a></th>
|
<th><a href="?<?= mkurl('SB=n&SO=' . $SO_next) ?>"><?= __("Name") ?></a></th>
|
||||||
<th><?= __("Version") ?></th>
|
<th><?= __("Version") ?></th>
|
||||||
<th><a href="?<?= mkurl('SB=v&SO=' . $SO_next) ?>"><?= __("Votes") ?></a></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): ?>
|
<?php if ($SID): ?>
|
||||||
<th><a href="?<?= mkurl('SB=w&SO=' . $SO_next) ?>"><?= __("Voted") ?></a></th>
|
<th><a href="?<?= mkurl('SB=w&SO=' . $SO_next) ?>"><?= __("Voted") ?></a></th>
|
||||||
<th><a href="?<?= mkurl('SB=o&SO=' . $SO_next) ?>"><?= __("Notify") ?></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><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<?php if ($row["OutOfDateTS"]): ?> class="flagged"<?php endif; ?>><?= htmlspecialchars($row["Version"]) ?></td>
|
||||||
<td><?= $row["NumVotes"] ?></td>
|
<td><?= $row["NumVotes"] ?></td>
|
||||||
|
<td><?= $row["Popularity"] ?></td>
|
||||||
<?php if ($SID): ?>
|
<?php if ($SID): ?>
|
||||||
<td>
|
<td>
|
||||||
<?php if (isset($row["Voted"])): ?>
|
<?php if (isset($row["Voted"])): ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue