2013-11-13 Miguel de Dios <miguel.dedios@artica.es>

* operation/visual_console/render_view.php,
	operation/visual_console/public_console.php: fixed the refresh of
	visualmaps.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9070 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-11-13 10:29:04 +00:00
parent 016d9d4bff
commit 83c47c4833
3 changed files with 30 additions and 72 deletions

View File

@ -1,3 +1,9 @@
2013-11-13 Miguel de Dios <miguel.dedios@artica.es>
* operation/visual_console/render_view.php,
operation/visual_console/public_console.php: fixed the refresh of
visualmaps.
2013-11-12 Sergio Martin <sergio.martin@artica.es> 2013-11-12 Sergio Martin <sergio.martin@artica.es>
* general/shortcut_bar.php: Fix styles, icons and links of the * general/shortcut_bar.php: Fix styles, icons and links of the

View File

@ -35,10 +35,6 @@ ob_start ('ui_process_page_head');
require ('include/functions_visual_map.php'); require ('include/functions_visual_map.php');
// Auto Refresh page (can now be disabled anywhere in the script)
$config["refr"] = (int) get_parameter ("refr");
$config["remote_addr"] = $_SERVER['REMOTE_ADDR'];
$hash = get_parameter ('hash'); $hash = get_parameter ('hash');
$id_layout = (int) get_parameter ('id_layout'); $id_layout = (int) get_parameter ('id_layout');
$config["id_user"] = get_parameter ('id_user'); $config["id_user"] = get_parameter ('id_user');
@ -50,8 +46,7 @@ if ( $myhash != $hash) {
exit; exit;
} }
$refr = (int) get_parameter ('refr', $config['vc_refr']); $refr = (int) get_parameter ('refr', 0);
$vc_refr = false;
$layout = db_get_row ('tlayout', 'id', $id_layout); $layout = db_get_row ('tlayout', 'id', $id_layout);
if (! $layout) { if (! $layout) {
@ -92,22 +87,13 @@ $table->style = array ();
$table->style[2] = 'text-align: center'; $table->style[2] = 'text-align: center';
$table->data[0][0] = __('Autorefresh time'); $table->data[0][0] = __('Autorefresh time');
if (empty($config["vc_refr"])) { $table->data[0][1] = html_print_select ($values, 'refr', $refr, '', 'N/A', 0, true, false, false);
$vc_refr = true;
$config["vc_refr"] = $refr;
}
$table->data[0][1] = html_print_select ($values, 'refr', $config["vc_refr"], '', 'N/A', 0, true, false, false);
$table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true); $table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
$table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true); $table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true);
if ($vc_refr) {
$config["vc_refr"] = 0;
}
echo '<div style="height:30px">&nbsp;</div>'; echo '<div style="height:30px">&nbsp;</div>';
if ($config['pure'] && $config["refr"] != 0) { if ($refr > 0) {
echo '<div id="countdown"><br /></div>'; echo '<div id="countdown"><br /></div>';
} }
@ -120,10 +106,12 @@ html_print_table ($table);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
if ($config["pure"] && $config["refr"] != 0) {
ui_require_jquery_file ('countdown'); ui_require_jquery_file ('countdown');
ui_require_css_file ('countdown'); ui_require_css_file ('countdown');
}
ui_require_javascript_file ('wz_jsgraphics'); ui_require_javascript_file ('wz_jsgraphics');
ui_require_javascript_file ('pandora_visual_console'); ui_require_javascript_file ('pandora_visual_console');
?> ?>
@ -135,11 +123,22 @@ $(document).ready (function () {
}); });
<?php <?php
if ($config["pure"] && $config["refr"] > 0) { if ($refr > 0) {
?> ?>
t = new Date(); t = new Date();
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>); t.setTime (t.getTime() + <?php echo $refr * 1000; ?>);
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'}); $("#countdown").countdown(
{
until: t,
format: 'MS',
description: '<?php echo __('Until refresh'); ?>',
onExpiry: function () {
href = "<?php echo ui_get_full_url();?>";
href = href + "&refr=<?php echo $refr;?>";
$(document).attr ("location", href);
}
}
);
<?php <?php
} }

View File

@ -132,54 +132,7 @@ else {
visual_map_print_visual_map ($id_layout); visual_map_print_visual_map ($id_layout);
$values = array ();
$values[5] = human_time_description_raw (5);
$values[30] = human_time_description_raw (30);
$values[SECONDS_1MINUTE] = human_time_description_raw(SECONDS_1MINUTE);
$values[SECONDS_2MINUTES] = human_time_description_raw(SECONDS_2MINUTES);
$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->width = '90%';
$table->data = array ();
$table->style = array ();
$table->style[2] = 'text-align: center';
$table->data[0][0] = __('Autorefresh time');
if (empty($config["vc_refr"])) {
$vc_refr = true;
$config["vc_refr"] = $refr;
}
$table->data[0][1] = html_print_select ($values, 'refr', $config["vc_refr"], '', 'N/A', 0, true, false, false);
$table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
$table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true);
if ($vc_refr) {
$config["vc_refr"] = 0;
}
echo '<div style="height:30px">&nbsp;</div>';
if ($config['pure'] && ((int)get_parameter('refr', 0)) != 0) {
echo '<div id="countdown"><br /></div>';
}
echo '<div style="height:30px">&nbsp;</div>';
if (!defined('METACONSOLE'))
echo '<form method="post" action="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view">';
else
echo '<form method="post" action="index.php?sec=screen&sec2=screens/screens&action=visualmap">';
html_print_input_hidden ('pure', $config["pure"]);
if (!defined('METACONSOLE'))
html_print_input_hidden ('id', $id_layout);
else
html_print_input_hidden ('id_visualmap', $id_layout);
html_print_table ($table);
echo '</form>';
if ($config["pure"] && ((int)get_parameter('refr', 0)) != 0) { if ($config["pure"] && ((int)get_parameter('refr', 0)) != 0) {
ui_require_jquery_file ('countdown'); ui_require_jquery_file ('countdown');