New maps in progress... (Create, edit and list mode)

This commit is contained in:
Arturo Gonzalez 2016-02-03 09:08:37 +01:00
parent d65ab71600
commit 596cacb41c
2 changed files with 65 additions and 61 deletions

View File

@ -85,15 +85,15 @@ if ($edit_networkmap) {
}
$generation_method = $values['generation_method'];
$filter = json_decode($values['filter'], true);
$show_groups_filter = $filter['show_groups'];
$show_module_plugins = $filter['show_groups'];
$show_snmp_modules = $filter['show_groups'];
$show_modules = $filter['show_groups'];
$show_policy_modules = $filter['show_groups'];
$show_pandora_nodes = $filter['show_groups'];
$show_module_group = $filter['show_groups'];
$id_tag = $filter['show_groups'];
$text = io_safe_output($filter['show_groups']);
$show_groups_filter = $filter['show_groups_filter'];
$show_module_plugins = $filter['show_module_plugins'];
$show_snmp_modules = $filter['show_snmp_modules'];
$show_modules = $filter['show_modules'];
$show_policy_modules = $filter['show_policy_modules'];
$show_pandora_nodes = $filter['show_pandora_nodes'];
$show_module_group = $filter['show_module_group'];
$id_tag = $filter['id_tag'];
$text = io_safe_output($filter['text']);
}
}
@ -167,38 +167,42 @@ else {
$table->data[5][0] = __('Description');
$table->data[5][1] = html_print_textarea ("description", 2, 65, $description, '', true);
$table->data[6][0] = __('Show groups filter');
$table->data[6][1] = html_print_checkbox('show_groups_filter', '1', $show_groups_filter, true);
$table->data[6][0] = __('Refresh time');
$table->data[6][1] = html_print_input_text ('source_period', $source_period, '', 8,
20,true);
$table->data[7][0] = __('Show module plugins');
$table->data[7][1] = html_print_checkbox('show_groups_filter', '1', $show_module_plugins, true);
$table->data[7][0] = __('Show groups filter');
$table->data[7][1] = html_print_checkbox('show_groups_filter', '1', $show_groups_filter, true);
$table->data[8][0] = __('Show snmp modules');
$table->data[8][1] = html_print_checkbox('show_groups_filter', '1', $show_snmp_modules, true);
$table->data[8][0] = __('Show module plugins');
$table->data[8][1] = html_print_checkbox('show_module_plugins', '1', $show_module_plugins, true);
$table->data[9][0] = __('Show modules');
$table->data[9][1] = html_print_checkbox('show_groups_filter', '1', $show_modules, true);
$table->data[9][0] = __('Show snmp modules');
$table->data[9][1] = html_print_checkbox('show_snmp_modules', '1', $show_snmp_modules, true);
$table->data[10][0] = __('Show policy modules');
$table->data[10][1] = html_print_checkbox('show_groups_filter', '1', $show_policy_modules, true);
$table->data[10][0] = __('Show modules');
$table->data[10][1] = html_print_checkbox('show_modules', '1', $show_modules, true);
$table->data[11][0] = __('Show pandora nodes');
$table->data[11][1] = html_print_checkbox('show_groups_filter', '1', $show_pandora_nodes, true);
$table->data[11][0] = __('Show policy modules');
$table->data[11][1] = html_print_checkbox('show_policy_modules', '1', $show_policy_modules, true);
$table->data[12][0] = __('Show module group');
$table->data[12][1] = html_print_checkbox('show_groups_filter', '1', $show_module_group, true);
$table->data[12][0] = __('Show pandora nodes');
$table->data[12][1] = html_print_checkbox('show_pandora_nodes', '1', $show_pandora_nodes, true);
$table->data[13][0] = __('Filter by tags');
$table->data[13][1] = html_print_select (tags_get_user_tags(), "id_tag", $id_tag, '', __('All'), 0, true, false, true, '', false, '');
$table->data[13][0] = __('Show module group');
$table->data[13][1] = html_print_checkbox('show_module_group', '1', $show_module_group, true);
$table->data[14][0] = __('Filter by text');
$table->data[14][1] = html_print_input_text ('text', $text, '', 20,
10,true);
$table->data[14][0] = __('Filter by tags');
$table->data[14][1] = html_print_select (tags_get_user_tags(), "id_tag", $id_tag, '', __('All'), 0, true, false, true, '', false, '');
$table->data[15][0] = __('Filter by text');
$table->data[15][1] = html_print_input_text ('text', $text, '', 30,
100,true);
echo '<form method="post" action="index.php?sec=maps&amp;sec2=operation/maps/networkmap_list">';
html_print_table($table);
echo "<div style='width: " . $table->width . "; text-align: right;'>";
if ($create_networkmap) {
html_print_input_hidden ('save_networkmap', 1);

View File

@ -39,7 +39,7 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
require_once('include/functions_migration.php');
$buttons['list'] = array('active' => true,
'text' => '<a href="index.php?sec=network&sec2=operation/maps/networkmap_list">' .
'text' => '<a href="index.php?sec=network&sec2=operation/maps/networkmap_list">' .
html_print_image("images/list.png", true,
array ('title' => __('List of networkmaps'))) .
'</a>');
@ -87,31 +87,31 @@ if ($save_networkmap) {
require ("general/noaccess.php");
return;
}
$type = MAP_TYPE_NETWORKMAP;
$subtype = (int) get_parameter('subtype', MAP_SUBTYPE_GROUPS);
$name = (string) get_parameter('name', "");
$description = (string) get_parameter('description', "");
$source_period = (int) get_parameter('source_period', 60 * 5);
$source = (int) get_parameter('source', MAP_SOURCE_GROUP);
$source_data = get_parameter('source_data', 'group');
$generation_method = get_parameter('generation_method', MAP_GENERATION_CIRCULAR);
$show_groups_filter = get_parameter('show_groups_filter', false);
$show_module_plugins = get_parameter('show_module_plugins', false);
$show_snmp_modules = get_parameter('show_snmp_modules', false);
$show_modules = get_parameter('show_modules', false);
$show_policy_modules = get_parameter('show_policy_modules', false);
$show_pandora_nodes = get_parameter('show_pandora_nodes', false);
$show_module_group = get_parameter('show_module_group', false);
$id_tag = get_parameter('id_tag', 0);
$text = get_parameter('text', "");
$source_data = (string) get_parameter('source_data', 'group');
$generation_method = (int) get_parameter('generation_method', MAP_GENERATION_CIRCULAR);
$show_groups_filter = (int) get_parameter('show_groups_filter', false);
$show_module_plugins = (int) get_parameter('show_module_plugins', false);
$show_snmp_modules = (int) get_parameter('show_snmp_modules', false);
$show_modules = (int) get_parameter('show_modules', false);
$show_policy_modules = (int) get_parameter('show_policy_modules', false);
$show_pandora_nodes = (int) get_parameter('show_pandora_nodes', false);
$show_module_group = (int) get_parameter('show_module_group', false);
$id_tag = (int) get_parameter('id_tag', 0);
$text = (string) get_parameter('text', "");
$values = array();
$values['name'] = $name;
$values['id_user'] = $config['id_user'];
$values['id_group'] = $id_group;
$values['subtype'] = $subtype;
$values['type'] = $$type;
$values['type'] = $type;
$values['description'] = $description;
$values['source_period'] = $source_period;
$values['source_data'] = $source_data;
@ -134,11 +134,10 @@ if ($save_networkmap) {
$same_name = true;
}
}
html_debug($values);
if (!empty($name) && !$same_name) {
$result_add = maps_save_map($values);
}
ui_print_result_message ($result_add,
__('Successfully created'),
__('Could not be created'));
@ -197,20 +196,21 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
}
else if ($update_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
$name = (string) get_parameter('name', "");
$description = (string) get_parameter('description', "");
$source_period = (int) get_parameter('source_period', 60 * 5);
$source = (int) get_parameter('source', MAP_SOURCE_GROUP);
$source_data = get_parameter('source_data', 'group');
$show_groups_filter = get_parameter('show_groups_filter', false);
$show_module_plugins = get_parameter('show_module_plugins', false);
$show_snmp_modules = get_parameter('show_snmp_modules', false);
$show_modules = get_parameter('show_modules', false);
$show_policy_modules = get_parameter('show_policy_modules', false);
$show_pandora_nodes = get_parameter('show_pandora_nodes', false);
$show_module_group = get_parameter('show_module_group', false);
$id_tag = get_parameter('id_tag', 0);
$text = get_parameter('text', "");
$source_data = (string) get_parameter('source_data', 'group');
$show_groups_filter = (int) get_parameter('show_groups_filter', false);
$show_module_plugins = (int) get_parameter('show_module_plugins', false);
$show_snmp_modules = (int) get_parameter('show_snmp_modules', false);
$show_modules = (int) get_parameter('show_modules', false);
$show_policy_modules = (int) get_parameter('show_policy_modules', false);
$show_pandora_nodes = (int) get_parameter('show_pandora_nodes', false);
$show_module_group = (int) get_parameter('show_module_group', false);
$id_tag = (int) get_parameter('id_tag', 0);
$text = (string) get_parameter('text', "");
$values = array();
$values['name'] = $name;
@ -218,9 +218,9 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
$values['description'] = $description;
$values['source_period'] = $source_period;
$values['source_data'] = $source_data;
$values['source'] = $source;
$filter = array();
$filter['show_groups_filter'] = 60;
$filter['show_groups_filter'] = $show_groups_filter;
$filter['show_module_plugins'] = $show_module_plugins;
$filter['show_snmp_modules'] = $show_snmp_modules;
$filter['show_modules'] = $show_modules;
@ -230,13 +230,13 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
$filter['id_tag'] = $id_tag;
$filter['text'] = $text;
$values['filter'] = json_encode($filter);
$result_add = false;
$result_update = false;
if (!empty($name)) {
$result_add = maps_update_map($id, $values);
$result_update = maps_update_map($id, $values);
}
ui_print_result_message ($result_add,
ui_print_result_message ($result_update,
__('Successfully updated'),
__('Could not be updated'));
}