diff --git a/ChangeLog b/ChangeLog index 530816c61..f73cb12dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-04-19 Wolfgang Sourdeau + + * SoObjects/Appointments/SOGoWebAppointmentFolder.m (-setReloadOnLogin:) + (-reloadOnLogin): new accessors to the "AutoReloadedWebCalendars" + settings for the "Calendar" module. + + * UI/Scheduler/UIxCalendarProperties.m (-setReloadOnLogin:) + (-reloadOnLogin): new accessors. + + * SoObjects/Appointments/SOGoAppointmentFolders.m + (-reloadWebCalendars:): moved method from + UI/Scheduler/UIxCalMainActions.m and added a boolean parameter to + it indicating whether the "reload on login" setting should be + honoured or ignored. + 2010-04-19 Francis Lachapelle * UI/Scheduler/UIxComponentEditor.m (-_loadRRules): added support diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.h b/SoObjects/Appointments/SOGoAppointmentFolders.h index bf7fba704..4699966af 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.h +++ b/SoObjects/Appointments/SOGoAppointmentFolders.h @@ -30,6 +30,7 @@ @interface SOGoAppointmentFolders : SOGoParentFolder - (NSArray *) webCalendarIds; +- (void) reloadWebCalendars: (BOOL) forceReload; - (BOOL) hasProxyCalendarsWithWriteAccess: (BOOL) write forUserWithLogin: (NSString *) userLogin; diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.m b/SoObjects/Appointments/SOGoAppointmentFolders.m index 4257cd1d6..4931c66f8 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.m +++ b/SoObjects/Appointments/SOGoAppointmentFolders.m @@ -284,8 +284,7 @@ rc = nil; - us = [[SOGoUser userWithLogin: [self ownerInContext: nil]] - userSettings]; + us = [[SOGoUser userWithLogin: owner] userSettings]; tmp = [us objectForKey: @"Calendar"]; if (tmp) { @@ -300,6 +299,31 @@ return rc; } +- (void) reloadWebCalendars: (BOOL) forceReload +{ + SOGoUserSettings *settings; + NSMutableDictionary *calendarSettings, *webCalendars; + NSArray *calendarIds; + SOGoWebAppointmentFolder *folder; + NSString *name; + int count, max; + + settings = [[SOGoUser userWithLogin: owner] userSettings]; + calendarSettings = [settings objectForKey: @"Calendar"]; + webCalendars = [calendarSettings objectForKey: @"WebCalendars"]; + calendarIds = [webCalendars allKeys]; + max = [calendarIds count]; + for (count = 0; count < max; count++) + { + name = [calendarIds objectAtIndex: count]; + folder = [self lookupName: name inContext: context acquire: NO]; + if (folder + && [folder isKindOfClass: [SOGoWebAppointmentFolder class]] + && (forceReload || [folder reloadOnLogin])) + [folder loadWebCalendar: [webCalendars objectForKey: name]]; + } +} + - (NSException *) _fetchPersonalFolders: (NSString *) sql withChannel: (EOAdaptorChannel *) fc { diff --git a/SoObjects/Appointments/SOGoWebAppointmentFolder.h b/SoObjects/Appointments/SOGoWebAppointmentFolder.h index 184ab150f..e237da32a 100644 --- a/SoObjects/Appointments/SOGoWebAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoWebAppointmentFolder.h @@ -30,6 +30,8 @@ - (int) loadWebCalendar: (NSString *) location; - (void) deleteAllContent; +- (void) setReloadOnLogin: (BOOL) newReloadOnLogin; +- (BOOL) reloadOnLogin; @end diff --git a/SoObjects/Appointments/SOGoWebAppointmentFolder.m b/SoObjects/Appointments/SOGoWebAppointmentFolder.m index c504dd281..5d0f59e73 100644 --- a/SoObjects/Appointments/SOGoWebAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoWebAppointmentFolder.m @@ -73,21 +73,32 @@ return imported; } +- (void) setReloadOnLogin: (BOOL) newReloadOnLogin +{ + [self setFolderPropertyValue: [NSNumber numberWithBool: newReloadOnLogin] + inCategory: @"AutoReloadedWebCalendars"]; +} + +- (BOOL) reloadOnLogin +{ + return [[self folderPropertyValueInCategory: @"AutoReloadedWebCalendars"] + boolValue]; +} + - (NSException *) delete { NSException *error; SOGoUserSettings *settings; - NSMutableDictionary *calSettings, *webCalendars; + NSMutableDictionary *webCalendars; NSString *name; - settings = [[context activeUser] userSettings]; - calSettings = [settings objectForKey: @"Calendar"]; - webCalendars = [calSettings objectForKey: @"WebCalendars"]; - name = [self nameInContainer]; - error = [super delete]; if (!error) { + settings = [[context activeUser] userSettings]; + webCalendars = [[settings objectForKey: @"Calendar"] + objectForKey: @"WebCalendars"]; + name = [self nameInContainer]; [webCalendars removeObjectForKey: name]; [settings synchronize]; } diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index bfea17b87..25c85b449 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -111,8 +111,8 @@ user = [[self alloc] initWithLogin: newLogin roles: newRoles trust: b]; if (user) { - [user autorelease]; [cache registerUser: user withName: newLogin]; + [user release]; } } if (newRoles) diff --git a/UI/MainUI/SOGoRootPage.m b/UI/MainUI/SOGoRootPage.m index 72bab1c5d..9d1255b5b 100644 --- a/UI/MainUI/SOGoRootPage.m +++ b/UI/MainUI/SOGoRootPage.m @@ -41,6 +41,8 @@ #import #import +#import + #import #import #import @@ -124,7 +126,9 @@ WORequest *request; WOCookie *authCookie; SOGoWebAuthenticator *auth; + SOGoAppointmentFolders *calendars; SOGoUserDefaults *ud; + SOGoUser *loggedInUser; NSString *username, *password, *language; NSArray *supportedLanguages; @@ -167,12 +171,18 @@ supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults] supportedLanguages]; + loggedInUser = [SOGoUser userWithLogin: username]; + [context setActiveUser: loggedInUser]; if (language && [supportedLanguages containsObject: language]) { - ud = [[SOGoUser userWithLogin: username] userDefaults]; + ud = [loggedInUser userDefaults]; [ud setLanguage: language]; [ud synchronize]; } + + calendars = [loggedInUser calendarsFolderInContext: context]; + if ([calendars respondsToSelector: @selector (reloadWebCalendars:)]) + [calendars reloadWebCalendars: NO]; } else { diff --git a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings index 035d7d65a..d225c7b09 100644 --- a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Tarefa Confidencial)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Czech.lproj/Localizable.strings b/UI/Scheduler/Czech.lproj/Localizable.strings index e0f6ace8d..d336dac7a 100644 --- a/UI/Scheduler/Czech.lproj/Localizable.strings +++ b/UI/Scheduler/Czech.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Důvěrný úkol)"; "Subscribe to a web calendar..." = "Přihlásit odběr vzdáleného kalendáře na webu"; "URL of the Calendar" = "Adresa vzdáleného kalendáře na webu"; "Web Calendar" = "Vzdálený kalendář na webu"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Dutch.lproj/Localizable.strings b/UI/Scheduler/Dutch.lproj/Localizable.strings index d363470de..8f8bc3940 100644 --- a/UI/Scheduler/Dutch.lproj/Localizable.strings +++ b/UI/Scheduler/Dutch.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Vertrouwelijke taak)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index bc9b1de50..9c27aab21 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Confidential task)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 8890d2282..9cdc2c7ec 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Tâche confidentielle)"; "Subscribe to a web calendar..." = "S'inscrire à un agenda en ligne..."; "URL of the Calendar" = "URL de l'agenda"; "Web Calendar" = "Calendrier web"; +"Reload on login" = "Rafraîchir à la connexion"; diff --git a/UI/Scheduler/German.lproj/Localizable.strings b/UI/Scheduler/German.lproj/Localizable.strings index 44a98215d..ae4474590 100644 --- a/UI/Scheduler/German.lproj/Localizable.strings +++ b/UI/Scheduler/German.lproj/Localizable.strings @@ -542,3 +542,4 @@ vtodo_class2 = "(Vertrauliche Aufgabe)"; "URL of the Calendar" = "URL des Kalenders"; "Web Calendar" = "Web-Kalender"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Hungarian.lproj/Localizable.strings b/UI/Scheduler/Hungarian.lproj/Localizable.strings index 8f5fe399d..0d9bc3897 100644 --- a/UI/Scheduler/Hungarian.lproj/Localizable.strings +++ b/UI/Scheduler/Hungarian.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Bizalmas feladat)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Italian.lproj/Localizable.strings b/UI/Scheduler/Italian.lproj/Localizable.strings index da553e3e7..b965bf248 100644 --- a/UI/Scheduler/Italian.lproj/Localizable.strings +++ b/UI/Scheduler/Italian.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Attività confidenziale)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Russian.lproj/Localizable.strings b/UI/Scheduler/Russian.lproj/Localizable.strings index c8a56ce1a..f90977000 100644 --- a/UI/Scheduler/Russian.lproj/Localizable.strings +++ b/UI/Scheduler/Russian.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Confidential task)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Spanish.lproj/Localizable.strings b/UI/Scheduler/Spanish.lproj/Localizable.strings index c77ce85d2..38245e2e0 100644 --- a/UI/Scheduler/Spanish.lproj/Localizable.strings +++ b/UI/Scheduler/Spanish.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Tarea confidencial)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/Swedish.lproj/Localizable.strings b/UI/Scheduler/Swedish.lproj/Localizable.strings index 89be81d2a..978b39809 100644 --- a/UI/Scheduler/Swedish.lproj/Localizable.strings +++ b/UI/Scheduler/Swedish.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Konfidentiell uppgift)"; "Subscribe to a web calendar..." = "Prenumrera på en webbkalender..."; "URL of the Calendar" = "URL till kalendern"; "Web Calendar" = "Webbkalender"; +"Reload on login" = "Reload on login"; diff --git a/UI/Scheduler/UIxCalMainActions.m b/UI/Scheduler/UIxCalMainActions.m index e2efff4f5..49dfb95a4 100644 --- a/UI/Scheduler/UIxCalMainActions.m +++ b/UI/Scheduler/UIxCalMainActions.m @@ -124,32 +124,7 @@ - (WOResponse *) reloadWebCalendarsAction { - SOGoUserSettings *settings; - NSMutableDictionary *calSettings, *webCalendars; - NSArray *calendarIds; - SOGoWebAppointmentFolder *folder; - NSString *name, *url; - int i, count, imported; - - settings = [[context activeUser] userSettings]; - calSettings = [settings objectForKey: @"Calendar"]; - webCalendars = [calSettings objectForKey: @"WebCalendars"]; - - if (webCalendars) - { - calendarIds = [webCalendars allKeys]; - count = [calendarIds count]; - for (i = 0; i < count; i++) - { - name = [calendarIds objectAtIndex: i]; - url = [webCalendars objectForKey: name]; - folder = [[self clientObject] lookupName: name - inContext: context - acquire: NO]; - if (folder) - imported = [folder loadWebCalendar: url]; - } - } + [[self clientObject] reloadWebCalendars: YES]; return [self responseWith204]; } diff --git a/UI/Scheduler/UIxCalendarProperties.m b/UI/Scheduler/UIxCalendarProperties.m index 4ffe752ff..73ab8ef73 100644 --- a/UI/Scheduler/UIxCalendarProperties.m +++ b/UI/Scheduler/UIxCalendarProperties.m @@ -28,6 +28,7 @@ #import #import #import +#import #import "UIxCalendarProperties.h" @@ -167,21 +168,37 @@ settings = [[context activeUser] userSettings]; calendarSettings = [settings objectForKey: @"Calendar"]; - rc = nil; - - if (calendarSettings) - { - webCalendars = [calendarSettings objectForKey: @"WebCalendars"]; - if (webCalendars) - rc = [webCalendars objectForKey: [calendar nameInContainer]]; - } + webCalendars = [calendarSettings objectForKey: @"WebCalendars"]; + if (webCalendars) + rc = [webCalendars objectForKey: [calendar nameInContainer]]; + else + rc = nil; return rc; } - (BOOL) isWebCalendar { - return ([self webCalendarURL] != nil); + return ([calendar isKindOfClass: [SOGoWebAppointmentFolder class]]); +} + +- (void) setReloadOnLogin: (BOOL) newReloadOnLogin +{ + if ([calendar respondsToSelector: @selector (setReloadOnLogin:)]) + [(SOGoWebAppointmentFolder *) calendar + setReloadOnLogin: newReloadOnLogin]; +} + +- (BOOL) reloadOnLogin +{ + BOOL rc; + + if ([calendar respondsToSelector: @selector (reloadOnLogin)]) + rc = [(SOGoWebAppointmentFolder *) calendar reloadOnLogin]; + else + rc = NO; + + return rc; } - (BOOL) shouldTakeValuesFromRequest: (WORequest *) request @@ -196,10 +213,12 @@ - (id ) savePropertiesAction { - NSString *action = nil; + NSString *action; if (reloadTasks) action = @"refreshTasks()"; + else + action = nil; return [self jsCloseWithRefreshMethod: action]; } diff --git a/UI/Scheduler/Welsh.lproj/Localizable.strings b/UI/Scheduler/Welsh.lproj/Localizable.strings index 90965b727..ddfed3d86 100644 --- a/UI/Scheduler/Welsh.lproj/Localizable.strings +++ b/UI/Scheduler/Welsh.lproj/Localizable.strings @@ -541,3 +541,4 @@ vtodo_class2 = "(Tasg gyhoeddus)"; "Subscribe to a web calendar..." = "Subscribe to a web calendar..."; "URL of the Calendar" = "URL of the Calendar"; "Web Calendar" = "Web Calendar"; +"Reload on login" = "Reload on login"; diff --git a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox index 87a33a2c9..3b3ceb50a 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox @@ -81,6 +81,12 @@ id="showCalendarTasks" var:checked="showCalendarTasks" /> +
diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 27a447be1..4768e18f6 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -2153,7 +2153,7 @@ function onCalendarModify(event) { var url = ApplicationBaseURL + calendarID + "/properties"; var windowID = sanitizeWindowName(calendarID + " properties"); var width = 310; - var height = 266; + var height = 275; var isWebCalendar = false; if (UserSettings['Calendar'] && UserSettings['Calendar']['WebCalendars']) { @@ -2164,9 +2164,9 @@ function onCalendarModify(event) { } } if (isWebCalendar) - height += 21; + height += 41; else if (calendarID == "/personal") - height -= 25; + height -= 26; var properties = window.open(url, windowID, "width="+width+",height="+height+",resizable=0");