diff --git a/pandora_console/include/ajax/map.ajax.php b/pandora_console/include/ajax/map.ajax.php index ee951170a7..48354d5ddd 100644 --- a/pandora_console/include/ajax/map.ajax.php +++ b/pandora_console/include/ajax/map.ajax.php @@ -44,7 +44,6 @@ if (is_ajax ()) { $shape = (string)get_parameter('shape', ''); $return_update = networkmap_enterprise_update_data($id_node_data, $label, $shape); - echo json_encode($return_update); return; } @@ -496,57 +495,44 @@ if (is_ajax ()) { $node_id = get_parameter('node_id'); $data_graph_id = (int)get_parameter('data_graph_id'); + $style = db_get_value('style', 'titem', 'id', $data_graph_id); + $node_style = json_decode($style, true); + + $node_label = $node_style['label']; + $node_shape = $node_style['shape']; + $table = new stdClass(); $table->id = 'node_options_' . $node_id; $table->width = "100%"; - $table->head = array(); $node_name = __('No name'); if ($type == ITEM_TYPE_AGENT_NETWORKMAP) { $node_name = agents_get_name($id_node_data); $table->head['type'] = __('Agent'); - - $node_shape = 'circle'; } else if ($type == ITEM_TYPE_MODULE_NETWORKMAP) { - $node_name = db_get_all_rows_sql("SELECT nombre - FROM tagente_modulo - WHERE id_agente_modulo = " . $id_node_data); - $node_name = $node_name[0]['nombre']; - $table->head['type'] = __('Module'); + $node_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_node_data); - $node_shape = 'square'; + $table->head['type'] = __('Module'); } else if ($type == ITEM_TYPE_GROUP_NETWORKMAP) { - $node_name = db_get_all_rows_sql("SELECT nombre - FROM tgrupo - WHERE id_grupo = " . $id_node_data); - $node_name = $node_name[0]['nombre']; - $table->head['type'] = __('Group'); + $node_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_node_data); - $node_shape = 'rhombus'; + $table->head['type'] = __('Group'); } else if ($type == ITEM_TYPE_POLICY_NETWORKMAP) { - $node_name = db_get_all_rows_sql("SELECT name - FROM tpolicies - WHERE id = " . $id_node_data); - $node_name = $node_name[0]['name']; - $table->head['type'] = __('Policy'); + $node_name = db_get_value('name', 'tpolicies', 'id', $id_node_data); - $node_shape = 'rhombus'; + $table->head['type'] = __('Policy'); } - $table->head['name'] = $node_name; - $node = db_get_all_rows_sql( - "SELECT style FROM titem WHERE id = " . $id_node_data); - $node = $node[0]; - $node_style = json_decode($node); + $table->head['name'] = $node_name; $table->data = array(); $table->data[0][0] = __('Label'); $table->data[0][1] = html_print_input_text('label', - $node_name, '', 12, 10, true); + $node_label, '', 12, 10, true); $table->data[1][0] = __('Shape'); $table->data[1][1] = html_print_select(array( 'circle' => __('Circle'), diff --git a/pandora_console/include/javascript/map/MapController.js b/pandora_console/include/javascript/map/MapController.js index c8e8b8118d..396af4fa8e 100644 --- a/pandora_console/include/javascript/map/MapController.js +++ b/pandora_console/include/javascript/map/MapController.js @@ -1768,7 +1768,6 @@ MapController.prototype.is_relationshipy = function(node) { break; } - return return_var; } @@ -1889,18 +1888,6 @@ MapController.prototype.events = function() { action: function(elm, d, i) { self.add_fictional_node(); } - }, - { - title: 'Edit map', - action: function(elm, d, i) { - self.editMap(self, elm); - } - }, - { - title: 'Save map', - action: function(elm, d, i) { - console.log('Save map!!'); - } } ]; diff --git a/pandora_console/include/javascript/map/NetworkmapController.js b/pandora_console/include/javascript/map/NetworkmapController.js index 9e3677455c..29cbfa0d98 100644 --- a/pandora_console/include/javascript/map/NetworkmapController.js +++ b/pandora_console/include/javascript/map/NetworkmapController.js @@ -2442,7 +2442,6 @@ NetworkmapController.prototype.editNode = function(target) { var nodeTarget = $(target); - var id_map = self._id; var type = parseInt(nodeTarget.data("type")); var data_id = parseInt(nodeTarget.data("id")); var data_graph_id = parseInt(nodeTarget.data("graph_id"));