|
|
 |
« on: September 02, 2010, 01:00:02 PM » |
|
Revision: 3214 http://pandora.svn.sourceforge.net/pandora/?rev=3214&view=revAuthor: zarzuelo Date: 2010-09-02 11:03:47 +0000 (Thu, 02 Sep 2010) Log Message: ----------- 2010-09-02 Sergio Martin
* godmode/massive/massive_operations.php godmode/massive/massive_enable_disable_alerts.php: Added the disable/enable alerts massive operation
Modified Paths: -------------- trunk/pandora_console/ChangeLog trunk/pandora_console/godmode/massive/massive_operations.php
Added Paths: ----------- trunk/pandora_console/godmode/massive/massive_enable_disable_alerts.php
Modified: trunk/pandora_console/ChangeLog =================================================================== --- trunk/pandora_console/ChangeLog 2010-09-01 13:39:06 UTC (rev 3213) +++ trunk/pandora_console/ChangeLog 2010-09-02 11:03:47 UTC (rev 3214) @@ -1,3 +1,9 @@ +2010-09-02 Sergio Martin + + * godmode/massive/massive_operations.php + godmode/massive/massive_enable_disable_alerts.php: Added + the disable/enable alerts massive operation + 2010-09-01 Sergio Martin
* operation/menu.php
Added: trunk/pandora_console/godmode/massive/massive_enable_disable_alerts.php =================================================================== --- trunk/pandora_console/godmode/massive/massive_enable_disable_alerts.php (rev 0) +++ trunk/pandora_console/godmode/massive/massive_enable_disable_alerts.php 2010-09-02 11:03:47 UTC (rev 3214) @@ -0,0 +1,206 @@ ++ +// Pandora FMS - http://pandorafms.com +// ================================================== +// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas +// Please see http://pandorafms.org for full contribution list + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation for version 2. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + +// Load global vars +check_login (); + +if (! check_acl ($config['id_user'], 0, "AW")) { + audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation", + "Trying to access massive alert deletion"); + require ("general/noaccess.php"); + return; +} + +require_once ('include/functions_agents.php'); +require_once ('include/functions_alerts.php'); + +if (is_ajax ()) { + $get_alerts = (bool) get_parameter ('get_alerts'); + + if ($get_alerts) { + $id_group = (int) get_parameter ('id_group'); + $id_alert_template = (int) get_parameter ('id_alert_template'); + $disabled = (int) get_parameter ('disabled'); + + $agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group, + array('order' => 'tagente.nombre, talert_template_modules.disabled', '`talert_template_modules`.disabled' => $disabled), + array ('LEFT(CONCAT(LEFT(tagente.nombre,40), " - ", tagente_modulo.nombre), 85) as agent_agentmodule_name', + 'talert_template_modules.id as template_module_id')); + + echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name')); + return; + } + return; +} + +$id_group = (int) get_parameter ('id_group'); +$action = (string) get_parameter ('action', ''); + +$result = false; + +switch($action) { + case 'enable_alerts': + $id_alert_template = (int) get_parameter ('id_alert_template_disabled', 0); + $id_disabled_alerts = get_parameter_post ('id_disabled_alerts', array()); + foreach($id_disabled_alerts as $id_alert) { + $result = set_alerts_agent_module_disable ($id_alert, false); + } + print_result_message ($result, __('Successfully enabled'), __('Could not be enabled')); + break; + case 'disable_alerts': + $id_alert_template = (int) get_parameter ('id_alert_template_enabled', 0); + $id_enabled_alerts = get_parameter_post ('id_enabled_alerts', array()); + + foreach($id_enabled_alerts as $id_alert) { + $result = set_alerts_agent_module_disable ($id_alert, true); + } + print_result_message ($result, __('Successfully disabled'), __('Could not be disabled')); + break; + default: + $id_alert_template = (int) get_parameter ('id_alert_template', 0); + break; +} + +$groups = get_user_groups (); + +$table->id = 'delete_table'; +$table->width = '95%'; +$table->data = array (); +$table->style = array (); +$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->data = array (); + +$templates = get_alert_templates (false, array ('id', 'name')); +$table->data[0][0] = ''; + +print_table ($table); + +echo ' '; + +require_jquery_file ('form'); +require_jquery_file ('pandora.controls'); +?> + +
Modified: trunk/pandora_console/godmode/massive/massive_operations.php =================================================================== --- trunk/pandora_console/godmode/massive/massive_operations.php 2010-09-01 13:39:06 UTC (rev 3213) +++ trunk/pandora_console/godmode/massive/massive_operations.php 2010-09-02 11:03:47 UTC (rev 3214) @@ -34,7 +34,8 @@
$options_alerts = array('add_alerts' => __('Massive alerts addition'), 'delete_alerts' => __('Massive alerts deletion'), - 'add_action_alerts' => __('Massive alert actions addition'), 'delete_action_alerts' => __('Massive alert actions deletion')); + 'add_action_alerts' => __('Massive alert actions addition'), 'delete_action_alerts' => __('Massive alert actions deletion'), + 'enable_disable_alerts' => __('Massive alert enable/disable'));
$options_agents = array('delete_agents' => __('Massive agents deletion'));
@@ -133,6 +134,9 @@ case 'add_action_alerts': require_once ('godmode/massive/massive_add_action_alerts.php'); break; + case 'enable_disable_alerts': + require_once ('godmode/massive/massive_enable_disable_alerts.php'); + break; case 'delete_agents': require_once ('godmode/massive/massive_delete_agents.php'); break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Pandora-commits mailing list Pandora-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pandora-commits
|