+2007-04-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/NSString+Utilities.m ([NSString -boolValue]): new
+ method that SOGo will need with non-gnustep Foundation
+ implementation.
+ ([NSString -stringByAppendingPathComponent:component]): new method
+ that SOGo will need when building with libFoundation. Method
+ removed later since it is available from
+ Foundation/NSPathUtilities.h.
+
+ * SoObjects/SOGo/SOGoUser.m ([SOGoUser -timeZone]): method moved
+ from SOGoObject.m.
+
+ * SoObjects/SOGo/SOGoObject.m: new ivar "context" that permits
+ every subclass to access [WOApplication context] without having to
+ invoke it more than once.
+
+ * SoObjects/Appointments/SOGoCalendarComponent.m
+ ([SOGoCalendarComponent -changeParticipationStatus:_status]):
+ moved method from SOGoTaskObject and SOGoAppointmentObject up to
+ their parent class.
+
+ * UI/Scheduler/UIxCalSelectTab.m: removed module.
+
2007-04-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Contacts/SOGoContactGCSEntry.m ([SOGoContactGCSEntry
#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;
}
- (NSArray *) fetchAllSOGoAppointments;
-- (NSArray *) calendarFoldersInContext: (WOContext *) context;
+- (NSArray *) calendarFolders;
@end
// 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];
}
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;
}
- (void) _appendComponentsMatchingFilters: (NSArray *) filters
toResponse: (WOResponse *) response
- inContext: (WOContext *) context
{
NSArray *apts;
unsigned int count, max;
}
}
-- (id) davCalendarQuery: (id) context
+- (id) davCalendarQuery: (id) queryContext
{
WOResponse *r;
NSArray *filters;
document = [[context request] contentAsDOMDocument];
filters = [self _parseCalendarFilters: [document documentElement]];
[self _appendComponentsMatchingFilters: filters
- toResponse: r
- inContext: context];
+ toResponse: r];
[r appendContentString:@"</D:multistatus>\r\n"];
return r;
}
- (BOOL) requestNamedIsHandledLater: (NSString *) name
- inContext: (WOContext *) context
{
return [name isEqualToString: @"OPTIONS"];
}
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
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) {
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;
}
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];
}
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];
}
/* 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
}
}
-- (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
{
- (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];
Class objectClass;
unsigned int count, max;
NSString *currentId, *currentUser;
- WOContext *context;
id deleteObject;
- context = [[WOApplication application] context];
currentUser = [[context activeUser] login];
max = [ids count];
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;
}
return firstShouldBeActive;
}
-- (NSArray *) calendarFoldersInContext: (WOContext *) context
+- (NSArray *) calendarFolders
{
NSMutableDictionary *userCalendar, *calendarDict;
NSMutableArray *calendarFolders;
[calendarFolders autorelease];
activeUser = [context activeUser];
-
userCalendar = [NSMutableDictionary new];
[userCalendar autorelease];
[userCalendar setObject: @"/" forKey: @"folder"];
/* 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__ */
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;
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]])
{
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]];
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
- (NSException *) delete;
+- (NSException *) changeParticipationStatus: (NSString *) _status;
+
/* mail notifications */
- (BOOL) sendEMailNotifications;
- (void) sendEMailUsingTemplateNamed: (NSString *) _pageName
#import <NGMail/NGMail.h>
#import <NGMail/NGSendMail.h>
-#import <SOGo/AgenorUserManager.h>
-#import <SOGo/SOGoPermissions.h>
-#import <SOGo/SOGoUser.h>
+#import <SoObjects/SOGo/AgenorUserManager.h>
+#import <SoObjects/SOGo/SOGoPermissions.h>
+#import <SoObjects/SOGo/SOGoUser.h>
#import "common.h"
NSString *tmpContent, *email;
iCalCalendar *tmpCalendar;
iCalRepeatableEntityObject *tmpComponent;
- WOContext *context;
if (!calContent)
{
tmpComponent = (iCalRepeatableEntityObject *) [tmpCalendar firstChildWithTag: [self componentTag]];
if (![tmpComponent isPublic])
{
- context = [[WOApplication application] context];
email = [[context activeUser] email];
if (!([tmpComponent isOrganizer: email]
|| [tmpComponent isParticipant: email]))
{
NSString *baseURL;
NSString *uid;
- WOContext *ctx;
NSArray *traversalObjects;
/* generate URL from traversal stack */
- ctx = [[WOApplication application] context];
- traversalObjects = [ctx objectTraversalStack];
+ traversalObjects = [context objectTraversalStack];
if ([traversalObjects count] > 0)
- baseURL = [[traversalObjects objectAtIndex:0] baseURLInContext:ctx];
+ baseURL = [[traversalObjects objectAtIndex:0] baseURLInContext: context];
else
{
baseURL = @"http://localhost/";
: nil);
}
+- (NSException *) changeParticipationStatus: (NSString *) _status
+{
+ iCalRepeatableEntityObject *component;
+ iCalPerson *p;
+ NSString *newContent;
+ NSException *ex;
+ NSString *myEMail;
+
+ ex = nil;
+
+ component = [self component: NO];
+ if (component)
+ {
+ myEMail = [[context activeUser] email];
+ p = [component findParticipantWithEmail: myEMail];
+ if (p)
+ {
+ // TODO: send iMIP reply mails?
+ [p setPartStat: _status];
+ newContent = [[component 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 "
+ @"calendar component"];
+ }
+ else
+ ex = [NSException exceptionWithHTTPStatus: 500 /* Server Error */
+ reason: @"unable to parse component record"];
+
+ return ex;
+}
+
- (BOOL) sendEMailNotifications
{
return sendEMailNotifications;
}
+- (NSTimeZone *) timeZoneForUser: (NSString *) email
+{
+ NSString *uid;
+
+ uid = [[AgenorUserManager sharedUserManager] getUIDForEmail: email];
+
+ return [[SOGoUser userWithLogin: uid andRoles: nil] timeZone];
+}
+
- (void) sendEMailUsingTemplateNamed: (NSString *) _pageName
forOldObject: (iCalRepeatableEntityObject *) _oldObject
andNewObject: (iCalRepeatableEntityObject *) _newObject
{
NSString *pageName;
iCalPerson *organizer;
- NSString *cn, *sender, *iCalString;
+ NSString *cn, *email, *sender, *iCalString;
NGSendMail *sendmail;
WOApplication *app;
unsigned i, count;
/* construct recipient */
cn = [attendee cn];
+ email = [attendee rfc822Email];
if (cn)
recipient = [NSString stringWithFormat: @"%@ <%@>",
- cn,
- [attendee rfc822Email]];
+ cn, email];
else
- recipient = [attendee rfc822Email];
+ recipient = email;
/* create page name */
// TODO: select user's default language?
mailTemplateDefaultLanguage,
_pageName];
/* construct message content */
- p = [app pageWithName: pageName inContext: [WOContext context]];
+ p = [app pageWithName: pageName inContext: context];
[p setNewApt: _newObject];
[p setOldApt: _oldObject];
[p setHomePageURL: [self homePageURLForPerson: attendee]];
- [p setViewTZ: [self userTimeZone: cn]];
+ [p setViewTZ: [self timeZoneForUser: email]];
subject = [p getSubject];
text = [p getBody];
/* send the damn thing */
[sendmail sendMimePart: msg
- toRecipients: [NSArray arrayWithObject: [attendee rfc822Email]]
+ toRecipients: [NSArray arrayWithObject: email]
sender: [organizer rfc822Email]];
}
}
}
- (NSArray *) rolesOfUser: (NSString *) login
- inContext: (WOContext *) context
{
AgenorUserManager *um;
iCalRepeatableEntityObject *component;
[sogoRoles addObject: SOGoRole_Organizer];
else if ([component isParticipant: email])
[sogoRoles addObject: SOGoRole_Participant];
- else if ([[container ownerInContext: nil] isEqualToString: login])
+ else if ([[container ownerInContext: context] isEqualToString: login])
[sogoRoles addObject: SoRole_Owner];
}
else
{
- user = [[SOGoUser alloc] initWithLogin: login roles: nil];
+ user = [SOGoUser userWithLogin: login andRoles: nil];
[sogoRoles addObjectsFromArray: [user rolesForObject: container
inContext: context]];
- [user release];
}
return sogoRoles;
= ([organizerEmail caseInsensitiveCompare: email] == NSOrderedSame);
else
isOrganizerOrOwner
- = [[container ownerInContext: nil] isEqualToString: login];
+ = [[container ownerInContext: context] isEqualToString: login];
return isOrganizerOrOwner;
}
- (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];
}
{
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
NSMutableArray *result;
NSMutableDictionary *uidToRecord;
unsigned i, count;
- WOContext *context;
SoSecurityManager *securityManager;
- context = [[WOApplication application] context];
securityManager = [SoSecurityManager sharedSecurityManager];
folders = [[self container] memberFolders];
onObject: aptFolder
inContext: context]) {
[self debugWithFormat:@"no permission to read the content of calendar: %@",
- [folders objectAtIndex:i]];
+ [folders objectAtIndex:i]];
continue;
}
/* 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
// 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];
}
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;
if (![folder isNotNull]) /* no folder was found for given UID */
continue;
- task = [folder lookupName:[self nameInContainer] inContext:ctx
+ task = [folder lookupName:[self nameInContainer] inContext: context
acquire:NO];
if ([task isKindOfClass: [NSException class]])
{
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];
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 {
}
}
-- (void) initContactSourcesInContext: (WOContext *) context;
+- (void) initContactSources
{
if (!contactFolders)
{
}
- (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)
- (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;
}
- (id) lookupName: (NSString *) name
- inContext: (WOContext *) context
+ inContext: (WOContext *) lookupContext
acquire: (BOOL) acquire
{
id obj;
// 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];
{
NSDictionary *lInfo;
NGMimeMessage *message;
- WOContext *ctx;
NSString *fromInternetSuffix;
BOOL addSuffix;
id body;
if ((lInfo = [self fetchInfo]) == nil)
return nil;
- ctx = [[WOApplication application] context];
- addSuffix = [ctx isAccessFromIntranet] ? NO : YES;
+ addSuffix = [context isAccessFromIntranet] ? NO : YES;
if (addSuffix) {
fromInternetSuffix =
[fromInternetSuffixPattern stringByReplacingVariablesWithBindings:
- [ctx request]
+ [context request]
stringForUnknownBindings:@""];
addSuffix = [fromInternetSuffix length] > 0 ? YES : NO;
/* identity */
- (SOGoMailIdentity *)preferredIdentity {
- WOContext *ctx;
-
- if ((ctx = [[WOApplication application] context]) == nil) {
- [self logWithFormat:@"ERROR(%s): cannot procede without context!",
- __PRETTY_FUNCTION__];
- return nil;
- }
-
- return [[ctx activeUser] primaryMailIdentityForAccount:
- [self nameInContainer]];
+ return [[context activeUser] primaryMailIdentityForAccount:
+ [self nameInContainer]];
}
/* hierarchy */
NSString *s;
NSArray *creds;
- rq = [[(WOApplication *)[WOApplication application] context] request];
+ rq = [context request];
s = [rq headerForKey:@"x-webobjects-remote-user"];
if ([s length] > 0)
/* detect webmail being accessed from the outside */
- (BOOL)isInternetRequest {
- return [[(WOApplication *)[WOApplication application] context]
- isAccessFromIntranet] ? NO : YES;
+ return ([context isAccessFromIntranet] ? NO : YES);
}
/* listing the available mailboxes */
- (BOOL)isInHomeFolderBranchOfLoggedInAccount:(id)_ctx {
id user;
- if (_ctx == nil) _ctx = [[WOApplication application] context];
- if (_ctx == nil) {
- [self errorWithFormat:@"Missing context!"];
- return NO;
- }
-
user = [_ctx activeUser];
return [[[self container] nameInContainer] isEqualToString:[user login]];
}
- (NSArray *)toManyRelationshipKeys {
- WOContext *ctx;
id user;
id account;
NSArray *shares;
- if ((ctx = [[WOApplication application] context]) == nil) {
- [self logWithFormat:@"ERROR(%s): cannot procede without context!",
- __PRETTY_FUNCTION__];
- return nil;
- }
-
/*
Note: this is not strictly correct. The accounts being retrieved should be
the accounts based on the container object of this folder. Given
functionality which isn't perfect either.
=> TODO
*/
- user = [ctx activeUser];
+ user = [context activeUser];
/* for now: return nothing if the home-folder does not belong to the login */
- if (![self isInHomeFolderBranchOfLoggedInAccount:ctx]) {
+ if (![self isInHomeFolderBranchOfLoggedInAccount: context]) {
[self warnWithFormat:@"User %@ tried to access mail hierarchy of %@",
[user login], [[self container] nameInContainer]];
return nil;
- (NSArray *)fetchIdentitiesWithOnlyEmitterAccess:(BOOL)_flag {
WOContext *ctx;
- if ((ctx = [[WOApplication application] context]) == nil) {
- [self logWithFormat:@"ERROR(%s): cannot procede without context!",
- __PRETTY_FUNCTION__];
- return nil;
- }
-
if ([self isInternetRequest]) { /* only show primary mailbox in Internet */
// just return the primary identity
id identity;
- identity = [[ctx activeUser] primaryMailIdentity];
+ identity = [[context activeUser] primaryMailIdentity];
return [identity isNotNull] ? [NSArray arrayWithObject:identity] : nil;
}
NSString *auth;
NSArray *creds;
- rq = [[(WOApplication *)[WOApplication application] context] request];
+ rq = [context request];
if ((auth = [rq headerForKey:@"authorization"]) == nil) {
/* no basic auth */
return nil;
- (NSString *) davMethodToObjC;
+#ifndef GNUSTEP_BASE_LIBRARY
+- (BOOL) boolValue;
+#endif
+
@end
#endif /* NSSTRING_URL_H */
* Boston, MA 02111-1307, USA.
*/
+#import <Foundation/NSArray.h>
#import <Foundation/NSEnumerator.h>
#import "NSString+Utilities.h"
return newName;
}
+#ifndef GNUSTEP_BASE_LIBRARY
+- (BOOL) boolValue
+{
+ return !([self isEqualToString: @"0"]
+ || [self isEqualToString: @"NO"]);
+}
+#endif
+
@end
/* security */
- (NSArray *) rolesOfUser: (NSString *) login
- inContext: (WOContext *) context
{
NSMutableArray *sogoRoles;
SOGoUser *user;
}
- (void)_setupFolders {
- WOContext *ctx;
NSMutableDictionary *md;
NSMutableArray *ma;
NSArray *luids;
if ((luids = [self uids]) == nil)
return;
- ctx = [[WOApplication application] context];
-
count = [luids count];
ma = [NSMutableArray arrayWithCapacity:count + 1];
md = [NSMutableDictionary dictionaryWithCapacity:count];
id folder;
uid = [luids objectAtIndex:i];
- folder = [self _primaryLookupFolderForUID:uid inContext:ctx];
+ folder = [self _primaryLookupFolderForUID:uid inContext: context];
if ([folder isNotNull]) {
[md setObject:folder forKey:uid];
@interface SOGoObject : NSObject
{
+ WOContext *context;
NSString *nameInContainer;
id container;
- NSTimeZone *userTimeZone;
NSString *customOwner;
}
- (NSString *) nameInContainer;
- (id) container;
-- (NSTimeZone *) serverTimeZone;
-- (NSTimeZone *) userTimeZone;
-- (NSTimeZone *) userTimeZone: (NSString *) username;
-
/* ownership */
- (void) setOwner: (NSString *) newOwner;
@implementation SOGoObject
static BOOL kontactGroupDAV = YES;
-static NSTimeZone *serverTimeZone = nil;
+ (int)version {
return 0;
+ (void) initialize
{
- NSString *tzName;
-
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
kontactGroupDAV =
asDefaultForPermission: SoPerm_View];
[[self soClassSecurityInfo] declareRole: SoRole_Owner
asDefaultForPermission: SoPerm_WebDAVAccess];
-
- if (!serverTimeZone)
- {
- tzName = [ud stringForKey: @"SOGoServerTimeZone"];
- if (!tzName)
- tzName = @"Canada/Eastern";
- serverTimeZone = [NSTimeZone timeZoneWithName: tzName];
- [serverTimeZone retain];
- }
}
+ (void) _fillDictionary: (NSMutableDictionary *) dictionary
}
/* DAV ACL properties */
-- (NSString *) _principalForUser: (NSString *) user
+- (NSString *) davOwner
{
- WOContext *context;
-
- context = [[WOApplication application] context];
-
return [NSString stringWithFormat: @"%@users/%@",
[self rootURLInContext: context],
- user];
-}
-
-- (NSString *) davOwner
-{
- return [self _principalForUser: [self ownerInContext: nil]];
+ [self ownerInContext: nil]];
}
- (NSString *) davAclRestrictions
- (SOGoDAVSet *) davPrincipalCollectionSet
{
NSString *usersUrl;
- WOContext *context;
- context = [[WOApplication application] context];
usersUrl = [NSString stringWithFormat: @"%@users",
[self rootURLInContext: context]];
SOGoAuthenticator *sAuth;
SoUser *user;
NSArray *roles;
- WOContext *context;
SoClassSecurityInfo *sInfo;
NSArray *davPermissions;
sAuth = [SOGoAuthenticator sharedSOGoAuthenticator];
- context = [[WOApplication application] context];
user = [sAuth userInContext: context];
roles = [user rolesForObject: self inContext: context];
sInfo = [[self class] soClassSecurityInfo];
NSArray *privileges;
NSMutableString *currentAce;
NSMutableArray *davAces;
- NSString *currentKey;
+ NSString *currentKey, *principal;
SOGoDAVSet *privilegesDS;
davAces = [NSMutableArray array];
appendFormat: @"<D:principal><D:property><D:%@/></D:property></D:principal>",
[currentKey substringFromIndex: 1]];
else
- [currentAce
- appendFormat: @"<D:principal><D:href>%@</D:href></D:principal>",
- [self _principalForUser: currentKey]];
+ {
+ principal = [NSString stringWithFormat: @"%@users/%@",
+ [self rootURLInContext: context],
+ currentKey];
+ [currentAce
+ appendFormat: @"<D:principal><D:href>%@</D:href></D:principal>",
+ principal];
+ }
+
privileges = [[aclsDictionary objectForKey: currentKey]
stringsWithFormat: @"<D:%@/>"];
privilegesDS = [SOGoDAVSet davSetWithArray: privileges
/* end of properties */
-- (BOOL)doesRetainContainer {
+- (BOOL) doesRetainContainer
+{
return YES;
}
- (id)initWithName:(NSString *)_name inContainer:(id)_container {
if ((self = [super init])) {
+ context = [[WOApplication application] context];
+ [context retain];
nameInContainer = [_name copy];
container =
[self doesRetainContainer] ? [_container retain] : _container;
- userTimeZone = nil;
customOwner = nil;
}
return self;
}
- (void)dealloc {
- if (customOwner)
- [customOwner release];
+ [context release];
+ [customOwner release];
if ([self doesRetainContainer])
[container release];
- if (userTimeZone)
- [userTimeZone release];
[nameInContainer release];
[super dealloc];
}
return nil;
}
-- (NSTimeZone *) serverTimeZone
-{
- return serverTimeZone;
-}
-
-/* TODO: should be moved into SOGoUser */
-- (NSTimeZone *) userTimeZone
-{
- NSUserDefaults *userPrefs;
- WOContext *context;
-
- if (!userTimeZone)
- {
- context = [[WOApplication application] context];
- userPrefs = [[context activeUser] userDefaults];
- userTimeZone = [NSTimeZone
- timeZoneWithName: [userPrefs stringForKey: @"timezonename"]];
- if (!userTimeZone)
- userTimeZone = [self serverTimeZone];
- [userTimeZone retain];
- }
-
- return userTimeZone;
-}
-
-- (NSTimeZone *) userTimeZone: (NSString *) username
-{
- NSUserDefaults *userPrefs;
- AgenorUserManager *am;
-
- am = [AgenorUserManager sharedUserManager];
- userPrefs = [am getUserDefaultsForUID: username];
- userTimeZone = [NSTimeZone timeZoneWithName: [userPrefs stringForKey: @"timezonename"]];
- if (!userTimeZone)
- userTimeZone = [self serverTimeZone];
-
- return userTimeZone;
-}
-
/* description */
- (void)appendAttributesToDescription:(NSMutableString *)_ms {
context.activeUser
*/
-@class NSString, NSArray, NSDictionary, NSURL, NSUserDefaults;
+@class NSString;
+@class NSArray;
+@class NSDictionary;
+@class NSURL;
+@class NSUserDefaults;
+@class NSTimeZone;
@class WOContext;
@interface SOGoUser : SoUser
NSString *email;
NSUserDefaults *userDefaults;
NSUserDefaults *userSettings;
+ NSTimeZone *userTimeZone;
}
++ (SOGoUser *) userWithLogin: (NSString *) login
+ andRoles: (NSArray *) roles;
+
/* properties */
-- (NSString *)email;
-- (NSString *)cn;
-- (NSURL *)freeBusyURL;
+- (NSString *) email;
+- (NSString *) cn;
+- (NSURL *) freeBusyURL;
/* shares and identities */
-- (NSString *)primaryIMAP4AccountString;
-- (NSString *)primaryMailServer;
-- (NSArray *)additionalIMAP4AccountStrings;
-- (NSArray *)additionalEMailAddresses;
-- (NSDictionary *)additionalIMAP4AccountsAndEMails;
+- (NSString *) primaryIMAP4AccountString;
+- (NSString *) primaryMailServer;
+- (NSArray *) additionalIMAP4AccountStrings;
+- (NSArray *) additionalEMailAddresses;
+- (NSDictionary *) additionalIMAP4AccountsAndEMails;
/* defaults */
- (NSUserDefaults *) userDefaults;
- (NSUserDefaults *) userSettings;
+- (NSTimeZone *) timeZone;
+- (NSTimeZone *) serverTimeZone;
+
/* folders */
-- (id)homeFolderInContext:(id)_ctx;
-- (id)schedulingCalendarInContext:(id)_ctx;
+- (id) homeFolderInContext: (id) _ctx;
+- (id) schedulingCalendarInContext: (id) _ctx;
- (NSArray *) rolesForObject: (NSObject *) object
inContext: (WOContext *) context;
#import "SOGoUser.h"
+static NSTimeZone *serverTimeZone = nil;
+
@interface NSObject (SOGoRoles)
-- (NSString *) roleOfUser: (NSString *) uid
- inContext: (WOContext *) context;
-- (NSArray *) rolesOfUser: (NSString *) uid
- inContext: (WOContext *) context;
+- (NSString *) roleOfUser: (NSString *) uid;
+- (NSArray *) rolesOfUser: (NSString *) uid;
@end
@implementation SOGoUser
++ (void) initialize
+{
+ NSString *tzName;
+
+ if (!serverTimeZone)
+ {
+ tzName = [[NSUserDefaults standardUserDefaults]
+ stringForKey: @"SOGoServerTimeZone"];
+ if (!tzName)
+ tzName = @"Canada/Eastern";
+ serverTimeZone = [NSTimeZone timeZoneWithName: tzName];
+ [serverTimeZone retain];
+ }
+}
+
++ (SOGoUser *) userWithLogin: (NSString *) login
+ andRoles: (NSArray *) roles
+{
+ SOGoUser *user;
+
+ user = [[self alloc] initWithLogin: login roles: roles];
+ [user autorelease];
+
+ return user;
+}
+
- (id) init
{
if ((self = [super init]))
return self;
}
-- (void)dealloc {
- [self->userDefaults release];
- [self->userSettings release];
- [self->cn release];
- [self->email release];
+- (void) dealloc
+{
+ [userDefaults release];
+ [userSettings release];
+ [cn release];
+ [email release];
[super dealloc];
}
/* internals */
-- (AgenorUserManager *)userManager {
+- (AgenorUserManager *) userManager
+{
static AgenorUserManager *um = nil;
if (um == nil) um = [[AgenorUserManager sharedUserManager] retain];
+
return um;
}
/* properties */
-- (NSString *)email {
- if (self->email == nil)
- self->email = [[[self userManager] getEmailForUID:[self login]] copy];
- return self->email;
+- (NSString *) email
+{
+ if (email == nil)
+ {
+ email = [[self userManager] getEmailForUID: [self login]];
+ [email retain];
+ }
+
+ return email;
}
-- (NSString *)cn {
- if (self->cn == nil)
- self->cn = [[[self userManager] getCNForUID:[self login]] copy];
- return self->cn;
+- (NSString *) cn
+{
+ if (cn == nil)
+ {
+ cn = [[self userManager] getCNForUID: [self login]];
+ [cn retain];
+ }
+
+ return cn;
}
-- (NSString *)primaryIMAP4AccountString {
- return [[self userManager] getIMAPAccountStringForUID:[self login]];
+- (NSString *) primaryIMAP4AccountString
+{
+ return [[self userManager] getIMAPAccountStringForUID: [self login]];
}
-- (NSString *)primaryMailServer {
- return [[self userManager] getServerForUID:[self login]];
+
+- (NSString *) primaryMailServer
+{
+ return [[self userManager] getServerForUID: [self login]];
}
-- (NSArray *)additionalIMAP4AccountStrings {
- return [[self userManager]getSharedMailboxAccountStringsForUID:[self login]];
+- (NSArray *) additionalIMAP4AccountStrings
+{
+ return [[self userManager]getSharedMailboxAccountStringsForUID: [self login]];
}
-- (NSArray *)additionalEMailAddresses {
- return [[self userManager] getSharedMailboxEMailsForUID:[self login]];
+
+- (NSArray *) additionalEMailAddresses
+{
+ return [[self userManager] getSharedMailboxEMailsForUID: [self login]];
}
-- (NSDictionary *)additionalIMAP4AccountsAndEMails {
- return [[self userManager] getSharedMailboxesAndEMailsForUID:[self login]];
+- (NSDictionary *) additionalIMAP4AccountsAndEMails
+{
+ return [[self userManager] getSharedMailboxesAndEMailsForUID: [self login]];
}
-- (NSURL *)freeBusyURL {
- return [[self userManager] getFreeBusyURLForUID:[self login]];
+- (NSURL *) freeBusyURL
+{
+ return [[self userManager] getFreeBusyURLForUID: [self login]];
}
/* defaults */
return userSettings;
}
+- (NSTimeZone *) timeZone
+{
+ NSString *timeZoneName;
+
+ if (!userTimeZone)
+ {
+ timeZoneName = [[self userDefaults] stringForKey: @"TimeZone"];
+ if ([timeZoneName length] > 0)
+ userTimeZone = [NSTimeZone timeZoneWithName: timeZoneName];
+ else
+ userTimeZone = nil;
+ if (!userTimeZone)
+ userTimeZone = [self serverTimeZone];
+ [userTimeZone retain];
+ }
+
+ return userTimeZone;
+}
+
+- (NSTimeZone *) serverTimeZone
+{
+ return serverTimeZone;
+}
+
/* folders */
// TODO: those methods should check whether the traversal stack in the context
// already contains proper folders to improve caching behaviour
-- (id)homeFolderInContext:(id)_ctx {
+- (id) homeFolderInContext: (id) _ctx
+{
/* Note: watch out for cyclic references */
// TODO: maybe we should add an [activeUser reset] method to SOPE
id folder;
return folder;
}
-- (id)schedulingCalendarInContext:(id)_ctx {
+- (id) schedulingCalendarInContext: (id) _ctx
+{
/* Note: watch out for cyclic references */
id folder;
}
if ([object respondsToSelector: @selector (rolesOfUser:inContext:)])
{
- sogoRoles = [object rolesOfUser: login inContext: context];
+ sogoRoles = [object rolesOfUser: login];
if (sogoRoles)
[rolesForObject addObjectsFromArray: sogoRoles];
}
if ([object respondsToSelector: @selector (roleOfUser:inContext:)])
{
- role = [object roleOfUser: login inContext: context];
+ role = [object roleOfUser: login];
if (role)
[rolesForObject addObject: role];
}
return self;
}
-- (SOGoGroupsFolder *) lookupGroupsFolder
-{
- return [self lookupName: @"Groups" inContext: nil acquire: NO];
-}
+// - (SOGoGroupsFolder *) lookupGroupsFolder
+// {
+// return [self lookupName: @"Groups" inContext: nil acquire: NO];
+// }
/* pathes */
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
}
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 */];
}
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;
-
- 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;
-}
+// /* 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;
+// }
+
+// return role;
+// }
/* WebDAV */
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];
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;
}
#import <NGExtensions/NSCalendarDate+misc.h>
#import <Appointments/SOGoFreeBusyObject.h>
+#import <SOGo/SOGoUser.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGoUI/UIxComponent.h>
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])
};
SOGoUserFolder = {
superclass = "SOGoFolder";
+ protectedBy = "<public>";
+ 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";
SOGoRootPage = {
};
SOGoUserFolder = {
- methods = {
- view = {
- protectedBy = "View";
- pageName = "SOGoUserHomePage";
- };
- };
};
SOGoGroupsFolder = {
methods = {
02111-1307, USA.
*/
-#import "SOGoJSStringFormatter.h"
-#import "common.h"
-
+#import <Foundation/NSDictionary.h>
+#import <Foundation/NSException.h>
+#import <Foundation/NSUserDefaults.h>
+#import <Foundation/NSKeyValueCoding.h>
+#import <Foundation/NSPathUtilities.h>
#import <NGObjWeb/SoHTTPAuthenticator.h>
+#import <NGObjWeb/SoObjects.h>
#import <NGObjWeb/WOResourceManager.h>
-
-#import <SOGo/NSString+Utilities.h>
-
-#import <SOGo/SOGoUser.h>
-#import <SOGo/SOGoObject.h>
-#import <SOGo/SOGoCustomGroupFolder.h>
-#import <SOGo/NSCalendarDate+SOGo.h>
-
-#import "UIxJSClose.h"
+#import <NGObjWeb/WORequest.h>
+#import <NGObjWeb/WOContext+SoObjects.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NSString+misc.h>
+#import <NGExtensions/NSURL+misc.h>
+#import <SoObjects/SOGo/SOGoUser.h>
+#import <SoObjects/SOGo/SOGoObject.h>
+#import <SoObjects/SOGo/SOGoCustomGroupFolder.h>
+#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
+#import <SoObjects/SOGo/NSString+Utilities.h>
#import "UIxComponent.h"
+#import "UIxJSClose.h"
@interface UIxComponent (PrivateAPI)
- (void)_parseQueryString:(NSString *)_s;
{
NSString *dst, *rel;
- dst = [[self userFolderPath] stringByAppendingPathComponent:_sub];
+ dst = [[self userFolderPath] stringByAppendingPathComponent: _sub];
rel = [dst urlPathRelativeToPath:[self ownPath]];
return rel;
- (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];
}
- (NSString *) dateStringForDate: (NSCalendarDate *) _date
{
- [_date setTimeZone: [[self clientObject] userTimeZone]];
+ NSTimeZone *userTimeZone;
+
+ userTimeZone = [[context activeUser] timeZone];
+ [_date setTimeZone: userTimeZone];
return [_date descriptionWithCalendarFormat:@"%Y%m%d"];
}
UIxTaskView.m \
UIxTaskEditor.m \
UIxTaskProposal.m \
- UIxCalSelectTab.m \
UIxCalDateLabel.m \
UIxDatePicker.m \
UIxTimeDateControl.m \
- (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];
// 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
[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 {
// 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;
}
- (BOOL)isSlotRangeGreen:(NGCalendarDateRange *)_slotRange {
NGCalendarDateRange *aptRange;
NSCalendarDate *aptStartDate, *aptEndDate;
+ NSTimeZone *timeZone;
if (_slotRange == nil)
return NO;
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;
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
- (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;
}
date = [NSCalendarDate dateWithTimeIntervalSince1970:
[[currentAppointment objectForKey: @"startdate"]
intValue]];
- [date setTimeZone: [[self clientObject] userTimeZone]];
+ [date setTimeZone: timeZone];
return [[self itemDateFormatter] stringForObjectValue: date];
}
date = [NSCalendarDate dateWithTimeIntervalSince1970:
[[currentAppointment objectForKey: @"enddate"]
intValue]];
- [date setTimeZone: [[self clientObject] userTimeZone]];
+ [date setTimeZone: timeZone];
return [[self itemDateFormatter] stringForObjectValue: date];
}
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],
intDate = [[currentAppointment objectForKey: @"startdate"] intValue];
date = [NSCalendarDate dateWithTimeIntervalSince1970: intDate];
- [date setTimeZone: [[self clientObject] userTimeZone]];
+ [date setTimeZone: timeZone];
return [NSString stringWithFormat: @"%.2d%.2d",
[date hourOfDay],
- (void) setSelectedDate: (NSCalendarDate *) _date
{
ASSIGN (selectedDate, _date);
- [selectedDate setTimeZone: [[self clientObject] userTimeZone]];
+ [selectedDate setTimeZone: timeZone];
}
- (NSCalendarDate *) selectedDate
- (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]];
+++ /dev/null
-/*
- Copyright (C) 2004 SKYRIX Software AG
-
- This file is part of OpenGroupware.org.
-
- OGo is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- OGo is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with OGo; see the file COPYING. If not, write to the
- Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
-*/
-// $Id$
-
-
-#include <SOGoUI/UIxComponent.h>
-#include <NGObjWeb/NGObjWeb.h>
-#include <NGExtensions/NGExtensions.h>
-
-
-@interface UIxCalSelectTab : UIxComponent
-{
- NSString *selection;
- NSCalendarDate *currentDate;
-}
-
-@end
-
-
-@implementation UIxCalSelectTab
-
-- (void)dealloc {
- [self->selection release];
- [self->currentDate release];
- [super dealloc];
-}
-
-- (void)setSelection:(NSString *)_selection {
- ASSIGN(self->selection, _selection);
-}
-
-- (NSString *)selection {
- return self->selection;
-}
-
-- (void)setCurrentDate:(NSCalendarDate *)_date {
- [_date setTimeZone:[[self clientObject] userTimeZone]];
- ASSIGN(self->currentDate, _date);
-}
-
-- (NSCalendarDate *)currentDate {
- return self->currentDate;
-}
-
-
-/* labels */
-
-
-- (NSString *)dayLabel {
- return [NSString stringWithFormat:@"%d",
- [self->currentDate dayOfMonth]];
-}
-
-- (NSString *)weekLabel {
- NSString *wlbl;
-
- wlbl = [self labelForKey:@"Week"];
- return [NSString stringWithFormat:@"%@ %d",
- wlbl,
- [self->currentDate weekOfYear]];
-}
-
-- (NSString *)monthLabel {
- return [NSString stringWithFormat:@"%@",
- [self localizedNameForMonthOfYear:[self->currentDate monthOfYear]]];
-}
-
-- (NSString *)yearLabel {
- return [NSString stringWithFormat:@"%d",
- [self->currentDate yearOfCommonEra]];
-}
-
-
-/* hrefs */
-
-- (NSString *)scheduletabLink {
- return [self completeHrefForMethod:@"schedule"];
-}
-
-- (NSString *)daytabLink {
- return [self completeHrefForMethod:@"dayoverview"];
-}
-
-- (NSString *)weektabLink {
- return [self completeHrefForMethod:@"weekoverview"];
-}
-
-- (NSString *)monthtabLink {
- return [self completeHrefForMethod:@"monthoverview"];
-}
-
-- (NSString *)yeartabLink {
- return [self completeHrefForMethod:@"yearoverview"];
-}
-
-
-@end
@class NSDictionary;
@class NSMutableDictionary;
@class NSString;
+@class NSTimeZone;
@class SOGoAptFormatter;
@class SOGoAppointmentFolder;
NSArray *allDayApts;
id appointment;
NSCalendarDate *currentDay;
+ NSTimeZone *timeZone;
SOGoAptFormatter *aptFormatter;
SOGoAptFormatter *aptTooltipFormatter;
SOGoAptFormatter *privateAptFormatter;
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];
}
[aptTooltipFormatter release];
[privateAptFormatter release];
[privateAptTooltipFormatter release];
+ [timeZone release];
[super dealloc];
}
- (void) setCurrentDay:(NSCalendarDate *) _day
{
- [_day setTimeZone: [[self clientObject] userTimeZone]];
- ASSIGN(currentDay, _day);
+ [_day setTimeZone: timeZone];
+ ASSIGN (currentDay, _day);
}
- (NSCalendarDate *) currentDay
clientObject = [self clientObject];
- folders = [[clientObject calendarFoldersInContext: context]
- objectEnumerator];
+ folders = [[clientObject calendarFolders] objectEnumerator];
currentFolderDict = [folders nextObject];
while (currentFolderDict)
{
NSDictionary *currentFolder;
unsigned int count;
- calendarFolders
- = [[self clientObject] calendarFoldersInContext: context];
+ calendarFolders = [[self clientObject] calendarFolders];
if (!colors)
{
colors = [NSMutableDictionary new];
#import <Foundation/NSBundle.h>
#import <Foundation/NSException.h>
#import <Foundation/NSCalendarDate.h>
+#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSURL.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SoObjects/Appointments/SOGoTaskObject.h>
+#import <SoObjects/SOGo/NSString+Utilities.h>
#import "UIxComponent+Agenor.h"
{
calendarList = [NSMutableArray new];
folder = [[self clientObject] container];
- allCalendars
- = [[folder calendarFoldersInContext: context] objectEnumerator];
+ allCalendars = [[folder calendarFolders] objectEnumerator];
currentCalendar = [allCalendars nextObject];
while (currentCalendar)
{
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"];
{
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];
- (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
[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 {
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;
}
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 {
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;
}
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];
{
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];
d = [NSCalendarDate dateWithYear: _year month:_month day:_day
hour:_hour minute:_minute second:_second
- timeZone: [[self clientObject] userTimeZone]];
+ timeZone: timeZone];
[self _setDate: d];
}
}
+++ /dev/null
-<?xml version="1.0" standalone="yes"?>
-<var:component xmlns="http://www.w3.org/1999/xhtml"
- xmlns:var="http://www.skyrix.com/od/binding"
- xmlns:const="http://www.skyrix.com/od/constant"
- xmlns:rsrc="OGo:url"
- xmlns:label="OGo:label"
- className="UIxPageFrame"
- title="name"
->
-
- <table id="skywintable"
- class="wintable"
- cellspacing="0"
- cellpadding="5"
- width="100%"
- >
- <tr>
- <td class="window_label">
- <var:component className="UIxCalDateLabel"
- startDate="startDate"
- endDate="endDate"
- const:selection="month"
- />
- </td>
- </tr>
- <tr>
- <td id="skywinbodycell" class="wincontent">
- <table border="0" cellpadding="0" cellspacing="0" width="100%">
- <tr bgcolor="#e8e8e0">
- <td align="left">
- <var:component className="UIxCalBackForthNavView"
- methodName="ownMethodName"
- prevQueryParameters="prevMonthQueryParameters"
- currentQueryParameters="todayQueryParameters"
- nextQueryParameters="nextMonthQueryParameters"
- label:label="this month"
- />
- </td>
- <td align="right" valign="middle" width="80%">
- <var:component className="UIxContactSelector"
- const:selectorId="uids" />
-<!-- <var:component className="AnaisUidSelector"
- calendarUIDs="clientObject.calendarUIDs"
- /> -->
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td id="skywinbodycell" class="wincontent">
- <table border="0" width="100%" cellpadding="0" cellspacing="0">
- <tr>
- <td colspan="2">
- <var:component className="UIxCalSelectTab"
- const:selection="month"
- currentDate="selectedDate"
- >
- <table border="0" cellpadding="4" width="100%" cellspacing="2">
- <tr>
- <td align="left" bgcolor="#e8e8e0" class="button_auto_env">
- <a var:href="ownMethodName"
- class="button_auto"
- var:queryDictionary="toggleShowRejectedAptsQueryParameters"
- label:string="$toggleShowRejectedAptsLabel"
- />
- </td>
- <td align="right" bgcolor="#e8e8e0">
- <table border="0" cellpadding="0" cellspacing="1">
- <tr>
- <td class="button_auto_env"
- nowrap="true"
- valign="middle"
- align="center"
- >
- <!--<a class="button_auto"
- href="monthprintview"
- var:queryDictionary="queryParameters"
- target="SOGoPrintView"
- ><var:string label:value="printview"/></a>-->
- </td>
- <td class="button_auto_env"
- nowrap="true"
- valign="middle"
- align="center"
- >
- <a class="button_auto"
- href="proposal"
- var:queryDictionary="queryParameters"
- ><var:string label:value="proposal"/></a>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <var:month-overview list="appointments"
- item="appointment"
- currentDay="currentDay"
- index="dayIndex"
- year="year"
- month="month"
- const:startDateKey="startDate"
- const:endDateKey="endDate"
- const:class="monthoverview"
- contentStyle="contentStyle"
- const:width="100%"
- >
- <var:month-info>
- <var:if condition="hasHolidayInfo">
- <var:string value="holidayInfo"
- const:class="monthoverview_holidayinfo"
- />
- </var:if>
- <var:foreach list="allDayApts" item="appointment">
- <var:component className="UIxCalInlineAptView"
- appointment="appointment"
- formatter="aptFormatter"
- tooltipFormatter="aptTooltipFormatter"
- url="appointmentViewURL"
- const:style="monthoverview"
- referenceDate="currentDay"
- canAccess="canAccessApt"
- />
- <br />
- </var:foreach>
- </var:month-info>
- <var:month-label const:orientation="top"
- dayOfWeek="dayOfWeek"
- const:class="monthoverview_title"
- >
- <var:string value="localizedDayOfWeekName"/>
- </var:month-label>
- <var:month-label const:orientation="left"
- weekOfYear="weekOfYear"
- class="weekStyle"
- >
- <a href="weekoverview"
- var:queryDictionary="currentWeekQueryParameters"
- ><var:string value="weekOfYear"/></a>
- </var:month-label>
- <var:month-title class="contentStyle">
- <span class="monthoverview_day">
- <a href="dayoverview"
- var:queryDictionary="currentDayQueryParameters"
- ><var:string value="currentDay.dayOfMonth"/></a>
- </span>
- <!-- removed for 0.8
- <br/>
- <span class="monthoverview_day_new">
- <a href="new"
- var:queryDictionary="currentDayQueryParameters"
- >[<var:string label:value="new"/>]</a>
- </span>-->
- </var:month-title>
- <var:month class="contentStyle">
- <var:component className="UIxCalInlineAptView"
- appointment="appointment"
- formatter="aptFormatter"
- tooltipFormatter="aptTooltipFormatter"
- url="appointmentViewURL"
- const:style="monthoverview"
- referenceDate="currentDay"
- canAccess="canAccessApt"
- />
- <br />
- </var:month>
- </var:month-overview>
- </var:component>
- </td>
- </tr>
- <tr bgcolor="#F5F5E9">
- <td align="left" width="10">
- <var:entity const:name="nbsp"/>
- </td>
- <td align="right">
- <img border="0"
- alt=""
- rsrc:src="corner_right.gif"
- />
- </td>
- </tr>
- <tr>
- <td colspan="2" bgcolor="#F5F5E9">
- <table border="0" width="100%" cellpadding="10" cellspacing="0">
- <tr/>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <!--
- <hr />
- start: <var:string value="startDate" /><br />
- end: <var:string value="endDate" /><br />
- -->
- <!--
- SOGo Server - <var:string value="name"/>
- <br />
- Client: <var:string value="clientObject"/>
- <br />
- Appointments: #<var:string value="appointments.count"/>
- from <var:string value="startDate" />
- to <var:string value="endDate" />
- <br />
-
-
- <hr />
-
- Appointments:
- <var:component className="UIxAptTableView" appointments="appointments"/>
- -->
-<!-- pre><var:string value="appointments" const:insertBR="YES"/></pre -->
-</var:component>
+++ /dev/null
-<?xml version='1.0' standalone='yes'?>
-
-<uix:tabview xmlns="http://www.w3.org/1999/xhtml"
- xmlns:var="http://www.skyrix.com/od/binding"
- xmlns:const="http://www.skyrix.com/od/constant"
- xmlns:rsrc="OGo:url"
- xmlns:label="OGo:label"
- xmlns:uix="OGo:uix"
- var:selection="selection"
- const:tabStyle="tab"
- const:selectedTabStyle="tab_selected"
- const:bodyStyle="tabview_body"
->
- <uix:tab const:key="day" var:label="dayLabel" var:href="daytabLink">
- <var:component-content />
- </uix:tab>
- <uix:tab const:key="week" var:label="weekLabel" var:href="weektabLink">
- <var:component-content />
- </uix:tab>
- <uix:tab const:key="month" var:label="monthLabel" var:href="monthtabLink">
- <var:component-content />
- </uix:tab>
- <uix:tab const:key="year" var:label="yearLabel" var:href="yeartabLink">
- <var:component-content />
- </uix:tab>
-</uix:tabview>