From d422546d0f35c7a6f8d9292bde78a872817f3d88 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 21 Sep 2016 10:24:41 +0200 Subject: [PATCH] New networkmaps in progress.. (Added open alert) --- .../functions_pandora_networkmap.js | 17 ++++++++ .../agentes/pandora_networkmap.view.php | 40 +++++++++++++------ 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 0c023aa40c..12a20b13e3 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -1716,6 +1716,23 @@ function init_drag_and_drop() { }); }); } + else { + var params = []; + params.push("update_node_alert=1"); + params.push("map_id=" + networkmap_id); + params.push("page=operation/agentes/pandora_networkmap.view"); + jQuery.ajax ({ + data: params.join ("&"), + dataType: 'json', + type: 'POST', + url: action="ajax.php", + success: function (data) { + if (data['correct']) { + alert("In the Open version of PandoraFMS can not be edited nodes or map"); + } + } + }); + } d3.event.sourceEvent.stopPropagation(); }) diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 3b3676b9c5..375be58cf8 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -22,27 +22,20 @@ require_once ('include/functions_modules.php'); //--------------INIT AJAX----------------------------------------------- if (is_ajax ()) { - $update_refresh_state = (bool)get_parameter('update_refresh_state', - false); - + $update_refresh_state = (bool)get_parameter('update_refresh_state',false); $set_center = (bool)get_parameter('set_center', false); $erase_relation = (bool)get_parameter('erase_relation', false); $search_agents = (bool) get_parameter ('search_agents'); - $get_agent_pos_search = (bool)get_parameter('get_agent_pos_search', - false); + $get_agent_pos_search = (bool)get_parameter('get_agent_pos_search',false); $get_shape_node = (bool)get_parameter('get_shape_node', false); $set_shape_node = (bool)get_parameter('set_shape_node', false); $get_info_module = (bool)get_parameter('get_info_module', false); - $get_tooltip_content = (bool)get_parameter('get_tooltip_content', - false); - - $add_several_agents = (bool)get_parameter('add_several_agents', - false); - - $update_fictional_point = (bool)get_parameter( - 'update_fictional_point', false); + $get_tooltip_content = (bool)get_parameter('get_tooltip_content',false); + $add_several_agents = (bool)get_parameter('add_several_agents',false); + $update_fictional_point = (bool)get_parameter('update_fictional_point', false); $update_z = (bool)get_parameter('update_z', false); $module_get_status = (bool)get_parameter('module_get_status', false); + $update_node_alert = (bool)get_parameter('update_node_alert', false); if ($module_get_status) { $id = (int)get_parameter('id', 0); @@ -596,6 +589,27 @@ if (is_ajax ()) { return; } + + if ($update_node_alert) { + $map_id = (int)get_parameter('map_id', 0); + + $filter = db_get_value('filter', 'tmap', 'id', $map_id); + $filter = json_decode($filter, true); + + $return = array(); + $return['correct'] = false; + if (!isset($filter['alert'])) { + $return['correct'] = true; + $filter['alert'] = 1; + $filter = json_encode($filter); + $values = array('filter' => $filter); + db_process_sql_update('tmap', $values, array('id' => $map_id)); + } + + echo json_encode($return); + + return; + } } //--------------END AJAX------------------------------------------------