diff --git a/pandora_console/godmode/agentes/module_manager_editor_plugin.php b/pandora_console/godmode/agentes/module_manager_editor_plugin.php index 7e66f078a9..0ecf2a710b 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_plugin.php +++ b/pandora_console/godmode/agentes/module_manager_editor_plugin.php @@ -153,18 +153,24 @@ foreach ($password_fields as $k => $p) { ?> diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 529ba7c848..ab20d53957 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -38,6 +38,7 @@ if (check_login()) { enterprise_include_once('include/functions_metaconsole.php'); $get_plugin_macros = get_parameter('get_plugin_macros'); + $get_module_macros = get_parameter('get_module_macros'); $search_modules = get_parameter('search_modules'); $get_module_detail = get_parameter('get_module_detail', 0); $get_module_autocomplete_input = (bool) get_parameter( @@ -118,6 +119,28 @@ if (check_login()) { return; } + if ($get_module_macros && $get_module_macros > 0) { + if (https_is_running()) { + header('Content-type: application/json'); + } + + $module_id = $get_module_macros; + + $module_macros = db_get_value( + 'macros', + 'tagente_modulo', + 'id_agente_modulo', + $module_id + ); + + $macros = []; + $macros['base64'] = base64_encode($module_macros); + $macros['array'] = json_decode($module_macros, true); + + echo json_encode($macros); + return; + } + if ($search_modules) { if (https_is_running()) { header('Content-type: application/json'); diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 27e4bc5fef..220459bacd 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -997,13 +997,18 @@ function add_macro_field(macro, row_model_id, type_copy, k) { $("#" + row_id).show(); } -function load_plugin_macros_fields(row_model_id) { +function load_plugin_macros_fields(row_model_id, moduleId = 0) { // Get plugin macros when selected and load macros fields var id_plugin = $("#id_plugin").val(); var params = []; params.push("page=include/ajax/module"); - params.push("get_plugin_macros=1"); + + if (moduleId > 0) { + params.push("get_module_macros=" + moduleId); + } else { + params.push("get_plugin_macros=1"); + } params.push("id_plugin=" + id_plugin); jQuery.ajax({