From: helge Date: Sun, 15 Aug 2004 13:59:17 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/trunk@220 d1b88da0-ebda-0310-925b-ed51d... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d86ab3f4ae2213480dfdb4beb5e0424511e4b33a;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/trunk@220 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 1baef4c1..ed7c13fa 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,5 +1,11 @@ 2004-08-15 Helge Hess + * v0.9.40 + + * UIxAppointmentProposal.wox: fixes in mockup code + + * UIxAppointmentEditor.m: some cleanups + * v0.9.39 * UIxAppointmentProposal.wox: work on page layout diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.m b/SOGo/UI/Scheduler/UIxAppointmentEditor.m index 99b326d6..c5f73e5d 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.m +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.m @@ -24,7 +24,9 @@ /* TODO: CLEAN UP */ -@class NSString, SOGoAppointment, iCalPerson; +@class NSString; +@class iCalPerson; +@class SOGoAppointment; @interface UIxAppointmentEditor : UIxComponent { @@ -41,7 +43,8 @@ - (iCalPerson *)getOrganizer; - (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values - treatAsResource:(BOOL)_isResource; + treatAsResource:(BOOL)_isResource; + @end #include "common.h" @@ -73,17 +76,17 @@ - (void)dealloc { [self->appointment release]; [self->participants release]; - [self->item release]; + [self->item release]; [super dealloc]; } /* accessors */ - (void)setItem:(id)_item { - ASSIGN(self->item, _item); + ASSIGN(self->item, _item); } - (id)item { - return self->item; + return self->item; } - (NSString *)formattedAptStartTime { @@ -101,7 +104,8 @@ } - (BOOL)isNewAppointment { - /* that doesn't work! */ + /* that doesn't work! (TODO: explain why!) */ + // TODO: is this actually used? return ![[self clientObject] isAppointment]; } @@ -198,43 +202,41 @@ /* helper */ - (NSString *)_completeURIForMethod:(NSString *)_method { - NSString *uri; - NSRange r; - - uri = [[[self context] request] uri]; + NSString *uri; + NSRange r; - /* first: identify query parameters */ - r = [uri rangeOfString:@"?" options:NSBackwardsSearch]; - if(r.length > 0) - uri = [uri substringToIndex:r.location]; + uri = [[[self context] request] uri]; - /* next: append trailing slash */ - if(![uri hasSuffix:@"/"]) - uri = [uri stringByAppendingString:@"/"]; + /* first: identify query parameters */ + r = [uri rangeOfString:@"?" options:NSBackwardsSearch]; + if (r.length > 0) + uri = [uri substringToIndex:r.location]; - /* next: append method */ - uri = [uri stringByAppendingString:_method]; + /* next: append trailing slash */ + if (![uri hasSuffix:@"/"]) + uri = [uri stringByAppendingString:@"/"]; + + /* next: append method */ + uri = [uri stringByAppendingString:_method]; - /* next: append query parameters */ - return [self completeHrefForMethod:uri]; + /* next: append query parameters */ + return [self completeHrefForMethod:uri]; } - /* email, cn */ - (NSString *)combinedCNAndEmailForUser { - return [NSString stringWithFormat:@"%@;%@", - [self emailForUser], - [self cnForUser]]; + return [NSString stringWithFormat:@"%@;%@", + [self emailForUser], + [self cnForUser]]; } - (NSString *)combinedCNAndEmail { - return [NSString stringWithFormat:@"%@;%@", - [self->item rfc822Email], - [self->item cnForDisplay]]; + return [NSString stringWithFormat:@"%@;%@", + [self->item rfc822Email], + [self->item cnForDisplay]]; } - /* new */ - (id)newAction { @@ -244,11 +246,16 @@ It is actually a folder method and should be defined on the folder. Note: 'clientObject' is the SOGoAppointmentFolder! + Update: remember that there are group folders as well. */ NSString *uri, *objectId, *nextMethod; objectId = [NSClassFromString(@"SOGoAppointmentFolder") globallyUniqueObjectId]; + if ([objectId length] == 0) { + return [NSException exceptionWithHTTPStatus:500 /* Internal Error */ + reason:@"could not create a unique ID"]; + } nextMethod = [NSString stringWithFormat:@"../%@/edit", objectId]; uri = [self _completeURIForMethod:nextMethod]; @@ -268,82 +275,74 @@ } - (iCalPerson *)getOrganizer { - iCalPerson *p; - NSString *emailProp; - - emailProp = [NSString stringWithFormat:@"mailto:%@", - [self emailForUser]]; - p = [[iCalPerson alloc] init]; - [p setEmail:emailProp]; - [p setCn:[self cnForUser]]; - return [p autorelease]; + iCalPerson *p; + NSString *emailProp; + + emailProp = [@"mailto:" stringByAppendingString:[self emailForUser]]; + p = [[[iCalPerson alloc] init] autorelease]; + [p setEmail:emailProp]; + [p setCn:[self cnForUser]]; + return p; } - (NSArray *)getICalPersonsFromFormValues:(NSArray *)_values - treatAsResource:(BOOL)_isResource + treatAsResource:(BOOL)_isResource { - unsigned i, count; - NSMutableArray *result; - - count = [_values count]; - result = [[NSMutableArray alloc] initWithCapacity:count]; - for (i = 0; i < count; i++) { - NSString *pString, *email, *cn; - NSRange r; - iCalPerson *p; - - pString = [_values objectAtIndex:i]; - if([pString length] == 0) - continue; - - /* delimiter between email and cn */ - r = [pString rangeOfString:@";"]; - if(r.length > 0) { - email = [pString substringToIndex:r.location]; - if(r.location + 1 < [pString length]) { - cn = [pString substringFromIndex:r.location + 1]; - } - else { - cn = nil; - } - } - else { - email = pString; - cn = nil; - } - if(cn == nil) { - /* fallback */ - AgenorUserManager *um = [AgenorUserManager sharedUserManager]; - cn = [um getCNForUID:[um getUIDForEmail:email]]; - } - p = [[iCalPerson alloc] init]; - [p setEmail:[@"mailto:" stringByAppendingString:email]]; - if(cn) - [p setCn:cn]; - - /* see RFC2445, sect. 4.2.16 for details */ - if(_isResource) { - [p setRole:@"NON-PARTICIPANT"]; - } - else { - [p setRole:@"REQ-PARTICIPANT"]; - } - [result addObject:p]; - [p release]; + unsigned i, count; + NSMutableArray *result; + + count = [_values count]; + result = [[NSMutableArray alloc] initWithCapacity:count]; + for (i = 0; i < count; i++) { + NSString *pString, *email, *cn; + NSRange r; + iCalPerson *p; + + pString = [_values objectAtIndex:i]; + if ([pString length] == 0) + continue; + + /* delimiter between email and cn */ + r = [pString rangeOfString:@";"]; + if (r.length > 0) { + email = [pString substringToIndex:r.location]; + cn = (r.location + 1 < [pString length]) + ? [pString substringFromIndex:r.location + 1] + : nil; } - return [result autorelease]; + else { + email = pString; + cn = nil; + } + if (cn == nil) { + /* fallback */ + AgenorUserManager *um = [AgenorUserManager sharedUserManager]; + cn = [um getCNForUID:[um getUIDForEmail:email]]; + } + + p = [[iCalPerson alloc] init]; + [p setEmail:[@"mailto:" stringByAppendingString:email]]; + if ([cn isNotNull]) [p setCn:cn]; + + /* see RFC2445, sect. 4.2.16 for details */ + [p setRole:_isResource ? @"NON-PARTICIPANT" : @"REQ-PARTICIPANT"]; + [result addObject:p]; + [p release]; + } + return [result autorelease]; } -/* for testing only */ +/* actions */ + - (id)testAction { - WORequest *req; + /* for testing only */ + WORequest *req; - NSLog(@"%s BEEN HERE!", - __PRETTY_FUNCTION__); + NSLog(@"%s BEEN HERE!", __PRETTY_FUNCTION__); - req = [[self context] request]; - NSLog(@"%@", [req formValues]); - return self; + req = [[self context] request]; + NSLog(@"%@", [req formValues]); + return self; } - (id)saveAction { @@ -369,11 +368,15 @@ if ([iCalString length] == 0) { // TODO: improve user experience ... (eg error panel like Zope) /* return 400 == Bad Request */ - return [NSException exceptionWithHTTPStatus:400 + return [NSException exceptionWithHTTPStatus:400 /* Bad Request */ reason:@"missing iCalendar form data in request"]; } apt = [[SOGoAppointment alloc] initWithICalString:iCalString]; + if (apt == nil) { + return [NSException exceptionWithHTTPStatus:400 /* Bad Request */ + reason:@"invalid iCalendar form data in request"]; + } /* merge in form values */ @@ -388,16 +391,16 @@ [apt setLocation:location]; [apt removeAllAttendees]; /* clean up */ - attendees = \ - [self getICalPersonsFromFormValues:[req formValuesForKey:@"participants"] - treatAsResource:NO]; + attendees = [self getICalPersonsFromFormValues: + [req formValuesForKey:@"participants"] + treatAsResource:NO]; [apt appendAttendees:attendees]; - attendees = \ - [self getICalPersonsFromFormValues:[req formValuesForKey:@"resources"] - treatAsResource:YES]; + attendees = [self getICalPersonsFromFormValues: + [req formValuesForKey:@"resources"] + treatAsResource:YES]; [apt appendAttendees:attendees]; [apt setOrganizer:[self getOrganizer]]; - + /* receive current representation for save operation */ iCalString = [apt iCalString]; [apt release]; apt = nil; diff --git a/SOGo/UI/Scheduler/UIxAppointmentProposal.wox b/SOGo/UI/Scheduler/UIxAppointmentProposal.wox index 34940b98..f2ff902c 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentProposal.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentProposal.wox @@ -174,35 +174,136 @@ - 00 - 30 - 00 - 30 - 00 - 30 - 00 - 30 - 00 30 00 30 00 30 00 30 00 30 - - - 2004-08-15 - new - new - new - new - new - new - new - new - new - new - new - new - new - new - new - new - new + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + 00 + + + 30 + + + + + 2004-08-15 + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + + + new + diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index 6e39df96..0093eef0 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,6 +1,6 @@ # $Id$ -SUBMINOR_VERSION:=39 +SUBMINOR_VERSION:=40 # v0.9.31 requires libWEExtensions v4.2.52 # v0.9.29 requires libWEExtensions v4.2.51