diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index cb6fe8cd42..a69343d6dd 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -66,11 +66,14 @@ function mainAgentsModules() { $modulegroup = get_parameter('modulegroup', 0); $refr = get_parameter('refresh', 0); // By default 30 seconds + $recursion = get_parameter('recursion', 0); $group_id = (int)get_parameter('group_id', 0); $offset = (int)get_parameter('offset', 0); $hor_offset = (int)get_parameter('hor_offset', 0); $block = $config['block_size']; + if(get_parameter('modulegroup') != null){ $agents_id = (array)get_parameter('id_agents2', -1); + } $selection_a_m = (int)get_parameter('selection_agent_module'); $modules_selected = (array)get_parameter('module', 0); $update_item = (string)get_parameter('edit_item',''); @@ -139,6 +142,8 @@ function mainAgentsModules() { $filter_groups_label = ''.__('Group').''; $filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;'); + $filter_recursion_label = ''.__('Recursion').''; + $filter_recursion = html_print_checkbox('recursion', 1, 0, true); //groups module $filter_module_groups_label = ''.__('Module group').''; $filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", @@ -245,12 +250,12 @@ function mainAgentsModules() { if($config['pure'] != 1){ echo '
'; + . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">'; echo ''; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -375,9 +380,14 @@ function mainAgentsModules() { } if ($group_id > 0) { - $filter_groups['id_grupo'] = $group_id; + if($recursion){ + $filter_groups['id_grupo'] = array_merge($group_id, + groups_get_id_recursive($group_id, true)); + } + else{ + $filter_groups['id_grupo'] = $group_id; + } } - $agents = agents_get_agents ($filter_groups); $nagents = count($agents); @@ -675,12 +685,14 @@ $ignored_params['refresh']=''; } $("#group_id").change (function () { + jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", "get_agents_group_json" : 1, "id_group" : this.value, "privilege" : "AW", - "keys_prefix" : "_" + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') }, function (data, status) { $("#id_agents2").html(''); @@ -699,7 +711,34 @@ $ignored_params['refresh']=''; "json" ); }); - + + $("#checkbox-recursion").change (function () { + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "id_group" : $("#group_id").val(), + "privilege" : "AW", + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') + }, + function (data, status) { + $("#id_agents2").html(''); + $("#module").html(''); + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + $("#id_agents2").append (option); + }); + }, + "json" + ); + }); + $("#modulegroup").change (function () { jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 0593021bdc..2651751809 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -911,6 +911,9 @@ You can of course remove the warnings, that's why we include the source and do n elseif(check_acl ($config['id_user'], 0, "RM")) html_print_select_groups($config['id_user'], "RM", true, 'combo_group', $group, ''); + + echo "   ".__('Recursion').html_print_checkbox('recursion', 1, 0, true); + ?> @@ -2001,7 +2004,38 @@ $(document).ready (function () { "get_agents_group_json" : 1, "id_group" : this.value, "privilege" : "AW", - "keys_prefix" : "_" + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') + }, + function (data, status) { + $("#id_agents").html(''); + $("#id_agents2").html(''); + $("#module").html(''); + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + $("#id_agents2").append (option); + }); + }, + "json" + ); + } + ); + + $("#checkbox-recursion").change ( + function () { + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "id_group" : $("#combo_group").val(), + "privilege" : "AW", + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') }, function (data, status) { $("#id_agents").html(''); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 7f8ef41777..f661a97e1a 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -47,7 +47,7 @@ if (is_ajax ()) { $id_group = (int) get_parameter('id_group'); if ($get_agents_group_json) { $id_group = (int) get_parameter('id_group'); - $recursion = (int) get_parameter ('recursion', 0); + $recursion = get_parameter ('recursion'); $id_os = get_parameter('id_os', ''); $agent_name = get_parameter('name', ''); $privilege = (string) get_parameter ('privilege', "AR"); @@ -58,7 +58,7 @@ if (is_ajax ()) { if ($id_group > 0) { $groups = array($id_group); - if ($recursion) { + if ($recursion === 'true') { $groups = array_merge($groups, groups_get_id_recursive($id_group, true)); }
" . $filter_groups_label . "" . $filter_groups . "" . $filter_groups ."   ". $filter_recursion_label . $filter_recursion. "" . $filter_module_groups_label . "