Match consolidation number to the phrasing in preferences

This commit is contained in:
Nathan Gray 2015-12-28 16:55:51 +00:00
parent 66200f722b
commit 6dfef23ae3
2 changed files with 9 additions and 11 deletions

View File

@ -663,7 +663,7 @@ class calendar_uiviews extends calendar_ui
// Always do 7 days for a week so scrolling works properly // 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); $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)) + $content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) +
array('owner' => $users); array('owner' => $users);
@ -719,7 +719,7 @@ class calendar_uiviews extends calendar_ui
if (!is_array($users)) $users = array($users); if (!is_array($users)) $users = array($users);
// for more then X users, show all in one row // 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); $dayEvents =& $this->bo->search($this->search_params);
$owner = 0; $owner = 0;

View File

@ -272,8 +272,8 @@ app.classes.calendar = AppJS.extend(
{ {
var multiple_owner = typeof this.state.owner != 'string' && var multiple_owner = typeof this.state.owner != 'string' &&
this.state.owner.length > 1 && this.state.owner.length > 1 &&
(this.state.view == 'day' && this.state.owner.length <= parseInt(this.egw.preference('day_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'))); this.state.view == 'week' && this.state.owner.length < parseInt(this.egw.preference('week_consolidate','calendar')));
// Make sure it's a string // Make sure it's a string
if(_id) _id = ''+_id; if(_id) _id = ''+_id;
@ -455,8 +455,8 @@ app.classes.calendar = AppJS.extend(
// Enable or disable // Enable or disable
if(state.owner.length > 1 && ( if(state.owner.length > 1 && (
state.view == 'day' && state.owner.length <= parseInt(egw.preference('day_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')) state.view == 'week' && state.owner.length < parseInt(egw.preference('week_consolidate','calendar'))
)) ))
{ {
sortable.sortable('enable') sortable.sortable('enable')
@ -1824,10 +1824,10 @@ app.classes.calendar = AppJS.extend(
{ {
case 'day': case 'day':
case 'day4': 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; break;
case 'week': 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; break;
case 'weekN': case 'weekN':
grid_count = parseInt(this.egw.preference('multiple_weeks','calendar')) || 3; 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? * 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) { granularity: function(state) {
return Math.min(240,(state.owner.length <= (egw.config('calview_no_consolidate','phpgwapi') || 5) ? state.owner.length : 1) return parseInt(egw.preference('interval','calendar')) || 30;
* (parseInt(egw.preference('interval','calendar')) || 30));
}, },
extend: function(sub) extend: function(sub)
{ {