From: Jan Schneider Date: Mon, 31 May 2010 13:56:21 +0000 (+0200) Subject: Check earlier whether we need to load calendar information from the backend. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=126b9f9522ebc606d1bcc8ebe5ea800584edac29;p=horde.git Check earlier whether we need to load calendar information from the backend. --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 8a144dce0..ec8098ef6 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2541,13 +2541,32 @@ KronolithCore = { this.closeRedBox(); this.quickClose(); + var type = calendar.split('|')[0], cal = calendar.split('|')[1]; + + if (cal && + (Object.isUndefined(Kronolith.conf.calendars[type]) || + Object.isUndefined(Kronolith.conf.calendars[type][cal])) && + (type == 'internal' || type == 'tasklists')) { + this.doAction('getCalendar', { type: type, cal: cal }, function(r) { + if (r.response.calendar) { + Kronolith.conf.calendars[type][cal] = r.response.calendar; + this.insertCalendarInList(type, cal, r.response.calendar); + $('kronolithSharedCalendars').show(); + this.editCalendar(type + '|' + cal); + } else { + window.history.back(); + } + }.bind(this)); + return; + } + this.redBoxOnDisplay = RedBox.onDisplay; RedBox.onDisplay = function() { if (this.redBoxOnDisplay) { this.redBoxOnDisplay(); } try { - $('kronolithCalendarForm' + calendar.split('|')[0]).focusFirstElement(); + $('kronolithCalendarForm' + type).focusFirstElement(); } catch(e) {} RedBox.onDisplay = this.redBoxOnDisplay; }.bind(this); @@ -2617,17 +2636,6 @@ KronolithCore = { (Object.isUndefined(Kronolith.conf.calendars[type]) || Object.isUndefined(Kronolith.conf.calendars[type][calendar]))) { switch (type) { - case 'internal': - case 'tasklists': - this.doAction('getCalendar', { type: type, cal: calendar }, function(r) { - if (r.response.calendar) { - Kronolith.conf.calendars[type][calendar] = r.response.calendar; - this.insertCalendarInList(type, calendar, r.response.calendar); - $('kronolithSharedCalendars').show(); - this.editCalendarCallback(type + '|' + calendar); - } - }.bind(this)); - return; case 'remote': newCalendar = true; break;