From ffccce1c8a22bca68bee430f591e16cf4c88341e Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 16 May 2016 11:21:03 -0600 Subject: [PATCH] Send holiday cache data for current year on initial load, so it's available for sidebox menu. --- calendar/inc/class.calendar_ui.inc.php | 3 +++ calendar/js/app.js | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 8c4def8d7e..11bcb71d65 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -557,6 +557,9 @@ class calendar_ui $cont['view'] = $this->view ? $this->view : 'week'; $cont['date'] = $this->date ? $this->date : Api\DateTime(); + $cont['year'] = (int)Api\DateTime::to($cont['date'],'Y'); + $cont['holidays'] = $this->bo->read_holidays($cont['year']); + $readonlys = array(); $sel_options['status_filter'] = array( array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), diff --git a/calendar/js/app.js b/calendar/js/app.js index 8a98780181..21f1be447d 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -181,7 +181,14 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( this.sidebox_et2 = _et2.widgetContainer; this.sidebox_hooked_templates.push(this.sidebox_et2); $j(_et2.DOMContainer).hide(); + + // Set client side holiday cache for this year + egw.window.et2_calendar_view.holiday_cache[content.data.year] = content.data.holidays; + delete content.data.holidays; + delete content.data.year; + this._setup_sidebox_filters(); + this.state = content.data; break;