From 4c16ac1d1343df60f285723a77a37a47c7979856 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 26 Oct 2012 09:48:32 +0000 Subject: [PATCH] 2012-10-26 Ramon Novoa * include/functions_reporting.php, operation/reporting/reporting_xml.php, godmode/reporting/reporting_builder.php, godmode/reporting/reporting_builder.item_editor.php: Integrated XML and PDF netflow reports into custom reports. Fixed some broken links. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7098 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++ .../reporting_builder.item_editor.php | 13 +++++---- .../godmode/reporting/reporting_builder.php | 6 ++--- .../include/functions_reporting.php | 27 +++++++++++++++---- .../operation/reporting/reporting_xml.php | 17 +++++++++--- 5 files changed, 54 insertions(+), 18 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d9105c7c00..38ae88b71b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2012-10-26 Ramon Novoa + + * include/functions_reporting.php, + operation/reporting/reporting_xml.php, + godmode/reporting/reporting_builder.php, + godmode/reporting/reporting_builder.item_editor.php: Integrated + XML and PDF netflow reports into custom reports. Fixed some broken + links. + 2012-10-25 Ramon Novoa * include/functions_reporting.php, diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index e3fc6f5723..50627bdb52 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -370,13 +370,7 @@ switch ($action) { break; } -// Build link for sort actions: metaconsole and normal console -$variable_link = ui_get_full_url(false); -// Metaconsole -if ($config['metaconsole'] == 1 and defined('METACONSOLE')) - $variable_link .= '/enterprise/meta/'; - -$urlForm = $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport; +$urlForm = $config['homeurl'] . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport; echo '
'; html_print_input_hidden('id_item', $idItem); @@ -1866,6 +1860,7 @@ function chooseType() { $("#row_period").show(); $("#row_max_values").show(); $("#row_resolution").show(); + $("#row_servers").show(); break; case 'netflow_pie': $("#row_netflow_filter").show(); @@ -1873,6 +1868,7 @@ function chooseType() { $("#row_period").show(); $("#row_max_values").show(); $("#row_resolution").show(); + $("#row_servers").show(); break; case 'netflow_data': $("#row_netflow_filter").show(); @@ -1880,6 +1876,7 @@ function chooseType() { $("#row_period").show(); $("#row_max_values").show(); $("#row_resolution").show(); + $("#row_servers").show(); break; case 'netflow_summary': $("#row_netflow_filter").show(); @@ -1887,6 +1884,7 @@ function chooseType() { $("#row_period").show(); $("#row_max_values").show(); $("#row_resolution").show(); + $("#row_servers").show(); break; case 'netflow_statistics': $("#row_netflow_filter").show(); @@ -1894,6 +1892,7 @@ function chooseType() { $("#row_period").show(); $("#row_max_values").show(); $("#row_resolution").show(); + $("#row_servers").show(); break; } } diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 0663b1a8f0..e691f3b8f9 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -392,7 +392,7 @@ switch ($action) { $data = array (); if (check_acl ($config["id_user"], $report["id_group"], "AW")) { - $data[0] = ''.$report['name'].''; } else { @@ -402,9 +402,9 @@ switch ($action) { $data[1] = $report['description']; - $data[2] = '' . + $data[2] = '' . html_print_image("images/reporting.png", true) . ''; - $data[3] = '' . html_print_image("images/database_lightning.png", true) . ''; //I chose ajax.php because it's supposed to give XML anyway + $data[3] = '' . html_print_image("images/database_lightning.png", true) . ''; //I chose ajax.php because it's supposed to give XML anyway //Calculate dinamically the number of the column diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 2435a50bfa..28f3562317 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2116,9 +2116,20 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $sizgraph_w = '750'; $sizgraph_h = '230'; } + + // Disable remote connections for netflow report items + if ($content['type'] != 'netflow_area' && + $content['type'] != 'netflow_pie' && + $content['type'] != 'netflow_data' && + $content['type'] != 'netflow_statistics' && + $content['type'] != 'netflow_summary') { + $remote_connection = 1; + } else { + $remote_connection = 0; + } $server_name = $content ['server_name']; - if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { + if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE') && $remote_connection == 1) { $connection = metaconsole_get_connection($server_name); if (metaconsole_load_external_db($connection) != NOERR) { //ui_print_error_message ("Error connecting to ".$server_name); @@ -2432,8 +2443,14 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $sla_showed_values[] = $sla_value; if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) { - //Restore db connection - metaconsole_restore_db(); + if ($content['type'] != 'netflow_area' && + $content['type'] != 'netflow_pie' && + $content['type'] != 'netflow_data' && + $content['type'] != 'netflow_statistics' && + $content['type'] != 'netflow_summary') { + //Restore db connection + metaconsole_restore_db(); + } } } @@ -4781,11 +4798,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f } $table->colspan[1][0] = 4; - $table->data[1][0] = netflow_draw_item ($start_date, $end_date, $resolution, $type, $filter, $max_aggregates, $unique_id, '', 'HTML'); + $table->data[1][0] = netflow_draw_item ($start_date, $end_date, $resolution, $type, $filter, $max_aggregates, $unique_id, $server_name, 'HTML'); break; } //Restore dbconnection - if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { + if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE') && $remote_connection == 1) { metaconsole_restore_db_force(); } } diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 31d34ed252..48865411ec 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -341,7 +341,18 @@ foreach ($contents as $content) { // Support for metaconsole $server_name = $content ['server_name']; - if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) { + // Disable remote connections for netflow report items + if ($content['type'] != 'netflow_area' && + $content['type'] != 'netflow_pie' && + $content['type'] != 'netflow_data' && + $content['type'] != 'netflow_statistics' && + $content['type'] != 'netflow_summary') { + $remote_connection = 1; + } else { + $remote_connection = 0; + } + + if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE') && $remote_connection == 1) { $connection = metaconsole_get_connection($server_name); if (metaconsole_connect($connection) != NOERR){ //ui_print_error_message ("Error connecting to ".$server_name); @@ -1535,7 +1546,7 @@ foreach ($contents as $content) { $data["title"] = $description . ' (' . __($filter['output']) . ')'; } - $data["objdata"]["netflow"] = netflow_draw_item ($start_date, $end_date, $resolution, $type, $filter, $max_aggregates, $unique_id, '', 'XML'); + $data["objdata"]["netflow"] = netflow_draw_item ($start_date, $end_date, $resolution, $type, $filter, $max_aggregates, $unique_id, $server_name, 'XML'); $buffer_file["objdata"] = $config['attachment_store'] . '/netflow_' . $time.'_'.$content['id_rc'] . '.tmp'; break; } @@ -1544,7 +1555,7 @@ foreach ($contents as $content) { echo ''; $counter++; - if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) { + if (($config ['metaconsole'] == 1) && defined('METACONSOLE') && $remote_connection == 1) { //Restore db connection metaconsole_restore_db(); }