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
This commit is contained in:
dervitx 2006-07-08 23:32:38 +00:00
parent b94087d374
commit d7cb04d9b7
3 changed files with 23 additions and 14 deletions

View File

@ -150,15 +150,15 @@ if (comprueba_login() == 0) {
$win_handle=dechex(crc32($nombre_agente.$row3["nombre"]));
echo "<td class=".$tdcolor." width='78'>";
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?tipo=mes&id=".$row3["id_agente_modulo"]."\", \"mes_".$win_handle."\")'><img border=0 src='images/grafica_m.gif'></a>&nbsp;";
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?tipo=mes&id=".$row3["id_agente_modulo"]."&refresh=180000\", \"mes_".$win_handle."\")'><img border=0 src='images/grafica_m.gif'></a>&nbsp;";
$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 '<a href="javascript:'.$link.'"><img border=0 src="images/grafica_w.gif"></a>&nbsp;';
$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 '<a href="javascript:'.$link.'"><img border=0 src="images/grafica_d.gif"></a>&nbsp;';
$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 '<a href="javascript:'.$link.'"><img border=0 src="images/grafica_h.gif"</a>';
}
else { # Writing string data in different way :)
@ -178,4 +178,4 @@ if (comprueba_login() == 0) {
}
else echo "<font class='red'>".$lang_label["no_modules"]."</font>";
}
?>
?>

View File

@ -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; $nn<count($MGD_event_data[$cc]); $nn++) {
$Dataset_events->addPoint(
$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);
}
}

View File

@ -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 '<style>';
include("../include/styles/pandora.css");
echo '</style>';
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 '<style>';
include("../include/styles/pandora.css");
echo '</style>';
if (isset($_GET["tipo"]) AND isset($_GET["id"])) {
$tipo =entrada_limpia($_GET["tipo"]);
$id_agente_modulo = entrada_limpia($_GET["id"]);