From 7eeafaf351d4643d478683edb325a51a0e037441 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 19 Aug 2019 11:32:40 +0200 Subject: [PATCH 1/2] Fixed bug in autorefresh in events view with fullscreen - #4522 --- pandora_console/operation/events/events.php | 65 ++++++++++++++++++++- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 10298b7a9c..99fca5ccbb 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -607,9 +607,9 @@ if ($pure) { // Countdown. echo '
  • '; - echo '
    '; - echo '
    '; - echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; echo __('Refresh').':'; echo html_print_select( get_refresh_time_array(), @@ -2129,6 +2129,10 @@ function reorder_tags_inputs() { } /* Tag management ends */ $(document).ready( function() { + + let refresco = ; + $('#refresh option[value='+refresco+']').attr('selected', 'selected'); + /* Filter to a href */ $('.events_link').on('click', function(e) { e.preventDefault(); @@ -2143,6 +2147,7 @@ $(document).ready( function() { var url = e.currentTarget.href; url += 'fb64=' + btoa(JSON.stringify(values)); + url += '&refr=' + ''; document.location = url; }); @@ -2279,6 +2284,60 @@ $(document).ready( function() { click_button_remove_tag("without"); }); + + //Autorefresh in fullscreen + var pure = ''; + if(pure == 1){ + var refresh_interval = parseInt(''); + var until_time=''; + + // If autorefresh is disabled, don't show the countdown + var refresh_time = ''; + if(refresh_time == '' || refresh_time == 0){ + $('#refrcounter').toggle(); + } + + function events_refresh() { + until_time = new Date(); + until_time.setTime (until_time.getTime () + parseInt()); + + $("#refrcounter").countdown ({ + until: until_time, + layout: '(%M%nn%M:%S%nn%S )', + labels: ['', '', '', '', '', '', ''], + onExpiry: function () { + dt_events.draw(false); + } + }); + } + // Start the countdown when page is loaded (first time). + events_refresh(); + // Repeat countdown according to refresh_interval. + setInterval(events_refresh, refresh_interval); + + + $("select#refresh").change (function () { + var href = window.location.href; + + inputs = $("#events_form :input"); + values = {}; + inputs.each(function() { + values[this.name] = $(this).val(); + }) + + var newValue = btoa(JSON.stringify(values)); + var fb64 = ''; + // Check if the filters have changed. + if(fb64 !== newValue){ + href = href.replace(fb64, newValue); + } + + href = href.replace('refr='+refresh_time, 'refr='+this.value); + + $(document).attr("location", href); + }); + } + }); From d85e4caa9985e33c7edf3fbc751e073d887c7d35 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 19 Aug 2019 11:36:13 +0200 Subject: [PATCH 2/2] Fixed bug in autorefresh in events view with fullscreen - #4522 --- pandora_console/operation/events/events.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 99fca5ccbb..52eac8b77e 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -607,9 +607,9 @@ if ($pure) { // Countdown. echo '
  • '; - echo '
    '; - echo '
    '; - echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; echo __('Refresh').':'; echo html_print_select( get_refresh_time_array(),