From d7cb04d9b7f702190e8b07bed51d5424095d64df Mon Sep 17 00:00:00 2001 From: dervitx Date: Sat, 8 Jul 2006 23:32:38 +0000 Subject: [PATCH] Two new functionalities: drawing of events on module's graphs and automatic refreshing They are configured via url variables: draw_events=1|0 and refresh=seconds - draw events defaults to 1. To turn it off, &draw_events=0 has to be appended to url - refreshing is made with header() function in win_stats.php function git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@109 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- .../operation/agentes/estado_ultimopaquete.php | 10 +++++----- pandora_console/reporting/fgraph.php | 12 ++++++------ pandora_console/reporting/stat_win.php | 15 ++++++++++++--- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index da7fad2de7..2791f159a4 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -150,15 +150,15 @@ if (comprueba_login() == 0) { $win_handle=dechex(crc32($nombre_agente.$row3["nombre"])); echo ""; - echo " "; + echo " "; - $link ="winopeng('reporting/stat_win.php?tipo=semana&id=".$row3["id_agente_modulo"]."','sem_".$win_handle."')"; + $link ="winopeng('reporting/stat_win.php?tipo=semana&id=".$row3["id_agente_modulo"]."&refresh=6000','sem_".$win_handle."')"; echo ' '; - $link ="winopeng('reporting/stat_win.php?tipo=dia&id=".$row3["id_agente_modulo"]."','dia_".$win_handle."')"; + $link ="winopeng('reporting/stat_win.php?tipo=dia&id=".$row3["id_agente_modulo"]."&refresh=800','dia_".$win_handle."')"; echo ' '; - $link ="winopeng('reporting/stat_win.php?tipo=hora&id=".$row3["id_agente_modulo"]."','hora_".$win_handle."')"; + $link ="winopeng('reporting/stat_win.php?tipo=hora&id=".$row3["id_agente_modulo"]."&refresh=30','hora_".$win_handle."')"; echo ''; } else { # Writing string data in different way :) @@ -178,4 +178,4 @@ if (comprueba_login() == 0) { } else echo "".$lang_label["no_modules"].""; } -?> \ No newline at end of file +?> diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index f670b22368..d5fbd8c176 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -237,7 +237,7 @@ function grafico_modulo_sparse($id_agente_modulo, $periodo, $intervalo, $etiquet // end 29.06.06 dervitx $Graph_param = array ( - 'title' => " $etiqueta - $nombre_agente / $nombre_modulo" , + 'title' => " $etiqueta - $nombre_agente / $nombre_modulo", 'size_x' => 550 , 'size_y' => 220 , 'id_agente_modulo' => $id_agente_modulo , @@ -250,7 +250,7 @@ function grafico_modulo_sparse($id_agente_modulo, $periodo, $intervalo, $etiquet &$etiq_base, array('Maximum','Average','Minimum'), array ( &$valores_max, &$grafica, &$valores_min ), - &$data_x + &$datax ); } @@ -278,7 +278,6 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data // $MGD_event_data = array ( (notvalidated) &array(data_x), (validated) => &array(data_x) ); - include ("../include/config.php"); require ("../include/languages/language_".$language_code.".php"); include 'Image/Graph.php'; @@ -375,7 +374,8 @@ function modulo_grafico_draw( $MGD_param, $MGD_labels, $MGD_data_name, $MGD_data $Dataset_events->setName($cc?'Validated events':'Not valid. events'); for ($nn=0; $nnaddPoint( - $MGD_event_data[$cc][$nn], $MGD_param['valor_maximo']); + $MGD_event_data[$cc][$nn], + ceil($MGD_param['valor_maximo'] / 7) + $MGD_param['valor_maximo']); } $Plot =& $Plotarea->addNew('Plot_Impulse', array(&$Dataset_events)); $Plot->setLineColor($cc?'green@0.5':'red@0.5'); @@ -1426,8 +1426,8 @@ if (isset($_GET["tipo"])){ $intervalo = $_GET["intervalo"]; $label = $_GET["label"]; $color = "#".$color; - if ( isset($_GET["draw_events"]) and $_GET["draw_events"]==1 ) - { $draw_events = 1; } else { $draw_events = 0; } + if ( isset($_GET["draw_events"]) and $_GET["draw_events"]==0 ) + { $draw_events = 0; } else { $draw_events = 1; } grafico_modulo_sparse($id, $periodo, $intervalo, $label, $color, $draw_events); } } diff --git a/pandora_console/reporting/stat_win.php b/pandora_console/reporting/stat_win.php index f10e3d01ff..40cbff3896 100644 --- a/pandora_console/reporting/stat_win.php +++ b/pandora_console/reporting/stat_win.php @@ -21,11 +21,20 @@ include ("../include/config.php"); include ("../include/functions.php"); include("../include/functions_db.php"); include("../include/languages/language_".$language_code.".php"); -echo ''; + if (comprueba_login() == 0) { // Has access to this page ??? + + // Parsing the refresh before sending any header + if (isset($_GET['refresh']) and is_numeric($_GET['refresh']) and $_GET['refresh']>0) { + header( 'refresh: ' . $_GET['refresh'] ); + } + + // CSS + echo ''; + if (isset($_GET["tipo"]) AND isset($_GET["id"])) { $tipo =entrada_limpia($_GET["tipo"]); $id_agente_modulo = entrada_limpia($_GET["id"]);