2011-09-03 Junichi Satoh <junichi@rworks.jp>
* godmode/massive/massive_delete_alerts.php, godmode/massive/massive_edit_modules.php, operation/agentes/ver_agente.php: Added group recursion feature, it allows to search agents in child groups. These three changes are contributed by Yusuke Arai. Thanks! git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4896 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ff57398a58
commit
7a1b9f9c1c
|
@ -1,3 +1,11 @@
|
|||
2011-09-03 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* godmode/massive/massive_delete_alerts.php,
|
||||
godmode/massive/massive_edit_modules.php,
|
||||
operation/agentes/ver_agente.php: Added group recursion feature,
|
||||
it allows to search agents in child groups. These three changes
|
||||
are contributed by Yusuke Arai. Thanks!
|
||||
|
||||
2011-09-02 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* install.php: Fixed css style in this view.
|
||||
|
|
|
@ -31,13 +31,27 @@ require_once ($config['homedir'].'/include/functions_users.php');
|
|||
|
||||
if (is_ajax ()) {
|
||||
$get_agents = (bool) get_parameter ('get_agents');
|
||||
$recursion = (int) get_parameter ('recursion');
|
||||
|
||||
if ($get_agents) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$id_alert_template = (int) get_parameter ('id_alert_template');
|
||||
|
||||
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
if ($recursion) {
|
||||
$groups = groups_get_id_recursive($id_group, true);
|
||||
}
|
||||
else {
|
||||
$groups = array($id_group);
|
||||
}
|
||||
|
||||
$agents_alerts = array();
|
||||
foreach( $groups as $group ) {
|
||||
$agents_alerts_one_group = alerts_get_agents_with_alert_template ($id_alert_template, $group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
if (is_array($agents_alerts_one_group)) {
|
||||
$agents_alerts = array_merge($agents_alerts, $agents_alerts_one_group);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode (index_array ($agents_alerts, 'id_agente', 'nombre'));
|
||||
return;
|
||||
|
@ -133,8 +147,8 @@ $table->data[0][3] = '';
|
|||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group,
|
||||
'', '', '', true, false, true, '', $id_alert_template == 0);
|
||||
$table->data[1][2] = '';
|
||||
$table->data[1][3] = '';
|
||||
$table->data[1][2] = __('Group recursion');
|
||||
$table->data[1][3] = html_print_checkbox ("recursion", 1, false, true, false);
|
||||
|
||||
$table->data[2][0] = __('Agents');
|
||||
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
|
||||
|
@ -189,6 +203,7 @@ $(document).ready (function () {
|
|||
{"page" : "godmode/massive/massive_delete_alerts",
|
||||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : $("#checkbox-recursion").attr ("checked") ? 1 : 0,
|
||||
"id_alert_template" : $("#id_alert_template").attr ("value")
|
||||
},
|
||||
function (data, status) {
|
||||
|
@ -203,6 +218,10 @@ $(document).ready (function () {
|
|||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$("#checkbox-recursion").click(function (){
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -95,7 +95,7 @@ $agents_select = get_parameter('agents');
|
|||
$agents_id = get_parameter('id_agents');
|
||||
$modules_select = get_parameter('module');
|
||||
$selection_mode = get_parameter('selection_mode', 'modules');
|
||||
|
||||
$recursion = get_parameter('recursion');
|
||||
|
||||
$update = (bool) get_parameter_post ('update');
|
||||
|
||||
|
@ -204,7 +204,7 @@ $table->style[2] = 'font-weight: bold';
|
|||
$table->rowstyle = array ();
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '35%'; /* Fixed using javascript */
|
||||
$table->size[1] = '35%';
|
||||
$table->size[2] = '15%';
|
||||
$table->size[3] = '35%';
|
||||
if (! $module_type) {
|
||||
|
@ -278,7 +278,8 @@ $groups = groups_get_all(true);
|
|||
$groups[0] = __('All');
|
||||
$table->colspan[2][1] = 2;
|
||||
$table->data[2][1] = html_print_select ($groups, 'groups_select',
|
||||
'', true, __('Select'), -1, true, false, true);
|
||||
'', true, __('Select'), -1, true, false, true).
|
||||
' '.__('Group recursion').' '.html_print_checkbox ("recursion", 1, false, true, false);
|
||||
$table->data[2][3] = __('Select all modules of this group').' '.html_print_checkbox_extended ("force_group", 'group', '', '', false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
$table->rowstyle[3] = 'vertical-align: top;';
|
||||
|
@ -446,7 +447,7 @@ $(document).ready (function () {
|
|||
function show_form() {
|
||||
$("td#delete_table-0-1, td#delete_table-edit1-1, td#delete_table-edit2-1").css ("width", "35%");
|
||||
$("#form_edit input[type=text]").attr ("value", "");
|
||||
$("#form_edit input[type=checkbox]").removeAttr ("checked");
|
||||
$("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked");
|
||||
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").show ();
|
||||
}
|
||||
|
||||
|
@ -476,6 +477,9 @@ $(document).ready (function () {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(this.id == "checkbox-recursion"){
|
||||
$("#groups_select").trigger("change");
|
||||
}
|
||||
else {
|
||||
if(this.checked) {
|
||||
$(".select_agents_row_2").css('display', 'none');
|
||||
|
@ -527,6 +531,7 @@ $(document).ready (function () {
|
|||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"recursion" : $("#checkbox-recursion").attr ("checked") ? 1 : 0,
|
||||
"id_group" : this.value
|
||||
},
|
||||
function (data, status) {
|
||||
|
|
|
@ -45,18 +45,21 @@ if (is_ajax ()) {
|
|||
|
||||
if ($get_agents_group_json) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$recursion = (int) get_parameter ('recursion', 0);
|
||||
|
||||
if($id_group > 0)
|
||||
$filter = sprintf(" WHERE id_grupo = %d", $id_group);
|
||||
if($id_group > 0) {
|
||||
$groups = array($id_group);
|
||||
if ($recursion) {
|
||||
$groups = array_merge($groups, groups_get_id_recursive($id_group, true));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$groups_orig = users_get_groups();
|
||||
|
||||
$a = 0;
|
||||
$groups = array_keys($groups_orig);
|
||||
|
||||
$filter = " WHERE id_grupo IN (". implode(',', $groups) .")";
|
||||
}
|
||||
|
||||
$filter = " WHERE id_grupo IN (". implode(',', $groups) .")";
|
||||
$agents = db_get_all_rows_sql("SELECT id_agente, nombre FROM tagente". $filter);
|
||||
|
||||
echo json_encode($agents);
|
||||
|
|
Loading…
Reference in New Issue