From 84b1eafc245edc2f242c166d5eba923e21ad0882 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 9 Sep 2015 20:59:23 +0000 Subject: [PATCH] Calendar et2 bugs: - Clicking a date in sidebox now changes to day view, unless you're in 4 day view - Today button no longer switches to month view - Put upper limits on planner by user & category headers to avoid hundreds of day headers --- calendar/inc/class.calendar_ui.inc.php | 16 +++++++--------- calendar/js/app.js | 10 ++++++++++ calendar/js/et2_widget_planner.js | 14 ++++++++++---- calendar/templates/default/sidebox.xet | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 80c4e51986..f07f860634 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -262,14 +262,10 @@ class calendar_ui */ function manage_states($set_states=NULL) { - $states = $states_session = $GLOBALS['egw']->session->appsession('session_data','calendar'); - // retrieve saved states from prefs - if(!$states) - { - $states = unserialize($this->bo->cal_prefs['saved_states']); - error_log(array2string($states)); - } + $states = is_array($this->bo->cal_prefs['saved_states']) ? + $this->bo->cal_prefs['saved_states'] : unserialize($this->bo->cal_prefs['saved_states']); + // only look at _REQUEST, if we are in the calendar (prefs and admin show our sidebox menu too!) if (is_null($set_states)) { @@ -373,7 +369,10 @@ class calendar_ui unset($owners[$k]); $this->owner = $states['owner'] = implode(',',$owners); } - + if(is_array($this->owner)) + { + $this->owner = implode(',',$this->owner); + } if (substr($this->view,0,8) == 'planner_') { $states['sortby'] = $this->sortby = $this->view == 'planner_cat' ? 'category' : 'user'; @@ -423,7 +422,6 @@ class calendar_ui // save the states in the session only when we are in calendar if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar') { - $GLOBALS['egw']->session->appsession('session_data','calendar',$states); // save defined states into the user-prefs if(!empty($states) && is_array($states)) { diff --git a/calendar/js/app.js b/calendar/js/app.js index e09ed3bec1..f0e48610a8 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -64,6 +64,8 @@ app.classes.calendar = AppJS.extend( days: egw.preference('days_in_weekview','calendar') }, + states_to_save: ['owner','filter','cat_id','view','sortby','planner_days'], + /** * Constructor * @@ -1651,6 +1653,14 @@ app.classes.calendar = AppJS.extend( // Sidebox is updated, we can clear the flag this.state_update_in_progress = false; + // Update saved state in preferences + var save = {}; + for(var i = 0; i < this.states_to_save.length; i++) + { + save[this.states_to_save[i]] = this.state[this.states_to_save[i]]; + } + egw.set_preference('calendar','saved_states', save); + return; } // old calendar state handling on server-side (incl. switching to and from listview) diff --git a/calendar/js/et2_widget_planner.js b/calendar/js/et2_widget_planner.js index 6ed4f3aa44..68e7b27a3a 100644 --- a/calendar/js/et2_widget_planner.js +++ b/calendar/js/et2_widget_planner.js @@ -284,11 +284,14 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize { this.headers.append(this._header_months(start, day_count)); } - if(day_count >= 5) + if(day_count >= 5 && day_count < 120) { this.headers.append(this._header_weeks(start, day_count)); } - this.headers.append(this._header_days(start, day_count)); + if(day_count < 60) + { + this.headers.append(this._header_days(start, day_count)); + } if(day_count <= 7) { this.headers.append(this._header_hours(start, day_count)); @@ -487,11 +490,14 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize this.headers.append(this._header_months(start, day_count)); } - if(day_count >= 5) + if(day_count >= 5 && day_count < 120) { this.headers.append(this._header_weeks(start, day_count)); } - this.headers.append(this._header_days(start, day_count)); + if(day_count < 60) + { + this.headers.append(this._header_days(start, day_count)); + } if(day_count <= 7) { this.headers.append(this._header_hours(start, day_count)); diff --git a/calendar/templates/default/sidebox.xet b/calendar/templates/default/sidebox.xet index 630d7c0eba..42a75a912f 100644 --- a/calendar/templates/default/sidebox.xet +++ b/calendar/templates/default/sidebox.xet @@ -37,7 +37,7 @@ Egroupware