2010-10-07 Sergio Martin <sergio.martin@artica.es>

* include/functions_reporting.php
	include/functions_visual_map.php
	operation/reporting/graph_viewer.php
	godmode/reporting/graph_builder.preview.php: Fixed the setting
	of width and height on custom graphs setup. Increased the height 
	of the graph in few sections to fix the rise of the leyend



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3361 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2010-10-07 09:27:38 +00:00
parent 13ba36c3e6
commit 7c640c5032
5 changed files with 100 additions and 85 deletions

View File

@ -1,3 +1,12 @@
2010-10-07 Sergio Martin <sergio.martin@artica.es>
* include/functions_reporting.php
include/functions_visual_map.php
operation/reporting/graph_viewer.php
godmode/reporting/graph_builder.preview.php: Fixed the setting
of width and height on custom graphs setup. Increased the height
of the graph in few sections to fix the rise of the leyend
2010-10-07 Sergio Martin <sergio.martin@artica.es> 2010-10-07 Sergio Martin <sergio.martin@artica.es>
* include/fgraph.php: Fixed crash when try to render * include/fgraph.php: Fixed crash when try to render

View File

@ -92,8 +92,12 @@ $weights = implode(',', $weight_array);
echo "<table class='databox'>"; echo "<table class='databox'>";
echo "<tr><td>"; echo "<tr><td>";
$graph_width = get_db_sql ("SELECT width FROM tgraph WHERE id_graph = ".$id);
$graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$id);
if ($config['flash_charts']) { if ($config['flash_charts']) {
echo graphic_combined_module (explode (',', $modules), explode (',', $weights), $period, $width, $height, echo graphic_combined_module (explode (',', $modules), explode (',', $weights), $period, $graph_width, $graph_height,
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked); 'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked);
} else { } else {
echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=Combined%20Sample%20Graph&height=$height&width=$width&stacked=$stacked&period=$period' border=1 alt=''>"; echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=Combined%20Sample%20Graph&height=$height&width=$width&stacked=$stacked&period=$period' border=1 alt=''>";

View File

@ -1680,10 +1680,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
array_push ($weights, $content2["weight"]); array_push ($weights, $content2["weight"]);
} }
$graph_width = get_db_sql ("SELECT width FROM tgraph WHERE id_graph = ".$content["id_gs"]); // Increase the height to fix the leyend rise
$graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$content["id_gs"]); $sizgraph_h += count($modules) * 15;
$table->colspan[1][0] = 3; $table->colspan[1][0] = 3;
$data = array (); $data = array ();
$data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">'; $data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';

View File

@ -306,7 +306,7 @@ function getImageStatusElement($layoutData) {
break; break;
case 4: case 4:
//Critical (ALERT) //Critical (ALERT)
$img = "4".$img."_bad.png"; $img .= "_bad.png";
break; break;
case 0: case 0:
//Normal (OK) //Normal (OK)

View File

@ -48,88 +48,91 @@ if ($delete_graph) {
} }
if ($view_graph) { if ($view_graph) {
$sql="SELECT * FROM tgraph_source WHERE id_graph = $id";
$sources = get_db_all_rows_sql($sql);
$sql="SELECT * FROM tgraph WHERE id_graph = $id"; $sql="SELECT * FROM tgraph WHERE id_graph = $id";
$res=mysql_query($sql); $graph = get_db_row_sql($sql);
if ($graph = mysql_fetch_array($res)){
$id_user = $graph["id_user"]; $id_user = $graph["id_user"];
$private = $graph["private"]; $private = $graph["private"];
$width = $graph["width"]; $width = $graph["width"];
$height = $graph["height"]; $height = $graph["height"] + count($sources) * 10;
$zoom = (int) get_parameter ('zoom', 0); $zoom = (int) get_parameter ('zoom', 0);
if ($zoom > 0) { //Increase the height to fix the leyend rise
switch ($zoom) { if ($zoom > 0) {
case 1: switch ($zoom) {
$width = 500; case 1:
$height = 210; $width = 500;
break; $height = 200 + count($sources) * 15;
case 2: break;
$width = 650; case 2:
$height = 310; $width = 650;
break; $height = 300 + count($sources) * 10;
case 3: break;
$width = 770; case 3:
$height = 400; $width = 770;
break; $height = 400 + count($sources) * 5;
} break;
} }
$period = (int) get_parameter ('period');
if (! $period)
$period = $graph["period"];
else
$period = 3600 * $period;
$events = $graph["events"];
$description = $graph["description"];
$stacked = (int) get_parameter ('stacked', -1);
if ($stacked == -1)
$stacked = $graph["stacked"];
$name = $graph["name"];
if (($graph["private"]==1) && ($graph["id_user"] != $id_user)){
audit_db($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access to a custom graph not allowed");
include ("general/noaccess.php");
exit;
}
// Header
print_page_header (__('Reporting'). " &raquo; ". __('Combined image render'), "images/reporting.png", false, "", false, "" );
echo "<table class='databox_frame' cellpadding=0 cellspacing=0>";
echo "<tr><td>";
print_custom_graph ($id, $height, $width, $period, $stacked);
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=1&id=$id'>";
echo "<table class='databox_frame' cellpadding=4 cellspacing=4>";
echo "<tr><td class='datos'>";
echo "<b>".__('Period')."</b>";
echo "<td class='datos'>";
print_select (get_custom_graph_periods (), 'period', intval ($period / 3600),
'', '', 0, false, false, false);
echo "<td class='datos'>";
$stackeds = array ();
$stackeds[0] = __('Graph defined');
$stackeds[0] = __('Area');
$stackeds[1] = __('Stacked area');
$stackeds[2] = __('Line');
$stackeds[3] = __('Stacked line');
print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
echo "<td class='datos'>";
$zooms = array();
$zooms[0] = __('Graph defined');
$zooms[1] = __('Zoom x1');
$zooms[2] = __('Zoom x2');
$zooms[3] = __('Zoom x3');
print_select ($zooms, 'zoom', $zoom , '', '', 0);
echo "<td class='datos'>";
echo "<input type=submit value='".__('Update')."' class='sub upd'>";
echo "</table>";
echo "</form>";
return;
} }
$period = (int) get_parameter ('period');
if (! $period)
$period = $graph["period"];
else
$period = 3600 * $period;
$events = $graph["events"];
$description = $graph["description"];
$stacked = (int) get_parameter ('stacked', -1);
if ($stacked == -1)
$stacked = $graph["stacked"];
$name = $graph["name"];
if (($graph["private"]==1) && ($graph["id_user"] != $id_user)){
audit_db($config['id_user'],$_SERVER['REMOTE_ADDR'], "ACL Violation","Trying to access to a custom graph not allowed");
include ("general/noaccess.php");
exit;
}
// Header
print_page_header (__('Reporting'). " &raquo; ". __('Combined image render'), "images/reporting.png", false, "", false, "" );
echo "<table class='databox_frame' cellpadding=0 cellspacing=0>";
echo "<tr><td>";
print_custom_graph ($id, $height, $width, $period, $stacked);
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=1&id=$id'>";
echo "<table class='databox_frame' cellpadding=4 cellspacing=4>";
echo "<tr><td class='datos'>";
echo "<b>".__('Period')."</b>";
echo "<td class='datos'>";
print_select (get_custom_graph_periods (), 'period', intval ($period / 3600),
'', '', 0, false, false, false);
echo "<td class='datos'>";
$stackeds = array ();
$stackeds[0] = __('Graph defined');
$stackeds[0] = __('Area');
$stackeds[1] = __('Stacked area');
$stackeds[2] = __('Line');
$stackeds[3] = __('Stacked line');
print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
echo "<td class='datos'>";
$zooms = array();
$zooms[0] = __('Graph defined');
$zooms[1] = __('Zoom x1');
$zooms[2] = __('Zoom x2');
$zooms[3] = __('Zoom x3');
print_select ($zooms, 'zoom', $zoom , '', '', 0);
echo "<td class='datos'>";
echo "<input type=submit value='".__('Update')."' class='sub upd'>";
echo "</table>";
echo "</form>";
return;
} }
// Header // Header