From: helge Date: Thu, 23 Jun 2005 12:19:13 +0000 (+0000) Subject: applied patches by Stephane X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05e608d85ca034a56f91c0a6fb1823084d9c201d;p=sope applied patches by Stephane git-svn-id: http://svn.opengroupware.org/SOPE/trunk@859 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 59e3c212..f10128f3 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,24 @@ +2005-06-23 Stephane Corthesy + + * v4.5.165 + + * WOComponent.m: -synchronizesVariablesWithBindings now returns NO if + the component is stateless (-isStateless returns YES) + + * WOComponent.m: -frameworkName now returns 'nil' if the component is + located in the main bundle (this might affect resource lookups) + + * WOComponent.m: +templateWithHTMLString:declarationString:languages: + is now a class method like in WO + + * WOComponent.m: -pathForResourceNamed: now checks whether a session + is available and otherwise uses the browserLanguages array to + perform a languages lookup + +2005-06-10 Helge Hess + + * WEClientCapabilities.m: fixed a typo (v4.5.164) + 2005-06-02 Helge Hess * WebDAV/SoObjectWebDAVDispatcher.m: prepared MKCALENDAR method diff --git a/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h b/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h index 734d4fd1..a332f6a8 100644 --- a/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h +++ b/sope-appserver/NGObjWeb/NGObjWeb/WOComponent.h @@ -89,7 +89,7 @@ - (WOElement *)templateWithName:(NSString *)_name; -- (WOElement *)templateWithHTMLString:(NSString *)_html ++ (WOElement *)templateWithHTMLString:(NSString *)_html declarationString:(NSString *)_wod languages:(NSArray *)_languages; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index be676a9e..c345cf7b 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=163 +SUBMINOR_VERSION:=165 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WEClientCapabilities.m b/sope-appserver/NGObjWeb/WEClientCapabilities.m index e0b96bbd..15ed9098 100644 --- a/sope-appserver/NGObjWeb/WEClientCapabilities.m +++ b/sope-appserver/NGObjWeb/WEClientCapabilities.m @@ -776,7 +776,7 @@ @end /* WEClientCapabilities */ -static NSString *ClientCapsCacheKey = @"WEClientCapabilties"; +static NSString *ClientCapsCacheKey = @"WEClientCapabilities"; @implementation WORequest(ClientCapabilities) diff --git a/sope-appserver/NGObjWeb/WOComponent.m b/sope-appserver/NGObjWeb/WOComponent.m index efe54cc3..e6360fcd 100644 --- a/sope-appserver/NGObjWeb/WOComponent.m +++ b/sope-appserver/NGObjWeb/WOComponent.m @@ -350,7 +350,13 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { return self->wocName; } - (NSString *)frameworkName { - return [[NGBundle bundleForClass:[self class]] bundleName]; + NSBundle *cbundle; + + cbundle = [NGBundle bundleForClass:[self class]]; + if (cbundle == [NSBundle mainBundle]) + return nil; + + return [cbundle bundleName]; } - (NSString *)path { NSArray *languages = nil; @@ -596,18 +602,20 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { } - (NSString *)pathForResourceNamed:(NSString *)_name ofType:(NSString *)_ext { - NSFileManager *fm = [NSFileManager defaultManager]; - NSEnumerator *languages = nil; - NSString *language = nil; + NSFileManager *fm; + NSEnumerator *languages; + NSString *language; BOOL isDirectory = NO; - NSString *cpath = [self path]; + NSString *cpath; if (_ext) _name = [_name stringByAppendingPathExtension:_ext]; - if (cpath == nil) { + if ((cpath = [self path]) == nil) { [self warnWithFormat:@"no path set in component %@", [self name]]; return nil; } + + fm = [NSFileManager defaultManager]; if (![fm fileExistsAtPath:cpath isDirectory:&isDirectory]) { [self warnWithFormat:@"component directory %@ does not exist !", cpath]; return nil; @@ -616,20 +624,23 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { [self warnWithFormat:@"component path %@ is not a directory !", cpath]; return nil; } + + /* check in language projects */ - // check in language projects - - languages = [[(WOSession *)[self session] languages] objectEnumerator]; - while ((language = [languages nextObject])) { - language = [[cpath stringByAppendingPathComponent: - [language stringByAppendingPathExtension:@"lproj"]] - stringByAppendingPathExtension:_name]; + languages = [self hasSession] + ? [[(WOSession *)[self session] languages] objectEnumerator] + : [[[[self context] request] browserLanguages] objectEnumerator]; + + while ((language = [languages nextObject]) != nil) { + language = [language stringByAppendingPathExtension:@"lproj"]; + language = [cpath stringByAppendingPathComponent:language]; + language = [language stringByAppendingPathExtension:_name]; if ([fm fileExistsAtPath:language]) return language; } - - // check in component + + /* check in component */ cpath = [cpath stringByAppendingPathComponent:_name]; if ([fm fileExistsAtPath:cpath]) return cpath; @@ -639,7 +650,7 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { /* template */ -- (WOElement *)templateWithHTMLString:(NSString *)_html ++ (WOElement *)templateWithHTMLString:(NSString *)_html declarationString:(NSString *)_wod languages:(NSArray *)_languages { @@ -649,9 +660,9 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { declarationString:(NSString *)_wod { IS_DEPRECATED; - return [self templateWithHTMLString:_html - declarationString:_wod - languages:[(WOSession *)[self session] languages]]; + return [[self class] templateWithHTMLString:_html + declarationString:_wod + languages:[(WOSession *)[self session] languages]]; } - (WOElement *)templateWithName:(NSString *)_name { @@ -715,7 +726,7 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { } - (BOOL)synchronizesVariablesWithBindings { - return YES; + return [self isStateless] ? NO : YES; } - (void)setValue:(id)_value forBinding:(NSString *)_name { @@ -1189,9 +1200,7 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { return str; } -@end /* WOComponent */ - -@implementation WOComponent(Statistics) +/* Statistics */ - (NSString *)descriptionForResponse:(WOResponse *)_response inContext:(WOContext *)_context @@ -1199,9 +1208,7 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { return [self name]; } -@end /* WOComponent(Statistics) */ - -@implementation WOComponent(AdvancedBindingAccessors) +/* AdvancedBindingAccessors */ - (void)setUnsignedIntValue:(unsigned)_value forBinding:(NSString *)_name { [self setValue:[NSNumber numberWithUnsignedInt:_value] forBinding:_name]; @@ -1231,4 +1238,4 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { } #endif -@end /* WOComponent(AdvancedBindingAccessors) */ +@end /* WOComponent */