From 5a440f10785b3d154582d3be026b5b94572c4ee5 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Wed, 9 Aug 2023 09:47:09 +0200 Subject: [PATCH 1/3] #11851 fixed setup interval editor --- .../godmode/setup/setup_visuals.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index cc5d026f35..6753d1d499 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1927,7 +1927,7 @@ $table_other->data[$row][] = html_print_label_input_block( ).html_print_div( [ 'class' => '', - 'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), + 'content' => __('Interval').html_print_select($units, 'interval_unit', '', '', '', '', true, false, false, '', false, 'width: 100%'), ], true ).html_print_button( @@ -1975,7 +1975,7 @@ $table_other->data[$row][] = html_print_label_input_block( ).html_print_button( __('Delete'), 'interval_del_btn', - empty($config['interval_values']), + false, '', [ 'mode' => 'link', @@ -2009,7 +2009,7 @@ $table_other->data[$row][] = html_print_label_input_block( ).html_print_div( [ 'class' => '', - 'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), + 'content' => __('Interval').html_print_select($units, 'module_interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), ], true ).html_print_button( @@ -2316,9 +2316,15 @@ $(document).ready (function () { // CUSTOM INTERVAL VALUES //------------------------------------------------------------------ $("#button-interval_del_btn").click( function() { - var interval_selected = $('#intervals option:selected').val(); - $('#hidden-interval_to_delete').val(interval_selected); - $('#submit-update_button').trigger('click'); + confirmDialog({ + title: "", + message: "", + onAccept: function() { + var interval_selected = $('#intervals option:selected').val(); + $('#hidden-interval_to_delete').val(interval_selected); + $('#button-update_button').trigger('click'); + } + }); }); $("#button-interval_add_btn").click( function() { From f1cbe8c360f9b12187414f421c2fc4f3440a8993 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Wed, 9 Aug 2023 12:47:51 +0200 Subject: [PATCH 2/3] #11851 Fixed operation of the interval field, allowing to add more than one. --- pandora_console/include/functions_config.php | 6 ++++++ pandora_console/include/functions_html.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 1b871d3c93..6f2643cc52 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1489,6 +1489,12 @@ function config_update_config() $interval_values_array = explode(',', $interval_values); if (in_array($new_interval, $interval_values_array) === false) { $interval_values_array[] = $new_interval; + // Get current periods. + $current_period = get_periods(false, false, true); + $new_current_period = array_keys($current_period); + $new_current_period = implode(',', $new_current_period); + // Add new periods to current. + array_push($interval_values_array, $new_current_period); $interval_values = implode(',', $interval_values_array); } } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index f56639cece..dcf367a54c 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2227,7 +2227,7 @@ function html_print_extended_select_for_time( $nothing_value, false, false, - false, + true, $class, $readonly, 'font-size: xx-small;'.$select_style From 7fc47883532f0c385d8bcfbdb82a0e2cd9e100c6 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Thu, 10 Aug 2023 13:08:12 +0200 Subject: [PATCH 3/3] #11851 Fixed weird interval --- pandora_console/include/functions_config.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 6f2643cc52..c522cdee92 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1491,10 +1491,13 @@ function config_update_config() $interval_values_array[] = $new_interval; // Get current periods. $current_period = get_periods(false, false, true); - $new_current_period = array_keys($current_period); - $new_current_period = implode(',', $new_current_period); - // Add new periods to current. - array_push($interval_values_array, $new_current_period); + if (!isset($current_period[-1])) { + $new_current_period = array_keys($current_period); + $new_current_period = implode(',', $new_current_period); + // Add new periods to current. + array_push($interval_values_array, $new_current_period); + } + $interval_values = implode(',', $interval_values_array); } }