diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index a4c19de294..39d47e6296 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -362,6 +362,13 @@ class calendar_hooks 'admin' => False, 'default' => ['weekN', 'month'], ), + 'auto_update_on_sidebox_change' => array( + 'type' => 'check', + 'label' => 'Update calendar view immediately when navigation calendar in sidebox is changed', + 'name' => 'auto_update_on_sidebox_change', + 'help' => 'When changing the month', + 'default'=> false + ), 'link_title' => array( 'type' => 'multiselect', 'label' => 'Link title for events to show', diff --git a/calendar/js/app.js b/calendar/js/app.js index 9e6b0093cf..7f7e899a9a 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -3353,6 +3353,8 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( // Dynamic resize of sidebox calendar to fill sidebox var preferred_width = jQuery('#calendar-sidebox_date .ui-datepicker-inline').outerWidth(); var font_ratio = 12 / parseFloat(jQuery('#calendar-sidebox_date .ui-datepicker-inline').css('font-size')); + var go_button_widget = date_widget.getRoot().getWidgetById('header_go'); + var auto_update = this.egw.preference('auto_update_on_sidebox_change', 'calendar') === '1'; var calendar_resize = function() { try { var percent = 1+((jQuery(date_widget.getDOMNode()).width() - preferred_width) / preferred_width); @@ -3361,6 +3363,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( .css('font-size',(percent*100)+'%'); // Position go and today + go_button_widget.set_disabled(false); var buttons = jQuery('#calendar-sidebox_date .ui-datepicker-header a span'); if(today.length && go_button.length) { @@ -3372,6 +3375,10 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( buttons.position({my: 'center', at: 'center', of: go_button}) .css('left', ''); } + if(auto_update) + { + go_button_widget.set_disabled(true); + } } catch (e){ // Resize didn't work } @@ -3382,16 +3389,19 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( onChangeMonthYear: function(year, month, inst) { // Update month button label - var go_button = date_widget.getRoot().getWidgetById('header_go'); - if(go_button) + if(go_button_widget) { var temp_date = new Date(year, month-1, 1,0,0,0); //temp_date.setUTCMinutes(temp_date.getUTCMinutes() + temp_date.getTimezoneOffset()); - go_button.btn.attr('title',egw.lang(date('F',temp_date))); + go_button_widget.btn.attr('title',egw.lang(date('F',temp_date))); // Store current _displayed_ date in date button for clicking temp_date.setUTCMinutes(temp_date.getUTCMinutes() - temp_date.getTimezoneOffset()); - go_button.btn.attr('data-date', temp_date.toJSON()); + go_button_widget.btn.attr('data-date', temp_date.toJSON()); + } + if(auto_update) + { + go_button_widget.click(); } window.setTimeout(calendar_resize,0); }, diff --git a/calendar/lang/egw_de.lang b/calendar/lang/egw_de.lang index 540140f242..8cb2b0b4ed 100644 --- a/calendar/lang/egw_de.lang +++ b/calendar/lang/egw_de.lang @@ -588,6 +588,7 @@ two weeks calendar de zwei Wochen type of planner calendar de Planer Typ unable to save calendar de Speichern nicht möglich uninvited calendar de Ausgeladen +update calendar view immediately when navigation calendar in sidebox is changed calendar de Kalenderansicht sofort aktualisieren, wenn der Navigationskalender in der Sidebox geändert wird. update timezones common de Zeitzonen aktualisieren updated calendar de Aktualisiert use end date calendar de Enddatum benutzen diff --git a/calendar/lang/egw_en.lang b/calendar/lang/egw_en.lang index 0cd457b51c..734e473128 100644 --- a/calendar/lang/egw_en.lang +++ b/calendar/lang/egw_en.lang @@ -588,6 +588,7 @@ tue calendar en Tue two weeks calendar en Two weeks type of planner calendar en Type of planner unable to save calendar en Unable to save +update calendar view immediately when navigation calendar in sidebox is changed calendar en Update calendar view immediately when navigation calendar in sidebox is changed update timezones common en Update time zones updated calendar en Updated use end date calendar en Use end date