diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index a093596b2b..99bb38cc21 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -670,21 +670,49 @@ if ($config['menu_type'] == 'classic') { + + var autorefresh_draw = ''; $("#header_autorefresh").css('padding-right', '5px'); - var refr_time = ; - var t = new Date(); - t.setTime (t.getTime () + parseInt()); - $("#refrcounter").countdown ({ - until: t, - layout: '%M%nn%M:%S%nn%S', - labels: ['', '', '', '', '', '', ''], - onExpiry: function () { + if(autorefresh_draw == true) { + var refresh_interval = parseInt(''); + var until_time=''; + + 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); + } else { + var refr_time = ; + var t = new Date(); + t.setTime (t.getTime () + parseInt()); + $("#refrcounter").countdown ({ + until: t, + layout: '%M%nn%M:%S%nn%S', + labels: ['', '', '', '', '', '', ''], + onExpiry: function () { href = $("a.autorefresh").attr ("href"); href = href + refr_time; $(document).attr ("location", href); } }); + } @@ -694,8 +722,38 @@ if ($config['menu_type'] == 'classic') { $("#combo_refr").toggle (); $("select#ref").change (function () { href = $("a.autorefresh").attr ("href"); - $(document).attr ("location", href + this.value); - }); + + if(autorefresh_draw == true){ + 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); + } + + $(document).attr("location", href+ '&refr=' + this.value); + + $(document).attr("location", href+'&fb64=' + newValue + '&refr=' + this.value); + + } else { + $(document).attr ("location", href + this.value); + } + }); return false; }); diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 9561872288..b316bea7ff 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1469,6 +1469,11 @@ echo "
'; echo ''; + +if ($_GET['refr'] || $do_refresh === true) { + $autorefresh_draw = true; +} + ?>