From: helge Date: Thu, 26 Aug 2004 23:29:09 +0000 (+0000) Subject: contact folder implementation v1 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c68afb4014e02ddf59abb9af5c0eab368156af15;p=scalable-opengroupware.org contact folder implementation v1 git-svn-id: http://svn.opengroupware.org/SOGo/trunk@278 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Contacts/ChangeLog b/SOGo/SoObjects/Contacts/ChangeLog index 1c480288..3b21ef60 100644 --- a/SOGo/SoObjects/Contacts/ChangeLog +++ b/SOGo/SoObjects/Contacts/ChangeLog @@ -1,3 +1,7 @@ +2004-08-27 Helge Hess + + * started implementation of contact folders (v0.9.1) + 2004-08-26 Marcus Mueller * Product.m: typo in comment fixed diff --git a/SOGo/SoObjects/Contacts/SOGoContactFolder.h b/SOGo/SoObjects/Contacts/SOGoContactFolder.h index 4d501abd..6c61e4b6 100644 --- a/SOGo/SoObjects/Contacts/SOGoContactFolder.h +++ b/SOGo/SoObjects/Contacts/SOGoContactFolder.h @@ -43,28 +43,9 @@ + (NSString *)globallyUniqueObjectId; -/* selection */ - -- (NSArray *)contactUIDs; - /* fetching */ -- (NSArray *)fetchCoreInfosFrom:(NSCalendarDate *)_startDate - to:(NSCalendarDate *)_endDate; - -- (NSArray *)fetchCoreInfosFromFolder:(OCSFolder *)_folder - from:(NSCalendarDate *)_startDate - to:(NSCalendarDate *)_endDate; - -/* URL generation */ - -- (NSString *)baseURLForContactWithUID:(NSString *)_uid inContext:(id)_ctx; - -/* folder management */ - -- (id)lookupHomeFolderForUID:(NSString *)_uid inContext:(id)_ctx; - -- (NSArray *)lookupContactFoldersForUIDs:(NSArray *)_uids inContext:(id)_ctx; +- (NSArray *)fetchCoreInfos; @end diff --git a/SOGo/SoObjects/Contacts/SOGoContactFolder.m b/SOGo/SoObjects/Contacts/SOGoContactFolder.m index 8d9a542f..849a3722 100644 --- a/SOGo/SoObjects/Contacts/SOGoContactFolder.m +++ b/SOGo/SoObjects/Contacts/SOGoContactFolder.m @@ -31,12 +31,7 @@ @implementation SOGoContactFolder -static BOOL debugOn = NO; -static NSTimeZone *MET = nil; - -+ (void)initialize { - if (MET == nil) MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain]; -} +static BOOL debugOn = YES; + (NSString *)globallyUniqueObjectId { /* @@ -63,15 +58,6 @@ static NSTimeZone *MET = nil; [super dealloc]; } -/* selection */ - -- (NSArray *)contactUIDs { - NSString *s; - - s = [[self container] nameInContainer]; - return [s isNotNull] ? [NSArray arrayWithObjects:&s count:1] : nil; -} - /* name lookup */ - (BOOL)isValidContactName:(NSString *)_key { @@ -112,133 +98,27 @@ static NSTimeZone *MET = nil; /* fetching */ -- (NSMutableDictionary *)fixupRecord:(NSDictionary *)_record { - NSMutableDictionary *md; - id tmp; - - md = [[_record mutableCopy] autorelease]; -#warning !! IMPLEMENT ME! - return md; -} - - (NSArray *)fixupRecords:(NSArray *)_records { - 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; - - row = [self fixupRecord:[_records objectAtIndex:i]]; - if (row) [ma addObject:row]; - } - return ma; -} - -- (NSArray *)fetchCoreInfosFromFolder:(OCSFolder *)_folder - from:(NSCalendarDate *)_startDate - to:(NSCalendarDate *)_endDate -{ -#warning !! IMPLEMENT ME! - return nil; -} - -- (NSArray *)fetchCoreInfosFrom:(NSCalendarDate *)_startDate - to:(NSCalendarDate *)_endDate -{ - /* this is the primary API */ - OCSFolder *folder; - - if ((folder = [self ocsFolder]) == nil) { - [self logWithFormat:@"ERROR(%s): missing folder for fetch!", - __PRETTY_FUNCTION__]; - return nil; - } - return [self fetchCoreInfosFromFolder:folder from:_startDate to:_endDate]; -} - -/* URL generation */ - -- (NSString *)baseURLForContactWithUID:(NSString *)_uid inContext:(id)_ctx { - NSString *url; - - if ([_uid length] == 0) - return nil; - - url = [self baseURLInContext:_ctx]; - if (![url hasSuffix:@"/"]) - url = [url stringByAppendingString:@"/"]; - return [url stringByAppendingString:_uid]; + return _records; } -/* folder management */ - -- (id)lookupHomeFolderForUID:(NSString *)_uid inContext:(id)_ctx { - // TODO: DUP to SOGoGroupFolder - NSException *error = nil; - NSArray *path; - id ctx, result; - - if (![_uid isNotNull]) +- (NSArray *)fetchCoreInfos { + NSArray *fields, *records; + + fields = [NSArray arrayWithObjects: + @"c_name", + @"sn", @"givenname", @"l", + @"mail", @"telephonenumber", + nil]; + records = [[self ocsFolder] fetchFields:fields matchingQualifier:nil]; + if (records == nil) { + [self logWithFormat:@"ERROR(%s): fetch failed!", __PRETTY_FUNCTION__]; return nil; - - if (_ctx == nil) _ctx = [[WOApplication application] context]; - - /* create subcontext, so that we don't destroy our environment */ - - if ((ctx = [_ctx createSubContext]) == nil) { - [self logWithFormat:@"ERROR: could not create SOPE subcontext!"]; - return nil; - } - - /* build path */ - - path = _uid != nil ? [NSArray arrayWithObjects:&_uid count:1] : nil; - - /* traverse path */ - - result = [[ctx application] traversePathArray:path inContext:ctx - error:&error acquire:NO]; - if (error != nil) { - [self logWithFormat:@"ERROR: folder lookup failed (uid=%@): %@", - _uid, error]; - return nil; - } - - [self debugWithFormat:@"Note: got folder for uid %@ path %@: %@", - _uid, [path componentsJoinedByString:@"=>"], result]; - return result; -} - -- (NSArray *)lookupContactFoldersForUIDs:(NSArray *)_uids inContext:(id)_ctx { - /* Note: can return NSNull objects in the array! */ - NSMutableArray *folders; - NSEnumerator *e; - NSString *uid; - - if ([_uids count] == 0) return nil; - folders = [NSMutableArray arrayWithCapacity:16]; - e = [_uids objectEnumerator]; - while ((uid = [e nextObject])) { - id folder; - - folder = [self lookupHomeFolderForUID:uid inContext:nil]; - if ([folder isNotNull]) { - folder = [folder lookupName:@"Contacts" inContext:nil acquire:NO]; - if ([folder isKindOfClass:[NSException class]]) - folder = nil; - } - if (![folder isNotNull]) - [self logWithFormat:@"Note: did not find folder for uid: '%@'", uid]; - - /* Note: intentionally add 'null' folders to allow a mapping */ - [folders addObject:folder ? folder : [NSNull null]]; } - return folders; + records = [self fixupRecords:records]; + if (debugOn) + [self logWithFormat:@"fetched %i records: %@", [records count], records]; + return records; } /* GET */ @@ -246,13 +126,17 @@ static NSTimeZone *MET = nil; - (id)GETAction:(WOContext *)_ctx { // TODO: I guess this should really be done by SOPE (redirect to // default method) + WOResponse *r; NSString *uri; uri = [[_ctx request] uri]; if (![uri hasSuffix:@"/"]) uri = [uri stringByAppendingString:@"/"]; uri = [uri stringByAppendingString:@"view"]; - return [self redirectToLocation:uri]; + r = [_ctx response]; + [r setStatus:302 /* moved */]; + [r setHeader:uri forKey:@"location"]; + return r; } @end /* SOGoContactFolder */ diff --git a/SOGo/SoObjects/Contacts/SOGoContactObject.m b/SOGo/SoObjects/Contacts/SOGoContactObject.m index 0e0be03a..cbd6b6cb 100644 --- a/SOGo/SoObjects/Contacts/SOGoContactObject.m +++ b/SOGo/SoObjects/Contacts/SOGoContactObject.m @@ -31,4 +31,22 @@ /* accessors */ +/* GET */ + +- (id)GETAction:(WOContext *)_ctx { + // TODO: I guess this should really be done by SOPE (redirect to + // default method) + WOResponse *r; + NSString *uri; + + uri = [[_ctx request] uri]; + if (![uri hasSuffix:@"/"]) uri = [uri stringByAppendingString:@"/"]; + uri = [uri stringByAppendingString:@"view"]; + + r = [_ctx response]; + [r setStatus:302 /* moved */]; + [r setHeader:uri forKey:@"location"]; + return r; +} + @end /* SOGoContactObject */ diff --git a/SOGo/SoObjects/Contacts/Version b/SOGo/SoObjects/Contacts/Version index 9385a64d..237a5904 100644 --- a/SOGo/SoObjects/Contacts/Version +++ b/SOGo/SoObjects/Contacts/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=0 +SUBMINOR_VERSION:=1 diff --git a/SOGo/UI/Common/ChangeLog b/SOGo/UI/Common/ChangeLog index a24ee4b4..376866e8 100644 --- a/SOGo/UI/Common/ChangeLog +++ b/SOGo/UI/Common/ChangeLog @@ -1,5 +1,10 @@ 2004-08-27 Helge Hess + * uix.css: make 'defaultfont' a generic class + + * UIxPageFrame.wox: added top-level menu with links for Calendar and + Contacts (v0.9.18) + * removed old components (UIxAppFrame, Header and Navigation) (v0.9.17) 2004-08-24 Maxime Wacker diff --git a/SOGo/UI/Common/UIxPageFrame.m b/SOGo/UI/Common/UIxPageFrame.m index 380d73a7..3ff66963 100644 --- a/SOGo/UI/Common/UIxPageFrame.m +++ b/SOGo/UI/Common/UIxPageFrame.m @@ -74,5 +74,8 @@ - (NSString *)calendarRootURL { return [[self userRootURL] stringByAppendingString:@"Calendar/"]; } +- (NSString *)contactsRootURL { + return [[self userRootURL] stringByAppendingString:@"Contacts/"]; +} @end /* UIxPageFrame */ diff --git a/SOGo/UI/Common/UIxPageFrame.wox b/SOGo/UI/Common/UIxPageFrame.wox index fb5ebd14..82efe4dd 100644 --- a/SOGo/UI/Common/UIxPageFrame.wox +++ b/SOGo/UI/Common/UIxPageFrame.wox @@ -17,6 +17,27 @@ + + + + + + + + + + +
+ + + + + +
+
diff --git a/SOGo/UI/Common/Version b/SOGo/UI/Common/Version index 33dfbe1b..cd35ad0f 100644 --- a/SOGo/UI/Common/Version +++ b/SOGo/UI/Common/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=17 +SUBMINOR_VERSION:=18 diff --git a/SOGo/UI/Common/uix.css b/SOGo/UI/Common/uix.css index 90657cd2..5d45c071 100644 --- a/SOGo/UI/Common/uix.css +++ b/SOGo/UI/Common/uix.css @@ -34,7 +34,7 @@ a:hover { background-color: #06348B; } -font.defaultfont { +.defaultfont { text-decoration: none; font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; font-size: 8pt; diff --git a/SOGo/UI/Contacts/ChangeLog b/SOGo/UI/Contacts/ChangeLog index 7c6d4522..23ad4702 100644 --- a/SOGo/UI/Contacts/ChangeLog +++ b/SOGo/UI/Contacts/ChangeLog @@ -1,3 +1,8 @@ +2004-08-27 Helge Hess + + * removed GET from product.plist, the SoObject directly implements GET + now and redirects to the view method (v0.9.3) + 2004-08-26 Helge Hess * product.plist: more fixes to product.plist (v0.9.2) diff --git a/SOGo/UI/Contacts/UIxContactsListView.wox b/SOGo/UI/Contacts/UIxContactsListView.wox index 7f53e297..62a70caa 100644 --- a/SOGo/UI/Contacts/UIxContactsListView.wox +++ b/SOGo/UI/Contacts/UIxContactsListView.wox @@ -7,8 +7,117 @@ className="UIxPageFrame" title="name" > + + + + + + + + +
+ + + + + +
+ + + Addressbook + + +
+
+ + + + + + + + + + + + +
+ + + + +
+ + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + +
LastnameFirstnameEmailPhoneLocation
+ +
+
+ + + +
+ + +
+
+
+
- clientObject: + clientObject:
\ No newline at end of file diff --git a/SOGo/UI/Contacts/Version b/SOGo/UI/Contacts/Version index 1bf86739..fc795f55 100644 --- a/SOGo/UI/Contacts/Version +++ b/SOGo/UI/Contacts/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=2 +SUBMINOR_VERSION:=3 diff --git a/SOGo/UI/Contacts/product.plist b/SOGo/UI/Contacts/product.plist index 82465079..850db677 100644 --- a/SOGo/UI/Contacts/product.plist +++ b/SOGo/UI/Contacts/product.plist @@ -14,10 +14,6 @@ protectedBy = "View"; pageName = "UIxContactsListView"; }; - GET = { /* hack to make it work as the default method */ - protectedBy = "View"; - pageName = "UIxContactsListView"; - }; }; }; diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index abf4851c..345e6de3 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,7 @@ +2004-08-27 Helge Hess + + * UIxCalView.m: minor code cleanups (v0.9.72) + 2004-08-25 Marcus Mueller * GNUmakefile.preamble: removed NGScripting from dependencies - it's no diff --git a/SOGo/UI/Scheduler/UIxCalView.m b/SOGo/UI/Scheduler/UIxCalView.m index e37aedab..eedbbf8e 100644 --- a/SOGo/UI/Scheduler/UIxCalView.m +++ b/SOGo/UI/Scheduler/UIxCalView.m @@ -24,11 +24,11 @@ static BOOL shouldDisplayWeekend = NO; } - (void)dealloc { - [self->appointments release]; - [self->allDayApts release]; - [self->appointment release]; - [self->currentDay release]; - [self->aptFormatter release]; + [self->appointments release]; + [self->allDayApts release]; + [self->appointment release]; + [self->currentDay release]; + [self->aptFormatter release]; [self->aptTooltipFormatter release]; [super dealloc]; } @@ -50,38 +50,37 @@ static BOOL shouldDisplayWeekend = NO; } - (NSDictionary *)aptTypeDict { - return nil; + return nil; } - - (NSString *)aptTypeLabel { - return @"aptLabel"; + return @"aptLabel"; } - - (NSString *)aptTypeIcon { - return @""; + return @""; } - (SOGoAptFormatter *)aptFormatter { - if(self->aptFormatter) - return self->aptFormatter; - self->aptFormatter = [[SOGoAptFormatter alloc] - initWithDisplayTimeZone:[self viewTimeZone]]; - [self->aptFormatter setFullDetails]; + if (self->aptFormatter) return self->aptFormatter; + + self->aptFormatter = [[SOGoAptFormatter alloc] + initWithDisplayTimeZone:[self viewTimeZone]]; + [self->aptFormatter setFullDetails]; + return self->aptFormatter; } - (SOGoAptFormatter *)aptTooltipFormatter { - if(self->aptTooltipFormatter) - return self->aptTooltipFormatter; - self->aptTooltipFormatter = [[SOGoAptFormatter alloc] - initWithDisplayTimeZone:[self viewTimeZone]]; - [self->aptTooltipFormatter setTooltip]; + if (self->aptTooltipFormatter) return self->aptTooltipFormatter; + self->aptTooltipFormatter = [[SOGoAptFormatter alloc] + initWithDisplayTimeZone:[self viewTimeZone]]; + [self->aptTooltipFormatter setTooltip]; + return self->aptTooltipFormatter; } /* TODO: remove this */ - (NSString *)shortTextForApt { - return [[self aptFormatter] stringForObjectValue:self->appointment]; + return [[self aptFormatter] stringForObjectValue:self->appointment]; } - (NSString *)shortTitleForApt { @@ -95,24 +94,24 @@ static BOOL shouldDisplayWeekend = NO; } - (NSString *)tooltipForApt { - return [[self aptTooltipFormatter] stringForObjectValue:self->appointment]; + return [[self aptTooltipFormatter] stringForObjectValue:self->appointment]; } - (BOOL)isMyApt { - NSString *mailtoChunk; - NSString *myEmail; + NSString *mailtoChunk; + NSString *myEmail; - mailtoChunk = [self->appointment valueForKey:@"partmails"]; - myEmail = [self emailForUser]; - if([mailtoChunk rangeOfString:myEmail].length > 0) - return YES; - return NO; + mailtoChunk = [self->appointment valueForKey:@"partmails"]; + myEmail = [self emailForUser]; + if ([mailtoChunk rangeOfString:myEmail].length > 0) + return YES; + return NO; } - (NSString *)aptStyle { - if(![self isMyApt]) - return @"apt_other"; - return nil; + if (![self isMyApt]) + return @"apt_other"; + return nil; } - (NSCalendarDate *)referenceDateForFormatter { @@ -120,13 +119,14 @@ static BOOL shouldDisplayWeekend = NO; } - (NSCalendarDate *)thisMonth { - return [self selectedDate]; + return [self selectedDate]; } - (NSCalendarDate *)nextMonth { - NSCalendarDate *date = [self thisMonth]; - return [date dateByAddingYears:0 months:0 days:[date numberOfDaysInMonth] - hours:0 minutes:0 seconds:0]; + NSCalendarDate *date = [self thisMonth]; + + return [date dateByAddingYears:0 months:0 days:[date numberOfDaysInMonth] + hours:0 minutes:0 seconds:0]; } @@ -145,50 +145,49 @@ static BOOL shouldDisplayWeekend = NO; } - (id)holidayInfo { - return nil; + return nil; } - (NSArray *)allDayApts { - NSArray *apts; - NSMutableArray *filtered; - unsigned i, count; + NSArray *apts; + NSMutableArray *filtered; + unsigned i, count; - if(self->allDayApts) - return self->allDayApts; + if (self->allDayApts) + return self->allDayApts; - apts = [self appointments]; - count = [apts count]; - filtered = [[NSMutableArray alloc] initWithCapacity:3]; - for(i = 0; i < count; i++) { - id apt; - NSNumber *bv; + apts = [self appointments]; + count = [apts count]; + filtered = [[NSMutableArray alloc] initWithCapacity:3]; + for (i = 0; i < count; i++) { + id apt; + NSNumber *bv; - apt = [apts objectAtIndex:i]; + apt = [apts objectAtIndex:i]; #warning !! check if isAllDay is correct - bv = [apt valueForKey:@"isAllDay"]; - if([bv boolValue]) { - [filtered addObject:apt]; - } - } + bv = [apt valueForKey:@"isAllDay"]; + if ([bv boolValue]) + [filtered addObject:apt]; + } - ASSIGN(self->allDayApts, filtered); - [filtered release]; - return self->allDayApts; + ASSIGN(self->allDayApts, filtered); + [filtered release]; + return self->allDayApts; } /* special appointments */ - (BOOL)hasDayInfo { - return [self hasHoldidayInfo] || [self hasAllDayApts]; + return [self hasHoldidayInfo] || [self hasAllDayApts]; } - (BOOL)hasHoldidayInfo { - return [self holidayInfo] != nil; + return [self holidayInfo] != nil; } - (BOOL)hasAllDayApts { - return [[self allDayApts] count] != 0; + return [[self allDayApts] count] != 0; } @@ -215,7 +214,7 @@ static BOOL shouldDisplayWeekend = NO; } - (BOOL)shouldHideWeekend { - return ![self shouldDisplayWeekend]; + return ![self shouldDisplayWeekend]; } @@ -238,6 +237,7 @@ static BOOL shouldDisplayWeekend = NO; - (NSString *)resourcePath { // TODO: broken + // TODO: where is this used? return @"/sogod.woa/WebServerResources/"; }