Added empty networkmap functions
This commit is contained in:
parent
4e672cc758
commit
1a04e6085a
|
@ -43,7 +43,7 @@ function networkmap_process_networkmap($id = 0) {
|
|||
|
||||
$networkmap = db_get_row_filter('tmap',
|
||||
array('id' => $id));
|
||||
$filter = json_decode($networkmap['filter'], true);
|
||||
$map_filter = json_decode($networkmap['filter'], true);
|
||||
|
||||
$pure = (int)get_parameter('pure', 0);
|
||||
|
||||
|
@ -95,181 +95,292 @@ function networkmap_process_networkmap($id = 0) {
|
|||
}
|
||||
|
||||
$nodes_and_relations = array();
|
||||
|
||||
|
||||
if (enterprise_installed() && ($numNodes > 0)) {
|
||||
$nodes_and_relations = get_structure_nodes($id);
|
||||
}
|
||||
else {
|
||||
// Generate dot file
|
||||
$graph = networkmap_generate_dot (__('Pandora FMS'),
|
||||
$id_group,
|
||||
$simple,
|
||||
$font_size,
|
||||
$layout,
|
||||
$nooverlap,
|
||||
$zoom,
|
||||
$ranksep,
|
||||
$center,
|
||||
$regen,
|
||||
$pure,
|
||||
$id,
|
||||
$show_snmp_modules,
|
||||
false, //cut_names
|
||||
true, // relative
|
||||
'',
|
||||
$ip_mask,
|
||||
$dont_show_subgroups,
|
||||
false,
|
||||
null,
|
||||
$old_mode);
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter;
|
||||
break;
|
||||
default:
|
||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($simple) {
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if ($nooverlap) {
|
||||
$filename_dot .= "_nooverlap";
|
||||
}
|
||||
$filename_dot .= "_" . $id . ".dot";
|
||||
if ($map_filter['empty_map']) {
|
||||
// Open Graph
|
||||
$graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom,
|
||||
$ranksep, $font_size, null);
|
||||
$graph .= networkmap_create_pandora_node (__('Pandora FMS'), $font_size, $simple);
|
||||
$graph .= networkmap_close_graph ();
|
||||
|
||||
file_put_contents($filename_dot, $graph);
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter;
|
||||
break;
|
||||
default:
|
||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($simple) {
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if ($nooverlap) {
|
||||
$filename_dot .= "_nooverlap";
|
||||
}
|
||||
$filename_dot .= "_" . $id . ".dot";
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
file_put_contents($filename_dot, $graph);
|
||||
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
}
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
}
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
//Search the agent of this module for to get the
|
||||
//position
|
||||
foreach ($nodes as $key2 => $node2) {
|
||||
if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') {
|
||||
if ($node2['id_agent'] == $node['id_agent']) {
|
||||
$nodes[$key]['coords'][0] =
|
||||
$nodes[$key2]['coords'][0] + $node['height'] / 2;
|
||||
$nodes[$key]['coords'][1] =
|
||||
$nodes[$key2]['coords'][1] + $node['width'] / 2;
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
//Search the agent of this module for to get the
|
||||
//position
|
||||
foreach ($nodes as $key2 => $node2) {
|
||||
if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') {
|
||||
if ($node2['id_agent'] == $node['id_agent']) {
|
||||
$nodes[$key]['coords'][0] =
|
||||
$nodes[$key2]['coords'][0] + $node['height'] / 2;
|
||||
$nodes[$key]['coords'][1] =
|
||||
$nodes[$key2]['coords'][1] + $node['width'] / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
$nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1];
|
||||
|
||||
if (($node['type'] == 'agent') || ($node['type'] == '')) {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 0;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module'];
|
||||
$nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 1;
|
||||
}
|
||||
|
||||
$style = array();
|
||||
$style['shape'] = 'circle';
|
||||
$style['image'] = $node['image'];
|
||||
$style['width'] = $node['width'];
|
||||
$style['height'] = $node['height'];
|
||||
$style['label'] = $node['text'];
|
||||
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
$nodes_and_relations['relations'] = array();
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_pandora_networkmap.php");
|
||||
save_generate_nodes($id, $nodes_and_relations);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Generate dot file
|
||||
$graph = networkmap_generate_dot (__('Pandora FMS'),
|
||||
$id_group,
|
||||
$simple,
|
||||
$font_size,
|
||||
$layout,
|
||||
$nooverlap,
|
||||
$zoom,
|
||||
$ranksep,
|
||||
$center,
|
||||
$regen,
|
||||
$pure,
|
||||
$id,
|
||||
$show_snmp_modules,
|
||||
false, //cut_names
|
||||
true, // relative
|
||||
'',
|
||||
$ip_mask,
|
||||
$dont_show_subgroups,
|
||||
false,
|
||||
null,
|
||||
$old_mode);
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter;
|
||||
break;
|
||||
default:
|
||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($simple) {
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if ($nooverlap) {
|
||||
$filename_dot .= "_nooverlap";
|
||||
}
|
||||
$filename_dot .= "_" . $id . ".dot";
|
||||
|
||||
file_put_contents($filename_dot, $graph);
|
||||
|
||||
switch (PHP_OS) {
|
||||
case "WIN32":
|
||||
case "WINNT":
|
||||
case "Windows":
|
||||
$filename_plain = sys_get_temp_dir() . "\\plain.txt";
|
||||
|
||||
$cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot);
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
}
|
||||
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||
$relation_nodes, $graph);
|
||||
|
||||
unlink($filename_plain);
|
||||
|
||||
//Set the position of modules
|
||||
foreach ($nodes as $key => $node) {
|
||||
if ($node['type'] == 'module') {
|
||||
//Search the agent of this module for to get the
|
||||
//position
|
||||
foreach ($nodes as $key2 => $node2) {
|
||||
if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') {
|
||||
if ($node2['id_agent'] == $node['id_agent']) {
|
||||
$nodes[$key]['coords'][0] =
|
||||
$nodes[$key2]['coords'][0] + $node['height'] / 2;
|
||||
$nodes[$key]['coords'][1] =
|
||||
$nodes[$key2]['coords'][1] + $node['width'] / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
$nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1];
|
||||
|
||||
if (($node['type'] == 'agent') || ($node['type'] == '')) {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 0;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module'];
|
||||
$nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 1;
|
||||
}
|
||||
|
||||
$style = array();
|
||||
$style['shape'] = 'circle';
|
||||
$style['image'] = $node['image'];
|
||||
$style['width'] = $node['width'];
|
||||
$style['height'] = $node['height'];
|
||||
$style['label'] = $node['text'];
|
||||
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
$nodes_and_relations['relations'] = array();
|
||||
$index = 0;
|
||||
foreach ($relation_nodes as $relation) {
|
||||
$nodes_and_relations['relations'][$index]['id_map'] = $id;
|
||||
|
||||
if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 0;
|
||||
}
|
||||
else if ($relation['parent_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 3;
|
||||
}
|
||||
|
||||
if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 0;
|
||||
}
|
||||
else if ($relation['child_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 3;
|
||||
}
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_pandora_networkmap.php");
|
||||
save_generate_nodes($id, $nodes_and_relations);
|
||||
}
|
||||
|
||||
$pandorafms_node = $nodes_and_relations['nodes'][0];
|
||||
$center = array('x' => $pandorafms_node['x'], 'y' => $pandorafms_node['y']);
|
||||
|
||||
$networkmap['center_x'] = $center['x'];
|
||||
$networkmap['center_y'] = $center['y'];
|
||||
db_process_sql_update('tmap',
|
||||
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||
array('id' => $id));
|
||||
}
|
||||
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
$nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1];
|
||||
|
||||
if (($node['type'] == 'agent') || ($node['type'] == '')) {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 0;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module'];
|
||||
$nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent'];
|
||||
$nodes_and_relations['nodes'][$index]['type'] = 1;
|
||||
}
|
||||
|
||||
$style = array();
|
||||
$style['shape'] = 'circle';
|
||||
$style['image'] = $node['image'];
|
||||
$style['width'] = $node['width'];
|
||||
$style['height'] = $node['height'];
|
||||
$style['label'] = $node['text'];
|
||||
$nodes_and_relations['nodes'][$index]['style'] = json_encode($style);
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
$nodes_and_relations['relations'] = array();
|
||||
$index = 0;
|
||||
foreach ($relation_nodes as $relation) {
|
||||
$nodes_and_relations['relations'][$index]['id_map'] = $id;
|
||||
|
||||
if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 0;
|
||||
}
|
||||
else if ($relation['parent_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['parent_type'] = 3;
|
||||
}
|
||||
|
||||
if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 0;
|
||||
}
|
||||
else if ($relation['child_type'] == 'module') {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module'];
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 1;
|
||||
}
|
||||
else {
|
||||
$nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child'];
|
||||
$nodes_and_relations['relations'][$index]['id_child_source_data'] = -2;
|
||||
$nodes_and_relations['relations'][$index]['child_type'] = 3;
|
||||
}
|
||||
|
||||
$index++;
|
||||
}
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once("include/functions_pandora_networkmap.php");
|
||||
save_generate_nodes($id, $nodes_and_relations);
|
||||
}
|
||||
|
||||
$pandorafms_node = $nodes_and_relations['nodes'][0];
|
||||
$center = array('x' => $pandorafms_node['x'], 'y' => $pandorafms_node['y']);
|
||||
|
||||
$networkmap['center_x'] = $center['x'];
|
||||
$networkmap['center_y'] = $center['y'];
|
||||
db_process_sql_update('tmap',
|
||||
array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']),
|
||||
array('id' => $id));
|
||||
}
|
||||
|
||||
return $nodes_and_relations;
|
||||
|
|
|
@ -33,10 +33,138 @@ include_once("include/functions_pandora_networkmap.php");
|
|||
|
||||
$new_networkmap = (bool) get_parameter('new_networkmap', false);
|
||||
$save_networkmap = (bool) get_parameter('save_networkmap', false);
|
||||
$save_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false);
|
||||
$update_empty_networkmap = (bool) get_parameter('save_empty_networkmap', false);
|
||||
$update_networkmap = (bool) get_parameter('update_networkmap', false);
|
||||
$copy_networkmap = (bool) get_parameter('copy_networkmap', false);
|
||||
$delete = (bool) get_parameter('delete', false);
|
||||
$tab = (string) get_parameter('tab', 'list');
|
||||
$new_empty_networkmap = get_parameter('new_empty_networkmap', false);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if ($new_empty_networkmap) {
|
||||
if ($networkmaps_write || $networkmaps_manage) {
|
||||
require ($config["homedir"]."/enterprise/godmode/agentes/pandora_networkmap_empty.editor.php");
|
||||
require('pandora_networkmap_empty.editor.php');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($save_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
|
||||
// ACL for the network map
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
// Default size values
|
||||
$width = 4000;
|
||||
$height = 4000;
|
||||
|
||||
$method = (string) get_parameter('method', 'fdp');
|
||||
|
||||
$dont_show_subgroups = 0;
|
||||
$node_radius = (int)get_parameter('node_radius', 40);
|
||||
$description = get_parameter('description', '');
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['source_period'] = 60;
|
||||
$values['width'] = $width;
|
||||
$values['height'] = $height;
|
||||
$values['id_user'] = $config['id_user'];
|
||||
$values['description'] = $description;
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$filter = array();
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
$filter['empty_map'] = 1;
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_insert('tmap',
|
||||
$values);
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message($result,
|
||||
__('Succesfully created'), __('Could not be created'), '',
|
||||
true);
|
||||
|
||||
// Force the tab = 'list'
|
||||
$tab = "list";
|
||||
}
|
||||
else if ($update_empty_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
|
||||
// ACL for the new network map
|
||||
$networkmap_write_new = check_acl ($config['id_user'], $id_group, "MW");
|
||||
$networkmap_manage_new = check_acl ($config['id_user'], $id_group, "MM");
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access networkmap");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$name = (string) get_parameter('name', '');
|
||||
|
||||
$recon_task_id = (int) get_parameter(
|
||||
'recon_task_id', 0);
|
||||
|
||||
$source = (string)get_parameter('source', 'group');
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
||||
$values['generation_method'] = 4;
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
|
||||
$dont_show_subgroups = 0;
|
||||
$node_radius = (int)get_parameter('node_radius', 40);
|
||||
$row = db_get_row('tmap', 'id', $id);
|
||||
$filter = json_decode($row['filter'], true);
|
||||
$filter['dont_show_subgroups'] = $dont_show_subgroups;
|
||||
$filter['node_radius'] = $node_radius;
|
||||
|
||||
$values['filter'] = json_encode($filter);
|
||||
|
||||
$result = false;
|
||||
if (!empty($name)) {
|
||||
$result = db_process_sql_update('tmap',
|
||||
$values, array('id' => $id));
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message($result,
|
||||
__('Succesfully updated'), __('Could not be updated'), '',
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
$result_txt = '';
|
||||
// The networkmap doesn't exist yet
|
||||
|
@ -546,6 +674,15 @@ switch ($tab) {
|
|||
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"');
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
|
||||
if (enterprise_installed()) {
|
||||
echo "<div style='width: " . $table->width . "; margin-top: 5px;'>";
|
||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
html_print_input_hidden ('new_empty_networkmap', 1);
|
||||
html_print_submit_button (__('Create empty networkmap'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"');
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue