From 4e662bf17c420cc997c39c9501cfe0df509d9a09 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Fri, 16 Aug 2019 21:37:45 +0200 Subject: [PATCH] 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 --- docs/NEWS | 7 +++++++ include/functions_entries.inc.php | 13 ++----------- templates/bulletproof/entries.tpl | 16 ++++++++++++---- templates/timeline/entries.tpl | 16 ++++++++++++---- templates/timeline/index.tpl | 16 ++++++++++++---- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index 7c6ac9f0..320a6a61 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -1,6 +1,13 @@ Version 2.3.1-beta1 ------------------------------------------------------------------------ + * Change footer_info and prev/next links for archive pages for + "stable archives" sort order. + + * Fix pagination in core for "stable archives" sort order and fix + prev/next links for pagination in timeline and bulletproof themes + when "stable archives" are active. + * Add Spartacus links ("more info") to plugin lists. * Fix/Change: Wording of plugin display ("version") and PHP/smarty diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 23d2be07..66be2a61 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -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); - } } /** diff --git a/templates/bulletproof/entries.tpl b/templates/bulletproof/entries.tpl index 5a8a70a7..143bf521 100644 --- a/templates/bulletproof/entries.tpl +++ b/templates/bulletproof/entries.tpl @@ -418,6 +418,14 @@ {if $template_option.show_pagination == 'true' && $footer_totalPages > 1} {/if} diff --git a/templates/timeline/entries.tpl b/templates/timeline/entries.tpl index dcb2ce06..2f9c641f 100644 --- a/templates/timeline/entries.tpl +++ b/templates/timeline/entries.tpl @@ -285,6 +285,14 @@ {if $footer_totalPages >1 } {/if} diff --git a/templates/timeline/index.tpl b/templates/timeline/index.tpl index a2c78086..8f5fd10d 100644 --- a/templates/timeline/index.tpl +++ b/templates/timeline/index.tpl @@ -114,6 +114,14 @@ {if $footer_totalPages >1 && !isset($staticpage_pagetitle)} {/if}