From: znek Date: Tue, 12 Oct 2004 14:55:32 +0000 (+0000) Subject: refactored some helper methods X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b3bc50eba7e650bd78f56f22eeaa69ae670410b;p=scalable-opengroupware.org refactored some helper methods git-svn-id: http://svn.opengroupware.org/SOGo/trunk@386 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Contacts/ChangeLog b/SOGo/UI/Contacts/ChangeLog index 859ae65a..115606fa 100644 --- a/SOGo/UI/Contacts/ChangeLog +++ b/SOGo/UI/Contacts/ChangeLog @@ -1,3 +1,7 @@ +2004-10-12 Marcus Mueller + + * UIxContactSelector.m: moved helpers to UIxComponent (v0.9.14) + 2004-10-08 Marcus Mueller * v0.9.13 diff --git a/SOGo/UI/Contacts/UIxContactSelector.m b/SOGo/UI/Contacts/UIxContactSelector.m index 175aa720..19edfebf 100644 --- a/SOGo/UI/Contacts/UIxContactSelector.m +++ b/SOGo/UI/Contacts/UIxContactSelector.m @@ -37,9 +37,7 @@ - (void)setCallback:(NSString *)_callback; - (NSString *)callback; -- (NSString *)userRootURL; -- (NSString *)selfURL; -- (NSString *)relativeContactsURL; +- (NSString *)relativeContactsPath; - (NSString *)jsFunctionName; - (NSString *)jsFunctionHref; @@ -92,34 +90,8 @@ /* Helper */ -- (NSString *)userRootURL { - WOContext *ctx; - NSArray *traversalObjects; - NSString *url; - - ctx = [self context]; - traversalObjects = [ctx objectTraversalStack]; - url = [[[traversalObjects objectAtIndex:1] - baseURLInContext:ctx] - stringByAppendingString:@"/"]; - return [[NSURL URLWithString:url] path]; -} - -- (NSString *)selfURL { - NSString *url; - - url = [[self clientObject] baseURLInContext:[self context]]; - return [[NSURL URLWithString:url] path]; -} - -- (NSString *)relativeContactsURL { - NSString *contactsURL, *selfURL, *relativeURL; - - contactsURL = [[self userRootURL] - stringByAppendingPathComponent:@"Contacts/select"]; - selfURL = [self selfURL]; - relativeURL = [contactsURL urlPathRelativeToPath:selfURL]; - return relativeURL; +- (NSString *)relativeContactsPath { + return [self relativePathToUserFolderSubPath:@"Contacts/select"]; } /* JavaScript */ diff --git a/SOGo/UI/Contacts/Version b/SOGo/UI/Contacts/Version index 92c8fa08..cc039aca 100644 --- a/SOGo/UI/Contacts/Version +++ b/SOGo/UI/Contacts/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=13 +SUBMINOR_VERSION:=14 diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index 891f60ec..87bc4eb3 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,8 @@ +2004-10-12 Marcus Mueller + + * UIxComponent.m: added some helper methods for computing relative + paths within the application (v0.9.14) + 2004-09-26 Helge Hess * UIxComponent.m: minor code cleanups (v0.9.13) diff --git a/SOGo/UI/SOGoUI/UIxComponent.h b/SOGo/UI/SOGoUI/UIxComponent.h index 86d32e17..a90ad765 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.h +++ b/SOGo/UI/SOGoUI/UIxComponent.h @@ -50,6 +50,10 @@ - (NSString *)ownMethodName; +- (NSString *)userFolderPath; +- (NSString *)ownPath; +- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub; + /* date selection */ - (NSTimeZone *)viewTimeZone; - (NSTimeZone *)backendTimeZone; diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index 905fcd79..f87bfe24 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -229,6 +229,34 @@ static BOOL uixDebugEnabled = NO; return [uri substringFromIndex:(r.location + 1)]; } +- (NSString *)userFolderPath { + WOContext *ctx; + NSArray *traversalObjects; + NSString *url; + + ctx = [self context]; + traversalObjects = [ctx objectTraversalStack]; + url = [[[traversalObjects objectAtIndex:1] + baseURLInContext:ctx] + stringByAppendingString:@"/"]; + return [[NSURL URLWithString:url] path]; +} + +- (NSString *)ownPath { + NSString *url; + + url = [[self clientObject] baseURLInContext:[self context]]; + return [[NSURL URLWithString:url] path]; +} + +- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub { + NSString *dst, *rel; + + dst = [[self userFolderPath] stringByAppendingPathComponent:_sub]; + rel = [dst urlPathRelativeToPath:[self ownPath]]; + return rel; +} + /* date */ - (NSTimeZone *)viewTimeZone { diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index 92c8fa08..cc039aca 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=13 +SUBMINOR_VERSION:=14