2013-01-28 Miguel de Dios <miguel.dedios@artica.es>

* ggodmode/massive/massive_operations.php,
	godmode/massive/massive_edit_modules.php: fixed the form editor for
	modules, now set the strings instruction for the unknown, warning
	and critical, set only for the selected modules (instead the all
	modules the bug).
	
	Fixes: #3602361




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7536 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-01-28 14:38:34 +00:00
parent 091fb69629
commit 86e41fa83d
3 changed files with 73 additions and 34 deletions

View File

@ -1,3 +1,13 @@
2013-01-28 Miguel de Dios <miguel.dedios@artica.es>
* ggodmode/massive/massive_operations.php,
godmode/massive/massive_edit_modules.php: fixed the form editor for
modules, now set the strings instruction for the unknown, warning
and critical, set only for the selected modules (instead the all
modules the bug).
Fixes: #3602361
2013-01-28 Sergio Martin <sergio.martin@artica.es>
* pandoradb_data.sql

View File

@ -113,13 +113,13 @@ if ($update) {
$agents_ = array();
}
foreach($agents_ as $agent_) {
foreach ($agents_ as $agent_) {
if($modules_ == false) {
if ($modules_ == false) {
$modules_ = array();
}
foreach($modules_ as $module_) {
foreach ($modules_ as $module_) {
$result = process_manage_edit ($module_, $agents_);
$count ++;
$success += (int)$result;
@ -127,7 +127,8 @@ if ($update) {
}
ui_print_result_message ($success > 0,
__('Successfully updated')."(".$success."/".$count.")",
__('Successfully updated') .
"(" . $success . "/" . $count . ")",
__('Could not be updated'));
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
@ -395,7 +396,7 @@ echo '<h3 class="error invisible" id="message"> </h3>';
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
ui_require_jquery_file ('pandora.controls');
if($selection_mode == 'modules'){
if ($selection_mode == 'modules') {
$modules_row = '';
$agents_row = 'none';
}
@ -491,34 +492,40 @@ $(document).ready (function () {
$('input[type=checkbox]').change (
function () {
if(this.id == "checkbox-force_type"){
if(this.checked) {
if (this.id == "checkbox-force_type") {
if (this.checked) {
$(".select_modules_row_2").css('display', 'none');
$("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 ();
}
else {
$(".select_modules_row_2").css('display', '');
if($('#module_name option:selected').val() == undefined) {
if ($('#module_name option:selected').val() == undefined) {
$("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, tr#delete_table-edit10, tr#delete_table-edit11, tr#delete_table-edit12").hide ();
}
}
}
else if(this.id == "checkbox-recursion"){
else if (this.id == "checkbox-recursion") {
$("#checkbox-force_group").attr("checked", false);
$("#groups_select").trigger("change");
}
else if (this.id == "checkbox-warning_inverse") {
return; //Do none
}
else if (this.id == "checkbox-critical_inverse") {
return; //Do none
}
else {
if (this.id == "checkbox-force_group") {
$("#checkbox-recursion").attr("checked", false);
}
if(this.checked) {
if (this.checked) {
$(".select_agents_row_2").css('display', 'none');
$("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, tr#delete_table-edit10, tr#delete_table-edit11, tr#delete_table-edit12").show ();
}
else {
$(".select_agents_row_2").css('display', '');
if($('#id_agents option:selected').val() == undefined) {
if ($('#id_agents option:selected').val() == undefined) {
$("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, tr#delete_table-edit10, tr#delete_table-edit11, tr#delete_table-edit12").hide ();
}
}
@ -602,19 +609,25 @@ function process_manage_edit ($module_name, $agents_select = null) {
$agents_select = array($agents_select);
/* List of fields which can be updated */
$fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval',
'disabled', 'post_process', 'unit', 'snmp_community', 'tcp_send', 'custom_string_1', 'plugin_parameter',
'custom_string_2', 'custom_string_3', 'min', 'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data', 'critical_inverse', 'warning_inverse');
$fields = array ('min_warning', 'max_warning', 'str_warning',
'min_critical', 'max_critical', 'str_critical', 'min_ff_event',
'module_interval', 'disabled', 'post_process', 'unit',
'snmp_community', 'tcp_send', 'custom_string_1',
'plugin_parameter', 'custom_string_2', 'custom_string_3', 'min',
'max', 'id_module_group', 'plugin_user', 'plugin_pass',
'id_export', 'history_data', 'critical_inverse',
'warning_inverse', 'critical_instructions',
'warning_instructions', 'unknown_instructions');
$values = array ();
// Specific snmp reused fields
if(get_parameter ('tcp_send', '') == 3) {
if (get_parameter ('tcp_send', '') == 3) {
$plugin_user_snmp = get_parameter ('plugin_user_snmp', '');
if($plugin_user_snmp != '') {
if ($plugin_user_snmp != '') {
$values['plugin_user'] = $plugin_user_snmp;
}
$plugin_pass_snmp = get_parameter ('plugin_pass_snmp', '');
if($plugin_pass_snmp != '') {
if ($plugin_pass_snmp != '') {
$values['plugin_pass'] = $plugin_pass_snmp;
}
}
@ -649,7 +662,7 @@ function process_manage_edit ($module_name, $agents_select = null) {
array ('id_agente_modulo'));
}
else {
if ($module_name == 0) {
if ($module_name == "0") {
//Any module
$modules = db_get_all_rows_filter ('tagente_modulo',
array ('id_agente' => $agents_select),
@ -669,7 +682,8 @@ function process_manage_edit ($module_name, $agents_select = null) {
return false;
foreach ($modules as $module) {
$result = modules_update_agent_module ($module['id_agente_modulo'], $values, true, $update_tags);
$result = modules_update_agent_module(
$module['id_agente_modulo'], $values, true, $update_tags);
if (is_error($result)) {
db_process_sql_rollback ();

View File

@ -32,21 +32,27 @@ enterprise_include ('godmode/massive/massive_operations.php');
$tab = (string) get_parameter ('tab', 'massive_agents');
$option = (string) get_parameter ('option', '');
$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'),
'enable_disable_alerts' => __('Massive alert enable/disable'), 'standby_alerts' => __('Massive alert setting standby'));
$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'),
'enable_disable_alerts' => __('Massive alert enable/disable'),
'standby_alerts' => __('Massive alert setting standby'));
$options_agents = array('edit_agents' => __('Massive agents edition'), 'delete_agents' => __('Massive agents deletion'));
$options_agents = array('edit_agents' => __('Massive agents edition'),
'delete_agents' => __('Massive agents deletion'));
if (check_acl ($config['id_user'], 0, "PM")) {
$options_users = array('add_profiles' => __('Massive profiles addition'),
$options_users = array(
'add_profiles' => __('Massive profiles addition'),
'delete_profiles' => __('Massive profiles deletion'));
}
else {
$options_users = array();
}
$options_modules = array('delete_modules' => __('Massive modules deletion'),
$options_modules = array(
'delete_modules' => __('Massive modules deletion'),
'edit_modules' => __('Massive modules edition'),
'copy_modules' => __('Massive modules copy'));
@ -55,7 +61,8 @@ $options_policies = array();
$policies_options = enterprise_hook('massive_policies_options');
if($policies_options != -1) {
$options_policies = array_merge($options_policies, $policies_options);
$options_policies =
array_merge($options_policies, $policies_options);
}
if (in_array($option, array_keys($options_alerts))) {
@ -159,7 +166,8 @@ echo '</div>';
<script language="javascript" type="text/javascript">
$(document).ready (function () {
$('#manage_config_form').submit( function() {
confirm_status = confirm(" <?php echo __('Are you sure?'); ?> ");
confirm_status =
confirm("<?php echo __('Are you sure?'); ?>");
if (confirm_status)
$("#loading").css("display", "");
else
@ -167,7 +175,8 @@ echo '</div>';
});
$('#form_edit').submit( function() {
confirm_status = confirm(" <?php echo __('Are you sure?'); ?> ");
confirm_status =
confirm("<?php echo __('Are you sure?'); ?>");
if (confirm_status)
$("#loading").css("display", "");
else
@ -175,7 +184,8 @@ echo '</div>';
});
$('[id^=form]').submit( function() {
confirm_status = confirm(" <?php echo __('Are you sure?'); ?> ");
confirm_status =
confirm("<?php echo __('Are you sure?'); ?>");
if (confirm_status)
$("#loading").css("display", "");
else
@ -188,14 +198,19 @@ echo '</div>';
<?php
echo "<br />";
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
echo '<table border="0"><tr><td>';
echo __("Action");
echo '</td><td>';
html_print_select($options, 'option', $option, 'this.form.submit()', '', 0, false, false, false);
html_print_select($options, 'option', $option, 'this.form.submit()', '',
0, false, false, false);
if($option == 'edit_agents' || $option == 'edit_modules')
echo '<a href="#" class="tip">&nbsp;<span>' . __("The blank fields will not be updated") . '</span></a>';
echo '<a href="#" class="tip">&nbsp;<span>' .
__("The blank fields will not be updated") . '</span></a>';
echo '</td></tr></table>';
echo '</form>';
echo "<br />";
switch ($option) {
case 'delete_alerts':