Skip to content

Commit

Permalink
Timeline 'More Events' button stays with current day
Browse files Browse the repository at this point in the history
Prior to this, the 'More Events' button would also set 'days' parameter
to its previous value - 7 like the 'Next' button does.

Regression introduced by e2d1de8.

Fixes #22743
  • Loading branch information
dregad committed Apr 18, 2017
1 parent a1c7193 commit 076ab80
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions core/timeline_inc.php
Expand Up @@ -47,10 +47,6 @@
$t_block_icon = $t_collapse_block ? 'fa-chevron-down' : 'fa-chevron-up';

$t_url_page = string_sanitize_url( basename( $_SERVER['SCRIPT_NAME'] ) );
$t_url_params = $_GET;
if( isset( $t_url_params['all'] ) ) {
unset( $t_url_params['all'] );
}
?>

<div id="timeline" class="widget-box widget-color-blue2 <?php echo $t_block_css ?>">
Expand Down Expand Up @@ -78,14 +74,14 @@
echo '&#160;&#160;';

echo '<div class="btn-group">';
$t_url_params['days'] = $f_days + 7;
$t_url_params = array( 'days' => $f_days + 7 );
$t_href = $t_url_page . '?' . http_build_query( $t_url_params );
echo ' <a class="btn btn-primary btn-xs btn-white btn-round" href="' . $t_href . '">' . lang_get( 'prev' ) . '</a>';

$t_next_days = ( $f_days - 7 ) > 0 ? $f_days - 7 : 0;
$t_next_days = max( $f_days - 7, 0 );

if( $t_next_days != $f_days ) {
$t_url_params['days'] = $t_next_days;
$t_url_params = array( 'days' => $t_next_days );
$t_href = $t_url_page . '?' . http_build_query( $t_url_params );
echo ' <a class="btn btn-primary btn-xs btn-white btn-round" href="' . $t_href . '">' . lang_get( 'next' ) . '</a>';
}
Expand All @@ -105,7 +101,10 @@
timeline_print_events( $t_events );
echo '<div class="widget-toolbox">';
echo '<div class="btn-toolbar">';
$t_url_params['all'] = 1;
$t_url_params = array(
'days' => $f_days,
'all' => 1,
);
$t_href = $t_url_page . '?' . http_build_query( $t_url_params );
echo '<a class="btn btn-primary btn-sm btn-white btn-round" href="' . $t_href . '">' . lang_get( 'timeline_more' ) . '</a>';
echo '</div>';
Expand Down

0 comments on commit 076ab80

Please sign in to comment.