From 7c640c5032c0c520aced40a8381156340dac7d0d Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 7 Oct 2010 09:27:38 +0000 Subject: [PATCH] 2010-10-07 Sergio Martin * 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 --- pandora_console/ChangeLog | 9 + .../reporting/graph_builder.preview.php | 6 +- .../include/functions_reporting.php | 7 +- .../include/functions_visual_map.php | 2 +- .../operation/reporting/graph_viewer.php | 161 +++++++++--------- 5 files changed, 100 insertions(+), 85 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 429cb7c96d..2ee3f17aa8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2010-10-07 Sergio Martin + + * 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 * include/fgraph.php: Fixed crash when try to render diff --git a/pandora_console/godmode/reporting/graph_builder.preview.php b/pandora_console/godmode/reporting/graph_builder.preview.php index 50565d180f..df14b76a6c 100644 --- a/pandora_console/godmode/reporting/graph_builder.preview.php +++ b/pandora_console/godmode/reporting/graph_builder.preview.php @@ -92,8 +92,12 @@ $weights = implode(',', $weight_array); echo ""; echo "
"; + + $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']) { - 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); } else { echo ""; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 87d2593340..a97ba1853e 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1680,10 +1680,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) { array_push ($weights, $content2["weight"]); } - $graph_width = get_db_sql ("SELECT width FROM tgraph WHERE id_graph = ".$content["id_gs"]); - $graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$content["id_gs"]); - - + // Increase the height to fix the leyend rise + $sizgraph_h += count($modules) * 15; + $table->colspan[1][0] = 3; $data = array (); $data[0] = ''; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index cfaa2b72ee..d30640821d 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -306,7 +306,7 @@ function getImageStatusElement($layoutData) { break; case 4: //Critical (ALERT) - $img = "4".$img."_bad.png"; + $img .= "_bad.png"; break; case 0: //Normal (OK) diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index 66d63529ce..1d1a47313f 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -48,88 +48,91 @@ if ($delete_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"; - $res=mysql_query($sql); - if ($graph = mysql_fetch_array($res)){ - $id_user = $graph["id_user"]; - $private = $graph["private"]; - $width = $graph["width"]; - $height = $graph["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; - } + $graph = get_db_row_sql($sql); + + $id_user = $graph["id_user"]; + $private = $graph["private"]; + $width = $graph["width"]; + $height = $graph["height"] + count($sources) * 10; + $zoom = (int) get_parameter ('zoom', 0); + //Increase the height to fix the leyend rise + if ($zoom > 0) { + switch ($zoom) { + case 1: + $width = 500; + $height = 200 + count($sources) * 15; + break; + case 2: + $width = 650; + $height = 300 + count($sources) * 10; + break; + case 3: + $width = 770; + $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'). " » ". __('Combined image render'), "images/reporting.png", false, "", false, "" ); - - echo ""; - echo "
"; - print_custom_graph ($id, $height, $width, $period, $stacked); - echo "
"; - $period_label = human_time_description ($period); - echo "
"; - echo ""; - echo "
"; - echo "".__('Period').""; - echo ""; - - print_select (get_custom_graph_periods (), 'period', intval ($period / 3600), - '', '', 0, false, false, false); - - echo ""; - $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 ""; - $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 ""; - echo ""; - echo "
"; - echo "
"; - 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'). " » ". __('Combined image render'), "images/reporting.png", false, "", false, "" ); + + echo ""; + echo "
"; + print_custom_graph ($id, $height, $width, $period, $stacked); + echo "
"; + $period_label = human_time_description ($period); + echo "
"; + echo ""; + echo "
"; + echo "".__('Period').""; + echo ""; + + print_select (get_custom_graph_periods (), 'period', intval ($period / 3600), + '', '', 0, false, false, false); + + echo ""; + $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 ""; + $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 ""; + echo ""; + echo "
"; + echo "
"; + return; } // Header