diff --git a/ChangeLog b/ChangeLog index 864fc8ba0..cdd687367 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-05-25 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoAptMailNotification.m (+initialize): + removed obsolete method. + (-viewTZ, setViewTZ): idem. + (-setupValues): the "viewTZ" is now initialized from here, using + the active user's defaults. + * UI/WebServerResources/SchedulerUIDnD.js: (SOGoEventDragEventCoordinates.setLocation) (SOGoEventDragGhostController.setLocation): new self-explanatory diff --git a/SoObjects/Appointments/SOGoAptMailNotification.m b/SoObjects/Appointments/SOGoAptMailNotification.m index 19e870ce0..71ca97772 100644 --- a/SoObjects/Appointments/SOGoAptMailNotification.m +++ b/SoObjects/Appointments/SOGoAptMailNotification.m @@ -25,6 +25,7 @@ #import #import +#import #import #import #import @@ -33,20 +34,14 @@ #import #import #import +#import +#import #import "iCalPerson+SOGo.h" #import "SOGoAptMailNotification.h" @implementation SOGoAptMailNotification -static NSTimeZone *UTC = nil; - -+ (void) initialize -{ - if (!UTC) - UTC = [[NSTimeZone timeZoneWithAbbreviation: @"UTC"] retain]; -} - - (id) init { if ((self = [super init])) @@ -100,22 +95,12 @@ static NSTimeZone *UTC = nil; return ([[previousApt location] length] > 0); } -- (NSTimeZone *) viewTZ -{ - if (viewTZ) return viewTZ; - return UTC; -} -- (void) setViewTZ: (NSTimeZone *) _viewTZ -{ - ASSIGN (viewTZ, _viewTZ); -} - - (NSCalendarDate *) oldStartDate { if (!oldStartDate) { ASSIGN (oldStartDate, [[self previousApt] startDate]); - [oldStartDate setTimeZone: [self viewTZ]]; + [oldStartDate setTimeZone: viewTZ]; } return oldStartDate; } @@ -125,7 +110,7 @@ static NSTimeZone *UTC = nil; if (!newStartDate) { ASSIGN (newStartDate, [[self apt] startDate]); - [newStartDate setTimeZone:[self viewTZ]]; + [newStartDate setTimeZone: viewTZ]; } return newStartDate; } @@ -167,6 +152,11 @@ static NSTimeZone *UTC = nil; { NSDictionary *sentByValues; NSString *sentBy, *sentByText; + SOGoUser *user; + + user = [context activeUser]; + viewTZ = [[user userDefaults] timeZone]; + [viewTZ retain]; values = [NSMutableDictionary new]; [values setObject: [self summary] forKey: @"Summary"]; diff --git a/SoObjects/Appointments/SOGoAptMailReceipt.m b/SoObjects/Appointments/SOGoAptMailReceipt.m index f4de27302..420ec5b30 100644 --- a/SoObjects/Appointments/SOGoAptMailReceipt.m +++ b/SoObjects/Appointments/SOGoAptMailReceipt.m @@ -131,13 +131,11 @@ static NSCharacterSet *wsSet = nil; SOGoDateFormatter *formatter; NSCalendarDate *tzDate; SOGoUser *currentUser; - SOGoUserDefaults *ud; currentUser = [context activeUser]; - ud = [currentUser userDefaults]; tzDate = [date copy]; - [tzDate setTimeZone: [ud timeZone]]; + [tzDate setTimeZone: viewTZ]; [tzDate autorelease]; formatter = [currentUser dateFormatterInContext: context]; diff --git a/SoObjects/Appointments/SOGoAptMailUpdate.m b/SoObjects/Appointments/SOGoAptMailUpdate.m index 90ed63705..a489f44f0 100644 --- a/SoObjects/Appointments/SOGoAptMailUpdate.m +++ b/SoObjects/Appointments/SOGoAptMailUpdate.m @@ -29,7 +29,6 @@ #import #import #import -#import #import "SOGoAptMailNotification.h" @@ -39,12 +38,11 @@ @implementation SOGoAptMailUpdate - (NSString *) valueForProperty: (NSString *) property + withDateFormatter: (SOGoDateFormatter *) dateFormatter { static NSDictionary *valueTypes = nil; NSString *valueType; id value; - SOGoUser *user; - NSTimeZone *userTZ; if (!valueTypes) { @@ -65,11 +63,8 @@ value = [(iCalEvent *) apt propertyValue: property]; if ([valueType isEqualToString: @"date"]) { - user = [context activeUser]; - userTZ = [[user userDefaults] timeZone]; - [value setTimeZone: userTZ]; - value = [[user dateFormatterInContext: context] - formattedDateAndTime: value]; + [value setTimeZone: viewTZ]; + value = [dateFormatter formattedDateAndTime: value]; } } else @@ -78,7 +73,7 @@ return value; } -- (void) _setupBodyContent +- (void) _setupBodyContentWithFormatter: (SOGoDateFormatter *) dateFormatter { NSArray *updatedProperties; NSMutableString *bodyContent; @@ -93,7 +88,8 @@ for (count = 0; count < max; count++) { property = [updatedProperties objectAtIndex: count]; - value = [self valueForProperty: property]; + value = [self valueForProperty: property + withDateFormatter: dateFormatter]; /* Unhandled properties will return nil */ if (value) { @@ -107,7 +103,7 @@ [bodyContent release]; } -- (void) _setupBodyValues +- (void) _setupBodyValuesWithFormatter: (SOGoDateFormatter *) dateFormatter { NSString *bodyText; @@ -116,7 +112,7 @@ inContext: context]; [values setObject: [values keysWithFormat: bodyText] forKey: @"_bodyStart"]; - [self _setupBodyContent]; + [self _setupBodyContentWithFormatter: dateFormatter]; [values setObject: [self labelForKey: @"Please accept" @" or decline those changes." inContext: context] @@ -144,7 +140,7 @@ [values setObject: [dateFormatter formattedTime: date] forKey: @"StartTime"]; - [self _setupBodyValues]; + [self _setupBodyValuesWithFormatter: dateFormatter]; } - (NSString *) getSubject