2012-01-23 Ramon Novoa <rnovoa@artica.es>
* operation/menu.php, operation/netflow/nf_live_view.php, godmode/netflow/nf_edit_form.php, godmode/netflow/nf_item_list.php, godmode/netflow/nf_report_item.php, godmode/netflow/nf_report_form.php, godmode/netflow/nf_edit.php: Multiple improvements to netflow live view and report and filter edition. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5407 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7ea01805e4
commit
9faeefd0a4
|
@ -1,3 +1,14 @@
|
|||
2012-01-23 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* operation/menu.php,
|
||||
operation/netflow/nf_live_view.php,
|
||||
godmode/netflow/nf_edit_form.php,
|
||||
godmode/netflow/nf_item_list.php,
|
||||
godmode/netflow/nf_report_item.php,
|
||||
godmode/netflow/nf_report_form.php,
|
||||
godmode/netflow/nf_edit.php: Multiple improvements to netflow live
|
||||
view and report and filter edition.
|
||||
|
||||
2012-01-23 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_agents.php: Removed Php warning in function
|
||||
|
|
|
@ -91,13 +91,7 @@ if ($multiple_delete) {
|
|||
$own_info = get_user_info ($config['id_user']);
|
||||
// Get group list that user has access
|
||||
$groups_user = users_get_groups ($config['id_user'], "AW", $own_info['is_admin'], true);
|
||||
|
||||
$groups_id = array();
|
||||
foreach($groups_user as $key => $groups){
|
||||
$groups_id[] = $groups['id_grupo'];
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',',$groups_id).")";
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',', array_keys ($groups_user)).")";
|
||||
$filters = db_get_all_rows_sql($sql);
|
||||
if ($filters === false)
|
||||
$filters = array ();
|
||||
|
|
|
@ -123,26 +123,24 @@ if ($create){
|
|||
$src_port = get_parameter('src_port','');
|
||||
$advanced_filter = (string) get_parameter('advanced_filter', '');
|
||||
|
||||
if($name == db_get_value('id_name', 'tnetflow_filter', 'id_name', $name)){
|
||||
$result = false;
|
||||
} else {
|
||||
$values = array (
|
||||
'id_name'=>$name,
|
||||
'id_group' => $assign_group,
|
||||
'ip_dst'=>$ip_dst,
|
||||
'ip_src'=>$ip_src,
|
||||
'dst_port'=>$dst_port,
|
||||
'src_port'=>$src_port,
|
||||
'aggregate'=>$aggregate,
|
||||
'advanced_filter'=>$advanced_filter,
|
||||
'output'=>$output
|
||||
);
|
||||
$result = db_process_sql_insert('tnetflow_filter', $values);
|
||||
}
|
||||
if ($result === false)
|
||||
echo '<h3 class="error">'.__ ('Error creating filter').'</h3>';
|
||||
else
|
||||
echo '<h3 class="suc">'.__ ('filter created successfully').'</h3>';
|
||||
$values = array (
|
||||
'id_name'=>$name,
|
||||
'id_group' => $assign_group,
|
||||
'ip_dst'=>$ip_dst,
|
||||
'ip_src'=>$ip_src,
|
||||
'dst_port'=>$dst_port,
|
||||
'src_port'=>$src_port,
|
||||
'aggregate'=>$aggregate,
|
||||
'advanced_filter'=>$advanced_filter,
|
||||
'output'=>$output
|
||||
);
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_filter', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating filter');
|
||||
} else {
|
||||
ui_print_success_message ('Filter created successfully');
|
||||
}
|
||||
}
|
||||
|
||||
$table->width = '80%';
|
||||
|
|
|
@ -31,13 +31,24 @@ if (! check_acl ($config["id_user"], 0, "IW")) {
|
|||
return;
|
||||
}
|
||||
|
||||
$buttons['list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
$buttons['report_list']['active'] = false;
|
||||
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['report_items']['active'] = true;
|
||||
$buttons['report_items']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$id.'">'
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Report items')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['edit_report']['active'] = false;
|
||||
$buttons['edit_report']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_form&id='.$id.'">'
|
||||
. html_print_image ("images/config.png", true, array ("title" => __('Edit report')))
|
||||
. '</a>';
|
||||
|
||||
//Header
|
||||
ui_print_page_header (__('Item list'), "images/god6.png", false, "", true, $buttons);
|
||||
|
||||
ui_print_page_header (__('Report items'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
$delete = (bool) get_parameter ('delete');
|
||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
||||
$order = get_parameter('order');
|
||||
|
@ -121,27 +132,25 @@ if ($reports_item === false)
|
|||
|
||||
$table->width = '98%';
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Sort');
|
||||
$table->head[1] = __('Id item');
|
||||
$table->head[2] = __('Filter');
|
||||
$table->head[3] = __('Max values');
|
||||
$table->head[4] = __('Item');
|
||||
$table->head[5] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
$table->head[0] = __('Order');
|
||||
$table->head[1] = __('Filter');
|
||||
$table->head[2] = __('Max. values');
|
||||
$table->head[3] = __('Chart type');
|
||||
$table->head[3] = __('Chart type');
|
||||
$table->head[4] = __('Action') . html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
|
||||
$table->style = array ();
|
||||
$table->style[1] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
$table->align[1] = 'center';
|
||||
$table->align[1] = 'left';
|
||||
$table->align[2] = 'center';
|
||||
$table->align[3] = 'center';
|
||||
$table->align[5] = 'right';
|
||||
$table->align[4] = 'right';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '10%';
|
||||
$table->size[2] = '50%';
|
||||
$table->size[3] = '10%';
|
||||
$table->size[4] = '20%';
|
||||
$table->size[5] = '20px';
|
||||
$table->size[2] = '5%';
|
||||
$table->size[3] = '15%';
|
||||
$table->size[4] = '60px';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
|
@ -177,29 +186,27 @@ $last_item = $item_max['id_rc'];
|
|||
$data[0] .= '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$item['id_report'].'&order=1&dir=down&id_rc='.$item['id_rc'].'">' . html_print_image("images/down.png", true, array("title" => __('Move to down'))) . '</a>';
|
||||
}
|
||||
|
||||
$data[1] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_item&id='.$item['id_report'].'&id_rc='.$item['id_rc'].'">'.$item['id_rc'].'</a>';
|
||||
$name_filter = db_get_value('id_name', 'tnetflow_filter', 'id_sg', $item['id_filter']);
|
||||
$data[1] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_item&id='.$item['id_report'].'&id_rc='.$item['id_rc'].'">'.$name_filter.'</a>';
|
||||
|
||||
$data[2] = $name_filter;
|
||||
|
||||
$data[3] = $item['max'];
|
||||
$data[2] = $item['max'];
|
||||
|
||||
switch ($item['show_graph']) {
|
||||
case 0:
|
||||
$data[4] = 'Area graph';
|
||||
$data[3] = 'Area graph';
|
||||
break;
|
||||
case 1:
|
||||
$data[4] = 'Pie graph';
|
||||
$data[3] = 'Pie graph';
|
||||
break;
|
||||
case 2:
|
||||
$data[4] = 'Data table';
|
||||
$data[3] = 'Data table';
|
||||
break;
|
||||
case 3:
|
||||
$data[4] = 'Statistics table';
|
||||
$data[3] = 'Statistics table';
|
||||
break;
|
||||
}
|
||||
|
||||
$data[5] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
|
||||
$data[4] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
|
||||
href='index.php?sec=netf&sec2=godmode/netflow/nf_item_list&delete=1&id_rc=".$item['id_rc']."&id=".$id."&offset=0'>" .
|
||||
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
|
||||
html_print_checkbox_extended ('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true);
|
||||
|
|
|
@ -34,6 +34,24 @@ $id = (int)get_parameter('id');
|
|||
$update = (string)get_parameter('update', 0);
|
||||
$create = (string)get_parameter('create', 0);
|
||||
|
||||
$buttons['report_list']['active'] = false;
|
||||
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['report_items']['active'] = false;
|
||||
$buttons['report_items']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$id.'">'
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Report items')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['edit_report']['active'] = true;
|
||||
$buttons['edit_report']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_form&id='.$id.'">'
|
||||
. html_print_image ("images/config.png", true, array ("title" => __('Edit report')))
|
||||
. '</a>';
|
||||
|
||||
//Header
|
||||
ui_print_page_header (__('Netflow Report'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
if ($id) {
|
||||
$permission = netflow_check_report_group ($id, false);
|
||||
if (!$permission) { //no tiene permisos para acceder a un informe
|
||||
|
@ -70,7 +88,8 @@ if ($update) {
|
|||
'description' => $description,
|
||||
),
|
||||
array ('id_report' => $id));
|
||||
}
|
||||
ui_print_result_message ($result, __('Report updated successfully'), __('Error updating report'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($create){
|
||||
|
@ -78,45 +97,19 @@ if ($create){
|
|||
$group = (int) get_parameter ('id_group');
|
||||
$description = get_parameter('description','');
|
||||
|
||||
if($name == db_get_value('id_name', 'tnetflow_report', 'id_name', $name)){
|
||||
$result = false;
|
||||
} else {
|
||||
$values = array (
|
||||
'id_name' => $name,
|
||||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
);
|
||||
$result = db_process_sql_insert('tnetflow_report', $values);
|
||||
}
|
||||
$id= db_get_value('id_report', 'tnetflow_report', 'id_name', $name);
|
||||
$values = array (
|
||||
'id_name' => $name,
|
||||
'id_group' => $group,
|
||||
'description' => $description,
|
||||
);
|
||||
$id = db_process_sql_insert('tnetflow_report', $values);
|
||||
if ($id === false) {
|
||||
ui_print_error_message ('Error creating report');
|
||||
} else {
|
||||
ui_print_success_message ('Report created successfully');
|
||||
}
|
||||
}
|
||||
|
||||
$buttons['view'] = '<a href="index.php?sec=netf&sec2=operation/netflow/nf_view&id='.$id.'">'
|
||||
. html_print_image ("images/lupa.png", true, array ("title" => __('View data')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['list_items'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$id.'">'
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Items list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['item'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_item&id='.$id.'">'
|
||||
. html_print_image ("images/config.png", true, array ("title" => __('Item editor')))
|
||||
. '</a>';
|
||||
|
||||
//Header
|
||||
ui_print_page_header (__('Netflow Report'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
if ($create || $update){
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully!'),
|
||||
__('Error!'));
|
||||
}
|
||||
|
||||
|
||||
$table->width = '80%';
|
||||
$table->border = 0;
|
||||
$table->cellspacing = 3;
|
||||
|
|
|
@ -36,16 +36,23 @@ $id_rc = (int)get_parameter('id_rc');
|
|||
$update = (string)get_parameter('update', 0);
|
||||
$create = (string)get_parameter('create', 0);
|
||||
|
||||
$buttons['list_items'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$id.'">'
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Item list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
$buttons['report_list']['active'] = false;
|
||||
$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report">'
|
||||
. html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['report_items']['active'] = true;
|
||||
$buttons['report_items']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_item_list&id='.$id.'">'
|
||||
. html_print_image ("images/god6.png", true, array ("title" => __('Report items')))
|
||||
. '</a>';
|
||||
|
||||
$buttons['edit_report']['active'] = false;
|
||||
$buttons['edit_report']['text'] = '<a href="index.php?sec=netf&sec2=godmode/netflow/nf_report_form&id='.$id.'">'
|
||||
. html_print_image ("images/config.png", true, array ("title" => __('Edit report')))
|
||||
. '</a>';
|
||||
|
||||
//Header
|
||||
ui_print_page_header (__('Netflow Report'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
ui_print_page_header (__('Report item editor'), "images/networkmap/so_cisco_new.png", false, "", true, $buttons);
|
||||
|
||||
if ($id_rc) {
|
||||
$item = netflow_reports_get_content ($id_rc);
|
||||
|
@ -95,22 +102,21 @@ if ($create){
|
|||
} else {
|
||||
$order++;
|
||||
}
|
||||
//
|
||||
|
||||
$values = array (
|
||||
'id_report' => $id,
|
||||
'id_filter' => $id_filter,
|
||||
'max' => $max_val,
|
||||
'show_graph' => $show_graph,
|
||||
'`order`' => $order
|
||||
);
|
||||
$result = db_process_sql_insert('tnetflow_report_content', $values);
|
||||
|
||||
if ($result === false)
|
||||
echo '<h3 class="error">'.__ ('Error creating item').'</h3>';
|
||||
else
|
||||
echo '<h3 class="suc">'.__ ('Item created successfully').'</h3>';
|
||||
'id_report' => $id,
|
||||
'id_filter' => $id_filter,
|
||||
'max' => $max_val,
|
||||
'show_graph' => $show_graph,
|
||||
'`order`' => $order
|
||||
);
|
||||
$id_rc = db_process_sql_insert('tnetflow_report_content', $values);
|
||||
if ($id_rc === false) {
|
||||
echo '<h3 class="error">'.__ ('Error creating item').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="suc">'.__ ('Item created successfully').'</h3>';
|
||||
}
|
||||
}
|
||||
|
||||
$table->width = '70%';
|
||||
$table->border = 0;
|
||||
|
@ -136,10 +142,10 @@ foreach($groups_user as $key => $groups){
|
|||
}
|
||||
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',',$groups_id).")";
|
||||
$table->data[0][0] = '<b>'.__('Filters').'</b>';
|
||||
$table->data[0][0] = '<b>'.__('Filter').'</b>';
|
||||
$table->data[0][1] = html_print_select_from_sql($sql, 'id_filter', $name_filter, '', '', 0, true);
|
||||
|
||||
$table->data[1][0] = '<b>'.__('Max values aggregated').'</b>';
|
||||
$table->data[1][0] = '<b>'.__('Max. values').'</b>';
|
||||
$max_values = array ('2' => '2',
|
||||
'5' => '5',
|
||||
'10' => '10',
|
||||
|
@ -150,7 +156,8 @@ $table->data[1][0] = '<b>'.__('Max values aggregated').'</b>';
|
|||
);
|
||||
$table->data[1][1] = html_print_select ($max_values, 'max', $max_val, '', '', 0, true);
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Elements').'</b>';
|
||||
$table->data[2][0] = '<b>'.__('Chart type').'</b>';
|
||||
$table->data[2][1] = html_print_select (netflow_get_chart_types (), 'show_graph', $show_graph,'','',0,true);
|
||||
$table->data[2][1] = html_print_select (netflow_get_chart_types (), 'show_graph', $show_graph,'','',0,true);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=netf&sec2=godmode/netflow/nf_report_item&id='.$id.'">';
|
||||
|
|
|
@ -263,10 +263,10 @@ $menu["usuarios"]["id"] = "oper-users";
|
|||
if (check_acl ($config['id_user'], 0, "IR")) {
|
||||
if ($config['activate_netflow']) {
|
||||
$menu["netf"]["text"] = __('Netflow');
|
||||
$menu["netf"]["sec2"] = "operation/netflow/nf_live_view";
|
||||
$menu["netf"]["sec2"] = "operation/netflow/nf_reporting";
|
||||
$menu["netf"]["id"] = "oper-netflow";
|
||||
$sub = array ();
|
||||
$sub["operation/netflow/nf_reporting"]["text"] = __('Reports');
|
||||
$sub["operation/netflow/nf_live_view"]["text"] = __('Live view');
|
||||
$menu["netf"]["sub"] = $sub;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ if (! check_acl ($config["id_user"], 0, "AR")) {
|
|||
}
|
||||
|
||||
// Read filter configuration
|
||||
$filter_id = (int) get_parameter ('filter_id', 0);
|
||||
$filter['id_name'] = (string) get_parameter ('name', '');
|
||||
$filter['id_group'] = (int) get_parameter ('assign_group', 0);
|
||||
$filter['aggregate'] = get_parameter('aggregate','');
|
||||
|
@ -53,18 +54,47 @@ $time = get_parameter_post ('time', date ("H:i:s", get_system_time ()));
|
|||
|
||||
// Read buttons
|
||||
$draw = get_parameter('draw_button', '');
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
$load = get_parameter('load_button', '');
|
||||
|
||||
// Calculate start and end dates
|
||||
$end_date = strtotime ($date . " " . $time);
|
||||
$start_date = $end_date - $period;
|
||||
|
||||
$buttons = array ();
|
||||
//$buttons['report_list'] = '<a href="index.php?sec=netf&sec2=operation/netflow/nf_reporting">'
|
||||
// . html_print_image ("images/edit.png", true, array ("title" => __('Report list')))
|
||||
// . '</a>';
|
||||
|
||||
//Header
|
||||
ui_print_page_header (__('Netflow live view'), "images/networkmap/so_cisco_new.png", false, "", false, $buttons);
|
||||
ui_print_page_header (__('Netflow live view'), "images/networkmap/so_cisco_new.png", false, "", false, array ());
|
||||
|
||||
// Save user defined filter
|
||||
if ($save != '') {
|
||||
$filter_id = db_process_sql_insert ('tnetflow_filter', $filter);
|
||||
if ($filter_id === false) {
|
||||
$filter_id = 0;
|
||||
echo '<h3 class="error">'.__ ('Error creating filter').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="suc">'.__ ('Filter created successfully').'</h3>';
|
||||
}
|
||||
}
|
||||
// Update current filter
|
||||
else if ($update != '' && $filter_id > 0) {
|
||||
// Do not update the filter name and group
|
||||
$filter_copy = $filter;
|
||||
unset ($filter_copy['id_name']);
|
||||
unset ($filter_copy['id_group']);
|
||||
|
||||
$result = db_process_sql_update ('tnetflow_filter', $filter_copy, array ('id_sg' => $filter_id));
|
||||
ui_print_result_message ($result, __('Filter updated successfully'), __('Error updating filter'));
|
||||
}
|
||||
// Load an existing filter
|
||||
else if ($load != '' && $filter_id > 0) {
|
||||
$result = db_get_row_sql ("SELECT * FROM tnetflow_filter WHERE id_sg = $filter_id");
|
||||
if ($result !== false) {
|
||||
$filter = $result;
|
||||
}
|
||||
}
|
||||
|
||||
// The filter name will not be needed anymore
|
||||
$filter['id_name'] = '';
|
||||
|
||||
echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_live_view">';
|
||||
|
||||
|
@ -92,16 +122,11 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
'25' => '25',
|
||||
'50' => '50'
|
||||
);
|
||||
$table->data[0][4] = '<b>'.__('Max.').'</b>';
|
||||
$table->data[0][6] = '<b>'.__('Max. values').'</b>';
|
||||
$table->data[0][7] = html_print_select ($max_values, 'max_aggregates', $max_aggregates, '', '', 0, true);
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
// echo '<div class="action-buttons" style="width:60%;">';
|
||||
// html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||
// html_print_input_hidden ('update_date', 1);
|
||||
// echo '</div>';
|
||||
|
||||
// Filter options table
|
||||
$table->width = '100%';
|
||||
$table->border = 0;
|
||||
|
@ -110,60 +135,69 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_l
|
|||
$table->size[0] = '15%';
|
||||
$table->data = array ();
|
||||
|
||||
// $table->data[0][0] = '<b>'.__('Name').'</b>';
|
||||
// $table->data[0][1] = html_print_input_text ('name', $filter['id_name'], false, 20, 80, true);
|
||||
//
|
||||
// $own_info = get_user_info ($config['id_user']);
|
||||
// $table->data[1][0] = '<b>'.__('Group').'</b>';
|
||||
// $table->data[1][1] = html_print_select_groups($config['id_user'], "IW",
|
||||
// $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true,
|
||||
// false, false);
|
||||
|
||||
$table->data[0][0] = ui_print_error_message ('Define a name for the filter and click on Save as new filter again', '', true);
|
||||
$table->colspan[0][0] = 4;
|
||||
|
||||
$table->data[1][0] = '<b>'.__('Name').'</b>';
|
||||
$table->data[1][1] = html_print_input_text ('name', $filter['id_name'], false, 20, 80, true);
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
$table->data[1][2] = '<b>'.__('Group').'</b>';
|
||||
$table->data[1][3] = html_print_select_groups($config['id_user'], "IW", $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false);
|
||||
|
||||
// Read filter type
|
||||
if ($filter['advanced_filter'] != '') {
|
||||
$filter_type = 1;
|
||||
} else {
|
||||
$filter_type = 0;
|
||||
}
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Filter:').'</b>';
|
||||
$table->data[0][1] = __('Normal') . ' ' . html_print_radio_button_extended ('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[0][2] = __('Advanced') . ' ' . html_print_radio_button_extended ('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][0] = '<b>'.__('Filter').'</b>';
|
||||
$table->data[2][1] = __('Normal') . ' ' . html_print_radio_button_extended ('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Advanced') . ' ' . html_print_radio_button_extended ('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][2] = '<b>'.__('Load filter').'</b>';
|
||||
$user_groups = users_get_groups ($config['id_user'], "AW", $own_info['is_admin'], true);
|
||||
$sql = "SELECT * FROM tnetflow_filter WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
|
||||
$table->data[2][3] = html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true);
|
||||
$table->data[2][3] .= html_print_submit_button (__('Load'), 'load_button', false, 'class="sub upd"', true);
|
||||
|
||||
$table->data[1][0] = __('Dst Ip'). ui_print_help_tip (__("Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[1][1] = html_print_input_text ('ip_dst', $filter['ip_dst'], false, 40, 80, true);
|
||||
$table->data[1][2] = __('Src Ip'). ui_print_help_tip (__("Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[1][3] = html_print_input_text ('ip_src', $filter['ip_src'], false, 40, 80, true);
|
||||
$table->data[3][0] = __('Dst Ip'). ui_print_help_tip (__("Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[3][1] = html_print_input_text ('ip_dst', $filter['ip_dst'], false, 40, 80, true);
|
||||
$table->data[3][2] = __('Src Ip'). ui_print_help_tip (__("Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249"), true);
|
||||
$table->data[3][3] = html_print_input_text ('ip_src', $filter['ip_src'], false, 40, 80, true);
|
||||
|
||||
$table->data[2][0] = __('Dst Port'). ui_print_help_tip (__("Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[2][1] = html_print_input_text ('dst_port', $filter['dst_port'], false, 40, 80, true);
|
||||
$table->data[2][2] = __('Src Port'). ui_print_help_tip (__("Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[2][3] = html_print_input_text ('src_port', $filter['src_port'], false, 40, 80, true);
|
||||
$table->data[4][0] = __('Dst Port'). ui_print_help_tip (__("Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[4][1] = html_print_input_text ('dst_port', $filter['dst_port'], false, 40, 80, true);
|
||||
$table->data[4][2] = __('Src Port'). ui_print_help_tip (__("Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22"), true);
|
||||
$table->data[4][3] = html_print_input_text ('src_port', $filter['src_port'], false, 40, 80, true);
|
||||
|
||||
$table->data[3][0] = ui_print_help_icon ('pcap_filter', true);
|
||||
$table->data[3][1] = html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px;'", true);
|
||||
$table->colspan[3][1] = 3;
|
||||
$table->data[5][0] = ui_print_help_icon ('pcap_filter', true);
|
||||
$table->data[5][1] = html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px;'", true);
|
||||
$table->colspan[5][1] = 3;
|
||||
|
||||
$table->data[4][0] = '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true);
|
||||
$table->data[6][0] = '<b>'.__('Aggregate by').'</b>'. ui_print_help_icon ('aggregate_by', true);
|
||||
|
||||
$aggregate_list = array();
|
||||
$aggregate_list = array ('none' => __('None'), 'proto' => __('Protocol'), 'srcip' =>__('Src Ip Address'), 'dstip' =>__('Dst Ip Address'), 'srcport' =>__('Src Port'), 'dstport' =>__('Dst Port') );
|
||||
|
||||
$table->data[4][1] = html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false);
|
||||
$table->data[6][1] = html_print_select ($aggregate_list, "aggregate", $filter['aggregate'], '', '', 0, true, false, true, '', false);
|
||||
|
||||
$table->data[4][2] = '<b>'.__('Output format').'</b>';
|
||||
$table->data[6][2] = '<b>'.__('Output format').'</b>';
|
||||
$show_output = array();
|
||||
$show_output = array ('packets' => __('Packets'), 'bytes' => __('Bytes'), 'flows' =>__('Flows'));
|
||||
$table->data[4][3] = html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false);
|
||||
$table->data[6][3] = html_print_select ($show_output, 'output', $filter['output'], '', '', 0, true, false, true, '', false);
|
||||
|
||||
html_print_table ($table);
|
||||
|
||||
html_print_submit_button (__('Draw'), 'draw_button', false, 'class="sub upd"');
|
||||
html_print_submit_button (__('Save as new filter'), 'save_button', false, 'class="sub upd" onClick="return defineFilterName();"');
|
||||
if ($filter_id > 0) {
|
||||
html_print_submit_button (__('Update current filter'), 'update_button', false, 'class="sub upd"');
|
||||
}
|
||||
echo'</form>';
|
||||
|
||||
if ($draw != '') {
|
||||
|
||||
// Get the command to call nfdump
|
||||
$command = netflow_get_command ($filter);
|
||||
// Get the command to call nfdump
|
||||
$command = netflow_get_command ($filter);
|
||||
|
||||
// Build a unique id for the cache
|
||||
$unique_id = 'live_view__' . ($end_date - $start_date);
|
||||
|
@ -176,40 +210,57 @@ if ($draw != '') {
|
|||
|
||||
<script type="text/javascript">
|
||||
|
||||
function displayAdvancedFilter () {
|
||||
// Hide the normal filter and display the advanced filter
|
||||
function displayAdvancedFilter () {
|
||||
|
||||
// Erase the normal filter
|
||||
document.getElementById("text-ip_dst").value = '';
|
||||
document.getElementById("text-ip_src").value = '';
|
||||
document.getElementById("text-dst_port").value = '';
|
||||
document.getElementById("text-src_port").value = '';
|
||||
// Erase the normal filter
|
||||
document.getElementById("text-ip_dst").value = '';
|
||||
document.getElementById("text-ip_src").value = '';
|
||||
document.getElementById("text-dst_port").value = '';
|
||||
document.getElementById("text-src_port").value = '';
|
||||
|
||||
// Hide the normal filter
|
||||
document.getElementById("table2-1").style.display = 'none';
|
||||
document.getElementById("table2-2").style.display = 'none';
|
||||
// Hide the normal filter
|
||||
document.getElementById("table2-3").style.display = 'none';
|
||||
document.getElementById("table2-4").style.display = 'none';
|
||||
|
||||
// Show the advanced filter
|
||||
document.getElementById("table2-3").style.display = '';
|
||||
};
|
||||
// Show the advanced filter
|
||||
document.getElementById("table2-5").style.display = '';
|
||||
};
|
||||
|
||||
function displayNormalFilter () {
|
||||
// Hide the advanced filter and display the normal filter
|
||||
function displayNormalFilter () {
|
||||
|
||||
// Erase the advanced filter
|
||||
document.getElementById("textarea_advanced_filter").value = '';
|
||||
// Erase the advanced filter
|
||||
document.getElementById("textarea_advanced_filter").value = '';
|
||||
|
||||
// Hide the advanced filter
|
||||
document.getElementById("table2-3").style.display = 'none';
|
||||
// Hide the advanced filter
|
||||
document.getElementById("table2-5").style.display = 'none';
|
||||
|
||||
// Show the normal filter
|
||||
document.getElementById("table2-1").style.display = '';
|
||||
document.getElementById("table2-2").style.display = '';
|
||||
};
|
||||
// Show the normal filter
|
||||
document.getElementById("table2-3").style.display = '';
|
||||
document.getElementById("table2-4").style.display = '';
|
||||
};
|
||||
|
||||
var filter_type = <?php echo $filter_type ?>;
|
||||
if (filter_type == 0) {
|
||||
displayNormalFilter ();
|
||||
} else {
|
||||
displayAdvancedFilter ();
|
||||
}
|
||||
// Ask the user to define a name for the filter in order to save it
|
||||
function defineFilterName () {
|
||||
if (document.getElementById("text-name").value == '') {
|
||||
document.getElementById("table2-0").style.display = '';
|
||||
document.getElementById("table2-1").style.display = '';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// Display the appropriate filter
|
||||
var filter_type = <?php echo $filter_type ?>;
|
||||
if (filter_type == 0) {
|
||||
displayNormalFilter ();
|
||||
} else {
|
||||
displayAdvancedFilter ();
|
||||
}
|
||||
|
||||
// Hide filter name and group
|
||||
document.getElementById("table2-0").style.display = 'none';
|
||||
document.getElementById("table2-1").style.display = 'none';
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue