Skip to content

Commit

Permalink
Merge pull request #17324 from mauriciofauth/nav-pagination-5.1
Browse files Browse the repository at this point in the history
[5.1] Fix broken pagination links in the navigation sidebar
  • Loading branch information
MauricioFauth committed Jan 28, 2022
2 parents bbb553d + 265e807 commit 77c34f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
10 changes: 4 additions & 6 deletions js/src/navigation.js
Expand Up @@ -1066,14 +1066,12 @@ Navigation.selectCurrentDatabase = function () {
Navigation.treePagination = function ($this) {
var $msgbox = Functions.ajaxShowMessage();
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
var url;
var params;
var url = 'index.php?route=/navigation';
var params = 'ajax_request=true';
if ($this[0].tagName === 'A') {
url = $this.attr('href');
params = 'ajax_request=true';
params += CommonParams.get('arg_separator') + $this.getPostData();
} else { // tagName === 'SELECT'
url = 'index.php?route=/navigation';
params = $this.closest('form').serialize() + CommonParams.get('arg_separator') + 'ajax_request=true';
params += CommonParams.get('arg_separator') + $this.closest('form').serialize();
}
var searchClause = Navigation.FastFilter.getSearchClause();
if (searchClause) {
Expand Down
24 changes: 14 additions & 10 deletions libraries/classes/Html/Generator.php
Expand Up @@ -1259,13 +1259,15 @@ public static function getListNavigator(

$_url_params[$name] = 0;
$list_navigator_html .= '<a' . $class . $title1 . ' href="' . $script
. Url::getCommon($_url_params, '&') . '">' . $caption1
. '</a>';
. '" data-post="'
. Url::getCommon($_url_params, '', false)
. '">' . $caption1 . '</a>';

$_url_params[$name] = $pos - $max_count;
$list_navigator_html .= ' <a' . $class . $title2
. ' href="' . $script . Url::getCommon($_url_params, '&') . '">'
. $caption2 . '</a>';
$list_navigator_html .= ' <a' . $class . $title2 . ' href="' . $script
. '" data-post="'
. Url::getCommon($_url_params, '', false)
. '">' . $caption2 . '</a>';
}

$list_navigator_html .= '<form action="' . $script
Expand Down Expand Up @@ -1296,17 +1298,19 @@ public static function getListNavigator(

$_url_params[$name] = $pos + $max_count;
$list_navigator_html .= '<a' . $class . $title3 . ' href="' . $script
. Url::getCommon($_url_params, '&') . '" >' . $caption3
. '</a>';
. '" data-post="'
. Url::getCommon($_url_params, '', false)
. '" >' . $caption3 . '</a>';

$_url_params[$name] = floor($count / $max_count) * $max_count;
if ($_url_params[$name] == $count) {
$_url_params[$name] = $count - $max_count;
}

$list_navigator_html .= ' <a' . $class . $title4
. ' href="' . $script . Url::getCommon($_url_params, '&') . '" >'
. $caption4 . '</a>';
$list_navigator_html .= ' <a' . $class . $title4 . ' href="' . $script
. '" data-post="'
. Url::getCommon($_url_params, '', false)
. '" >' . $caption4 . '</a>';
}
$list_navigator_html .= '</div>' . "\n";
}
Expand Down

0 comments on commit 77c34f4

Please sign in to comment.