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:
parent
091fb69629
commit
86e41fa83d
|
@ -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>
|
2013-01-28 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* pandoradb_data.sql
|
* pandoradb_data.sql
|
||||||
|
|
|
@ -113,13 +113,13 @@ if ($update) {
|
||||||
$agents_ = array();
|
$agents_ = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($agents_ as $agent_) {
|
foreach ($agents_ as $agent_) {
|
||||||
|
|
||||||
if($modules_ == false) {
|
if ($modules_ == false) {
|
||||||
$modules_ = array();
|
$modules_ = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($modules_ as $module_) {
|
foreach ($modules_ as $module_) {
|
||||||
$result = process_manage_edit ($module_, $agents_);
|
$result = process_manage_edit ($module_, $agents_);
|
||||||
$count ++;
|
$count ++;
|
||||||
$success += (int)$result;
|
$success += (int)$result;
|
||||||
|
@ -127,7 +127,8 @@ if ($update) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($success > 0,
|
ui_print_result_message ($success > 0,
|
||||||
__('Successfully updated')."(".$success."/".$count.")",
|
__('Successfully updated') .
|
||||||
|
"(" . $success . "/" . $count . ")",
|
||||||
__('Could not be updated'));
|
__('Could not be updated'));
|
||||||
|
|
||||||
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
|
$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>';
|
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
|
||||||
ui_require_jquery_file ('pandora.controls');
|
ui_require_jquery_file ('pandora.controls');
|
||||||
|
|
||||||
if($selection_mode == 'modules'){
|
if ($selection_mode == 'modules') {
|
||||||
$modules_row = '';
|
$modules_row = '';
|
||||||
$agents_row = 'none';
|
$agents_row = 'none';
|
||||||
}
|
}
|
||||||
|
@ -491,34 +492,40 @@ $(document).ready (function () {
|
||||||
|
|
||||||
$('input[type=checkbox]').change (
|
$('input[type=checkbox]').change (
|
||||||
function () {
|
function () {
|
||||||
if(this.id == "checkbox-force_type"){
|
if (this.id == "checkbox-force_type") {
|
||||||
if(this.checked) {
|
if (this.checked) {
|
||||||
$(".select_modules_row_2").css('display', 'none');
|
$(".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 ();
|
$("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 {
|
else {
|
||||||
$(".select_modules_row_2").css('display', '');
|
$(".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 ();
|
$("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);
|
$("#checkbox-force_group").attr("checked", false);
|
||||||
$("#groups_select").trigger("change");
|
$("#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 {
|
else {
|
||||||
if (this.id == "checkbox-force_group") {
|
if (this.id == "checkbox-force_group") {
|
||||||
$("#checkbox-recursion").attr("checked", false);
|
$("#checkbox-recursion").attr("checked", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.checked) {
|
if (this.checked) {
|
||||||
$(".select_agents_row_2").css('display', 'none');
|
$(".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 ();
|
$("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 {
|
else {
|
||||||
$(".select_agents_row_2").css('display', '');
|
$(".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 ();
|
$("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 ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,24 +604,30 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($agents_select))
|
if (!is_array($agents_select))
|
||||||
$agents_select = array($agents_select);
|
$agents_select = array($agents_select);
|
||||||
|
|
||||||
/* List of fields which can be updated */
|
/* 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',
|
$fields = array ('min_warning', 'max_warning', 'str_warning',
|
||||||
'disabled', 'post_process', 'unit', 'snmp_community', 'tcp_send', 'custom_string_1', 'plugin_parameter',
|
'min_critical', 'max_critical', 'str_critical', 'min_ff_event',
|
||||||
'custom_string_2', 'custom_string_3', 'min', 'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data', 'critical_inverse', 'warning_inverse');
|
'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 ();
|
$values = array ();
|
||||||
|
|
||||||
// Specific snmp reused fields
|
// Specific snmp reused fields
|
||||||
if(get_parameter ('tcp_send', '') == 3) {
|
if (get_parameter ('tcp_send', '') == 3) {
|
||||||
$plugin_user_snmp = get_parameter ('plugin_user_snmp', '');
|
$plugin_user_snmp = get_parameter ('plugin_user_snmp', '');
|
||||||
if($plugin_user_snmp != '') {
|
if ($plugin_user_snmp != '') {
|
||||||
$values['plugin_user'] = $plugin_user_snmp;
|
$values['plugin_user'] = $plugin_user_snmp;
|
||||||
}
|
}
|
||||||
$plugin_pass_snmp = get_parameter ('plugin_pass_snmp', '');
|
$plugin_pass_snmp = get_parameter ('plugin_pass_snmp', '');
|
||||||
if($plugin_pass_snmp != '') {
|
if ($plugin_pass_snmp != '') {
|
||||||
$values['plugin_pass'] = $plugin_pass_snmp;
|
$values['plugin_pass'] = $plugin_pass_snmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -633,7 +646,7 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
||||||
if (get_parameter('quiet_select', -1) != -1) {
|
if (get_parameter('quiet_select', -1) != -1) {
|
||||||
$values['quiet'] = get_parameter('quiet_select');
|
$values['quiet'] = get_parameter('quiet_select');
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_modules = false;
|
$filter_modules = false;
|
||||||
|
|
||||||
if (!is_numeric($module_name) or ($module_name != 0))
|
if (!is_numeric($module_name) or ($module_name != 0))
|
||||||
|
@ -649,7 +662,7 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
||||||
array ('id_agente_modulo'));
|
array ('id_agente_modulo'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($module_name == 0) {
|
if ($module_name == "0") {
|
||||||
//Any module
|
//Any module
|
||||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||||
array ('id_agente' => $agents_select),
|
array ('id_agente' => $agents_select),
|
||||||
|
@ -669,7 +682,8 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach ($modules as $module) {
|
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)) {
|
if (is_error($result)) {
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
|
|
|
@ -32,21 +32,27 @@ enterprise_include ('godmode/massive/massive_operations.php');
|
||||||
$tab = (string) get_parameter ('tab', 'massive_agents');
|
$tab = (string) get_parameter ('tab', 'massive_agents');
|
||||||
$option = (string) get_parameter ('option', '');
|
$option = (string) get_parameter ('option', '');
|
||||||
|
|
||||||
$options_alerts = array('add_alerts' => __('Massive alerts addition'), 'delete_alerts' => __('Massive alerts deletion'),
|
$options_alerts = array('add_alerts' => __('Massive alerts addition'),
|
||||||
'add_action_alerts' => __('Massive alert actions addition'), 'delete_action_alerts' => __('Massive alert actions deletion'),
|
'delete_alerts' => __('Massive alerts deletion'),
|
||||||
'enable_disable_alerts' => __('Massive alert enable/disable'), 'standby_alerts' => __('Massive alert setting standby'));
|
'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")) {
|
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'));
|
'delete_profiles' => __('Massive profiles deletion'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$options_users = array();
|
$options_users = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options_modules = array('delete_modules' => __('Massive modules deletion'),
|
$options_modules = array(
|
||||||
|
'delete_modules' => __('Massive modules deletion'),
|
||||||
'edit_modules' => __('Massive modules edition'),
|
'edit_modules' => __('Massive modules edition'),
|
||||||
'copy_modules' => __('Massive modules copy'));
|
'copy_modules' => __('Massive modules copy'));
|
||||||
|
|
||||||
|
@ -55,7 +61,8 @@ $options_policies = array();
|
||||||
$policies_options = enterprise_hook('massive_policies_options');
|
$policies_options = enterprise_hook('massive_policies_options');
|
||||||
|
|
||||||
if($policies_options != -1) {
|
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))) {
|
if (in_array($option, array_keys($options_alerts))) {
|
||||||
|
@ -159,7 +166,8 @@ echo '</div>';
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$('#manage_config_form').submit( 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)
|
if (confirm_status)
|
||||||
$("#loading").css("display", "");
|
$("#loading").css("display", "");
|
||||||
else
|
else
|
||||||
|
@ -167,15 +175,17 @@ echo '</div>';
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#form_edit').submit( function() {
|
$('#form_edit').submit( function() {
|
||||||
confirm_status = confirm(" <?php echo __('Are you sure?'); ?> ");
|
confirm_status =
|
||||||
|
confirm("<?php echo __('Are you sure?'); ?>");
|
||||||
if (confirm_status)
|
if (confirm_status)
|
||||||
$("#loading").css("display", "");
|
$("#loading").css("display", "");
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[id^=form]').submit( function() {
|
$('[id^=form]').submit( function() {
|
||||||
confirm_status = confirm(" <?php echo __('Are you sure?'); ?> ");
|
confirm_status =
|
||||||
|
confirm("<?php echo __('Are you sure?'); ?>");
|
||||||
if (confirm_status)
|
if (confirm_status)
|
||||||
$("#loading").css("display", "");
|
$("#loading").css("display", "");
|
||||||
else
|
else
|
||||||
|
@ -188,14 +198,19 @@ echo '</div>';
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
echo "<br />";
|
||||||
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
|
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
|
||||||
echo '<table border="0"><tr><td>';
|
echo '<table border="0"><tr><td>';
|
||||||
|
echo __("Action");
|
||||||
echo '</td><td>';
|
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')
|
if($option == 'edit_agents' || $option == 'edit_modules')
|
||||||
echo '<a href="#" class="tip"> <span>' . __("The blank fields will not be updated") . '</span></a>';
|
echo '<a href="#" class="tip"> <span>' .
|
||||||
|
__("The blank fields will not be updated") . '</span></a>';
|
||||||
echo '</td></tr></table>';
|
echo '</td></tr></table>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
echo "<br />";
|
||||||
|
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case 'delete_alerts':
|
case 'delete_alerts':
|
||||||
|
|
Loading…
Reference in New Issue