diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 4a0076e847..9e9e1c0941 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -654,6 +654,18 @@ function snmp_browser_print_oid( ); } + if (isset($_POST['print_copy_oid'])) { + // Hidden by default. + $output .= html_print_button( + __('Use this OID'), + 'use_iod', + false, + 'use_oid()', + 'class="sub add invisible"', + true + ); + } + // Select agent modal. $output .= snmp_browser_print_create_modules(true); @@ -1134,6 +1146,14 @@ function snmp_browser_print_container( false, 'id_agent_module' ); + $output .= html_print_input_hidden( + 'is_policy_agent', + 1, + true, + false, + false, + 'is_policy_agent' + ); $output .= html_print_table($table, true); $output .= html_print_div( [ diff --git a/pandora_console/include/javascript/pandora_snmp_browser.js b/pandora_console/include/javascript/pandora_snmp_browser.js index 58a1972c40..87c2675f8b 100644 --- a/pandora_console/include/javascript/pandora_snmp_browser.js +++ b/pandora_console/include/javascript/pandora_snmp_browser.js @@ -7,6 +7,10 @@ function snmpBrowse() { // Hide the data div hideOIDData(); + $("#button-srcbutton") + .find("div") + .addClass("rotation"); + // Reset previous searches $("#search_results").css("display", "none"); $("#hidden-search_count").val(-1); @@ -258,7 +262,7 @@ function snmpGet(oid) { var ajax_url = $("#hidden-ajax_url").val(); var server_to_exec = $("#server_to_exec").val(); var target_port = $("#target_port").val(); - var print_create_agent_module = true; + var is_policy_or_agent = $("#is_policy_agent").val(); // Check for a custom action var custom_action = $("#hidden-custom_action").val(); @@ -283,7 +287,11 @@ function snmpGet(oid) { params["custom_action"] = custom_action; params["page"] = "include/ajax/snmp_browser.ajax"; params["target_port"] = target_port; - params["print_create_agent_module"] = print_create_agent_module; + if (typeof is_policy_or_agent !== "undefined") { + params["print_copy_oid"] = 1; + } else { + params["print_create_agent_module"] = 1; + } // SNMP get! jQuery.ajax({ diff --git a/pandora_console/operation/snmpconsole/snmp_browser.php b/pandora_console/operation/snmpconsole/snmp_browser.php index 27ae0633f2..8dda019fcb 100644 --- a/pandora_console/operation/snmpconsole/snmp_browser.php +++ b/pandora_console/operation/snmpconsole/snmp_browser.php @@ -745,9 +745,20 @@ function show_add_module() { }); } } - ], + ], }); } } - + +function use_oid() { + $("#text-snmp_oid").val($("#hidden-snmp_oid").val()); + + $("#snmp_data").empty(); + + $("#snmp_data").css("display", "none"); + $(".forced_title_layer").css("display", "none"); + + $("#snmp_browser_container").dialog("close"); +} +