2008-07-08 Sancho Lerena <slerena@artica.es>

* operation/reporting/graph_viewer.php: Added controls to view in the
        new combined graphic mode (lines), and to change size to three pre-
        defined sizes.

        * reporting/fgraph.php: Stacked mode support was missing by unknown
        reason. Reactivated. Added a mode to view combined graphs in "wired"
        mode (lines only).

        * godmode/agentes/modificar_agente.php: Disabled agents was not shown,
        so was unable to activate again. Fixed.

        * godmode/reporting/graph_builder.php: Added support for line mode.
        Disabled agents don't shown in combo. Some other minor fixes. Changed
        to show the name of the module, instead of description.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@942 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-07-08 20:06:44 +00:00
parent e46ed7d89b
commit dae75937fb
5 changed files with 126 additions and 42 deletions

View File

@ -1,5 +1,20 @@
2008-07-08 Sancho Lerena <slerena@artica.es>
* operation/reporting/graph_viewer.php: Added controls to view in the
new combined graphic mode (lines), and to change size to three pre-
defined sizes.
* reporting/fgraph.php: Stacked mode support was missing by unknown
reason. Reactivated. Added a mode to view combined graphs in "wired"
mode (lines only).
* godmode/agentes/modificar_agente.php: Disabled agents was not shown,
so was unable to activate again. Fixed.
* godmode/reporting/graph_builder.php: Added support for line mode.
Disabled agents don't shown in combo. Some other minor fixes. Changed
to show the name of the module, instead of description.
* include/config.php: Deleted. This file should not be included in SVN
* images/so_aix.png: New icon for AIX systems.

View File

@ -160,24 +160,24 @@ echo "</td></table>";
if ($search != ""){
$search_sql = " AND nombre LIKE '%$search%' ";
} else {
$search_sql = "";
$search_sql = " 1 = 1";
}
// Show only selected groups
if ($ag_group > 1){
$sql1="SELECT * FROM tagente WHERE id_grupo=$ag_group
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
$sql1="SELECT * FROM tagente WHERE id_grupo = $ag_group
AND $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $ag_group
AND disabled = 0 $search_sql ORDER BY nombre";
AND $search_sql ORDER BY nombre";
} else {
// Is admin user ??
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
$sql1 = "SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
$sql1 = "SELECT * FROM tagente WHERE $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE $search_sql ORDER BY nombre, id_grupo";
} else {
$sql1="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
$sql1="SELECT * FROM tagente WHERE $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
}
}
@ -211,10 +211,17 @@ if (mysql_num_rows($result)){
}
if (give_acl($id_user, $id_grupo, "AW")==1){
// Agent name
echo "<tr><td class='$tdcolor'>
<b><a href='index.php?sec=gagente&
echo "<tr><td class='$tdcolor'>";
if ($row["disabled"] == 1){
echo "<i>";
}
echo "<b><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b></td>";
id_agente=".$row["id_agente"]."'>".substr(strtoupper($row["nombre"]),0,20)."</a></b>";
if ($row["disabled"] == 1){
echo "<i>";
}
echo "</td>";
echo "<td align='center' class='$tdcolor'>";
// Has remote configuration ?

View File

@ -282,7 +282,7 @@ echo "</b>";
// Show combo with agents
echo "<td class='datos' colspan=2>";
print_select_from_sql ('SELECT id_agente, nombre FROM tagente ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
print_select_from_sql ('SELECT id_agente, nombre FROM tagente WHERE disabled = 0 ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
if (isset($chunkdata))
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
@ -427,15 +427,13 @@ echo "<tr>";
echo "<td class='datos2'>";
echo "<b>".lang_string ("Stacked")."</b></td>";
echo "<td class='datos2'>";
echo "<select name='stacked'>";
if ($stacked == 1){
echo "<option value=1>Yes</option>";
echo "<option value=0>No</option>";
} else {
echo "<option value=0>No</option>";
echo "<option value=1>Yes</option>";
}
echo "</select></td>";
$stackeds[0] = lang_string ('Area');
$stackeds[1] = lang_string ('Stacked area');
$stackeds[2] = lang_string ('Line');
print_select ($stackeds, 'stacked', $stacked, '', '', 0);
echo "</td>";
/*
@ -452,6 +450,8 @@ if ($alerts == 1){
}
echo "</select>";
*/
echo "</tr></table>";
echo "<table width='500px'>";
echo "<tr><td align='right'><input type=submit name='update_agent' class='sub upd' value='".$lang_label["add"]."/".$lang_label["redraw"]."'>";
@ -535,11 +535,7 @@ function agent_changed () {
success: function (data) {
$('#id_module').append ($('<option></option>').attr ('value', 0).text ("--"));
jQuery.each (data, function (i, val) {
if (val['descripcion'] == "") {
s = html_entity_decode (val['nombre']);
} else {
s = html_entity_decode (val['descripcion']);
}
s = html_entity_decode (val['nombre']);
$('#id_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
});
$('#id_module').fadeIn ('normal');

View File

@ -58,7 +58,24 @@ if (isset($_GET["view_graph"])){
$id_user = $row["id_user"];
$private = $row["private"];
$width = $row["width"];
$height = $row["height"];
$height = $row["height"];
$zoom = (int) get_parameter ('zoom', 0);
if ($zoom > 0){
switch ($zoom){
case 1:
$width = 500;
$height = 210;
break;
case 2:
$width = 650;
$height = 310;
break;
case 3:
$width = 770;
$height = 400;
break;
}
}
$period = (int) get_parameter ('period');
if (! $period)
$period = $row["period"];
@ -66,6 +83,10 @@ if (isset($_GET["view_graph"])){
$period = 3600 * $period;
$events = $row["events"];
$description = $row["description"];
$stacked = (int) get_parameter ('stacked');
if (! $stacked)
$stacked = $row["stacked"];
$name = $row["name"];
if (($row["private"]==1) && ($row["id_user"] != $id_user)){
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access to a custom graph not allowed");
@ -91,13 +112,15 @@ if (isset($_GET["view_graph"])){
}
echo "<h2>".$lang_label["reporting"]." &gt; ";
echo $lang_label["combined_image"]."</h2>";
echo "<table class='databox_frame'>";
echo "<table class='databox_frame' cellpadding=0 cellspacing=0>";
echo "<tr><td>";
echo "<img src='reporting/fgraph.php?tipo=combined&height=$height&width=$width&id=$modules&period=$period&weight_l=$weights' border=1 alt=''>";
echo "<img
src='reporting/fgraph.php?tipo=combined&height=$height&width=$width&id=$modules&period=$period&weight_l=$weights&stacked=$stacked'
border=1 alt=''>";
echo "</td></tr></table>";
$period_label = human_time_description ($period);
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'>";
echo "<table class='databox_frame'>";
echo "<table class='databox_frame' cellpadding=4 cellspacing=4>";
echo "<tr><td class='datos'>";
echo "<b>".lang_string ('period')."</b>";
echo "<td class='datos'>";
@ -114,13 +137,30 @@ if (isset($_GET["view_graph"])){
$periods[4320] = lang_string ('six_months');
print_select ($periods, 'period', intval ($period / 3600), '', '', 0);
echo "<td class='datos'>";
$stackeds = array ();
$stackeds[0] = lang_string ('Area');
$stackeds[1] = lang_string ('Stacked area');
$stackeds[2] = lang_string ('Line');
print_select ($stackeds, 'stacked', $stacked , '', '', 0);
echo "<td class='datos'>";
$zooms = array();
$zooms[0] = lang_string ('Graph defined');
$zooms[1] = lang_string ('Zoom x1');
$zooms[2] = lang_string ('Zoom x2');
$zooms[3] = lang_string ('Zoom x3');
print_select ($zooms, 'zoom', $zoom , '', '', 0);
echo "<td class='datos'>";
echo "<input type=submit value='".$lang_label["update"]."' class='sub upd'>";
echo "</table>";
echo "</form>";
}
}
echo "<h2>".$lang_label["reporting"]." &gt; ";
echo $lang_label["custom_graph_viewer"]."</h2>";
echo "<h2>" . lang_string ("reporting") . " &gt; ";
echo lang_string ("custom_graph_viewer") . "</h2>";
$color=1;
$sql="SELECT * FROM tgraph";

View File

@ -253,7 +253,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
if ($pure == 0){
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Font->setSize(7);
$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
@ -274,7 +274,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
} else {
$Font =& $Graph->addNew('font', $config['fontpath']);
$Font->setSize(6);
$Font->setSize(7);
$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
@ -333,16 +333,42 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
$Plot->setUpperBound( $alert_high );
}
// create the 1st plot as smoothed area chart using the 1st dataset
if ($stacked == 0) {
// Non-stacked
$Plot =& $Plotarea->addNew('area', array(&$dataset));
} else {
// Stacked (> 2.0)
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Area', array(&$dataset, 'stacked'));
if ($stacked == 0) {
// Non-stacked
$Plot =& $Plotarea->addNew('area', array(&$dataset));
} elseif ($stacked == 1) {
// Stacked (> 2.0)
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Area', array(&$dataset, 'stacked'));
} else {
$color_array[0] = "red";
$color_array[1] = "blue";
$color_array[2] = "green";
$color_array[3] = 'yellow'; // yellow
$color_array[4] = '#FF5FDF'; // pink
$color_array[5] = 'orange'; // orange
$color_array[6] = '#FE00DA'; // magenta
$color_array[7] = '#00E2FF'; // cyan
$color_array[8] = '#000000'; // Black
// Single lines, new in 2.0 (Jul08)
for ($i = 0; $i < $module_number; $i++){
$Plot =& $Plotarea->addNew('line', array(&$dataset[$i]));
$Plot->setLineColor($color_array[$i]);
}
}
// Color management
if ($stacked != 2){
$Plot->setLineColor('gray@0.4');
}
$Plot->setLineColor('gray@0.4');
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
// $AxisX->Hide();
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);