Update wiki links to the new short URL
[aur.git] / web / template / pkg_search_results.php
blob7c5ad03b1f891cd1e4822ef0e3f3e181b00196f8
1 <?php
2 if ($show_headers) {
3 $fmtth = function($title, $sb=false, $so=false, $hint=false) {
4 echo '<th>';
5 if ($sb) {
6 echo '<a href="?' . mkurl('SB=' . $sb . '&SO=' . $so) . '">' . $title . '</a>';
7 } else {
8 echo $title;
10 if ($hint) {
11 echo '<span title="' . $hint . '" class="hover-help"><sup>?</sup></span>';
13 echo '</th>';
15 } else {
16 $fmtth = function($title, $sb=false, $so=false, $hint=false) {
17 echo '<th>' . $title . '</th>';
21 if (!$result): ?>
22 <p><?= __("Error retrieving package list.") ?></p>
23 <?php elseif ($total == 0): ?>
24 <p><?= __("No packages matched your search criteria.") ?></p>
25 <?php else: ?>
26 <?php if ($show_headers): ?>
27 <div class="pkglist-stats">
28 <p>
29 <?= _n('%d package found.', '%d packages found.', $total) ?>
30 <?= __('Page %d of %d.', $current, $pages) ?>
31 </p>
32 <?php if (count($templ_pages) > 1): ?>
33 <p class="pkglist-nav">
34 <?php foreach ($templ_pages as $pagenr => $pagestart): ?>
35 <?php if ($pagestart === false): ?>
36 <span class="page"><?= $pagenr ?></span>
37 <?php elseif ($pagestart + 1 == $first): ?>
38 <span class="page"><?= $pagenr ?></span>
39 <?php else: ?>
40 <a class="page" href="<?= get_uri('/packages/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
41 <?php endif; ?>
42 <?php endforeach; ?>
43 </p>
44 <?php endif; ?>
45 </div>
46 <?php endif; ?>
48 <form id="pkglist-results-form" method="post" action="<?= get_uri('/pkgbase/'); ?>?<?= htmlentities($_SERVER['QUERY_STRING']) ?>">
49 <table class="results">
50 <thead>
51 <tr>
52 <?php if ($SID && $show_headers): ?>
53 <th>&nbsp;</th>
54 <?php endif; ?>
55 <?php $fmtth(__('Name'), 'n', $SO_next) ?>
56 <?php $fmtth(__('Version')) ?>
57 <?php $fmtth(__('Votes'), 'v', $SO_next) ?>
58 <?php $fmtth(__('Popularity'), 'p', $SO_next, __('Popularity is calculated as the sum of all votes with each vote being weighted with a factor of %.2f per day since its creation.', 0.98)) ?>
59 <?php if ($SID): ?>
60 <?php $fmtth(__('Voted'), 'w', $SO_next) ?>
61 <?php $fmtth(__('Notify'), 'o', $SO_next) ?>
62 <?php endif; ?>
63 <?php $fmtth(__('Description')) ?>
64 <?php $fmtth(__('Maintainer'), 'm', $SO_next) ?>
65 </tr>
66 </thead>
67 <tbody>
69 <?php foreach ($searchresults as $indx => $row): ?>
70 <tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>">
71 <?php if ($SID && $show_headers): ?>
72 <td><input type="checkbox" name="IDs[<?= $row["PackageBaseID"] ?>]" value="1" /></td>
73 <?php endif; ?>
74 <td><a href="<?= htmlspecialchars(get_pkg_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
75 <td<?php if ($row["OutOfDateTS"]): ?> class="flagged"<?php endif; ?>><?= htmlspecialchars($row["Version"]) ?></td>
76 <td><?= $row["NumVotes"] ?></td>
77 <td><?= number_format($row["Popularity"], 2) ?></td>
78 <?php if ($SID): ?>
79 <td>
80 <?php if (isset($row["Voted"])): ?>
81 <?= __("Yes") ?>
82 <?php endif; ?>
83 </td>
84 <td>
85 <?php if (isset($row["Notify"])): ?>
86 <?= __("Yes") ?>
87 <?php endif; ?>
88 </td>
89 <?php endif; ?>
90 <td class="wrap"><?= htmlspecialchars($row['Description'], ENT_QUOTES); ?></td>
91 <td>
92 <?php if (isset($row["Maintainer"])): ?>
93 <?php if ($SID): ?>
94 <a href="<?= get_uri('/account/') . htmlspecialchars($row['Maintainer'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['Maintainer'])) ?>"><?= htmlspecialchars($row['Maintainer']) ?></a>
95 <?php else: ?>
96 <a href="<?= get_uri('/packages/'); ?>?K=<?= htmlspecialchars($row['Maintainer'], ENT_QUOTES) ?>&amp;SeB=m"><?= htmlspecialchars($row['Maintainer']) ?></a>
97 <?php endif; ?>
98 <?php else: ?>
99 <span><?= __("orphan") ?></span>
100 <?php endif; ?>
101 </td>
102 </tr>
103 <?php endforeach; ?>
105 </tbody>
106 </table>
108 <?php if ($show_headers): ?>
109 <div class="pkglist-stats">
111 <?= _n('%d package found.', '%d packages found.', $total) ?>
112 <?= __('Page %d of %d.', $current, $pages) ?>
113 </p>
114 <?php if (count($templ_pages) > 1): ?>
115 <p class="pkglist-nav">
116 <?php foreach ($templ_pages as $pagenr => $pagestart): ?>
117 <?php if ($pagestart === false): ?>
118 <span class="page"><?= $pagenr ?></span>
119 <?php elseif ($pagestart + 1 == $first): ?>
120 <span class="page"><?= $pagenr ?></span>
121 <?php else: ?>
122 <a class="page" href="<?= get_uri('/packages/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
123 <?php endif; ?>
124 <?php endforeach; ?>
125 </p>
126 <?php endif; ?>
127 </div>
129 <?php if ($SID): ?>
131 <select name="action">
132 <option><?= __("Actions") ?></option>
133 <option value="do_UnFlag"><?= __("Unflag Out-of-date") ?></option>
134 <option value="do_Adopt"><?= __("Adopt Packages") ?></option>
135 <option value="do_Disown"><?= __("Disown Packages") ?></option>
136 <?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
137 <option value="do_Delete"><?= __("Delete Packages") ?></option>
138 <?php endif; ?>
139 <option value="do_Notify"><?= __("Notify") ?></option>
140 <option value="do_UnNotify"><?= __("UnNotify") ?></option>
141 </select>
142 <?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
143 <label for="merge_Into"><?= __("Merge into") ?></label>
144 <input type="text" id="merge_Into" name="merge_Into" />
145 <?php endif; ?>
146 <label class="confirmation"><input type="checkbox" name="confirm" value="1" /> <?= __("Confirm") ?></label>
147 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
148 <input type="submit" class="button" style="width: 80px" value="<?= __("Go") ?>" />
149 </p>
150 <?php endif; # if ($SID) ?>
151 <?php endif; ?>
152 </form>
153 <?php endif; # search was successful and returned multiple results ?>