diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 34dee668fd..ce6dc14ec1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,18 @@ +2009-05-19 Esteban Sanchez + + * godmode/agentes/massive_delete_alerts.php: Fixed an error when selecting + multiple agents. Changed some strings. Deleted "None" from the agents list. + Style corrections. + + * godmode/agentes/massive_delete_modules.php: Changed the way it works. + Fixes #2707976. + + * images/download.png, images/star.png, images/note.png: More tango icons. + + * include/functions_alerts.php: Style corrections. + + * include/functions_modules.php: Added get_agents_with_module_name(). + 2009-05-19 Esteban Sanchez * include/functions_alerts.php: Added get_agents_with_alert_template(). diff --git a/pandora_console/godmode/agentes/massive_delete_alerts.php b/pandora_console/godmode/agentes/massive_delete_alerts.php index 605df98c35..0b620add95 100644 --- a/pandora_console/godmode/agentes/massive_delete_alerts.php +++ b/pandora_console/godmode/agentes/massive_delete_alerts.php @@ -57,15 +57,14 @@ function process_manage_delete ($id_alert_template, $id_agents) { return false; } - $modules = get_agent_modules ($id_agents, 'id_agente_modulo', false, true); - process_sql_begin (); + $modules = get_agent_modules ($id_agents, 'id_agente_modulo', false, true); $success = delete_alert_agent_module (false, array ('id_agent_module' => $modules, 'id_alert_template' => $id_alert_template)); if (! $success) { - echo '

'.__('There was an error deleting the alert, the operation has been cancelled').'

'; - echo '

'.__('Could not delete alert in agent %s', get_agent_name ($id_agent)).'

'; + echo '

'.__('There was an error deleting the alerts, the operation has been cancelled').'

'; + echo '

'.__('Could not delete alerts').'

'; process_sql_rollback (); } else { echo '

'.__('Successfully deleted').'

'; @@ -74,7 +73,7 @@ function process_manage_delete ($id_alert_template, $id_agents) { } $id_group = (int) get_parameter ('id_group'); -$id_agents = (array) get_parameter ('id_agents'); +$id_agents = get_parameter ('id_agents'); $id_alert_template = (int) get_parameter ('id_alert_template'); $delete = (bool) get_parameter_post ('delete'); @@ -112,7 +111,7 @@ $table->data[2][0] .= ''; $agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group, false, array ('tagente.nombre', 'tagente.id_agente')); $table->data[2][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'), - 'id_agents', '', '', '', '', true, true, true, '', $id_alert_template == 0); + 'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0); echo '
'; print_table ($table); @@ -136,15 +135,15 @@ $(document).ready (function () { if (this.value != 0) { $("#id_agents").enable (); $("#id_group").enable ().change (); - } else { $("#id_group, #id_agents").disable (); } }); + $("#id_group").change (function () { var $select = $("#id_agents").disable (); $("#agent_loading").show (); - $("option[value!=0]", $select).remove (); + $("option", $select).remove (); jQuery.post ("ajax.php", {"page" : "godmode/agentes/massive_delete_alerts", diff --git a/pandora_console/godmode/agentes/massive_delete_modules.php b/pandora_console/godmode/agentes/massive_delete_modules.php index 3ae1a70500..200a1bd8cd 100644 --- a/pandora_console/godmode/agentes/massive_delete_modules.php +++ b/pandora_console/godmode/agentes/massive_delete_modules.php @@ -29,25 +29,44 @@ if (! give_acl ($config['id_user'], 0, "AW")) { require_once ('include/functions_agents.php'); require_once ('include/functions_modules.php'); +if (is_ajax ()) { + $get_agents = (bool) get_parameter ('get_agents'); + + if ($get_agents) { + $id_group = (int) get_parameter ('id_group'); + $module_name = (string) get_parameter ('module_name'); + + $agents_modules = get_agents_with_module_name ($module_name, $id_group, + array ('delete_pending' => 0, + '`tagente_modulo`.disabled' => 0), + array ('tagente.id_agente', 'tagente.nombre')); + + echo json_encode (index_array ($agents_modules, 'id_agente', 'nombre')); + return; + } + return; +} + echo '

'.__('Massive modules deletion').'

'; -function process_manage_delete ($id_modules) { - if (empty ($id_modules)) { - echo '

'.__('No modules selected').'

'; +function process_manage_delete ($module_name, $id_agents) { + if (empty ($module_name)) { + echo '

'.__('No module selected').'

'; + return false; + } + + if (empty ($id_agents)) { + echo '

'.__('No agents selected').'

'; return false; } process_sql_begin (); - - foreach ($id_modules as $id_module) { - $success = delete_agent_module ($id_module); - if (! $success) - break; - } - + $modules = get_agent_modules ($id_agents, 'id_agente_modulo', + array ('nombre' => $module_name), true); + $success = delete_agent_module ($modules); if (! $success) { - echo '

'.__('There was an error deleting the module, the operation has been cancelled').'

'; - echo '

'.__('Could not delete module').' '.get_agentmodule_name ($id_module).'

'; + echo '

'.__('There was an error deleting the modules, the operation has been cancelled').'

'; + echo '

'.__('Could not delete modules').'

'; process_sql_rollback (); } else { echo '

'.__('Successfully deleted').'

'; @@ -56,13 +75,13 @@ function process_manage_delete ($id_modules) { } $id_group = (int) get_parameter ('id_group'); -$id_agent = (int) get_parameter ('id_agent'); -$id_modules = get_parameter ('id_modules'); +$id_agents = (array) get_parameter ('id_agents'); +$module_name = (string) get_parameter ('module_name'); $delete = (bool) get_parameter_post ('delete'); if ($delete) { - process_manage_delete ($id_modules); + process_manage_delete ($module_name, $id_agents); } $groups = get_user_groups (); @@ -78,26 +97,27 @@ $table->size[0] = '15%'; $table->size[1] = '85%'; $table->data = array (); -$table->data[0][0] = __('Group'); -$table->data[0][1] = print_select ($groups, 'id_group', $id_group, - false, '', '', true); -$table->data[1][0] = __('Agent'); -$table->data[1][0] .= ''; -$table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"), - 'id_agent', $id_agent, false, __('None'), 0, true); +$table->data[0][0] = __('Modules'); +$modules = array (); +$modules = get_db_all_rows_filter ('tagente_modulo', false, 'DISTINCT(nombre)'); +$table->data[0][1] = print_select (index_array ($modules, 'nombre', 'nombre'), + 'module_name', $module_name, false, __('Select'), '', true); -$table->data[2][0] = __('Modules'); -$table->data[2][0] .= '