2012-10-26 Ramon Novoa <rnovoa@artica.es>

* 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
This commit is contained in:
Ramon Novoa 2012-10-26 09:48:32 +00:00
parent 6a3d7c1c11
commit 4c16ac1d13
5 changed files with 54 additions and 18 deletions

View File

@ -1,3 +1,12 @@
2012-10-26 Ramon Novoa <rnovoa@artica.es>
* 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 <rnovoa@artica.es> 2012-10-25 Ramon Novoa <rnovoa@artica.es>
* include/functions_reporting.php, * include/functions_reporting.php,

View File

@ -370,13 +370,7 @@ switch ($action) {
break; break;
} }
// Build link for sort actions: metaconsole and normal console $urlForm = $config['homeurl'] . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
$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;
echo '<form action="' . $urlForm . '" method="post">'; echo '<form action="' . $urlForm . '" method="post">';
html_print_input_hidden('id_item', $idItem); html_print_input_hidden('id_item', $idItem);
@ -1866,6 +1860,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_max_values").show(); $("#row_max_values").show();
$("#row_resolution").show(); $("#row_resolution").show();
$("#row_servers").show();
break; break;
case 'netflow_pie': case 'netflow_pie':
$("#row_netflow_filter").show(); $("#row_netflow_filter").show();
@ -1873,6 +1868,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_max_values").show(); $("#row_max_values").show();
$("#row_resolution").show(); $("#row_resolution").show();
$("#row_servers").show();
break; break;
case 'netflow_data': case 'netflow_data':
$("#row_netflow_filter").show(); $("#row_netflow_filter").show();
@ -1880,6 +1876,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_max_values").show(); $("#row_max_values").show();
$("#row_resolution").show(); $("#row_resolution").show();
$("#row_servers").show();
break; break;
case 'netflow_summary': case 'netflow_summary':
$("#row_netflow_filter").show(); $("#row_netflow_filter").show();
@ -1887,6 +1884,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_max_values").show(); $("#row_max_values").show();
$("#row_resolution").show(); $("#row_resolution").show();
$("#row_servers").show();
break; break;
case 'netflow_statistics': case 'netflow_statistics':
$("#row_netflow_filter").show(); $("#row_netflow_filter").show();
@ -1894,6 +1892,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_max_values").show(); $("#row_max_values").show();
$("#row_resolution").show(); $("#row_resolution").show();
$("#row_servers").show();
break; break;
} }
} }

View File

@ -392,7 +392,7 @@ switch ($action) {
$data = array (); $data = array ();
if (check_acl ($config["id_user"], $report["id_group"], "AW")) { if (check_acl ($config["id_user"], $report["id_group"], "AW")) {
$data[0] = '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&action=edit&id_report='. $data[0] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&action=edit&id_report='.
$report['id_report'].'">'.$report['name'].'</a>'; $report['id_report'].'">'.$report['name'].'</a>';
} }
else { else {
@ -402,9 +402,9 @@ switch ($action) {
$data[1] = $report['description']; $data[1] = $report['description'];
$data[2] = '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/operation/reporting/reporting_viewer&id='.$report['id_report'].'">' . $data[2] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/operation/reporting/reporting_viewer&id='.$report['id_report'].'">' .
html_print_image("images/reporting.png", true) . '</a>'; html_print_image("images/reporting.png", true) . '</a>';
$data[3] = '<a href="'. ui_get_full_url(false) . '/ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway $data[3] = '<a href="'. ui_get_full_url(false, false, false, false) . 'ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
//Calculate dinamically the number of the column //Calculate dinamically the number of the column

View File

@ -2117,8 +2117,19 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$sizgraph_h = '230'; $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']; $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); $connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) { if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name); //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; $sla_showed_values[] = $sla_value;
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) { if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
//Restore db connection if ($content['type'] != 'netflow_area' &&
metaconsole_restore_db(); $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->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; break;
} }
//Restore dbconnection //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(); metaconsole_restore_db_force();
} }
} }

View File

@ -341,7 +341,18 @@ foreach ($contents as $content) {
// Support for metaconsole // Support for metaconsole
$server_name = $content ['server_name']; $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); $connection = metaconsole_get_connection($server_name);
if (metaconsole_connect($connection) != NOERR){ if (metaconsole_connect($connection) != NOERR){
//ui_print_error_message ("Error connecting to ".$server_name); //ui_print_error_message ("Error connecting to ".$server_name);
@ -1535,7 +1546,7 @@ foreach ($contents as $content) {
$data["title"] = $description . ' (' . __($filter['output']) . ')'; $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'; $buffer_file["objdata"] = $config['attachment_store'] . '/netflow_' . $time.'_'.$content['id_rc'] . '.tmp';
break; break;
} }
@ -1544,7 +1555,7 @@ foreach ($contents as $content) {
echo '</object>'; echo '</object>';
$counter++; $counter++;
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) { if (($config ['metaconsole'] == 1) && defined('METACONSOLE') && $remote_connection == 1) {
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();
} }