From 0b63fc22f9f1bd73a78787135a7a550319213bb3 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 26 Oct 2017 13:28:08 +0200 Subject: [PATCH] Added lost code in limbo, come back to the heaven darling --- .../functions_pandora_networkmap.js | 119 ++++++++++++++++-- 1 file changed, 107 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index a9c36700a8..fd519519ad 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -307,7 +307,12 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -342,7 +347,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -365,7 +376,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -400,7 +417,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -425,7 +448,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -460,7 +489,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); } @@ -618,6 +653,30 @@ function add_new_link(new_link) { graph.links.push(new_link); } +function move_to_networkmap (node) { + var params = []; + params.push("get_networkmap_from_fictional=1"); + params.push("id=" + node.id_db); + params.push("id_map=" + node.map_id); + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + + jQuery.ajax ({ + data: params.join ("&"), + dataType: 'json', + type: 'POST', + url: action="ajax.php", + success: function (data) { + if (data['correct']) { + window.location="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" + data['id_networkmap']; + } + else { + edit_node(node, true); + } + } + }); +} + + function edit_node(data_node, dblClick) { if (enterprise_installed) { var flag_edit_node = true; @@ -3173,7 +3232,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3207,7 +3272,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3235,7 +3306,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3273,7 +3350,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3303,7 +3386,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3341,7 +3430,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); });