2010-08-17 Sergio Martin <sergio.martin@artica.es>

* 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



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3146 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2010-08-17 17:06:27 +00:00
parent 5d64f97d61
commit ad3a8a3cc2
10 changed files with 108 additions and 110 deletions

View File

@ -1,3 +1,19 @@
2010-08-17 Sergio Martin <sergio.martin@artica.es>
* 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 <sergio.martin@artica.es>
* extensions/agents_modules.php: Added an agent group filter into

View File

@ -76,8 +76,6 @@ if ($add) {
}
echo '<h3>'.__('Massive alert actions addition').'</h3>';
$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] .= '</span>';
echo '<form method="post" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=add_action_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -41,7 +41,6 @@ if (is_ajax ()) {
return;
}
echo '<h3>'.__('Massive alerts addition').'</h3>';
function process_manage_add ($id_alert_template, $id_agents) {
if (empty ($id_agents)) {
echo '<h3 class="error">'.__('No agents selected').'</h3>';
@ -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 '<form method="post" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=add_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -28,8 +28,6 @@ require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
require_once ('include/functions_modules.php');
echo '<h3>'.__('Massive copy').'</h3>';
$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)
// . '<a href="#" class="tip">&nbsp;<span>' . __("Type two chars at least for search") . '</span></a>';
echo '<form id="manage_config_form" method="post">';
echo '<form action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=copy_modules" id="manage_config_form" method="post">';
echo '<fieldset id="fieldset_source">';
echo '<legend><span>'.__('Source');

View File

@ -76,8 +76,6 @@ if ($delete) {
}
echo '<h3>'.__('Massive alert actions deletion').'</h3>';
$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 '<form method="post" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=delete_action_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -62,8 +62,6 @@ $id_agents = get_parameter ('id_agents');
$delete = (bool) get_parameter_post ('delete');
echo '<h3>'.__('Massive agent deletion').'</h3>';
if ($delete) {
process_manage_delete ($id_agents);
}
@ -92,7 +90,7 @@ $table->data[1][0] .= '</span>';
$table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
'id_agents[]', 0, false, '', '', true, true);
echo '<form method="post" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=delete_agents" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -43,7 +43,6 @@ if (is_ajax ()) {
return;
}
echo '<h3>'.__('Massive alerts deletion').'</h3>';
function process_manage_delete ($id_alert_template, $id_agents) {
if (empty ($id_alert_template)) {
echo '<h3 class="error">'.__('No alert selected').'</h3>';
@ -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 '<form method="post" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=delete_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -45,8 +45,6 @@ if (is_ajax ()) {
return;
}
echo '<h3>'.__('Massive modules deletion').'</h3>';
function process_manage_delete ($module_name, $id_agents) {
if (empty ($module_name)) {
echo '<h3 class="error">'.__('No module selected').'</h3>';
@ -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 '<form method="post" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=delete_modules" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -26,8 +26,6 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
require_once ('include/functions_modules.php');
echo '<h3>'.__('Massive modules edition').'</h3>';
function process_manage_edit ($module_name, $group_select = null, $agents_select = null) {
if (is_int ($module_name) && $module_name <= 0) {
echo '<h3 class="error">'.__('No modules selected').'</h3>';
@ -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 '<form method="post" id="form_edit" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&option=edit_modules" id="form_edit" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';

View File

@ -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'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=copy_modules">'
. print_image ("images/copy.png", true, array ("title" => __('Copy modules')))
. "</a>";
if($tab == 'copy_modules')
$copymoduletab['active'] = true;
else
$copymoduletab['active'] = false;
/* Edit Modules */
$editmoduletab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=edit_modules">'
. print_image ("images/edit.png", true, array ("title" => __('Edit modules')))
. "</a>";
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' => '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=massive_alerts">'
. print_image ('images/bell.png', true, array ('title' => __('Massive alert actions')))
. '</a>', 'active' => $tab == 'massive_alerts');
$agentstab = array('text' => '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=massive_agents">'
. print_image ('images/bricks.png', true, array ('title' => __('Massive agent actions')))
. '</a>', 'active' => $tab == 'massive_agents');
$modulestab = array('text' => '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=massive_modules">'
. print_image ('images/brick.png', true, array ('title' => __('Massive module actions')))
. '</a>', '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'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_modules">'
. print_image ("images/delete_modules.png", true, array ("title" => __('Delete modules')))
. "</a>";
if($tab == 'delete_modules')
$deletemoduletab['active'] = true;
else
$deletemoduletab['active'] = false;
/* Delete Agents */
$deleteagenttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_agents">'
. print_image ("images/delete_agents.png", true, array ("title" => __('Delete agents')))
. "</a>";
if($tab == 'delete_agents')
$deleteagenttab['active'] = true;
else
$deleteagenttab['active'] = false;
/* Add alerts actions */
$addactionalerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=add_action_alerts">'
. print_image ("images/cog.png", true, array ("title" => __('Add Actions')))
. "</a>";
if($tab == 'add_action_alerts')
$addactionalerttab['active'] = true;
else
$addactionalerttab['active'] = false;
/* Delete alerts actions */
$deleteactionalerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_action_alerts">'
. print_image ("images/cog_del.png", true, array ("title" => __('Delete Actions')))
. "</a>";
if($tab == 'delete_action_alerts')
$deleteactionalerttab['active'] = true;
else
$deleteactionalerttab['active'] = false;
/* Add Alerts */
$addalerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=add_alerts">'
. print_image ("images/god2.png", true, array ("title" => __('Add alerts')))
. "</a>";
if($tab == 'add_alerts')
$addalerttab['active'] = true;
else
$addalerttab['active'] = false;
/* Delete Alerts */
$deletealerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/massive_operations&tab=delete_alerts">'
. print_image ("images/delete_alerts.png", true, array ("title" => __('Delete alerts')))
. "</a>";
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'). ' &raquo; '. __('Massive operations'), "images/god1.png", false, "", true, $onheader);
print_page_header (__('Agent configuration'). ' &raquo; '. $options[$option], "images/god1.png", false, "", true, $onheader);
echo '<form method="post" id="form_options" action="index.php?sec=gagente&sec2=godmode/agentes/massive_operations">';
echo '<table border="0"><tr><td>';
echo '<h3>'.__('Massive options').':</h3>';
echo '</td><td>';
print_select($options, 'option', $option, 'this.form.submit()', '', 0, false, false, false);
echo '</td></tr></table>';
echo '</form>';
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;