From bef7daca713ceb3ef7d3cece1e2750417cef28b2 Mon Sep 17 00:00:00 2001 From: vgilc Date: Wed, 21 Dec 2011 17:14:41 +0000 Subject: [PATCH] 2011-12-21 Vanessa Gil * operation/netflow/nf_view.php godmode/netflow/nf_report_item.php godmode/netflow/nf_report.php: Allow repeat filters in reports. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5293 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++ .../godmode/netflow/nf_item_list.php | 2 +- pandora_console/godmode/netflow/nf_report.php | 6 +-- .../godmode/netflow/nf_report_item.php | 37 +++++++------------ pandora_console/include/functions_graph.php | 7 ++-- .../operation/netflow/nf_reporting.php | 3 ++ pandora_console/operation/netflow/nf_view.php | 11 +++--- 7 files changed, 34 insertions(+), 38 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 813ce9c5ea..c657d264fa 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-12-21 Vanessa Gil + * operation/netflow/nf_view.php + godmode/netflow/nf_report_item.php + godmode/netflow/nf_report.php: Allow repeat filters + in reports. + 2011-12-21 Vanessa Gil * godmode/netflow/nf_edit.php godmode/netflow/nf_edit_form.php diff --git a/pandora_console/godmode/netflow/nf_item_list.php b/pandora_console/godmode/netflow/nf_item_list.php index 39ffb657ec..22719425f9 100644 --- a/pandora_console/godmode/netflow/nf_item_list.php +++ b/pandora_console/godmode/netflow/nf_item_list.php @@ -98,7 +98,7 @@ $reports_item = db_get_all_rows_sql(' WHERE id_report = ' . $id); if ($reports_item === false) - $filter = array (); + $reports_item = array (); $table->width = '90%'; $table->head = array (); diff --git a/pandora_console/godmode/netflow/nf_report.php b/pandora_console/godmode/netflow/nf_report.php index 3394eb6674..fbf61acf5d 100644 --- a/pandora_console/godmode/netflow/nf_report.php +++ b/pandora_console/godmode/netflow/nf_report.php @@ -86,7 +86,7 @@ $filter['limit'] = (int) $config['block_size']; $reports = db_get_all_rows_filter ('tnetflow_report', $filter); if ($reports === false) - $filter = array (); + $reports = array(); $table->width = '80%'; $table->head = array (); @@ -148,10 +148,6 @@ echo '
-$(document).ready (function () { - $("textarea").TextAreaResizer (); -}); - function check_all_checkboxes() { if ($("input[name=all_delete]").attr('checked')) { $(".check_delete").attr('checked', true); diff --git a/pandora_console/godmode/netflow/nf_report_item.php b/pandora_console/godmode/netflow/nf_report_item.php index d388dfd9c9..c9bd38c38e 100644 --- a/pandora_console/godmode/netflow/nf_report_item.php +++ b/pandora_console/godmode/netflow/nf_report_item.php @@ -102,33 +102,22 @@ if ($create){ $timedate = $date .".".$time; $date_time = strtotime ($date." ".$time); - $sql1 = "select id_filter from tnetflow_report_content where id_report='".$id."'"; - $filters_aux = db_get_all_rows_sql($sql1); - $exist = false; - foreach($filters_aux as $filter_aux){ - if ($name_filter == $filter_aux['id_filter']){ - $exist = true; - echo '

'.__ ('Error creating item. Filter already exists.').'

'; - break; - } - } - if (!$exist){ - $values = array ( - 'id_report' => $id, - 'id_filter' => $name_filter, - 'date' => $date_time, - 'period' => $period, - 'max' => $max_val, - 'show_graph' => $show_graph + $values = array ( + 'id_report' => $id, + 'id_filter' => $name_filter, + 'date' => $date_time, + 'period' => $period, + 'max' => $max_val, + 'show_graph' => $show_graph ); - $result = db_process_sql_insert('tnetflow_report_content', $values); - + $result = db_process_sql_insert('tnetflow_report_content', $values); + if ($result === false) - echo '

'.__ ('Error creating item').'

'; - else - echo '

'.__ ('Item created successfully').'

'; + echo '

'.__ ('Error creating item').'

'; + else + echo '

'.__ ('Item created successfully').'

'; } -} + $table->width = '80%'; $table->border = 0; $table->cellspacing = 3; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index abc3270f29..a312d3c782 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2027,7 +2027,7 @@ echo"

Gráfica de área

"; $aggs[$data[$i]['agg']] = $data[$i]['agg']; } // Read data that falls in the current interval - while (isset ($data[$j])) { + while(isset ($data[$j])) { $ag = $data[$j]['agg']; $date = $data[$j]['date']; @@ -2056,7 +2056,9 @@ echo"

Gráfica de área

"; // Average if ($count > 0) { - $chart[$timestamp_short][$ag] = $chart[$timestamp_short][$ag]/$count; + if (isset($chart[$timestamp_short][$ag])){ + $chart[$timestamp_short][$ag] = $chart[$timestamp_short][$ag]/$count; + } } else { $chart[$timestamp_short][$ag] = 0; } @@ -2235,7 +2237,6 @@ function grafico_netflow_aggregate_pie ($data) { } $i++; } -html_debug_print($values); return pie3d_graph($config['flash_charts'], $values, 320, 200, __('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size']); diff --git a/pandora_console/operation/netflow/nf_reporting.php b/pandora_console/operation/netflow/nf_reporting.php index fa2a0cff2a..389af6be1a 100644 --- a/pandora_console/operation/netflow/nf_reporting.php +++ b/pandora_console/operation/netflow/nf_reporting.php @@ -39,6 +39,9 @@ $filter['offset'] = (int) get_parameter ('offset'); $filter['limit'] = (int) $config['block_size']; $reports = db_get_all_rows_filter ('tnetflow_report', $filter); +if ($reports == false){ + $reports = array(); +} $table->width = '98%'; $table->head = array (); diff --git a/pandora_console/operation/netflow/nf_view.php b/pandora_console/operation/netflow/nf_view.php index bf2ad4a01a..e488de9451 100644 --- a/pandora_console/operation/netflow/nf_view.php +++ b/pandora_console/operation/netflow/nf_view.php @@ -220,13 +220,14 @@ echo'
'; if ($id!=''){ echo"

$report_name

"; - $sql1 = "select id_filter from tnetflow_report_content where id_report='".$id."'"; - $all_filters = db_get_all_rows_sql($sql1); + + $sql1 = "select id_rc from tnetflow_report_content where id_report='".$id."'"; + $all_rcs = db_get_all_rows_sql($sql1); $x = 0; - while(isset($all_filters[$x]['id_filter'])) { - $filter = $all_filters[$x]['id_filter']; - $sql = "SELECT * FROM tnetflow_report_content WHERE id_report='".$id."' and id_filter='".$filter."'"; + while(isset($all_rcs[$x]['id_rc'])) { + $rc = $all_rcs[$x]['id_rc']; + $sql = "SELECT * FROM tnetflow_report_content WHERE id_rc='".$rc."'"; $content_report = db_get_row_sql($sql); $name_filter = $content_report['id_filter'];