Autorefresh bug fix

This commit is contained in:
Luis Calvo 2019-05-21 12:16:06 +02:00
parent ce359bfaf6
commit e361c4243a
1 changed files with 62 additions and 4 deletions

View File

@ -143,6 +143,57 @@ if ($config['menu_type'] == 'classic') {
$_GET['sec2'] = ''; $_GET['sec2'] = '';
} }
if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) {
// home screen chosen by the user
$home_page = '';
if (isset($config['id_user'])) {
$user_info = users_get_user_by_id($config['id_user']);
$home_page = io_safe_output($user_info['section']);
$home_url = $user_info['data_section'];
}
if ($home_page != '') {
switch ($home_page) {
case 'Event list':
$_GET['sec2'] = 'operation/events/events';
break;
case 'Group view':
$_GET['sec2'] = 'operation/agentes/group_view';
break;
case 'Alert detail':
$_GET['sec2'] = 'operation/agentes/alerts_status';
break;
case 'Tactical view':
$_GET['sec2'] = 'operation/agentes/tactical';
break;
case 'Default':
$_GET['sec2'] = 'general/logon_ok';
break;
case 'Dashboard':
$_GET['sec2'] = 'enterprise/dashboard/main_dashboard';
break;
case 'Visual console':
$_GET['sec2'] = 'operation/visual_console/render_view';
break;
case 'Other':
$home_url = io_safe_output($home_url);
$url_array = parse_url($home_url);
parse_str($url_array['query'], $res);
foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
break;
}
}
}
if (!isset($_GET['refr'])) { if (!isset($_GET['refr'])) {
$_GET['refr'] = null; $_GET['refr'] = null;
} }
@ -212,14 +263,21 @@ if ($config['menu_type'] == 'classic') {
); );
$autorefresh_additional .= '</span>'; $autorefresh_additional .= '</span>';
unset($values); unset($values);
if ($home_page != '') {
$autorefresh_link_open_img = '<a class="white autorefresh" href="index.php?refr=">';
} else {
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">'; $autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
}
if ($_GET['refr'] if ($_GET['refr']
|| ((isset($select[0]['time_autorefresh']) === true) || ((isset($select[0]['time_autorefresh']) === true)
&& $select[0]['time_autorefresh'] !== 0) && $select[0]['time_autorefresh'] !== 0)
) { ) {
if ($home_page != '') {
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="index.php?refr=">';
} else {
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">'; $autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
}
} else { } else {
$autorefresh_link_open_txt = '<a>'; $autorefresh_link_open_txt = '<a>';
} }
@ -614,7 +672,7 @@ if ($config['menu_type'] == 'classic') {
if ($_GET['refr'] || $do_refresh === true) { if ($_GET['refr'] || $do_refresh === true) {
?> ?>
$("#header_autorefresh").css('padding-right', '5px'); $("#header_autorefresh").css('padding-right', '5px');
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>; var refr_time = <?php echo (int) get_parameter('refr', $config['refr']); ?>;
var t = new Date(); var t = new Date();
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>)); t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({ $("#refrcounter").countdown ({