From 6dfef23ae3f2aa404008c3b710713a6877fb6721 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 28 Dec 2015 16:55:51 +0000 Subject: [PATCH] Match consolidation number to the phrasing in preferences --- calendar/inc/class.calendar_uiviews.inc.php | 4 ++-- calendar/js/app.js | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/calendar/inc/class.calendar_uiviews.inc.php b/calendar/inc/class.calendar_uiviews.inc.php index 804a63cc2d..e37285e8cd 100644 --- a/calendar/inc/class.calendar_uiviews.inc.php +++ b/calendar/inc/class.calendar_uiviews.inc.php @@ -663,7 +663,7 @@ class calendar_uiviews extends calendar_ui // Always do 7 days for a week so scrolling works properly $this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1); - if (count($users) == 1 || count($users) > $this->cal_prefs['week_consolidate']) // for more then X users, show all in one row + if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate']) // for more then X users, show all in one row { $content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) + array('owner' => $users); @@ -719,7 +719,7 @@ class calendar_uiviews extends calendar_ui if (!is_array($users)) $users = array($users); // for more then X users, show all in one row - if (count($users) == 1 || count($users) > $this->cal_prefs['day_consolidate']) + if (count($users) == 1 || count($users) >= $this->cal_prefs['day_consolidate']) { $dayEvents =& $this->bo->search($this->search_params); $owner = 0; diff --git a/calendar/js/app.js b/calendar/js/app.js index 85eded8891..d0e5137170 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -272,8 +272,8 @@ app.classes.calendar = AppJS.extend( { var multiple_owner = typeof this.state.owner != 'string' && this.state.owner.length > 1 && - (this.state.view == 'day' && this.state.owner.length <= parseInt(this.egw.preference('day_consolidate','calendar')) || - this.state.view == 'week' && this.state.owner.length <= parseInt(this.egw.preference('week_consolidate','calendar'))); + (this.state.view == 'day' && this.state.owner.length < parseInt(this.egw.preference('day_consolidate','calendar')) || + this.state.view == 'week' && this.state.owner.length < parseInt(this.egw.preference('week_consolidate','calendar'))); // Make sure it's a string if(_id) _id = ''+_id; @@ -455,8 +455,8 @@ app.classes.calendar = AppJS.extend( // Enable or disable if(state.owner.length > 1 && ( - state.view == 'day' && state.owner.length <= parseInt(egw.preference('day_consolidate','calendar')) || - state.view == 'week' && state.owner.length <= parseInt(egw.preference('week_consolidate','calendar')) + state.view == 'day' && state.owner.length < parseInt(egw.preference('day_consolidate','calendar')) || + state.view == 'week' && state.owner.length < parseInt(egw.preference('week_consolidate','calendar')) )) { sortable.sortable('enable') @@ -1824,10 +1824,10 @@ app.classes.calendar = AppJS.extend( { case 'day': case 'day4': - grid_count = state.state.owner.length > parseInt(this.egw.preference('day_consolidate','calendar')) ? 1 : state.state.owner.length; + grid_count = state.state.owner.length >= parseInt(this.egw.preference('day_consolidate','calendar')) ? 1 : state.state.owner.length; break; case 'week': - grid_count = state.state.owner.length > parseInt(this.egw.preference('week_consolidate','calendar')) ? 1 : state.state.owner.length; + grid_count = state.state.owner.length >= parseInt(this.egw.preference('week_consolidate','calendar')) ? 1 : state.state.owner.length; break; case 'weekN': grid_count = parseInt(this.egw.preference('multiple_weeks','calendar')) || 3; @@ -3109,11 +3109,9 @@ app.classes.calendar = AppJS.extend( }, /** * How big or small are the displayed time chunks? - * We automatically scale the user's preference based on how many rows / calendars are shown. */ granularity: function(state) { - return Math.min(240,(state.owner.length <= (egw.config('calview_no_consolidate','phpgwapi') || 5) ? state.owner.length : 1) - * (parseInt(egw.preference('interval','calendar')) || 30)); + return parseInt(egw.preference('interval','calendar')) || 30; }, extend: function(sub) {