[aur-dev] [PATCH 1/3] Hide the table sorting links on the dashboard
The tables on the dashboard always show the 50 most recent packages, ordered by last update. Do not make the table headers of these tables clickable. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- web/template/pkg_search_results.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index d596ec2..8a2e8d3 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -1,4 +1,17 @@ <?php +function fmtth($title, $sb=false, $so=false, $hint=false) { + echo '<th>'; + if ($sb) { + echo '<a href="' . mkurl('SB=' . $sb . '&SO = ' . $so) . '">' . $title . '</a>'; + } else { + echo $title; + } + if ($hint) { + echo '<span title="' . $hint . '" class="hover-help"><sup>?</sup></span>'; + } + echo '</th>'; +} + if (!$result): ?> <p><?= __("Error retrieving package list.") ?></p> <?php elseif ($total == 0): ?> @@ -33,16 +46,16 @@ if (!$result): ?> <?php if ($SID && $show_headers): ?> <th> </th> <?php endif; ?> - <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><span title="<?= __('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) ?>" class="hover-help"><sup>?</sup></span></th> + <?php fmtth(__('Name'), $show_headers ? 'n' : false, $SO_next) ?> + <?php fmtth(__('Version')) ?> + <?php fmtth(__('Votes'), $show_headers ? 'v' : false, $SO_next) ?> + <?php fmtth(__('Popularity'), $show_headers ? 'p' : false, $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)) ?> <?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> + <?php fmtth(__('Voted'), $show_headers ? 'w' : false, $SO_next) ?> + <?php fmtth(__('Notify'), $show_headers ? 'o' : false, $SO_next) ?> <?php endif; ?> - <th><?= __("Description") ?></th> - <th><a href="?<?= mkurl('SB=m&SO=' . $SO_next) ?>"><?= __("Maintainer") ?></a></th> + <?php fmtth(__('Description')) ?> + <?php fmtth(__('Maintainer'), $show_headers ? 'm' : false, $SO_next) ?> </tr> </thead> <tbody> -- 2.11.1
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- web/lib/pkgfuncs.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index ee4ca52..063cc93 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -649,7 +649,7 @@ function pkg_display_details($id=0, $row, $SID="") { * @param bool $show_headers True if statistics should be included * @param string $SID The session ID of the visitor * - * @return void + * @return int The total number of packages matching the query */ function pkg_search_page($params, $show_headers=true, $SID="") { $dbh = DB::connect(); @@ -860,7 +860,7 @@ function pkg_search_page($params, $show_headers=true, $SID="") { include('pkg_search_results.php'); - return; + return $total; } /** -- 2.11.1
In addition to showing the 50 most recent maintained and co-maintained packages, add links to all packages one owns or co-maintains. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- web/html/home.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/html/home.php b/web/html/home.php index ff9caa7..08ae59f 100644 --- a/web/html/home.php +++ b/web/html/home.php @@ -21,7 +21,7 @@ if (isset($_COOKIE["AURSID"])) { <div id="intro" class="box"> <?php if (isset($_COOKIE["AURSID"])): ?> <h2><?= __("Dashboard"); ?></h2> - <h3><?= __("My Packages"); ?></h3> + <h3><?= __("My Packages"); ?> <span class="more">(<a href="<?= get_uri('/packages/') ?>?SeB=m&K=<?= username_from_sid($_COOKIE["AURSID"]); ?>"><?= __('more') ?></a>)</span></h3> <?php $params = array( 'PP' => 50, @@ -32,7 +32,7 @@ if (isset($_COOKIE["AURSID"])) { ); pkg_search_page($params, false, $_COOKIE["AURSID"]); ?> - <h3><?= __("Co-Maintained Packages"); ?></h3> + <h3><?= __("Co-Maintained Packages"); ?> <span class="more">(<a href="<?= get_uri('/packages/') ?>?SeB=c&K=<?= username_from_sid($_COOKIE["AURSID"]); ?>"><?= __('more') ?></a>)</span></h3> <?php $params = array( 'PP' => 50, -- 2.11.1
On Sat, 2017-02-04 at 11:21 +0100, Lukas Fleischer wrote:
The tables on the dashboard always show the 50 most recent packages, ordered by last update. Do not make the table headers of these tables clickable.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- web/template/pkg_search_results.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index d596ec2..8a2e8d3 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -1,4 +1,17 @@ <?php +function fmtth($title, $sb=false, $so=false, $hint=false) { + echo '<th>'; + if ($sb) { + echo '<a href="' . mkurl('SB=' . $sb . '&SO = ' . $so) . '">' . $title . '</a>';
There's an issue here where when a URL is generated, the '?' is missing from the URL causing a URL like ".../packages/SB=..." where that URL will 404. A '?' needs to be put in between the " and the ' immediately after "href=".
[...]
On Wed, 08 Feb 2017 at 18:34:16, Mark Weiman wrote:
[...]
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index d596ec2..8a2e8d3 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -1,4 +1,17 @@ <?php +function fmtth($title, $sb=false, $so=false, $hint=false) { + echo '<th>'; + if ($sb) { + echo '<a href="' . mkurl('SB=' . $sb . '&SO = ' . $so) . '">' . $title . '</a>';
There's an issue here where when a URL is generated, the '?' is missing from the URL causing a URL like ".../packages/SB=..." where that URL will 404. A '?' needs to be put in between the " and the ' immediately after "href=".
Good catch, thanks for letting me know. Fixed in pu!
[...]
participants (2)
-
Lukas Fleischer
-
Mark Weiman