Fix some load order bugs. Firefox finishes loading list view before the sidebox, causing some discrepancies in views

This commit is contained in:
Nathan Gray 2015-12-03 20:44:52 +00:00
parent 161f37858d
commit 3ec70206cd
2 changed files with 15 additions and 7 deletions

View File

@ -234,7 +234,6 @@ class calendar_uiviews extends calendar_ui
$this->merge(); $this->merge();
return; return;
} }
if (!$this->view) $this->view = 'week';
// handle views in other files // handle views in other files
if (!isset($this->public_functions[$this->view]) && $this->view !== 'listview') if (!isset($this->public_functions[$this->view]) && $this->view !== 'listview')

View File

@ -59,7 +59,7 @@ app.classes.calendar = AppJS.extend(
*/ */
state: { state: {
date: new Date(), date: new Date(),
view: egw.preference('defaultcalendar','calendar') || 'day', view: egw.preference('saved_states','calendar').view || egw.preference('defaultcalendar','calendar') || 'day',
owner: egw.user('account_id') owner: egw.user('account_id')
}, },
@ -2302,14 +2302,20 @@ app.classes.calendar = AppJS.extend(
// Some data is missing for the current owner, go get it // Some data is missing for the current owner, go get it
if(need_data && seperate_owners) if(need_data && seperate_owners)
{ {
this._fetch_data(jQuery.extend({}, state, {owner: value[i].owner})); this._fetch_data(
jQuery.extend({}, state, {owner: value[i].owner}),
this.sidebox_et2 ? null : this.et2.getInstanceManager()
);
} }
} }
// Some data was missing, go get it // Some data was missing, go get it
if(need_data && !seperate_owners) if(need_data && !seperate_owners)
{ {
this._fetch_data(state); this._fetch_data(
state,
this.sidebox_et2 ? null : this.et2.getInstanceManager()
);
} }
}, },
@ -2327,7 +2333,10 @@ app.classes.calendar = AppJS.extend(
*/ */
_fetch_data: function(state, instance, start) _fetch_data: function(state, instance, start)
{ {
if(!this.sidebox_et2 && !instance) return; if(!this.sidebox_et2 && !instance)
{
return;
}
if(typeof start === 'undefined') if(typeof start === 'undefined')
{ {
@ -3139,12 +3148,12 @@ jQuery.extend(app.classes.calendar,{
app.calendar.date.long_date(state.first, state.last) app.calendar.date.long_date(state.first, state.last)
}, },
start_date: function(state) { start_date: function(state) {
return app.calendar.date.start_of_week(state.date || new Date()); return app.calendar.date.start_of_week(app.calendar.View.start_date.call(this,state));
}, },
end_date: function(state) { end_date: function(state) {
state.days = '' + (state.days >= 5 ? state.days : egw.preference('days_in_weekview','calendar') || 7); state.days = '' + (state.days >= 5 ? state.days : egw.preference('days_in_weekview','calendar') || 7);
var d = app.calendar.date.start_of_week(state.date || new Date()); var d = app.calendar.date.start_of_week(app.calendar.View.start_date.call(this,state));
// Always 7 days, we just turn weekends on or off // Always 7 days, we just turn weekends on or off
d.setUTCHours(24*7-1); d.setUTCHours(24*7-1);
return d; return d;