Add recursion group search for agent/module view and angent/module item in reports - #1113
This commit is contained in:
parent
ab3b6838b9
commit
dc33195358
|
@ -66,11 +66,14 @@ function mainAgentsModules() {
|
||||||
$modulegroup = get_parameter('modulegroup', 0);
|
$modulegroup = get_parameter('modulegroup', 0);
|
||||||
$refr = get_parameter('refresh', 0); // By default 30 seconds
|
$refr = get_parameter('refresh', 0); // By default 30 seconds
|
||||||
|
|
||||||
|
$recursion = get_parameter('recursion', 0);
|
||||||
$group_id = (int)get_parameter('group_id', 0);
|
$group_id = (int)get_parameter('group_id', 0);
|
||||||
$offset = (int)get_parameter('offset', 0);
|
$offset = (int)get_parameter('offset', 0);
|
||||||
$hor_offset = (int)get_parameter('hor_offset', 0);
|
$hor_offset = (int)get_parameter('hor_offset', 0);
|
||||||
$block = $config['block_size'];
|
$block = $config['block_size'];
|
||||||
|
if(get_parameter('modulegroup') != null){
|
||||||
$agents_id = (array)get_parameter('id_agents2', -1);
|
$agents_id = (array)get_parameter('id_agents2', -1);
|
||||||
|
}
|
||||||
$selection_a_m = (int)get_parameter('selection_agent_module');
|
$selection_a_m = (int)get_parameter('selection_agent_module');
|
||||||
$modules_selected = (array)get_parameter('module', 0);
|
$modules_selected = (array)get_parameter('module', 0);
|
||||||
$update_item = (string)get_parameter('edit_item','');
|
$update_item = (string)get_parameter('edit_item','');
|
||||||
|
@ -139,6 +142,8 @@ function mainAgentsModules() {
|
||||||
$filter_groups_label = '<b>'.__('Group').'</b>';
|
$filter_groups_label = '<b>'.__('Group').'</b>';
|
||||||
$filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;');
|
$filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;');
|
||||||
|
|
||||||
|
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
|
||||||
|
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
|
||||||
//groups module
|
//groups module
|
||||||
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
$filter_module_groups_label = '<b>'.__('Module group').'</b>';
|
||||||
$filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name",
|
$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){
|
if($config['pure'] != 1){
|
||||||
echo '<form method="post" action="'
|
echo '<form method="post" action="'
|
||||||
. ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
|
. ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
|
||||||
|
|
||||||
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
|
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>" . $filter_groups_label . "</td>";
|
echo "<td>" . $filter_groups_label . "</td>";
|
||||||
echo "<td>" . $filter_groups . "</td>";
|
echo "<td>" . $filter_groups ." ". $filter_recursion_label . $filter_recursion. "</td>";
|
||||||
echo "<td></td>";
|
echo "<td></td>";
|
||||||
echo "<td></td>";
|
echo "<td></td>";
|
||||||
echo "<td>" . $filter_module_groups_label . "</td>";
|
echo "<td>" . $filter_module_groups_label . "</td>";
|
||||||
|
@ -375,9 +380,14 @@ function mainAgentsModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($group_id > 0) {
|
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);
|
$agents = agents_get_agents ($filter_groups);
|
||||||
$nagents = count($agents);
|
$nagents = count($agents);
|
||||||
|
|
||||||
|
@ -675,12 +685,14 @@ $ignored_params['refresh']='';
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#group_id").change (function () {
|
$("#group_id").change (function () {
|
||||||
|
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post ("ajax.php",
|
||||||
{"page" : "operation/agentes/ver_agente",
|
{"page" : "operation/agentes/ver_agente",
|
||||||
"get_agents_group_json" : 1,
|
"get_agents_group_json" : 1,
|
||||||
"id_group" : this.value,
|
"id_group" : this.value,
|
||||||
"privilege" : "AW",
|
"privilege" : "AW",
|
||||||
"keys_prefix" : "_"
|
"keys_prefix" : "_",
|
||||||
|
"recursion" : $('#checkbox-recursion').is(':checked')
|
||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
$("#id_agents2").html('');
|
$("#id_agents2").html('');
|
||||||
|
@ -699,7 +711,34 @@ $ignored_params['refresh']='';
|
||||||
"json"
|
"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 = $("<option></option>")
|
||||||
|
.attr ("value", value["id_agente"])
|
||||||
|
.html (value["alias"]);
|
||||||
|
$("#id_agents").append (option);
|
||||||
|
$("#id_agents2").append (option);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
$("#modulegroup").change (function () {
|
$("#modulegroup").change (function () {
|
||||||
jQuery.post ("ajax.php",
|
jQuery.post ("ajax.php",
|
||||||
{"page" : "operation/agentes/ver_agente",
|
{"page" : "operation/agentes/ver_agente",
|
||||||
|
|
|
@ -908,6 +908,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"))
|
elseif(check_acl ($config['id_user'], 0, "RM"))
|
||||||
html_print_select_groups($config['id_user'],
|
html_print_select_groups($config['id_user'],
|
||||||
"RM", true, 'combo_group', $group, '');
|
"RM", true, 'combo_group', $group, '');
|
||||||
|
|
||||||
|
echo " ".__('Recursion').html_print_checkbox('recursion', 1, 0, true);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1076,7 +1079,6 @@ You can of course remove the warnings, that's why we include the source and do n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// html_debug($agents);
|
|
||||||
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1994,7 +1996,38 @@ $(document).ready (function () {
|
||||||
"get_agents_group_json" : 1,
|
"get_agents_group_json" : 1,
|
||||||
"id_group" : this.value,
|
"id_group" : this.value,
|
||||||
"privilege" : "AW",
|
"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 = $("<option></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) {
|
function (data, status) {
|
||||||
$("#id_agents").html('');
|
$("#id_agents").html('');
|
||||||
|
|
|
@ -47,7 +47,7 @@ if (is_ajax ()) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
if ($get_agents_group_json) {
|
if ($get_agents_group_json) {
|
||||||
$id_group = (int) get_parameter('id_group');
|
$id_group = (int) get_parameter('id_group');
|
||||||
$recursion = (int) get_parameter ('recursion', 0);
|
$recursion = get_parameter ('recursion');
|
||||||
$id_os = get_parameter('id_os', '');
|
$id_os = get_parameter('id_os', '');
|
||||||
$agent_name = get_parameter('name', '');
|
$agent_name = get_parameter('name', '');
|
||||||
$privilege = (string) get_parameter ('privilege', "AR");
|
$privilege = (string) get_parameter ('privilege', "AR");
|
||||||
|
@ -58,7 +58,7 @@ if (is_ajax ()) {
|
||||||
|
|
||||||
if ($id_group > 0) {
|
if ($id_group > 0) {
|
||||||
$groups = array($id_group);
|
$groups = array($id_group);
|
||||||
if ($recursion) {
|
if ($recursion === 'true') {
|
||||||
$groups = array_merge($groups,
|
$groups = array_merge($groups,
|
||||||
groups_get_id_recursive($id_group, true));
|
groups_get_id_recursive($id_group, true));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue