diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index b072bb20f..0ca7c0868 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -38,11 +38,17 @@ #import "SOGo/SOGoFolder.h" -@class NSString, NSArray, NSCalendarDate, NSException, NSMutableDictionary; +@class NSArray; +@class NSCalendarDate; +@class NSException; +@class NSMutableDictionary; +@class NSString; +@class NSTimeZone; @class GCSFolder; @interface SOGoAppointmentFolder : SOGoFolder { + NSTimeZone *timeZone; NSMutableDictionary *uidToFilename; } @@ -106,7 +112,7 @@ - (NSArray *) fetchAllSOGoAppointments; -- (NSArray *) calendarFoldersInContext: (WOContext *) context; +- (NSArray *) calendarFolders; @end diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 806919003..b877f3007 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -84,12 +84,23 @@ static NSNumber *sharedYes = nil; // SOGoRole_Assistant, nil] // asDefaultForPermission: SoPerm_View]; - sharedYes = [[NSNumber numberWithBool:YES] retain]; + sharedYes = [[NSNumber numberWithBool: YES] retain]; +} + +- (id) initWithName: (NSString *) name + inContainer: (id) newContainer +{ + if ((self = [super initWithName: name inContainer: newContainer])) + { + timeZone = [[context activeUser] timeZone]; + } + + return self; } - (void) dealloc { - [self->uidToFilename release]; + [uidToFilename release]; [super dealloc]; } @@ -108,8 +119,7 @@ static NSNumber *sharedYes = nil; NSString *s; s = [[self container] nameInContainer]; -#warning HH DEBUG - [self logWithFormat:@"CAL UID: %@", s]; +// [self logWithFormat:@"CAL UID: %@", s]; return [s isNotNull] ? [NSArray arrayWithObjects:&s count:1] : nil; } @@ -237,7 +247,6 @@ static NSNumber *sharedYes = nil; - (void) _appendComponentsMatchingFilters: (NSArray *) filters toResponse: (WOResponse *) response - inContext: (WOContext *) context { NSArray *apts; unsigned int count, max; @@ -266,7 +275,7 @@ static NSNumber *sharedYes = nil; } } -- (id) davCalendarQuery: (id) context +- (id) davCalendarQuery: (id) queryContext { WOResponse *r; NSArray *filters; @@ -285,8 +294,7 @@ static NSNumber *sharedYes = nil; document = [[context request] contentAsDOMDocument]; filters = [self _parseCalendarFilters: [document documentElement]]; [self _appendComponentsMatchingFilters: filters - toResponse: r - inContext: context]; + toResponse: r]; [r appendContentString:@"\r\n"]; return r; @@ -342,7 +350,6 @@ static NSNumber *sharedYes = nil; } - (BOOL) requestNamedIsHandledLater: (NSString *) name - inContext: (WOContext *) context { return [name isEqualToString: @"OPTIONS"]; } @@ -356,7 +363,7 @@ static NSNumber *sharedYes = nil; BOOL handledLater; /* first check attributes directly bound to the application */ - handledLater = [self requestNamedIsHandledLater: _key inContext: _ctx]; + handledLater = [self requestNamedIsHandledLater: _key]; if (handledLater) obj = nil; else @@ -467,7 +474,7 @@ static NSNumber *sharedYes = nil; if (![_uid isNotNull]) return nil; - if ((rname = [self->uidToFilename objectForKey:_uid]) != nil) + if ((rname = [uidToFilename objectForKey:_uid]) != nil) return [rname isNotNull] ? rname : nil; if ((folder = [self ocsFolder]) == nil) { @@ -476,13 +483,13 @@ static NSNumber *sharedYes = nil; return nil; } - if (self->uidToFilename == nil) - self->uidToFilename = [[NSMutableDictionary alloc] initWithCapacity:16]; + if (uidToFilename == nil) + uidToFilename = [[NSMutableDictionary alloc] initWithCapacity:16]; if ((rname = [self resourceNameForEventUID:_uid inFolder:folder]) == nil) - [self->uidToFilename setObject:[NSNull null] forKey:_uid]; + [uidToFilename setObject:[NSNull null] forKey:_uid]; else - [self->uidToFilename setObject:rname forKey:_uid]; + [uidToFilename setObject:rname forKey:_uid]; return rname; } @@ -527,7 +534,7 @@ static NSNumber *sharedYes = nil; if ((tmp = [_record objectForKey:@"startdate"])) { tmp = [[NSCalendarDate alloc] initWithTimeIntervalSince1970: (NSTimeInterval)[tmp unsignedIntValue]]; - [tmp setTimeZone: [self userTimeZone]]; + [tmp setTimeZone: timeZone]; if (tmp) [md setObject:tmp forKey:@"startDate"]; [tmp release]; } @@ -537,7 +544,7 @@ static NSNumber *sharedYes = nil; if ((tmp = [_record objectForKey:@"enddate"])) { tmp = [[NSCalendarDate alloc] initWithTimeIntervalSince1970: (NSTimeInterval)[tmp unsignedIntValue]]; - [tmp setTimeZone: [self userTimeZone]]; + [tmp setTimeZone: timeZone]; if (tmp) [md setObject:tmp forKey:@"endDate"]; [tmp release]; } @@ -557,15 +564,41 @@ static NSNumber *sharedYes = nil; /* cycle is in _r */ tmp = [_r startDate]; - [tmp setTimeZone:[self userTimeZone]]; + [tmp setTimeZone: timeZone]; [md setObject:tmp forKey:@"startDate"]; tmp = [_r endDate]; - [tmp setTimeZone:[self userTimeZone]]; + [tmp setTimeZone: timeZone]; [md setObject:tmp forKey:@"endDate"]; return md; } +- (NSArray *) fixupRecords: (NSArray *) records + fetchRange: (NGCalendarDateRange *) r +{ + // TODO: is the result supposed to be sorted by date? + NSMutableArray *ma; + unsigned count, max; + id row; // TODO: what is the type of the record? + + if (records) + { + max = [records count]; + ma = [NSMutableArray arrayWithCapacity: max]; + for (count = 0; count < max; count++) + { + row = [self fixupRecord: [records objectAtIndex: count] + fetchRange: r]; + if (row) + [ma addObject: row]; + } + } + else + ma = nil; + + return ma; +} + - (void) _flattenCycleRecord: (NSDictionary *) _row forRange: (NGCalendarDateRange *) _r intoArray: (NSMutableArray *) _ma @@ -611,28 +644,6 @@ static NSNumber *sharedYes = nil; } } -- (NSArray *) fixupRecords: (NSArray *) _records - fetchRange: (NGCalendarDateRange *) _r -{ - // TODO: is the result supposed to be sorted by date? - NSMutableArray *ma; - unsigned i, count; - - if (_records == nil) return nil; - if ((count = [_records count]) == 0) - return _records; - - ma = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - id row; // TODO: what is the type of the record? - - row = [_records objectAtIndex:i]; - row = [self fixupRecord:row fetchRange:_r]; - if (row != nil) [ma addObject:row]; - } - return ma; -} - - (NSArray *) fixupCyclicRecords: (NSArray *) _records fetchRange: (NGCalendarDateRange *) _r { @@ -692,10 +703,8 @@ static NSNumber *sharedYes = nil; - (NSString *) _privacySqlString { NSString *privacySqlString, *owner, *currentUser, *email; - WOContext *context; SOGoUser *activeUser; - context = [[WOApplication application] context]; activeUser = [context activeUser]; currentUser = [activeUser login]; owner = [self ownerInContext: context]; @@ -876,10 +885,8 @@ static NSNumber *sharedYes = nil; Class objectClass; unsigned int count, max; NSString *currentId, *currentUser; - WOContext *context; id deleteObject; - context = [[WOApplication application] context]; currentUser = [[context activeUser] login]; max = [ids count]; @@ -927,11 +934,9 @@ static NSNumber *sharedYes = nil; if (![_uid isNotNull]) return nil; - if (_ctx == nil) _ctx = [[WOApplication application] context]; - /* create subcontext, so that we don't destroy our environment */ - if ((ctx = [_ctx createSubContext]) == nil) { + if ((ctx = [context createSubContext]) == nil) { [self errorWithFormat:@"could not create SOPE subcontext!"]; return nil; } @@ -1166,7 +1171,7 @@ static NSNumber *sharedYes = nil; return firstShouldBeActive; } -- (NSArray *) calendarFoldersInContext: (WOContext *) context +- (NSArray *) calendarFolders { NSMutableDictionary *userCalendar, *calendarDict; NSMutableArray *calendarFolders; @@ -1177,7 +1182,6 @@ static NSNumber *sharedYes = nil; [calendarFolders autorelease]; activeUser = [context activeUser]; - userCalendar = [NSMutableDictionary new]; [userCalendar autorelease]; [userCalendar setObject: @"/" forKey: @"folder"]; diff --git a/SoObjects/Appointments/SOGoAppointmentObject.h b/SoObjects/Appointments/SOGoAppointmentObject.h index 17e9b24b0..d6fe91e86 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.h +++ b/SoObjects/Appointments/SOGoAppointmentObject.h @@ -48,22 +48,18 @@ /* folder management */ -- (id) lookupHomeFolderForUID: (NSString *) _uid inContext: (id)_ctx; +- (id) lookupHomeFolderForUID: (NSString *) _uid + inContext: (id) _ctx; - (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids inContext: (id) _ctx; /* "iCal multifolder saves" */ -- (NSException *) saveContentString: (NSString *)_iCal +- (NSException *) saveContentString: (NSString *) _iCal baseSequence: (int) _v; - (NSException *) deleteWithBaseSequence: (int) _v; - - (NSException *) saveContentString: (NSString *) _iCalString; -- (NSException *) changeParticipationStatus: (NSString *) _status - inContext: (id) _ctx; - - @end #endif /* __Appointments_SOGoAppointmentObject_H__ */ diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 4fbebbdb0..ea76ffb2b 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -112,11 +112,8 @@ NSEnumerator *e; id folder; NSException *allErrors = nil; - id ctx; - - ctx = [[WOApplication application] context]; - e = [[self lookupCalendarFoldersForUIDs:_uids inContext:ctx] + e = [[self lookupCalendarFoldersForUIDs:_uids inContext: context] objectEnumerator]; while ((folder = [e nextObject]) != nil) { NSException *error; @@ -125,7 +122,7 @@ if (![folder isNotNull]) /* no folder was found for given UID */ continue; - apt = [folder lookupName: [self nameInContainer] inContext:ctx + apt = [folder lookupName: [self nameInContainer] inContext: context acquire: NO]; if ([apt isKindOfClass: [NSException class]]) { @@ -160,17 +157,14 @@ NSEnumerator *e; id folder; NSException *allErrors = nil; - id ctx; - ctx = [[WOApplication application] context]; - - e = [[self lookupCalendarFoldersForUIDs:_uids inContext:ctx] + e = [[self lookupCalendarFoldersForUIDs:_uids inContext: context] objectEnumerator]; while ((folder = [e nextObject])) { NSException *error; SOGoAppointmentObject *apt; - apt = [folder lookupName:[self nameInContainer] inContext:ctx + apt = [folder lookupName:[self nameInContainer] inContext: context acquire:NO]; if ([apt isKindOfClass: [NSException class]]) { [self logWithFormat: @"%@", [(NSException *) apt reason]]; @@ -428,57 +422,6 @@ return [self saveContentString: _iCalString baseSequence: 0]; } -- (NSException *) changeParticipationStatus: (NSString *) _status - inContext: (id) _ctx -{ - iCalEvent *apt; - iCalPerson *p; - NSString *newContent; - NSException *ex; - NSString *myEMail; - - ex = nil; - - // TODO: do we need to use SOGoAppointment? (prefer iCalEvent?) - apt = (iCalEvent *) [self component: NO]; - - if (apt) - { - myEMail = [[_ctx activeUser] email]; - p = [apt findParticipantWithEmail: myEMail]; - if (p) - { - // TODO: send iMIP reply mails? - - [p setPartStat:_status]; - newContent = [[apt parent] versitString]; - if (newContent) - { - ex = [self saveContentString:newContent]; - if (ex) - // TODO: why is the exception wrapped? - /* Server Error */ - ex = [NSException exceptionWithHTTPStatus: 500 - reason: [ex reason]]; - } - else - ex - = [NSException exceptionWithHTTPStatus: 500 /* Server Error */ - reason: @"Could not generate iCalendar data ..."]; - } - else - ex = [NSException exceptionWithHTTPStatus: 404 /* Not Found */ - reason: @"user does not participate in this " - @"appointment"]; - } - else - ex = [NSException exceptionWithHTTPStatus:500 /* Server Error */ - reason:@"unable to parse appointment record"]; - - return ex; -} - - /* message type */ - (NSString *) outlookMessageClass diff --git a/SoObjects/Appointments/SOGoFreeBusyObject.m b/SoObjects/Appointments/SOGoFreeBusyObject.m index 5c86c19ae..b76cb819e 100644 --- a/SoObjects/Appointments/SOGoFreeBusyObject.m +++ b/SoObjects/Appointments/SOGoFreeBusyObject.m @@ -47,14 +47,17 @@ - (NSString *) contentAsString { NSCalendarDate *today, *startDate, *endDate; + NSTimeZone *timeZone; today = [[NSCalendarDate calendarDate] beginOfDay]; - [today setTimeZone: [self userTimeZone]]; + timeZone = [[context activeUser] timeZone]; + [today setTimeZone: timeZone]; startDate = [today dateByAddingYears: 0 months: 0 days: -14 hours: 0 minutes: 0 seconds: 0]; endDate = [startDate dateByAddingYears: 0 months: 1 days: 0 hours: 0 minutes: 0 seconds: 0]; + return [self contentAsStringFrom: startDate to: endDate]; } @@ -72,16 +75,13 @@ { id calFolder; SoSecurityManager *sm; - WOApplication *woApp; NSArray *infos; - woApp = [WOApplication application]; - calFolder = [container lookupName: @"Calendar" inContext: nil acquire: NO]; sm = [SoSecurityManager sharedSecurityManager]; if (![sm validatePermission: SOGoPerm_FreeBusyLookup onObject: calFolder - inContext: [woApp context]]) + inContext: context]]) infos = [calFolder fetchFreeBusyInfosFrom: _startDate to: _endDate]; else diff --git a/SoObjects/Appointments/SOGoGroupAppointmentFolder.m b/SoObjects/Appointments/SOGoGroupAppointmentFolder.m index c154c5b30..099fdf4f4 100644 --- a/SoObjects/Appointments/SOGoGroupAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoGroupAppointmentFolder.m @@ -130,10 +130,8 @@ NSMutableArray *result; NSMutableDictionary *uidToRecord; unsigned i, count; - WOContext *context; SoSecurityManager *securityManager; - context = [[WOApplication application] context]; securityManager = [SoSecurityManager sharedSecurityManager]; folders = [[self container] memberFolders]; @@ -166,7 +164,7 @@ onObject: aptFolder inContext: context]) { [self debugWithFormat:@"no permission to read the content of calendar: %@", - [folders objectAtIndex:i]]; + [folders objectAtIndex:i]]; continue; } diff --git a/SoObjects/Appointments/SOGoTaskObject.h b/SoObjects/Appointments/SOGoTaskObject.h index 234362633..9f57bf588 100644 --- a/SoObjects/Appointments/SOGoTaskObject.h +++ b/SoObjects/Appointments/SOGoTaskObject.h @@ -46,19 +46,17 @@ /* folder management */ -- (id)lookupHomeFolderForUID:(NSString *)_uid inContext:(id)_ctx; -- (NSArray *)lookupCalendarFoldersForUIDs:(NSArray *)_uids inContext:(id)_ctx; +- (id) lookupHomeFolderForUID: (NSString *) _uid + inContext: (id) _ctx; +- (NSArray *) lookupCalendarFoldersForUIDs: (NSArray *) _uids + inContext: (id) _ctx; /* "iCal multifolder saves" */ -- (NSException *)saveContentString:(NSString *)_iCal baseSequence:(int)_v; -- (NSException *)deleteWithBaseSequence:(int)_v; - -- (NSException *)saveContentString:(NSString *)_iCalString; - -- (NSException *)changeParticipationStatus:(NSString *)_status - inContext:(id)_ctx; - +- (NSException *) saveContentString: (NSString *) _iCal + baseSequence: (int) _v; +- (NSException *) deleteWithBaseSequence: (int) _v; +- (NSException *) saveContentString: (NSString *) _iCalString; @end diff --git a/SoObjects/Appointments/SOGoTaskObject.m b/SoObjects/Appointments/SOGoTaskObject.m index c364b922b..9f539b78f 100644 --- a/SoObjects/Appointments/SOGoTaskObject.m +++ b/SoObjects/Appointments/SOGoTaskObject.m @@ -121,6 +121,7 @@ static NSString *mailTemplateDefaultLanguage = nil; // TODO: what does this do? lookup the home of the organizer? return [[self container] lookupHomeFolderForUID:_uid inContext:_ctx]; } + - (NSArray *)lookupCalendarFoldersForUIDs:(NSArray *)_uids inContext:(id)_ctx { return [[self container] lookupCalendarFoldersForUIDs:_uids inContext:_ctx]; } @@ -131,11 +132,8 @@ static NSString *mailTemplateDefaultLanguage = nil; NSEnumerator *e; id folder; NSException *allErrors = nil; - id ctx; - ctx = [[WOApplication application] context]; - - e = [[self lookupCalendarFoldersForUIDs:_uids inContext:ctx] + e = [[self lookupCalendarFoldersForUIDs: _uids inContext: context] objectEnumerator]; while ((folder = [e nextObject]) != nil) { NSException *error; @@ -173,18 +171,16 @@ static NSString *mailTemplateDefaultLanguage = nil; NSEnumerator *e; id folder; NSException *allErrors = nil; - id ctx; - ctx = [[WOApplication application] context]; - - e = [[self lookupCalendarFoldersForUIDs:_uids inContext:ctx] + e = [[self lookupCalendarFoldersForUIDs: _uids inContext: context] objectEnumerator]; while ((folder = [e nextObject])) { NSException *error; SOGoTaskObject *task; - task = [folder lookupName:[self nameInContainer] inContext:ctx - acquire:NO]; + task = [folder lookupName: [self nameInContainer] + inContext: context + acquire: NO]; if (![task isNotNull]) { [self logWithFormat:@"Note: did not find '%@' in folder: %@", [self nameInContainer], folder]; @@ -452,52 +448,6 @@ static NSString *mailTemplateDefaultLanguage = nil; return [self saveContentString:_iCalString baseSequence:0]; } -- (NSException *)changeParticipationStatus:(NSString *)_status - inContext:(id)_ctx -{ - iCalToDo *task; - iCalPerson *p; - NSString *newContent; - NSException *ex; - NSString *myEMail; - - // TODO: do we need to use SOGoTask? (prefer iCalToDo?) - task = (iCalToDo *) [self component: NO]; - - if (task == nil) { - return [NSException exceptionWithHTTPStatus:500 /* Server Error */ - reason:@"unable to parse task record"]; - } - - myEMail = [[_ctx activeUser] email]; - if ((p = [task findParticipantWithEmail:myEMail]) == nil) { - return [NSException exceptionWithHTTPStatus:404 /* Not Found */ - reason:@"user does not participate in this " - @"task"]; - } - - [p setPartStat:_status]; - newContent = [[task parent] versitString]; - - // TODO: send iMIP reply mails? - -// [task release]; task = nil; - - if (newContent == nil) { - return [NSException exceptionWithHTTPStatus:500 /* Server Error */ - reason:@"Could not generate iCalendar data ..."]; - } - - if ((ex = [self saveContentString:newContent]) != nil) { - // TODO: why is the exception wrapped? - return [NSException exceptionWithHTTPStatus:500 /* Server Error */ - reason:[ex reason]]; - } - - return nil /* means: no error */; -} - - /* message type */ - (NSString *)outlookMessageClass { diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index fb81bb53a..6e61cc675 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -169,7 +169,7 @@ } } -- (void) initContactSourcesInContext: (WOContext *) context; +- (void) initContactSources { if (!contactFolders) { @@ -180,18 +180,18 @@ } - (id) lookupName: (NSString *) name - inContext: (WOContext *) context + inContext: (WOContext *) lookupContext acquire: (BOOL) acquire { id obj; id folder; /* first check attributes directly bound to the application */ - obj = [super lookupName: name inContext: context acquire: NO]; + obj = [super lookupName: name inContext: lookupContext acquire: NO]; if (!obj) { if (!contactFolders) - [self initContactSourcesInContext: context]; + [self initContactSources]; folder = [contactFolders objectForKey: name]; obj = ((folder) @@ -204,32 +204,21 @@ - (NSArray *) toManyRelationshipKeys { - WOContext *context; - if (!contactFolders) - { - context = [[WOApplication application] context]; - [self initContactSourcesInContext: context]; - } + [self initContactSources]; return [contactFolders allKeys]; } - (NSArray *) contactFolders { - WOContext *context; - if (!contactFolders) - { - context = [[WOApplication application] context]; - [self initContactSourcesInContext: context]; - } + [self initContactSources]; return [contactFolders allValues]; } - (NSString *) roleOfUser: (NSString *) uid - inContext: (WOContext *) context { NSArray *roles, *traversalPath; NSString *objectName, *role; diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.m b/SoObjects/Contacts/SOGoContactLDAPFolder.m index fb51aa20d..3338f05cc 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.m +++ b/SoObjects/Contacts/SOGoContactLDAPFolder.m @@ -281,7 +281,7 @@ } - (id) lookupName: (NSString *) name - inContext: (WOContext *) context + inContext: (WOContext *) lookupContext acquire: (BOOL) acquire { id obj; @@ -290,7 +290,7 @@ // NSLog (@"looking up name '%@'...", name); /* first check attributes directly bound to the application */ - obj = [super lookupName: name inContext: context acquire: NO]; + obj = [super lookupName: name inContext: lookupContext acquire: NO]; if (!obj) { [self _loadEntries: name]; diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index 3c7cc1a16..bfacb66ca 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -241,7 +241,6 @@ /* security */ - (NSArray *) rolesOfUser: (NSString *) login - inContext: (WOContext *) context { NSMutableArray *sogoRoles; SOGoUser *user; diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index d0d6a34eb..8664beeda 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -67,10 +67,10 @@ return self; } -- (SOGoGroupsFolder *) lookupGroupsFolder -{ - return [self lookupName: @"Groups" inContext: nil acquire: NO]; -} +// - (SOGoGroupsFolder *) lookupGroupsFolder +// { +// return [self lookupName: @"Groups" inContext: nil acquire: NO]; +// } /* pathes */ @@ -131,11 +131,11 @@ return contacts; } -- (id) groupsFolder: (NSString *) _key - inContext: (WOContext *) _ctx -{ - return [$(@"SOGoGroupsFolder") objectWithName: _key inContainer: self]; -} +// - (id) groupsFolder: (NSString *) _key +// inContext: (WOContext *) _ctx +// { +// return [$(@"SOGoGroupsFolder") objectWithName: _key inContainer: self]; +// } - (id) mailAccountsFolder: (NSString *) _key inContext: (WOContext *) _ctx @@ -168,12 +168,12 @@ } else if ([_key isEqualToString: @"Contacts"]) obj = [self privateContacts: _key inContext: _ctx]; - else if ([_key isEqualToString: @"Groups"]) - obj = [self groupsFolder: _key inContext: _ctx]; +// else if ([_key isEqualToString: @"Groups"]) +// obj = [self groupsFolder: _key inContext: _ctx]; else if ([_key isEqualToString: @"Mail"]) obj = [self mailAccountsFolder: _key inContext: _ctx]; else if ([_key isEqualToString: @"freebusy.ifb"]) - obj = [self freeBusyObject:_key inContext:_ctx]; + obj = [self freeBusyObject:_key inContext: _ctx]; else obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */]; } @@ -181,38 +181,38 @@ return obj; } -/* FIXME: here is a vault of hackish ways to gain access to subobjects by - granting ro access to the homepage depending on the subobject in question. - This is wrong and dangerous. */ -- (NSString *) roleOfUser: (NSString *) uid - inContext: (WOContext *) context -{ - NSArray *roles, *traversalPath; - NSString *objectName, *role; +// /* FIXME: here is a vault of hackish ways to gain access to subobjects by +// granting ro access to the homepage depending on the subobject in question. +// This is wrong and dangerous. */ +// - (NSString *) roleOfUser: (NSString *) uid +// inContext: (WOContext *) context +// { +// NSArray *roles, *traversalPath; +// NSString *objectName, *role; - role = nil; - traversalPath = [context objectForKey: @"SoRequestTraversalPath"]; - if ([traversalPath count] > 1) - { - objectName = [traversalPath objectAtIndex: 1]; - if ([objectName isEqualToString: @"Calendar"] - || [objectName isEqualToString: @"Contacts"]) - { - roles = [[context activeUser] - rolesForObject: [self lookupName: objectName - inContext: context - acquire: NO] - inContext: context]; - if ([roles containsObject: SOGoRole_Assistant] - || [roles containsObject: SOGoRole_Delegate]) - role = SOGoRole_Assistant; - } - else if ([objectName isEqualToString: @"freebusy.ifb"]) - role = SOGoRole_Assistant; - } +// role = nil; +// traversalPath = [context objectForKey: @"SoRequestTraversalPath"]; +// if ([traversalPath count] > 1) +// { +// objectName = [traversalPath objectAtIndex: 1]; +// if ([objectName isEqualToString: @"Calendar"] +// || [objectName isEqualToString: @"Contacts"]) +// { +// roles = [[context activeUser] +// rolesForObject: [self lookupName: objectName +// inContext: context +// acquire: NO] +// inContext: context]; +// if ([roles containsObject: SOGoRole_Assistant] +// || [roles containsObject: SOGoRole_Delegate]) +// role = SOGoRole_Assistant; +// } +// else if ([objectName isEqualToString: @"freebusy.ifb"]) +// role = SOGoRole_Assistant; +// } - return role; -} +// return role; +// } /* WebDAV */ @@ -244,10 +244,8 @@ collections itself. So for use its the home folder, the public folder and the groups folder. */ - WOContext *context; NSArray *tag; - context = [[WOApplication application] context]; tag = [NSArray arrayWithObjects: @"href", @"DAV:", @"D", [self baseURLInContext: context], nil]; diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index f8a0e549a..5a3285e10 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -154,19 +154,27 @@ return self->item; } -- (NSCalendarDate *)startTime { +- (NSCalendarDate *) startTime +{ NSCalendarDate *date; + NSTimeZone *timeZone; date = [[self authorativeEvent] startDate]; - [date setTimeZone:[[self clientObject] userTimeZone]]; + timeZone = [[context activeUser] timeZone]; + [date setTimeZone: timeZone]; + return date; } -- (NSCalendarDate *)endTime { +- (NSCalendarDate *) endTime +{ NSCalendarDate *date; + NSTimeZone *timeZone; date = [[self authorativeEvent] endDate]; - [date setTimeZone:[[self clientObject] userTimeZone]]; + timeZone = [[context activeUser] timeZone]; + [date setTimeZone: timeZone]; + return date; } diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index 7731f9eaa..cbab37612 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -28,6 +28,7 @@ #import #import +#import #import #import @@ -112,9 +113,11 @@ NSCalendarDate *startDate, *endDate; NSString *queryDay, *additionalDays; NSTimeZone *uTZ; + SOGoUser *user; co = [self clientObject]; - uTZ = [co userTimeZone]; + user = [context activeUser]; + uTZ = [user timeZone]; queryDay = [self queryParameterForKey: @"sday"]; if ([queryDay length]) diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index 6895273fe..8cca37cd0 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -17,13 +17,9 @@ }; SOGoUserFolder = { superclass = "SOGoFolder"; + protectedBy = ""; + defaultAccess = "allow"; /* protectedBy = "HomePage Access"; */ - defaultRoles = { - "Homepage Access" = ( "Owner", "Assistant", "Delegate", "FreeBusy" ); - "WebDAV Access" = ( "Owner", "Assistant", "Delegate", "FreeBusy" ); - "Access Contents Information" = ( "Owner", "Assistant", "Delegate", - "FreeBusy" ); - }; }; SOGoFolder = { superclass = "SOGoObject"; @@ -68,12 +64,6 @@ SOGoRootPage = { }; SOGoUserFolder = { - methods = { - view = { - protectedBy = "View"; - pageName = "SOGoUserHomePage"; - }; - }; }; SOGoGroupsFolder = { methods = { diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index 0758c504b..1ac4b49f6 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -19,22 +19,25 @@ 02111-1307, USA. */ -#import "SOGoJSStringFormatter.h" -#import "common.h" - +#import +#import +#import #import +#import #import - -#import - -#import -#import -#import -#import - -#import "UIxJSClose.h" +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import #import "UIxComponent.h" +#import "UIxJSClose.h" @interface UIxComponent (PrivateAPI) - (void)_parseQueryString:(NSString *)_s; @@ -370,13 +373,16 @@ static BOOL uixDebugEnabled = NO; - (NSCalendarDate *) selectedDate { + NSTimeZone *userTimeZone; + if (!_selectedDate) { + userTimeZone = [[context activeUser] timeZone]; _selectedDate = [NSCalendarDate dateFromShortDateString: [self queryParameterForKey: @"day"] andShortTimeString: [self queryParameterForKey: @"hm"] - inTimeZone: [[self clientObject] userTimeZone]]; + inTimeZone: userTimeZone]; [_selectedDate retain]; } @@ -385,7 +391,10 @@ static BOOL uixDebugEnabled = NO; - (NSString *) dateStringForDate: (NSCalendarDate *) _date { - [_date setTimeZone: [[self clientObject] userTimeZone]]; + NSTimeZone *userTimeZone; + + userTimeZone = [[context activeUser] timeZone]; + [_date setTimeZone: userTimeZone]; return [_date descriptionWithCalendarFormat:@"%Y%m%d"]; } diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 17c12eaaa..3f1fa9b07 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -249,13 +249,15 @@ - (NSCalendarDate *) newStartDate { NSCalendarDate *newStartDate, *now; + NSTimeZone *timeZone; int hour; newStartDate = [self selectedDate]; if ([[self queryParameterForKey: @"hm"] length] == 0) { now = [NSCalendarDate calendarDate]; - [now setTimeZone: [[self clientObject] userTimeZone]]; + timeZone = [[context activeUser] timeZone]; + [now setTimeZone: timeZone]; if ([now isDateOnSameDay: newStartDate]) { hour = [now hourOfDay]; @@ -365,23 +367,23 @@ // TODO: add tentatively -- (id) acceptOrDeclineAction: (BOOL) _accept +- (id) acceptOrDeclineAction: (BOOL) accept { - [[self clientObject] changeParticipationStatus: - _accept ? @"ACCEPTED" : @"DECLINED" - inContext: [self context]]; + [[self clientObject] changeParticipationStatus: (accept + ? @"ACCEPTED" + : @"DECLINED")]; return self; } - (id) acceptAction { - return [self acceptOrDeclineAction:YES]; + return [self acceptOrDeclineAction: YES]; } - (id) declineAction { - return [self acceptOrDeclineAction:NO]; + return [self acceptOrDeclineAction: NO]; } @end diff --git a/UI/Scheduler/UIxAppointmentProposal.m b/UI/Scheduler/UIxAppointmentProposal.m index 978a03146..f81d87eba 100644 --- a/UI/Scheduler/UIxAppointmentProposal.m +++ b/UI/Scheduler/UIxAppointmentProposal.m @@ -170,30 +170,44 @@ [self setStartDateMonth:[NSNumber numberWithInt:[_date monthOfYear]]]; [self setStartDateYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]]; } -- (NSCalendarDate *)startDate { + +- (NSCalendarDate *) startDate +{ + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; + return [NSCalendarDate dateWithYear:[[self startDateYear] intValue] month:[[self startDateMonth] intValue] day:[[self startDateDay] intValue] hour:[[self startDateHour] intValue] minute:[[self startDateMinute] intValue] second:0 - timeZone:[[self clientObject] userTimeZone]]; + timeZone: timeZone]; } -- (void)setEndDate:(NSCalendarDate *)_date { + +- (void) setEndDate: (NSCalendarDate *) _date +{ [self setEndDateHour:[NSNumber numberWithInt:[_date hourOfDay]]]; [self setEndDateMinute:[NSNumber numberWithInt:[_date minuteOfHour]]]; [self setEndDateDay:[NSNumber numberWithInt:[_date dayOfMonth]]]; [self setEndDateMonth:[NSNumber numberWithInt:[_date monthOfYear]]]; [self setEndDateYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]]; } -- (NSCalendarDate *)endDate { + +- (NSCalendarDate *) endDate +{ + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; + return [NSCalendarDate dateWithYear:[[self endDateYear] intValue] month:[[self endDateMonth] intValue] day:[[self endDateDay] intValue] hour:[[self endDateHour] intValue] minute:[[self endDateMinute] intValue] second:59 - timeZone:[[self clientObject] userTimeZone]]; + timeZone: timeZone]; } - (void)setDuration:(id)_duration { @@ -273,28 +287,31 @@ // TODO: from startdate to enddate NSMutableArray *ma; NSCalendarDate *base, *stop, *current; - + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; base = [NSCalendarDate dateWithYear:[[self startDateYear] intValue] month:[[self startDateMonth] intValue] day:[[self startDateDay] intValue] hour:12 minute:0 second:0 - timeZone:[[self clientObject] userTimeZone]]; + timeZone: timeZone]; stop = [NSCalendarDate dateWithYear:[[self endDateYear] intValue] month:[[self endDateMonth] intValue] day:[[self endDateDay] intValue] hour:12 minute:0 second:0 - timeZone:[[self clientObject] userTimeZone]]; - - ma = [NSMutableArray arrayWithCapacity:16]; + timeZone: timeZone]; + ma = [NSMutableArray arrayWithCapacity: 16]; current = base; - while ([current compare:stop] != NSOrderedDescending) { - [current setTimeZone:[[self clientObject] userTimeZone]]; - [ma addObject:current]; + while ([current compare:stop] != NSOrderedDescending) + { + [current setTimeZone: timeZone]; + [ma addObject:current]; /* Note: remember the timezone behaviour of the method below! */ - current = [current dateByAddingYears:0 months:0 days:1]; - } + current = [current dateByAddingYears:0 months:0 days:1]; + } + return ma; } @@ -323,6 +340,7 @@ - (BOOL)isSlotRangeGreen:(NGCalendarDateRange *)_slotRange { NGCalendarDateRange *aptRange; NSCalendarDate *aptStartDate, *aptEndDate; + NSTimeZone *timeZone; if (_slotRange == nil) return NO; @@ -334,8 +352,9 @@ aptEndDate = [[NSCalendarDate alloc] initWithTimeIntervalSince1970: [aptStartDate timeIntervalSince1970] + [self durationAsTimeInterval]]; - [aptStartDate setTimeZone:[[self clientObject] userTimeZone]]; - [aptEndDate setTimeZone:[[self clientObject] userTimeZone]]; + timeZone = [[context activeUser] timeZone]; + [aptStartDate setTimeZone: timeZone]; + [aptEndDate setTimeZone: timeZone]; aptRange = [NGCalendarDateRange calendarDateRangeWithStartDate:aptStartDate endDate:aptEndDate]; [aptEndDate release]; aptEndDate = nil; diff --git a/UI/Scheduler/UIxAppointmentView.h b/UI/Scheduler/UIxAppointmentView.h index 0eaf48e47..a7f4a20dc 100644 --- a/UI/Scheduler/UIxAppointmentView.h +++ b/UI/Scheduler/UIxAppointmentView.h @@ -18,22 +18,22 @@ id item; } -- (iCalEvent *)appointment; +- (iCalEvent *) appointment; /* permissions */ -- (BOOL)canAccessApt; -- (BOOL)canEditApt; +- (BOOL) canAccessApt; +- (BOOL) canEditApt; -- (SOGoDateFormatter *)dateFormatter; -- (NSCalendarDate *)startTime; -- (NSCalendarDate *)endTime; +- (SOGoDateFormatter *) dateFormatter; +- (NSCalendarDate *) startTime; +- (NSCalendarDate *) endTime; -- (NSString *)attributesTabLink; -- (NSString *)participantsTabLink; +- (NSString *) attributesTabLink; +- (NSString *) participantsTabLink; -- (NSString *)completeHrefForMethod:(NSString *)_method - withParameter:(NSString *)_param - forKey:(NSString *)_key; +- (NSString *) completeHrefForMethod: (NSString *) _method + withParameter: (NSString *) _param + forKey: (NSString *) _key; @end diff --git a/UI/Scheduler/UIxAppointmentView.m b/UI/Scheduler/UIxAppointmentView.m index d1aeb4267..8adb3a9b5 100644 --- a/UI/Scheduler/UIxAppointmentView.m +++ b/UI/Scheduler/UIxAppointmentView.m @@ -97,17 +97,23 @@ - (NSCalendarDate *)startTime { NSCalendarDate *date; - + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; date = [[self appointment] startDate]; - [date setTimeZone:[[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; + return date; } - (NSCalendarDate *)endTime { NSCalendarDate *date; - + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; date = [[self appointment] endDate]; - [date setTimeZone:[[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; + return date; } diff --git a/UI/Scheduler/UIxCalAptListView.m b/UI/Scheduler/UIxCalAptListView.m index 5da22d549..92d227d8f 100644 --- a/UI/Scheduler/UIxCalAptListView.m +++ b/UI/Scheduler/UIxCalAptListView.m @@ -129,7 +129,7 @@ date = [NSCalendarDate dateWithTimeIntervalSince1970: [[currentAppointment objectForKey: @"startdate"] intValue]]; - [date setTimeZone: [[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; return [[self itemDateFormatter] stringForObjectValue: date]; } @@ -141,7 +141,7 @@ date = [NSCalendarDate dateWithTimeIntervalSince1970: [[currentAppointment objectForKey: @"enddate"] intValue]]; - [date setTimeZone: [[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; return [[self itemDateFormatter] stringForObjectValue: date]; } @@ -158,7 +158,7 @@ intDate = [[currentAppointment objectForKey: @"startdate"] intValue]; date = [NSCalendarDate dateWithTimeIntervalSince1970: intDate]; - [date setTimeZone: [[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; return [NSString stringWithFormat: @"%d%.2d%.2d", [date yearOfCommonEra], @@ -173,7 +173,7 @@ intDate = [[currentAppointment objectForKey: @"startdate"] intValue]; date = [NSCalendarDate dateWithTimeIntervalSince1970: intDate]; - [date setTimeZone: [[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; return [NSString stringWithFormat: @"%.2d%.2d", [date hourOfDay], diff --git a/UI/Scheduler/UIxCalDateSelector.m b/UI/Scheduler/UIxCalDateSelector.m index 6ab548c85..bfb2efc1f 100644 --- a/UI/Scheduler/UIxCalDateSelector.m +++ b/UI/Scheduler/UIxCalDateSelector.m @@ -33,7 +33,7 @@ - (void) setSelectedDate: (NSCalendarDate *) _date { ASSIGN (selectedDate, _date); - [selectedDate setTimeZone: [[self clientObject] userTimeZone]]; + [selectedDate setTimeZone: timeZone]; } - (NSCalendarDate *) selectedDate diff --git a/UI/Scheduler/UIxCalMonthView.m b/UI/Scheduler/UIxCalMonthView.m index e5c82ecde..53bd5a757 100644 --- a/UI/Scheduler/UIxCalMonthView.m +++ b/UI/Scheduler/UIxCalMonthView.m @@ -36,14 +36,10 @@ - (id) init { - NSTimeZone *tz; - if ((self = [super init])) { - tz = [[self clientObject] userTimeZone]; - monthAptFormatter - = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz]; + = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; [monthAptFormatter setShortMonthTitleOnly]; dateFormatter = [[SOGoDateFormatter alloc] initWithLocale: [self locale]]; diff --git a/UI/Scheduler/UIxCalView.h b/UI/Scheduler/UIxCalView.h index 133674ce1..cd5059290 100644 --- a/UI/Scheduler/UIxCalView.h +++ b/UI/Scheduler/UIxCalView.h @@ -17,6 +17,7 @@ @class NSDictionary; @class NSMutableDictionary; @class NSString; +@class NSTimeZone; @class SOGoAptFormatter; @class SOGoAppointmentFolder; @@ -29,6 +30,7 @@ NSArray *allDayApts; id appointment; NSCalendarDate *currentDay; + NSTimeZone *timeZone; SOGoAptFormatter *aptFormatter; SOGoAptFormatter *aptTooltipFormatter; SOGoAptFormatter *privateAptFormatter; diff --git a/UI/Scheduler/UIxCalView.m b/UI/Scheduler/UIxCalView.m index 48534781b..1f9c8277b 100644 --- a/UI/Scheduler/UIxCalView.m +++ b/UI/Scheduler/UIxCalView.m @@ -43,17 +43,16 @@ static BOOL shouldDisplayWeekend = NO; self = [super init]; if (self) { - NSTimeZone *tz; - - tz = [[self clientObject] userTimeZone]; + timeZone = [[context activeUser] timeZone]; + [timeZone retain]; aptFormatter - = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz]; + = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; aptTooltipFormatter - = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz]; + = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; privateAptFormatter - = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz]; + = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; privateAptTooltipFormatter - = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: tz]; + = [[SOGoAptFormatter alloc] initWithDisplayTimeZone: timeZone]; [self configureFormatters]; componentsData = [NSMutableDictionary new]; } @@ -72,6 +71,7 @@ static BOOL shouldDisplayWeekend = NO; [aptTooltipFormatter release]; [privateAptFormatter release]; [privateAptTooltipFormatter release]; + [timeZone release]; [super dealloc]; } @@ -322,8 +322,8 @@ static BOOL shouldDisplayWeekend = NO; - (void) setCurrentDay:(NSCalendarDate *) _day { - [_day setTimeZone: [[self clientObject] userTimeZone]]; - ASSIGN(currentDay, _day); + [_day setTimeZone: timeZone]; + ASSIGN (currentDay, _day); } - (NSCalendarDate *) currentDay @@ -478,8 +478,7 @@ static BOOL shouldDisplayWeekend = NO; clientObject = [self clientObject]; - folders = [[clientObject calendarFoldersInContext: context] - objectEnumerator]; + folders = [[clientObject calendarFolders] objectEnumerator]; currentFolderDict = [folders nextObject]; while (currentFolderDict) { diff --git a/UI/Scheduler/UIxCalendarSelector.m b/UI/Scheduler/UIxCalendarSelector.m index d28e94847..5903aecbf 100644 --- a/UI/Scheduler/UIxCalendarSelector.m +++ b/UI/Scheduler/UIxCalendarSelector.m @@ -112,8 +112,7 @@ colorForNumber (unsigned int number) NSDictionary *currentFolder; unsigned int count; - calendarFolders - = [[self clientObject] calendarFoldersInContext: context]; + calendarFolders = [[self clientObject] calendarFolders]; if (!colors) { colors = [NSMutableDictionary new]; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 11258889a..d3cbdd89c 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -310,8 +310,7 @@ { calendarList = [NSMutableArray new]; folder = [[self clientObject] container]; - allCalendars - = [[folder calendarFoldersInContext: context] objectEnumerator]; + allCalendars = [[folder calendarFolders] objectEnumerator]; currentCalendar = [allCalendars nextObject]; while (currentCalendar) { @@ -743,7 +742,7 @@ co = [self clientObject]; if (![co - respondsToSelector: @selector(changeParticipationStatus:inContext:)]) + respondsToSelector: @selector(changeParticipationStatus:)]) return [NSException exceptionWithHTTPStatus:400 /* Bad Request */ reason: @"method cannot be invoked on the specified object"]; diff --git a/UI/Scheduler/UIxTaskEditor.m b/UI/Scheduler/UIxTaskEditor.m index 4a34ac6bd..360cdf019 100644 --- a/UI/Scheduler/UIxTaskEditor.m +++ b/UI/Scheduler/UIxTaskEditor.m @@ -290,12 +290,15 @@ { NSCalendarDate *newStartDate, *now; int hour; + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; newStartDate = [self selectedDate]; if ([[self queryParameterForKey: @"hm"] length] == 0) { now = [NSCalendarDate calendarDate]; - [now setTimeZone: [[self clientObject] userTimeZone]]; + [now setTimeZone: timeZone]; if ([now isDateOnSameDay: newStartDate]) { hour = [now hourOfDay]; @@ -434,20 +437,19 @@ - (id) acceptOrDeclineAction: (BOOL) _accept { [[self clientObject] changeParticipationStatus: - _accept ? @"ACCEPTED" : @"DECLINED" - inContext: [self context]]; + _accept ? @"ACCEPTED" : @"DECLINED"]; return self; } - (id) acceptAction { - return [self acceptOrDeclineAction:YES]; + return [self acceptOrDeclineAction: YES]; } - (id) declineAction { - return [self acceptOrDeclineAction:NO]; + return [self acceptOrDeclineAction: NO]; } - (id) changeStatusAction diff --git a/UI/Scheduler/UIxTaskProposal.m b/UI/Scheduler/UIxTaskProposal.m index c558ccdd2..bdd092d02 100644 --- a/UI/Scheduler/UIxTaskProposal.m +++ b/UI/Scheduler/UIxTaskProposal.m @@ -170,30 +170,44 @@ [self setStartDateMonth:[NSNumber numberWithInt:[_date monthOfYear]]]; [self setStartDateYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]]; } -- (NSCalendarDate *)startDate { + +- (NSCalendarDate *) startDate +{ + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; + return [NSCalendarDate dateWithYear:[[self startDateYear] intValue] month:[[self startDateMonth] intValue] day:[[self startDateDay] intValue] hour:[[self startDateHour] intValue] minute:[[self startDateMinute] intValue] second:0 - timeZone:[[self clientObject] userTimeZone]]; + timeZone: timeZone]; } -- (void)setEndDate:(NSCalendarDate *)_date { + +- (void) setEndDate: (NSCalendarDate *) _date +{ [self setEndDateHour:[NSNumber numberWithInt:[_date hourOfDay]]]; [self setEndDateMinute:[NSNumber numberWithInt:[_date minuteOfHour]]]; [self setEndDateDay:[NSNumber numberWithInt:[_date dayOfMonth]]]; [self setEndDateMonth:[NSNumber numberWithInt:[_date monthOfYear]]]; [self setEndDateYear:[NSNumber numberWithInt:[_date yearOfCommonEra]]]; } -- (NSCalendarDate *)endDate { + +- (NSCalendarDate *) endDate +{ + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; + return [NSCalendarDate dateWithYear:[[self endDateYear] intValue] month:[[self endDateMonth] intValue] day:[[self endDateDay] intValue] hour:[[self endDateHour] intValue] minute:[[self endDateMinute] intValue] second:59 - timeZone:[[self clientObject] userTimeZone]]; + timeZone: timeZone]; } - (void)setDuration:(id)_duration { @@ -269,32 +283,36 @@ return ma; } -- (NSArray *)days { +- (NSArray *) days +{ // TODO: from startdate to enddate NSMutableArray *ma; - NSCalendarDate *base, *stop, *current; - - base = [NSCalendarDate dateWithYear:[[self startDateYear] intValue] - month:[[self startDateMonth] intValue] - day:[[self startDateDay] intValue] - hour:12 minute:0 second:0 - timeZone:[[self clientObject] userTimeZone]]; - stop = [NSCalendarDate dateWithYear:[[self endDateYear] intValue] - month:[[self endDateMonth] intValue] - day:[[self endDateDay] intValue] - hour:12 minute:0 second:0 - timeZone:[[self clientObject] userTimeZone]]; + NSCalendarDate *base, *stop, *current; + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; + base = [NSCalendarDate dateWithYear: [[self startDateYear] intValue] + month: [[self startDateMonth] intValue] + day: [[self startDateDay] intValue] + hour: 12 minute: 0 second: 0 + timeZone: timeZone]; + stop = [NSCalendarDate dateWithYear: [[self endDateYear] intValue] + month: [[self endDateMonth] intValue] + day: [[self endDateDay] intValue] + hour: 12 minute: 0 second: 0 + timeZone: timeZone]; ma = [NSMutableArray arrayWithCapacity:16]; current = base; while ([current compare:stop] != NSOrderedDescending) { - [current setTimeZone:[[self clientObject] userTimeZone]]; + [current setTimeZone: timeZone]; [ma addObject:current]; /* Note: remember the timezone behaviour of the method below! */ current = [current dateByAddingYears:0 months:0 days:1]; } + return ma; } @@ -320,27 +338,32 @@ return idx == NSNotFound ? YES : NO; } -- (BOOL)isSlotRangeGreen:(NGCalendarDateRange *)_slotRange { +- (BOOL)isSlotRangeGreen: (NGCalendarDateRange *) _slotRange +{ NGCalendarDateRange *aptRange; NSCalendarDate *aptStartDate, *aptEndDate; + NSTimeZone *timeZone; if (_slotRange == nil) return NO; - + + timeZone = [[context activeUser] timeZone]; /* calculate the interval requested by the user (can be larger) */ aptStartDate = [_slotRange startDate]; // TODO: gives warning on MacOSX - aptEndDate = [[NSCalendarDate alloc] initWithTimeIntervalSince1970: - [aptStartDate timeIntervalSince1970] - + [self durationAsTimeInterval]]; - [aptStartDate setTimeZone:[[self clientObject] userTimeZone]]; - [aptEndDate setTimeZone:[[self clientObject] userTimeZone]]; - aptRange = [NGCalendarDateRange calendarDateRangeWithStartDate:aptStartDate - endDate:aptEndDate]; - [aptEndDate release]; aptEndDate = nil; + aptEndDate + = [[NSCalendarDate alloc] + initWithTimeIntervalSince1970: ([aptStartDate timeIntervalSince1970] + + [self durationAsTimeInterval])]; + [aptStartDate setTimeZone: timeZone]; + [aptEndDate setTimeZone: timeZone]; + aptRange = [NGCalendarDateRange calendarDateRangeWithStartDate: aptStartDate + endDate: aptEndDate]; + [aptEndDate release]; + aptEndDate = nil; - return [self isRangeGreen:aptRange]; + return [self isRangeGreen: aptRange]; } - (BOOL)isFirstHalfGreen { diff --git a/UI/Scheduler/UIxTaskView.m b/UI/Scheduler/UIxTaskView.m index c2004dd85..323034134 100644 --- a/UI/Scheduler/UIxTaskView.m +++ b/UI/Scheduler/UIxTaskView.m @@ -95,19 +95,27 @@ return dateFormatter; } -- (NSCalendarDate *)startTime { +- (NSCalendarDate *) startTime +{ NSCalendarDate *date; - + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; date = [[self task] startDate]; - [date setTimeZone:[[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; + return date; } -- (NSCalendarDate *)endTime { +- (NSCalendarDate *) endTime +{ NSCalendarDate *date; - + NSTimeZone *timeZone; + + timeZone = [[context activeUser] timeZone]; date = [[self task] due]; - [date setTimeZone:[[self clientObject] userTimeZone]]; + [date setTimeZone: timeZone]; + return date; } diff --git a/UI/Scheduler/UIxTimeDateControl.m b/UI/Scheduler/UIxTimeDateControl.m index a18640d0c..22de5971c 100644 --- a/UI/Scheduler/UIxTimeDateControl.m +++ b/UI/Scheduler/UIxTimeDateControl.m @@ -69,12 +69,15 @@ return label; } -- (void)setDate:(NSCalendarDate *)_date { - NSLog (@"^^^^^^ %@: setDate: %@", self, _date); +- (void) setDate: (NSCalendarDate *) _date +{ + NSTimeZone *timeZone; int minuteValue; + + timeZone = [[context activeUser] timeZone]; if (!_date) _date = [NSCalendarDate date]; - [_date setTimeZone: [[self clientObject] userTimeZone]]; + [_date setTimeZone: timeZone]; [self _setDate: _date]; minuteValue = [_date minuteOfHour]; @@ -251,8 +254,9 @@ { NSCalendarDate *d; unsigned _year, _month, _day, _hour, _minute, _second; + NSTimeZone *timeZone; - NSLog (@"******************** %@: take values...", self); + timeZone = [[context activeUser] timeZone]; /* call super, so that the form values are applied on the popups */ [super takeValuesFromRequest:_rq inContext:_ctx]; @@ -270,7 +274,7 @@ d = [NSCalendarDate dateWithYear: _year month:_month day:_day hour:_hour minute:_minute second:_second - timeZone: [[self clientObject] userTimeZone]]; + timeZone: timeZone]; [self _setDate: d]; } } diff --git a/UI/Templates/SchedulerUI/UIxCalMonthOverview.wox b/UI/Templates/SchedulerUI/UIxCalMonthOverview.wox deleted file mode 100644 index 795e5f79d..000000000 --- a/UI/Templates/SchedulerUI/UIxCalMonthOverview.wox +++ /dev/null @@ -1,216 +0,0 @@ - - - - - - - - - - - - - -
- -
- - - - - -
- - - - -
-
- - - - - - - - - - - -
- - - - - - -
- - - - - - - -
- - - -
-
- - - - - - - -
-
-
- - - - - - - - - - - - - - -
-
-
-
-
- - - -
- - -
-
-
- - - -