Dynamic unit in massive edit modules

This commit is contained in:
Daniel Maya 2017-09-25 14:51:45 +02:00
parent d7f3e1ecde
commit f67a4d90ae
2 changed files with 11 additions and 4 deletions

View File

@ -565,7 +565,7 @@ foreach ($targets2 as $t) {
$table->data['edit6'][1] = html_print_select ($targets, 'id_export', '','', __('No change'), '', true, false, false);
$table->data['edit6'][2] = __('Unit');
$table->data['edit6'][3] = html_print_input_text ('unit', '', '', 15, 60, true);
$table->data['edit6'][3] = html_print_extended_select_for_unit('unit','', '', '', '0', '15', true, false, false);
/* FF stands for Flip-flop */
@ -1127,7 +1127,7 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
/* List of fields which can be updated */
$fields = array ('dynamic_interval', 'dynamic_max', 'dynamic_min', 'dynamic_two_tailed', 'min_warning', 'max_warning', 'str_warning',
'min_critical', 'max_critical', 'str_critical', 'min_ff_event',
'module_interval', 'disabled', 'post_process', 'unit',
'module_interval', 'disabled', 'post_process', 'unit_select',
'snmp_community', 'tcp_send', 'custom_string_1',
'plugin_parameter', 'custom_string_2', 'custom_string_3', 'min',
'max', 'id_module_group', 'plugin_user', 'plugin_pass',
@ -1159,6 +1159,13 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
$values['post_process'] = $value;
}
break;
case 'unit_select':
if($value == "none"){
$values['unit'] = (string) get_parameter('unit_text');
} else {
$values['unit'] = $value;
}
break;
default:
if ($value != '') {
$values[$field] = $value;

View File

@ -630,7 +630,7 @@ function html_print_extended_select_for_unit($name, $selected = '',
// $fields = post_process_get_custom_values();
$fields['_timeticks_'] = 'timeticks';
$fields['_timeticks_'] = 'Timeticks';
$fields['none'] = __('none');
if($no_change != 0){
@ -653,7 +653,7 @@ function html_print_extended_select_for_unit($name, $selected = '',
else {
$uniq_name = $name;
}
html_debug($selected);
ob_start();
echo '<div id="' . $uniq_name . '_default" style="width:100%;display:inline;">';