From 7b956e8ef660cd3c445aff661a3e5fe668b70135 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 7 Nov 2017 15:05:31 +0100 Subject: [PATCH] Added new option to networkmap, reset --- pandora_console/images/reset.png | Bin 0 -> 545 bytes .../include/functions_pandora_networkmap.php | 6 + .../functions_pandora_networkmap.js | 132 ++++++++++++++++++ .../include/javascript/jquery.contextMenu.css | 1 + 4 files changed, 139 insertions(+) create mode 100644 pandora_console/images/reset.png diff --git a/pandora_console/images/reset.png b/pandora_console/images/reset.png new file mode 100644 index 0000000000000000000000000000000000000000..a3304f8263f6ed232286716f630f1bce240b54ca GIT binary patch literal 545 zcmV++0^a?JP)?*) z<^wqiKr9Fp_<$pAECj_NOtJu*+n^rWKy0!RV1Wj_0Z``wEDGQrgr(~JIIM+vED@eS zFmnkc^+P?25{@9x^rNXw1e&^lq?iE+Fct#7Re*-EK2kaW1?NFfkReA7&V&y&C;&*! zM=}Hy-Wx#)3d#prwNR~JPEx3R!4GBPlSO7Wg5Q;ZwOc+2dH3X#^CZwbSOX`ip z7zmBR4?t`PjY0)znq`26X&_W!0ny0|)$j#Sz1YK)j1o@(8or=14D517w6t^q>K#%I zy^j>Jg~$=r0J9A}Ht`sk08J@i!+?4wU@J=npo(D0").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 250, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + proceed_to_restart_map(map_id); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var dialog_confirm_text = "
"; + dialog_confirm_text = dialog_confirm_text + "
"; + dialog_confirm_text = dialog_confirm_text + "

" + warning_message + "

"; + dialog_confirm_text = dialog_confirm_text + "

" + message_to_confirm + "

"; + dialog_confirm_text = dialog_confirm_text + "
"; + + $('#restart_map_confirm').html(dialog_confirm_text); + $('#restart_map_confirm').dialog('open'); +} + +function proceed_to_restart_map (map_id) { + $("
").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 450, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + var new_elements = []; + new_elements[0] = $("#text-name").val(); + new_elements[1] = $("#id_group").val(); + new_elements[2] = $("#text-node_radius").val(); + new_elements[3] = $("#textarea_description").val(); + new_elements[4] = $("input[name=source]:checked").val(); + if (new_elements[4] == 'group') { + new_elements[5] = $("#checkbox-dont_show_subgroups").is(':checked'); + } + else if (new_elements[4] == 'recon_task') { + new_elements[5] = $("#recon_task_id").val(); + } + else { + new_elements[5] = $("#text-ip_mask").val(); + } + new_elements[6] = $("#method").val(); + reset_map_from_form(map_id, new_elements); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var params = []; + params.push("get_reset_map_form=1"); + params.push("map_id=" + map_id); + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + jQuery.ajax({ + data: params.join("&"), + dataType: 'html', + type: 'POST', + url: action = "ajax.php", + success: function (data) { + $('#restart_map_form').html(data); + $('#restart_map_form').dialog('open'); + } + }); +} + +function reset_map_from_form (map_id, new_elements) { + var params = []; + params.push("reset_map=1"); + params.push("map_id=" + map_id); + params.push("elems[]=" + new_elements) + 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['error']) { + location.reload(true); + } + } + }); +} + function set_parent(parent_data) { if (enterprise_installed) { var selection = d3.selectAll('.node_children'); diff --git a/pandora_console/include/javascript/jquery.contextMenu.css b/pandora_console/include/javascript/jquery.contextMenu.css index 3a844d4a7e..b0b04223bf 100644 --- a/pandora_console/include/javascript/jquery.contextMenu.css +++ b/pandora_console/include/javascript/jquery.contextMenu.css @@ -117,6 +117,7 @@ .context-menu-item.icon-set_parent { background-image: url(../../images/father.png); } .context-menu-item.icon-add_node { background-image: url(../../images/add.png); } .context-menu-item.icon-refresh_holding_area { background-image: url(../../images/refresh_holding_area.png); } +.context-menu-item.icon-restart_map { background-image: url(../../images/reset.png); } .context-menu-item.icon-interface_link_children { background-image: url(../../images/icono_link_hijo.png); } .context-menu-item.icon-interface_link_parent { background-image: url(../../images/icono_link_padre.png); } .context-menu-item.icon-interface_link_cancel { background-image: url(../../images/link_abortar.png); }