2013-04-12 Miguel de Dios <miguel.dedios@artica.es>
* godmode/setup/setup_visuals.php, include/functions_config.php, include/config_process.php, general/header.php: fixed the autorefresh and set a white list of pages with autorefresh in config_process. Fixes: #3609243 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7979 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
811bcc96de
commit
1024a3631e
|
@ -1,3 +1,12 @@
|
|||
2013-04-12 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/setup/setup_visuals.php, include/functions_config.php,
|
||||
include/config_process.php, general/header.php: fixed the
|
||||
autorefresh and set a white list of pages with autorefresh in
|
||||
config_process.
|
||||
|
||||
Fixes: #3609243
|
||||
|
||||
2013-04-12 Mario Pulido <mario.pulido@artica.es>
|
||||
|
||||
* godmode/alerts/configure_alert_action.php,
|
||||
|
|
|
@ -82,44 +82,55 @@ config_check();
|
|||
|
||||
$table->data[0][0] = $servers_link_open . $servers_check_img . $servers_link_close;
|
||||
|
||||
// Autorefresh
|
||||
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//======= Autorefresh code =============================
|
||||
$autorefresh_txt = '';
|
||||
$autorefresh_additional = '';
|
||||
|
||||
$ignored_params = array ('agent_config' => false, 'code' => false);
|
||||
if ($config['enable_refr']) {
|
||||
$ignored_params['refr'] = 0;
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
||||
|
||||
if (!isset($_GET['sec2'])) {
|
||||
$_GET['sec2'] = '';
|
||||
}
|
||||
if (!isset($_GET['refr'])) {
|
||||
$_GET['refr'] = null;
|
||||
}
|
||||
|
||||
if (array_search($_GET['sec2'], $config['autorefresh_white_list']) !== false) {
|
||||
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = array (
|
||||
'5' => __('5 seconds'),
|
||||
'10' => __('10 seconds'),
|
||||
'15' => __('15 seconds'),
|
||||
'30' => __('30 seconds'),
|
||||
(string)SECONDS_1MINUTE => __('1 minute'),
|
||||
(string)SECONDS_2MINUTES => __('2 minutes'),
|
||||
(string)SECONDS_5MINUTES => __('5 minutes'),
|
||||
(string)SECONDS_15MINUTES => __('15 minutes'),
|
||||
(string)SECONDS_30MINUTES => __('30 minutes'),
|
||||
(string)SECONDS_1HOUR => __('1 hour'));
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none; padding-right: 9px;">';
|
||||
$autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset ($values);
|
||||
}
|
||||
else {
|
||||
if (!isset($_GET['sec2']))
|
||||
$_GET['sec2'] = '';
|
||||
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
|
||||
|
||||
if (($config['refr']) && (($_GET['sec2'] == 'operation/agentes/tactical') || ($_GET['sec2'] == 'operation/agentes/estado_agente') ||
|
||||
($_GET['sec2'] == 'operation/agentes/group_view') || ($_GET['sec2'] == 'operation/events/events') ||
|
||||
($_GET['sec2'] == 'enterprise/dashboard/main_dashboard'))) {
|
||||
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
||||
}
|
||||
else {
|
||||
$ignored_params['refr'] = '';
|
||||
$values = array (
|
||||
'5' => __('5 seconds'),
|
||||
'10' => __('10 seconds'),
|
||||
'15' => __('15 seconds'),
|
||||
'30' => __('30 seconds'),
|
||||
(string)SECONDS_1MINUTE => __('1 minute'),
|
||||
(string)SECONDS_2MINUTES => __('2 minutes'),
|
||||
(string)SECONDS_5MINUTES => __('5 minutes'),
|
||||
(string)SECONDS_15MINUTES => __('15 minutes'),
|
||||
(string)SECONDS_30MINUTES => __('30 minutes'),
|
||||
(string)SECONDS_1HOUR => __('1 hour'));
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none">';
|
||||
$autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset ($values);
|
||||
}
|
||||
$ignored_params['refr'] = false;
|
||||
}
|
||||
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">';
|
||||
|
@ -127,7 +138,11 @@ config_check();
|
|||
$autorefresh_link_close = '</a>';
|
||||
|
||||
$table->data[0][1] = $autorefresh_link_open_img . $autorefresh_img . $autorefresh_link_close;
|
||||
$table->data[0][2] .= $autorefresh_link_open_txt . $autorefresh_txt . $autorefresh_link_close . $autorefresh_additional;
|
||||
$table->data[0][2] = $autorefresh_link_open_txt . $autorefresh_txt . $autorefresh_link_close . $autorefresh_additional;
|
||||
//======================================================
|
||||
|
||||
|
||||
|
||||
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
@ -141,7 +156,6 @@ config_check();
|
|||
$maintenance_link_open_img = '<a href="' . $maintenance_link . '" title="' . $maintenance_title . '" class="' . $maintenance_class . '">';
|
||||
$maintenance_link_close = '</a>';
|
||||
$maintenance_img = $maintenance_link_open_img . html_print_image ("images/header_warning.png", true, array ("title" => __('You have %d warning(s)', $config["alert_cnt"]), "id" => "yougotalert", "class" => "bot")) . $maintenance_link_close;
|
||||
$maintenance_txt = $maintenance_link_open_txt . $maintenance_txt . $maintenance_link_close;
|
||||
}
|
||||
else {
|
||||
$maintenance_img = html_print_image ("images/header_ready.png", true, array ("title" => __('There are not warnings'), "id" => "yougotalert", "class" => "bot"));
|
||||
|
@ -261,7 +275,7 @@ config_check();
|
|||
|
||||
|
||||
<?php
|
||||
if ($config["refr"]) {
|
||||
if ($_GET["refr"]) {
|
||||
?>
|
||||
t = new Date();
|
||||
t.setTime (t.getTime () + <?php echo $config["refr"] * 1000; ?>);
|
||||
|
@ -269,26 +283,26 @@ config_check();
|
|||
layout: '%M%nn%M:%S%nn%S',
|
||||
labels: ['', '', '', '', '', '', ''],
|
||||
onExpiry: function () {
|
||||
$(this).text ("...");
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
href = href + <?php echo $_GET["refr"]; ?>;
|
||||
$(document).attr ("location", href);
|
||||
}
|
||||
});
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
$("a.autorefresh").click (function () {
|
||||
$("a.autorefresh_txt").toggle ();
|
||||
$("#combo_refr").toggle ();
|
||||
$("select#ref").change (function () {
|
||||
href = $(this).attr ("href");
|
||||
$(document).attr ("location", href + this.value);
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
$("a.autorefresh").click (function () {
|
||||
$("a.autorefresh_txt").toggle ();
|
||||
$("#combo_refr").toggle ();
|
||||
$("#combo_refr").css('padding-right', '9px');
|
||||
$("select#ref").change (function () {
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
$(document).attr ("location", href + this.value);
|
||||
});
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -185,17 +185,6 @@ $values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES);
|
|||
$values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES);
|
||||
$values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES);
|
||||
|
||||
$table->data[$row][0] = __('Enable refresh for all pages');
|
||||
$table->data[$row][1] = __('Yes').' '.html_print_radio_button ('enable_refr', 1, '', $config["enable_refr"], true).' ';
|
||||
$table->data[$row][1] .= __('No').' '.html_print_radio_button ('enable_refr', 0, '', $config["enable_refr"], true);
|
||||
|
||||
$row++;
|
||||
|
||||
$table->data[$row][0] = __('Global default interval for refresh') . ui_print_help_tip(__('This interval will affect all pages'), true);
|
||||
$table->data[$row][1] = html_print_select ($values, 'refr', $config["refr"], '', 'N/A', 0, true, false, false);
|
||||
|
||||
$row++;
|
||||
|
||||
$table->data[$row][0] = __('Default interval for refresh on Visual Console') . ui_print_help_tip(__('This interval will affect to Visual Console pages'), true);
|
||||
$table->data[$row][1] = html_print_select ($values, 'vc_refr', $config["vc_refr"], '', 'N/A', 0, true, false, false);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ if (empty($script_tz)){
|
|||
|
||||
global $develop_bypass;
|
||||
/* Help to debug problems. Override global PHP configuration */
|
||||
$develop_bypass = 0;
|
||||
$develop_bypass = 1;
|
||||
|
||||
if ($develop_bypass != 1) {
|
||||
// error_reporting(E_ALL);
|
||||
|
@ -204,6 +204,23 @@ if (isset($_POST['vc_refr'])){
|
|||
}
|
||||
|
||||
|
||||
//======= Autorefresh code =============================================
|
||||
$config['autorefresh_white_list'] = array(
|
||||
'operation/agentes/tactical',
|
||||
'operation/agentes/group_view',
|
||||
'operation/agentes/estado_agente',
|
||||
'operation/agentes/alerts_status',
|
||||
'operation/agentes/status_monitor',
|
||||
'enterprise/operation/services/services',
|
||||
'enterprise/dashboard/main_dashboard',
|
||||
'operation/reporting/graph_viewer',
|
||||
'operation/snmpconsole/snmp_view',
|
||||
'operation/agentes/networkmap',
|
||||
'enterprise/operation/services/services',
|
||||
'operation/events/events');
|
||||
//======================================================================
|
||||
|
||||
|
||||
//======================================================================
|
||||
// Update the $config['homeurl'] with the full url with the special
|
||||
// cases (reverse proxy, others ports...).
|
||||
|
|
|
@ -386,10 +386,6 @@ function config_update_config () {
|
|||
$error_update[] = __('Interactive charts');
|
||||
if (!config_update_value ('custom_logo', (string) get_parameter ('custom_logo')))
|
||||
$error_update[] = __('Custom logo');
|
||||
if (!config_update_value ('enable_refr', get_parameter('enable_refr')))
|
||||
$error_update[] = __('Enable refresh for all pages');
|
||||
if (!config_update_value ('refr', get_parameter('refr')))
|
||||
$error_update[] = __('Global default interval for refresh');
|
||||
if (!config_update_value ('vc_refr', get_parameter('vc_refr')))
|
||||
$error_update[] = __('Default interval for refresh on Visual Console');
|
||||
if (!config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')))
|
||||
|
@ -1019,18 +1015,10 @@ function config_process_config () {
|
|||
config_update_value ('dbtype', 'mysql');
|
||||
}
|
||||
|
||||
if (!isset ($config['enable_refr'])) {
|
||||
config_update_value ('enable_refr', 0);
|
||||
}
|
||||
|
||||
if (!isset ($config['vc_refr'])) {
|
||||
config_update_value ('vc_refr', 60);
|
||||
}
|
||||
|
||||
if (!isset ($config['refr'])) {
|
||||
config_update_value ('refr', '');
|
||||
}
|
||||
|
||||
if (!isset($config['agent_size_text_small'])) {
|
||||
config_update_value ('agent_size_text_small', 18);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue