* Calendar - Add preference to update calendar view immediately when navigation calendar in sidebox is changed

This commit is contained in:
nathangray 2018-06-05 12:57:01 -06:00
parent 430368eab9
commit 3444126629
4 changed files with 23 additions and 4 deletions

View File

@ -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',

View File

@ -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);
},

View File

@ -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

View File

@ -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