From: wolfgang Date: Mon, 23 Jul 2007 13:56:28 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1117 d1b88da0-ebda-0310... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f64d5ee94f4fe26a50cec5bb09a81e71a78427c9;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1117 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/Apache/SOGo.conf b/Apache/SOGo.conf index 11066ef7..5e835ecc 100644 --- a/Apache/SOGo.conf +++ b/Apache/SOGo.conf @@ -4,6 +4,27 @@ Alias /SOGo.woa/WebServerResources/ \ /usr/GNUstep/System/Library/SOGo-0.9/WebServerResources/ Alias /SOGO.woa/WebServerResources/ \ /usr/GNUstep/System/Library/SOGo-0.9/WebServerResources/ + + + SetHandler default-handler + + + + SetHandler default-handler + + + + SetHandler default-handler + + + + SetHandler default-handler + + + + SetHandler default-handler + + AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \ /usr/GNUstep/System/Library/SOGo-0.9/$1.SOGo/Resources/$2 diff --git a/ChangeLog b/ChangeLog index b0c5f04e..8c87a945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2007-07-22 Wolfgang Sourdeau + + * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder -davNamespaces]): added new overriden + method that declares the DAV namespace related to CardDAV. + ([SOGoContactGCSFolder -davComplianceClassesInContext:]): new + method that declares the "access-control" and "addressbook-access" + classes to the list. + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([-lookupActionForCalDAVMethod:]): removed method. + ([SOGoAppointmentFolder -davNamespaces]): added new overriden + method that declares the DAV namespace related to CalDAV. + + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -davNamespaces]): new + optional method for subclasses which handle specific extensions to + the DAV protocol: CardDAV or CalDAV. + ([SOGoFolder + -lookupName:lookupNameinContext:localContextacquire:acquire]): + new overriden method that handles dav invocations for extensions + to DAV by returning an appropriate SoSelectorInvocation. + + * SoObjects/SOGo/NSString+Utilities.m ([NSString + -asDavInvocation]): new method returning a dictionary with a "ns" + key representing the dav namespace and a "method" key representing + the dav method name of the request. + + * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences + +initialize]): scan the value of SOGoUIxUserCanChangePassword. + Default is "no". + ([UIxPreferences -shouldDisplayPasswordChange]): new template + method that returns the value of SOGoUIxUserCanChangePassword. + + * UI/MainUI/SOGoUserHomePage.m ([SOGoUserHomePage +initialize]): + scan the value of SOGoUIxDefaultModule. If not set, the default + module defaults to "Calendar". + ([SOGoUserHomePage -defaultAction]): redirect the user to the + value of "SOGoUIxDefaultModule". + 2007-07-20 Wolfgang Sourdeau * UI/Contacts/UIxContactsListView.m ([UIxContactsListView diff --git a/NEWS b/NEWS index 2bb7b299..d26220fc 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,11 @@ 0.9.0-20070xxx -------------- +- added the ability to choose the default module from the + application settings: "Calendars", "Contacts" or "Mail"; +- added the ability to show or hide the password change dialog from the + application settings; - put a work-around in the LDAP directory code to avoid fetching all the - entries whenever a specific one is being requested. + entries whenever a specific one is being requested; 0.9.0-20070713 -------------- diff --git a/SOGo.conf b/SOGo.conf deleted file mode 100644 index 3c63ad19..00000000 --- a/SOGo.conf +++ /dev/null @@ -1,26 +0,0 @@ -# SOGo config - -AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \ - /Users/helge/GNUstep/Library/SOGo/$1.SOGo/Contents/Resources/$2 - - -SetHandler ngobjweb-adaptor -SetAppPort 25000 - - - -SetHandler default-handler - - - -SetHandler default-handler - - - -SetHandler default-handler - - - -SetHandler default-handler - - diff --git a/SoObjects/Appointments/NSArray+Appointments.m b/SoObjects/Appointments/NSArray+Appointments.m index 7f0f9114..f3915a01 100644 --- a/SoObjects/Appointments/NSArray+Appointments.m +++ b/SoObjects/Appointments/NSArray+Appointments.m @@ -26,16 +26,17 @@ @implementation NSMutableArray (iCalPersonConvenience) -- (void)removePerson: (iCalPerson *)_person { +- (void) removePerson: (iCalPerson *) _person +{ int i; - - for (i = [self count] - 1; i >= 0; i--) { - iCalPerson *p; + iCalPerson *p; - p = [self objectAtIndex:i]; - if ([p hasSameEmailAddress:_person]) - [self removeObjectAtIndex:i]; - } + for (i = [self count] - 1; i >= 0; i--) + { + p = [self objectAtIndex: i]; + if ([p hasSameEmailAddress: _person]) + [self removeObjectAtIndex: i]; + } } @end diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 4e7257c3..8cc9c45d 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -21,7 +21,6 @@ #import #import -#import #import #import #import @@ -32,7 +31,6 @@ #import #import #import -#import #import #import "common.h" @@ -135,21 +133,6 @@ static NSNumber *sharedYes = nil; return ([_key length] != 0); } -- (id) lookupActionForCalDAVMethod: (NSString *)_key -{ - SoSelectorInvocation *invocation; - NSString *name; - - name = [NSString stringWithFormat: @"%@:", [_key davMethodToObjC]]; - - invocation = [[SoSelectorInvocation alloc] - initWithSelectorNamed: name - addContextParameter: YES]; - [invocation autorelease]; - - return invocation; -} - - (void) appendObject: (NSDictionary *) object withBaseURL: (NSString *) baseURL toREPORTResponse: (WOResponse *) r @@ -280,6 +263,11 @@ static NSNumber *sharedYes = nil; } } +- (NSArray *) davNamespaces +{ + return [NSArray arrayWithObject: @"urn:ietf:params:xml:ns:caldav"]; +} + - (id) davCalendarQuery: (id) queryContext { WOResponse *r; @@ -376,10 +364,7 @@ static NSNumber *sharedYes = nil; obj = [super lookupName:_key inContext:_ctx acquire:NO]; if (!obj) { - if ([_key hasPrefix: @"{urn:ietf:params:xml:ns:caldav}"]) - obj - = [self lookupActionForCalDAVMethod: [_key substringFromIndex: 31]]; - else if ([self isValidAppointmentName:_key]) + if ([self isValidAppointmentName:_key]) { url = [[[_ctx request] uri] urlWithoutParameters]; if ([url hasSuffix: @"AsTask"]) diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index 04263df9..df3f0834 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -19,10 +19,17 @@ 02111-1307, USA. */ +#import +#import +#import +#import +#import +#import +#import +#import +#import #import -#import "common.h" - #import "SOGoContactGCSEntry.h" #import "SOGoContactGCSFolder.h" @@ -180,6 +187,28 @@ return records; } +- (NSArray *) davNamespaces +{ + return [NSArray arrayWithObject: @"urn:ietf:params:xml:ns:carddav"]; +} + +- (NSArray *) davComplianceClassesInContext: (id)_ctx +{ + NSMutableArray *classes; + NSArray *primaryClasses; + + classes = [NSMutableArray new]; + [classes autorelease]; + + primaryClasses = [super davComplianceClassesInContext: _ctx]; + if (primaryClasses) + [classes addObjectsFromArray: primaryClasses]; + [classes addObject: @"access-control"]; + [classes addObject: @"addressbook-access"]; + + return classes; +} + - (NSString *) groupDavResourceType { return @"vcard-collection"; diff --git a/SoObjects/SOGo/NSString+Utilities.h b/SoObjects/SOGo/NSString+Utilities.h index 29679f53..31c913ef 100644 --- a/SoObjects/SOGo/NSString+Utilities.h +++ b/SoObjects/SOGo/NSString+Utilities.h @@ -37,6 +37,7 @@ - (NSString *) urlWithoutParameters; - (NSString *) davMethodToObjC; +- (NSDictionary *) asDavInvocation; - (NSString *) stringByDetectingURLs; diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 6a93540d..2f1d617c 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -108,6 +108,35 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil; return newName; } +- (NSDictionary *) asDavInvocation +{ + NSMutableDictionary *davInvocation; + NSRange nsEnclosing, methodEnclosing; + unsigned int length; + + davInvocation = nil; + if ([self hasPrefix: @"{"]) + { + nsEnclosing = [self rangeOfString: @"}"]; + length = [self length]; + if (nsEnclosing.length > 0 + && nsEnclosing.location < (length - 1)) + { + methodEnclosing = NSMakeRange(nsEnclosing.location + 1, + length - nsEnclosing.location - 1); + nsEnclosing.length = nsEnclosing.location - 1; + nsEnclosing.location = 1; + davInvocation = [NSMutableDictionary dictionaryWithCapacity: 2]; + [davInvocation setObject: [self substringWithRange: nsEnclosing] + forKey: @"ns"]; + [davInvocation setObject: [self substringWithRange: methodEnclosing] + forKey: @"method"]; + } + } + + return davInvocation; +} + - (NSRange) _rangeOfURLInRange: (NSRange) refRange { int start, length; diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index f4263b69..5358299d 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -73,6 +73,9 @@ - (BOOL) create; - (NSException *) delete; +/* dav */ +- (NSArray *) davNamespaces; + /* acls as a container */ - (NSArray *) aclUsersForObjectAtPath: (NSArray *) objectPathArray; - (NSArray *) aclsForUser: (NSString *) uid diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 530a0e0e..5b6f5d2c 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -28,6 +28,8 @@ #import #import +#import +#import #import #import #import @@ -38,6 +40,8 @@ #import #import +#import "NSString+Utilities.h" + #import "SOGoPermissions.h" #import "SOGoUser.h" @@ -523,8 +527,48 @@ static NSString *defaultUserID = @""; return [[self davURL] absoluteString]; } +- (id) lookupName: (NSString *) lookupName + inContext: (id) localContext + acquire: (BOOL) acquire +{ + id obj; + NSArray *davNamespaces; + NSDictionary *davInvocation; + NSString *objcMethod; + + obj = [super lookupName: lookupName inContext: localContext + acquire: acquire]; + if (!obj) + { + davNamespaces = [self davNamespaces]; + if ([davNamespaces count] > 0) + { + davInvocation = [lookupName asDavInvocation]; + if (davInvocation + && [davNamespaces + containsObject: [davInvocation objectForKey: @"ns"]]) + { + objcMethod = [[davInvocation objectForKey: @"method"] + davMethodToObjC]; + obj = [[SoSelectorInvocation alloc] + initWithSelectorNamed: + [NSString stringWithFormat: @"%@:", objcMethod] + addContextParameter: YES]; + [obj autorelease]; + } + } + } + + return obj; +} + /* WebDAV */ +- (NSArray *) davNamespaces +{ + return nil; +} + - (BOOL) davIsCollection { return [self isFolderish]; diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index 3b54ade1..67869825 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -23,30 +23,64 @@ #import #import #import +#import +#import #import #import #import #import +#import #import #import #import #import +static NSString *defaultModule; + @interface SOGoUserHomePage : UIxComponent @end @implementation SOGoUserHomePage ++ (void) initialize +{ + NSUserDefaults *ud; + + ud = [NSUserDefaults standardUserDefaults]; + defaultModule = [ud stringForKey: @"SOGoUIxDefaultModule"]; + if (defaultModule) + { + if (defaultModule) + { + if (!([defaultModule isEqualToString: @"Calendar"] + || [defaultModule isEqualToString: @"Contacts"] + || [defaultModule isEqualToString: @"Mail"])) + { + [self logWithFormat: @"default module '%@' not accepted (must be" + @"'Calendar', 'Contacts' or Mail)", defaultModule]; + defaultModule = @"Calendar"; + } + } + else + defaultModule = @"Calendar"; + + [self logWithFormat: @"default module set to '%@'", defaultModule]; + [defaultModule retain]; + } +} + - (id ) defaultAction { - NSString *baseURL, *url; + SOGoUserFolder *co; + NSURL *moduleURL; - baseURL = [[context request] uri]; - url = [baseURL stringByAppendingString:@"/../Calendar"]; + co = [self clientObject]; + moduleURL = [NSURL URLWithString: defaultModule + relativeToURL: [co soURL]]; - return [self redirectToLocation: url]; + return [self redirectToLocation: [moduleURL absoluteString]]; } - (void) _fillFreeBusyItems: (NSMutableArray *) items diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 2c8c486b..5799e82d 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -40,8 +40,19 @@ workweek = from -> to identities */ +static BOOL shouldDisplayPasswordChange = NO; + @implementation UIxPreferences ++ (void) initialize +{ + NSUserDefaults *ud; + + ud = [NSUserDefaults standardUserDefaults]; + shouldDisplayPasswordChange + = [ud boolForKey: @"SOGoUIxUserCanChangePassword"]; +} + - (id) init { NSDictionary *locale; @@ -426,4 +437,9 @@ return [[request method] isEqualToString: @"POST"]; } +- (BOOL) shouldDisplayPasswordChange +{ + return shouldDisplayPasswordChange; +} + @end diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 223c86b7..6d97ce4a 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -19,7 +19,9 @@ label:value="Date and Time"/>
  • -
  • + +
  • +
    -
    -
    -
    - -
    + +
    +
    +
    + +
    +