1
0

Fix pagination and links for "stable archives".

* Fix core pagination for "stable archives".

  The current page will always be the current page,
  regardless of archive sorting order. Page 76 of
  86 pages will remain page 76, even if the archive
  sorting is changed; it won't become page 10.

* Fix pagination for "stable archives" in themes.

  Timeline and Bulletproof have pagination.
  Both need to swap the prev/next links for
  stable archives, as the sorting order has
  been reversed.

* Fix prev/next page links for stable archives.

  We shouldn't swap prev/next links for archive
  pages. With stable archives, the title page is
  the last page of the archive, not the first, so
  all other pages are "previos", and we should
  display it like that.

Cherry-picked from master.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein
2019-08-16 21:37:45 +02:00
parent cd3464be70
commit 4e662bf17c
5 changed files with 45 additions and 23 deletions

View File

@ -973,13 +973,9 @@ function serendipity_printEntryFooter($suffix = '.html', $totalEntries = null) {
$uriArguments[] = 'P%s';
$serendipity['smarty']->assign('footer_totalEntries', $totalEntries);
$serendipity['smarty']->assign('footer_totalPages', $totalPages);
if (serendipity_db_bool($serendipity['archiveSortStable']) && $serendipity['GET']['action'] != 'search') {
$serendipity['smarty']->assign('footer_currentPage', $totalPages - $serendipity['GET']['page']);
} else {
$serendipity['smarty']->assign('footer_currentPage', $serendipity['GET']['page']);
}
$serendipity['smarty']->assign('footer_currentPage', $serendipity['GET']['page']);
$serendipity['smarty']->assign('footer_pageLink', str_replace('%2A', '*', serendipity_rewriteURL(implode('/', $uriArguments) . $suffix)));
$serendipity['smarty']->assign('footer_info', sprintf(PAGE_BROWSE_ENTRIES, serendipity_db_bool($serendipity['archiveSortStable']) && $serendipity['GET']['action'] != 'search' ? $totalPages - (int)$serendipity['GET']['page'] +1 : (int)$serendipity['GET']['page'], $totalPages, $totalEntries));
$serendipity['smarty']->assign('footer_info', sprintf(PAGE_BROWSE_ENTRIES, (int)$serendipity['GET']['page'], $totalPages, $totalEntries));
if ($serendipity['GET']['page'] < $totalPages) {
$uriArguments = $serendipity['uriArguments'];
@ -987,11 +983,6 @@ function serendipity_printEntryFooter($suffix = '.html', $totalEntries = null) {
$serendipity['smarty']->assign('footer_next_page', serendipity_rewriteURL(str_replace('//', '/', implode('/', $uriArguments)) . $suffix));
}
if (serendipity_db_bool($serendipity['archiveSortStable']) && $serendipity['GET']['action'] != 'search') {
$temp = $serendipity['smarty']->getTemplateVars('footer_prev_page');
$serendipity['smarty']->assign('footer_prev_page', $serendipity['smarty']->getTemplateVars('footer_next_page'));
$serendipity['smarty']->assign('footer_next_page', $temp);
}
}
/**