2011-08-22 Junichi Satoh <junichi@rworks.jp>
* include/javascript/jquery.pandora.controls.js, godmode/groups/group_list.php, godmode/massive/massive_delete_agents.php, godmode/massive/massive_edit_agents.php, godmode/massive/massive_delete_modules.php, include/functions_modules.php: Added group recursion feature, it allows to search agents in child groups. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4797 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
5dfce3c495
commit
13ba59c2cd
|
@ -1,3 +1,13 @@
|
|||
2011-08-22 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* include/javascript/jquery.pandora.controls.js,
|
||||
godmode/groups/group_list.php,
|
||||
godmode/massive/massive_delete_agents.php,
|
||||
godmode/massive/massive_edit_agents.php,
|
||||
godmode/massive/massive_delete_modules.php,
|
||||
include/functions_modules.php: Added group recursion feature,
|
||||
it allows to search agents in child groups.
|
||||
|
||||
2011-08-22 SAncho Lerena <slerena@ærtica.es>
|
||||
|
||||
* pandora_console.spec: Updated spec for being used in Suse build
|
||||
|
|
|
@ -66,6 +66,7 @@ if (is_ajax ()) {
|
|||
$disabled = (int) get_parameter ('disabled', 0);
|
||||
$search = (string) get_parameter ('search', '');
|
||||
$keycount = (int) get_parameter ('keycount', 0);
|
||||
$recursion = (int) get_parameter ('recursion', 0);
|
||||
|
||||
if (! check_acl ($config['id_user'], $id_group, "AR")) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
|
@ -81,7 +82,7 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
$agents['keycount'] = $keycount;
|
||||
$agents = $agents + agents_get_group_agents ($id_group, $filter, "none");
|
||||
$agents = $agents + agents_get_group_agents ($id_group, $filter, "none", false, $recursion);
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ function process_manage_delete ($id_agents) {
|
|||
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$id_agents = get_parameter ('id_agents');
|
||||
$recursion = get_parameter('recursion');
|
||||
|
||||
$delete = (bool) get_parameter_post ('delete');
|
||||
|
||||
|
@ -91,12 +92,16 @@ $table->style[0] = 'font-weight: bold; vertical-align:top';
|
|||
$table->style[2] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '85%';
|
||||
$table->size[1] = '35%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '35%';
|
||||
|
||||
$table->data = array ();
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
|
||||
false, '', '', true);
|
||||
$table->data[0][2] = __('Group recursion');
|
||||
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
|
||||
|
||||
$table->data[1][0] = __('Agents');
|
||||
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
|
||||
|
@ -122,8 +127,14 @@ ui_require_jquery_file ('pandora.controls');
|
|||
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function (){
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
$("#id_group").pandoraSelectGroupAgent ({
|
||||
agentSelect: "select#id_agents"
|
||||
agentSelect: "select#id_agents",
|
||||
recursion: function() {return recursion}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -34,11 +34,13 @@ if (is_ajax ()) {
|
|||
if ($get_agents) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$module_name = (string) get_parameter ('module_name');
|
||||
$recursion = (int) get_parameter ('recursion');
|
||||
|
||||
$agents_modules = modules_get_agents_with_module_name ($module_name, $id_group,
|
||||
array ('delete_pending' => 0,
|
||||
'tagente_modulo.disabled' => 0),
|
||||
array ('tagente.id_agente', 'tagente.nombre'));
|
||||
array ('tagente.id_agente', 'tagente.nombre'),
|
||||
$recursion);
|
||||
|
||||
echo json_encode (index_array ($agents_modules, 'id_agente', 'nombre'));
|
||||
return;
|
||||
|
@ -79,6 +81,7 @@ function process_manage_delete ($module_name, $id_agents) {
|
|||
$id_group = (int) get_parameter ('id_group');
|
||||
$id_agents = (array) get_parameter ('id_agents');
|
||||
$module_name = (string) get_parameter ('module_name');
|
||||
$recursion = get_parameter ('recursion');
|
||||
|
||||
$delete = (bool) get_parameter_post ('delete');
|
||||
|
||||
|
@ -104,7 +107,9 @@ $table->style[0] = 'font-weight: bold; vertical-align:top';
|
|||
$table->style[2] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '85%';
|
||||
$table->size[1] = '35%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '35%';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
|
@ -121,6 +126,8 @@ $table->data[0][1] = html_print_select($modulesSelect,
|
|||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
|
||||
false, '', '', true, false, true, '', empty ($module_name));
|
||||
$table->data[1][2] = __('Group recursion');
|
||||
$table->data[1][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
|
||||
|
||||
$table->data[2][0] = __('Agent');
|
||||
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
|
||||
|
@ -160,6 +167,12 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
if ($("#module_name").attr ("value") != "") {
|
||||
$("#id_group").trigger("change");
|
||||
}
|
||||
});
|
||||
|
||||
$("#id_group").change (function () {
|
||||
var $select = $("#id_agents").disable ();
|
||||
$("#agent_loading").show ();
|
||||
|
@ -169,7 +182,8 @@ $(document).ready (function () {
|
|||
{"page" : "godmode/massive/massive_delete_modules",
|
||||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"module_name" : $("#module_name").attr ("value")
|
||||
"module_name" : $("#module_name").attr ("value"),
|
||||
"recursion" : $("#checkbox-recursion").attr ("checked") ? 1 : 0
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
|
|
|
@ -49,6 +49,7 @@ if (is_ajax ()) {
|
|||
}
|
||||
|
||||
$update_agents = get_parameter ('update_agents', 0);
|
||||
$recursion = get_parameter ('recursion');
|
||||
|
||||
if ($update_agents) {
|
||||
$values = array();
|
||||
|
@ -186,12 +187,16 @@ $table->style[0] = 'font-weight: bold; vertical-align:top';
|
|||
$table->style[2] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '85%';
|
||||
$table->size[1] = '35%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '35%';
|
||||
|
||||
$table->data = array ();
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
|
||||
false, '', '', true);
|
||||
$table->data[0][2] = __('Group recursion');
|
||||
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false);
|
||||
|
||||
$table->data[1][0] = __('Agents');
|
||||
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
|
||||
|
@ -510,12 +515,20 @@ $(document).ready (function () {
|
|||
}
|
||||
);
|
||||
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function (){
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
$("#id_group").pandoraSelectGroupAgent ({
|
||||
agentSelect: "select#id_agents"
|
||||
agentSelect: "select#id_agents",
|
||||
recursion: function() {return recursion}
|
||||
});
|
||||
|
||||
$("#id_group").pandoraSelectGroupAgentDisabled ({
|
||||
agentSelect: "select#id_agents"
|
||||
agentSelect: "select#id_agents",
|
||||
recursion: function() {return recursion}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -305,7 +305,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
*
|
||||
* @return array All the agents which have a module with the name given.
|
||||
*/
|
||||
function modules_get_agents_with_module_name ($module_name, $id_group, $filter = false, $fields = 'tagente.*') {
|
||||
function modules_get_agents_with_module_name ($module_name, $id_group, $filter = false, $fields = 'tagente.*', $childGroups = false) {
|
||||
if (empty ($module_name))
|
||||
return false;
|
||||
|
||||
|
@ -313,7 +313,7 @@ function modules_get_agents_with_module_name ($module_name, $id_group, $filter =
|
|||
$filter = array ();
|
||||
$filter[] = 'tagente_modulo.id_agente = tagente.id_agente';
|
||||
$filter['tagente_modulo.nombre'] = $module_name;
|
||||
$filter['tagente.id_agente'] = array_keys (agents_get_group_agents ($id_group, false, "none"));
|
||||
$filter['tagente.id_agente'] = array_keys (agents_get_group_agents ($id_group, false, "none", false, $childGroups));
|
||||
|
||||
return db_get_all_rows_filter ('tagente, tagente_modulo',
|
||||
$filter, $fields);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
pandoraSelectGroupAgent: new function() {
|
||||
this.defaults = {
|
||||
agentSelect: "select#id_agent",
|
||||
recursion: 0,
|
||||
loading: "#agent_loading",
|
||||
callbackBefore: dummyFunc,
|
||||
callbackPre: dummyFunc,
|
||||
|
@ -33,7 +34,8 @@
|
|||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/groups/group_list",
|
||||
"get_group_agents" : 1,
|
||||
"id_group" : this.value
|
||||
"id_group" : this.value,
|
||||
"recursion" : config.recursion
|
||||
},
|
||||
function (data, status) {
|
||||
jQuery.each (data, function (id, value) {
|
||||
|
@ -60,6 +62,7 @@
|
|||
pandoraSelectGroupAgentDisabled: new function() {
|
||||
this.defaults = {
|
||||
agentSelect: "select#id_agent",
|
||||
recursion: 0,
|
||||
loading: "#agent_loading",
|
||||
callbackBefore: dummyFunc,
|
||||
callbackPre: dummyFunc,
|
||||
|
@ -87,7 +90,8 @@
|
|||
{"page" : "godmode/groups/group_list",
|
||||
"get_group_agents" : 1,
|
||||
"disabled" : 1,
|
||||
"id_group" : this.value
|
||||
"id_group" : this.value,
|
||||
"recursion" : config.recursion
|
||||
},
|
||||
function (data, status) {
|
||||
jQuery.each (data, function (id, value) {
|
||||
|
|
Loading…
Reference in New Issue