diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 41aba3ba0b..407996c885 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2010-08-17 Sergio Martin + + * godmode/agentes/massive_copy_modules.php + godmode/agentes/massive_add_alerts.php + godmode/agentes/massive_delete_agents.php + godmode/agentes/massive_config.php + godmode/agentes/massive_delete_action_alerts.php + godmode/agentes/massive_delete_alerts.php + godmode/agentes/massive_edit_modules.php + godmode/agentes/massive_operations.php + godmode/agentes/massive_delete_modules.php + godmode/agentes/massive_add_action_alerts.php: Restructured the + tabs of masive operations. Now there are only four tabs: module, + agents, alerts and the enterprise policy masive operations. All + the operations are now classified under this hierarchy + 2010-08-17 Sergio Martin * extensions/agents_modules.php: Added an agent group filter into diff --git a/pandora_console/godmode/agentes/massive_add_action_alerts.php b/pandora_console/godmode/agentes/massive_add_action_alerts.php index 389d351ecf..bf1d8a3afc 100644 --- a/pandora_console/godmode/agentes/massive_add_action_alerts.php +++ b/pandora_console/godmode/agentes/massive_add_action_alerts.php @@ -76,8 +76,6 @@ if ($add) { } -echo '

'.__('Massive alert actions addition').'

'; - $groups = get_user_groups (); $table->id = 'delete_table'; @@ -114,7 +112,7 @@ $table->data[2][1] .= print_input_text ('fires_max', 0, '', 4, 10, true); $table->data[2][1] .= print_help_icon ("alert-matches", true); $table->data[2][1] .= ''; -echo '
'; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_add_alerts.php b/pandora_console/godmode/agentes/massive_add_alerts.php index 60895e4122..ee5c8c0b62 100644 --- a/pandora_console/godmode/agentes/massive_add_alerts.php +++ b/pandora_console/godmode/agentes/massive_add_alerts.php @@ -41,7 +41,6 @@ if (is_ajax ()) { return; } -echo '

'.__('Massive alerts addition').'

'; function process_manage_add ($id_alert_template, $id_agents) { if (empty ($id_agents)) { echo '

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

'; @@ -118,7 +117,7 @@ $table->data[2][0] = __('Alert template'); $table->data[2][1] = print_select (index_array ($templates, 'id', 'name'), 'id_alert_template', $id_alert_template, false, __('Select'), 0, true); -echo ''; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_config.php b/pandora_console/godmode/agentes/massive_copy_modules.php similarity index 98% rename from pandora_console/godmode/agentes/massive_config.php rename to pandora_console/godmode/agentes/massive_copy_modules.php index c63f6e25cf..61644622fd 100644 --- a/pandora_console/godmode/agentes/massive_config.php +++ b/pandora_console/godmode/agentes/massive_copy_modules.php @@ -28,8 +28,6 @@ require_once ('include/functions_agents.php'); require_once ('include/functions_alerts.php'); require_once ('include/functions_modules.php'); -echo '

'.__('Massive copy').'

'; - $source_id_group = (int) get_parameter ('source_id_group'); $source_id_agent = (int) get_parameter ('source_id_agent'); $destiny_id_group = (int) get_parameter ('destiny_id_group'); @@ -71,7 +69,7 @@ $table->data[0][3] = print_select (get_group_agents ($source_id_group, false, "n // array('style' => 'background: url(images/lightning.png) no-repeat right;'), true) // . ' ' . __("Type two chars at least for search") . ''; -echo ''; +echo ''; echo '
'; echo ''.__('Source'); diff --git a/pandora_console/godmode/agentes/massive_delete_action_alerts.php b/pandora_console/godmode/agentes/massive_delete_action_alerts.php index 129c4bac96..939b64ee4b 100644 --- a/pandora_console/godmode/agentes/massive_delete_action_alerts.php +++ b/pandora_console/godmode/agentes/massive_delete_action_alerts.php @@ -76,8 +76,6 @@ if ($delete) { } -echo '

'.__('Massive alert actions deletion').'

'; - $groups = get_user_groups (); $table->id = 'delete_table'; @@ -106,7 +104,7 @@ $actions = get_alert_actions (); $table->data[2][0] = __('Action'); $table->data[2][1] = print_select ($actions, 'action', '', '', __('None'), 0, true); -echo ''; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_delete_agents.php b/pandora_console/godmode/agentes/massive_delete_agents.php index 8bac48b5fd..39b6e3facf 100644 --- a/pandora_console/godmode/agentes/massive_delete_agents.php +++ b/pandora_console/godmode/agentes/massive_delete_agents.php @@ -62,8 +62,6 @@ $id_agents = get_parameter ('id_agents'); $delete = (bool) get_parameter_post ('delete'); -echo '

'.__('Massive agent deletion').'

'; - if ($delete) { process_manage_delete ($id_agents); } @@ -92,7 +90,7 @@ $table->data[1][0] .= ''; $table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"), 'id_agents[]', 0, false, '', '', true, true); -echo ''; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_delete_alerts.php b/pandora_console/godmode/agentes/massive_delete_alerts.php index 10c4131fed..d680eaa354 100644 --- a/pandora_console/godmode/agentes/massive_delete_alerts.php +++ b/pandora_console/godmode/agentes/massive_delete_alerts.php @@ -43,7 +43,6 @@ if (is_ajax ()) { return; } -echo '

'.__('Massive alerts deletion').'

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

'.__('No alert selected').'

'; @@ -112,7 +111,7 @@ $agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group, $table->data[2][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'), 'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0); -echo ''; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_delete_modules.php b/pandora_console/godmode/agentes/massive_delete_modules.php index 132da98ba4..dbb02ffed0 100644 --- a/pandora_console/godmode/agentes/massive_delete_modules.php +++ b/pandora_console/godmode/agentes/massive_delete_modules.php @@ -45,8 +45,6 @@ if (is_ajax ()) { return; } -echo '

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

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

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

'; @@ -117,7 +115,7 @@ $agents = get_agents_with_module_name ($module_name, $id_group, $table->data[2][1] = print_select (index_array ($agents, 'id_agente', 'nombre'), 'id_agents[]', 0, false, __('None'), 0, true, true, true, '', empty ($module_name)); -echo ''; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_edit_modules.php b/pandora_console/godmode/agentes/massive_edit_modules.php index 5357758f3e..32b029ca53 100644 --- a/pandora_console/godmode/agentes/massive_edit_modules.php +++ b/pandora_console/godmode/agentes/massive_edit_modules.php @@ -26,8 +26,6 @@ if (! give_acl ($config['id_user'], 0, "PM")) { require_once ('include/functions_modules.php'); -echo '

'.__('Massive modules edition').'

'; - function process_manage_edit ($module_name, $group_select = null, $agents_select = null) { if (is_int ($module_name) && $module_name <= 0) { echo '

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

'; @@ -220,7 +218,7 @@ $table->data['edit7'][1] = print_input_text ('min_ff_event', '', '', 5, 15, true $table->data['edit7'][2] = __('Historical data'); $table->data['edit7'][3] = print_select(array('' => '', '1' => __('Yes'), '0' => __('No')),'history_data','','','', '', true); -echo ''; +echo ''; print_table ($table); echo '
'; diff --git a/pandora_console/godmode/agentes/massive_operations.php b/pandora_console/godmode/agentes/massive_operations.php index bd1d78a700..e80a375f9f 100644 --- a/pandora_console/godmode/agentes/massive_operations.php +++ b/pandora_console/godmode/agentes/massive_operations.php @@ -30,101 +30,97 @@ require_once ('include/functions_modules.php'); enterprise_include ('godmode/agentes/massive_operations.php'); $tab = (string) get_parameter ('tab', 'copy_modules'); +$option = (string) get_parameter ('option', ''); -/* Copy modules */ -$copymoduletab['text'] = '' - . print_image ("images/copy.png", true, array ("title" => __('Copy modules'))) - . ""; -if($tab == 'copy_modules') - $copymoduletab['active'] = true; -else - $copymoduletab['active'] = false; - -/* Edit Modules */ -$editmoduletab['text'] = '' - . print_image ("images/edit.png", true, array ("title" => __('Edit modules'))) - . ""; -if($tab == 'edit_modules') - $editmoduletab['active'] = true; -else - $editmoduletab['active'] = false; + +$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')); + +$options_agents = array('delete_agents' => __('Massive agents deletion')); + +$options_modules = array('delete_modules' => __('Massive modules deletion'), 'edit_modules' => __('Massive modules edition'), + 'copy_modules' => __('Massive modules copy')); + +$options_policies = array(); + +$policies_options = enterprise_hook('massive_policies_options'); + +if($policies_options != -1) { + $options_policies = array_merge($options_policies, $policies_options); +} + +$modules_snmp_options = enterprise_hook('massive_modules_snmp_options'); + +if($modules_snmp_options != -1) { + $options_modules = array_merge($options_modules, $modules_snmp_options); +} + + +if(in_array($option, array_keys($options_alerts))) { + $tab = 'massive_alerts'; +}elseif(in_array($option, array_keys($options_agents))) { + $tab = 'massive_agents'; +}elseif(in_array($option, array_keys($options_modules))) { + $tab = 'massive_modules'; +}elseif(in_array($option, array_keys($options_policies))) { + $tab = 'massive_policies'; +}else { + $option = ''; +} + +switch($tab) { + case 'massive_alerts': + $options = $options_alerts; + break; + case 'massive_agents': + $options = $options_agents; + break; + case 'massive_modules': + $options = $options_modules; + break; + case 'massive_policies': + $options = $options_policies; + break; +} + +// Set the default option of the category +if($option == ''){ + $option = array_shift(array_keys($options)); +} + +$alertstab = array('text' => '' + . print_image ('images/bell.png', true, array ('title' => __('Massive alert actions'))) + . '', 'active' => $tab == 'massive_alerts'); + +$agentstab = array('text' => '' + . print_image ('images/bricks.png', true, array ('title' => __('Massive agent actions'))) + . '', 'active' => $tab == 'massive_agents'); + +$modulestab = array('text' => '' + . print_image ('images/brick.png', true, array ('title' => __('Massive module actions'))) + . '', 'active' => $tab == 'massive_modules'); /* Collection */ -$modulessnmpTab = enterprise_hook('massive_modules_snmp_tab'); +$policiestab = enterprise_hook('massive_policies_tab'); -if ($modulessnmpTab == -1) - $modulessnmpTab = ""; - -/* Delete Modules */ -$deletemoduletab['text'] = '' - . print_image ("images/delete_modules.png", true, array ("title" => __('Delete modules'))) - . ""; -if($tab == 'delete_modules') - $deletemoduletab['active'] = true; -else - $deletemoduletab['active'] = false; - -/* Delete Agents */ -$deleteagenttab['text'] = '' - . print_image ("images/delete_agents.png", true, array ("title" => __('Delete agents'))) - . ""; -if($tab == 'delete_agents') - $deleteagenttab['active'] = true; -else - $deleteagenttab['active'] = false; - -/* Add alerts actions */ -$addactionalerttab['text'] = '' - . print_image ("images/cog.png", true, array ("title" => __('Add Actions'))) - . ""; -if($tab == 'add_action_alerts') - $addactionalerttab['active'] = true; -else - $addactionalerttab['active'] = false; - -/* Delete alerts actions */ -$deleteactionalerttab['text'] = '' - . print_image ("images/cog_del.png", true, array ("title" => __('Delete Actions'))) - . ""; -if($tab == 'delete_action_alerts') - $deleteactionalerttab['active'] = true; -else - $deleteactionalerttab['active'] = false; - -/* Add Alerts */ -$addalerttab['text'] = '' - . print_image ("images/god2.png", true, array ("title" => __('Add alerts'))) - . ""; -if($tab == 'add_alerts') - $addalerttab['active'] = true; -else - $addalerttab['active'] = false; - -/* Delete Alerts */ -$deletealerttab['text'] = '' - . print_image ("images/delete_alerts.png", true, array ("title" => __('Delete alerts'))) - . ""; -if($tab == 'delete_alerts') - $deletealerttab['active'] = true; -else - $deletealerttab['active'] = false; - -/* Collection */ -$policiesTab = enterprise_hook('massive_policies_tab'); - -if ($policiesTab == -1) - $policiesTab = ""; +if ($policiestab == -1) + $policiestab = ""; -$onheader = array('copy_modules' => $copymoduletab, 'edit_modules' => $editmoduletab, - 'add_modules_snmp' => $modulessnmpTab, 'delete_modules' => $deletemoduletab, 'delete_agents' => $deleteagenttab, - 'add_action_alerts' => $addactionalerttab, 'delete_action_alerts' => $deleteactionalerttab, - 'add_alerts' => $addalerttab, 'delete_alerts' => $deletealerttab, 'policies' => $policiesTab); +$onheader = array('massive_agents' => $agentstab, 'massive_modules' => $modulestab, + 'massive_alerts' => $alertstab, 'policies' => $policiestab); -print_page_header (__('Agent configuration'). ' » '. __('Massive operations'), "images/god1.png", false, "", true, $onheader); +print_page_header (__('Agent configuration'). ' » '. $options[$option], "images/god1.png", false, "", true, $onheader); +echo ''; +echo '
'; +echo '

'.__('Massive options').':

'; +echo '
'; +print_select($options, 'option', $option, 'this.form.submit()', '', 0, false, false, false); +echo '
'; +echo ''; -switch ($tab) { +switch ($option) { case 'delete_alerts': require_once ('godmode/agentes/massive_delete_alerts.php'); break; @@ -147,10 +143,10 @@ switch ($tab) { require_once ('godmode/agentes/massive_edit_modules.php'); break; case 'copy_modules': - require_once ('godmode/agentes/massive_config.php'); + require_once ('godmode/agentes/massive_copy_modules.php'); break; default: - if (!enterprise_hook('massive_operations', array($tab))) { + if (!enterprise_hook('massive_operations', array($option))) { require_once ('godmode/agentes/massive_config.php'); } break;