diff --git a/SoObjects/SOGo/WOContext+SOGo.m b/SoObjects/SOGo/WOContext+SOGo.m index c558b1be6..35e3a9d90 100644 --- a/SoObjects/SOGo/WOContext+SOGo.m +++ b/SoObjects/SOGo/WOContext+SOGo.m @@ -38,10 +38,18 @@ NSMutableArray *languages; NSArray *browserLanguages; SOGoUser *user; - NSString *language; + NSString *language, *theme; languages = [NSMutableArray array]; user = [self activeUser]; + theme = [[self request] formValueForKey: @"theme"]; + + if ([theme length] > 0) + { + [languages addObject: [NSString stringWithFormat: @"theme_%@", theme]]; + [self setObject: theme forKey: @"theme"]; + } + if (!user || [[user login] isEqualToString: @"anonymous"]) { browserLanguages = [[self request] browserLanguages]; @@ -55,14 +63,6 @@ [languages addObject: language]; } - // if (activeUser && [activeUser language]) - // [languages addObject: [activeUser language]]; - - // if ([self hasSession]) - // [languages addObjectsFromArray: [[self session] languages]]; - // else - // [languages addObjectsFromArray: [[self request] browserLanguages]]; - return languages; } diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index e32e160cd..a3b8a0c38 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -273,10 +273,18 @@ - (NSString *) pageJavaScriptURL { WOComponent *page; - NSString *filename; + NSString *theme, *filename; page = [context page]; - filename = [NSString stringWithFormat: @"js/%@.js", NSStringFromClass([page class])]; + theme = [context objectForKey: @"theme"]; + if ([theme length]) + { + filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, NSStringFromClass([page class])]; + } + else + { + filename = [NSString stringWithFormat: @"js/%@.js", NSStringFromClass([page class])]; + } NSLog(@"pageJavaScript => %@", filename); return [self urlForResourceFilename: filename]; @@ -285,10 +293,19 @@ - (NSString *) productJavaScriptURL { WOComponent *page; - NSString *filename; + NSString *theme, *filename; page = [context page]; - filename = [NSString stringWithFormat: @"js/%@.js", [page frameworkName]]; + [context resourceLookupLanguages]; + theme = [context objectForKey: @"theme"]; + if ([theme length]) + { + filename = [NSString stringWithFormat: @"js/%@/%@.js", theme, [page frameworkName]]; + } + else + { + filename = [NSString stringWithFormat: @"js/%@.js", [page frameworkName]]; + } NSLog(@"productJavaScript => %@", filename); return [self urlForResourceFilename: filename]; diff --git a/UI/Common/UIxToolbar.m b/UI/Common/UIxToolbar.m index b4376b311..b5b925e17 100644 --- a/UI/Common/UIxToolbar.m +++ b/UI/Common/UIxToolbar.m @@ -113,8 +113,9 @@ rm = [self pageResourceManager]; - return [rm pathForResourceNamed: rn inFramework: fw - languages: [[self context] resourceLookupLanguages]]; + return [rm pathForResourceNamed: rn + inFramework: fw + languages: languages]; } - (id)loadToolbarConfigFromResourceNamed:(NSString *)_name { diff --git a/UI/SOGoUI/UIxComponent.h b/UI/SOGoUI/UIxComponent.h index 7e66fdf47..7052d315f 100644 --- a/UI/SOGoUI/UIxComponent.h +++ b/UI/SOGoUI/UIxComponent.h @@ -43,6 +43,7 @@ NSCalendarDate *_selectedDate; NSDictionary *locale; SOGoUserDefaults *userDefaults; + NSArray *languages; } + (NSArray *) monthLabelKeys; diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index b2a1315af..37cddddd8 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -49,6 +49,7 @@ #import #import #import +#import #import #import "UIxJSClose.h" @@ -149,6 +150,7 @@ static SoProduct *commonProduct = nil; if (!userDefaults) ASSIGN (userDefaults, [SOGoSystemDefaults sharedSystemDefaults]); language = [userDefaults language]; + ASSIGN (languages, [context resourceLookupLanguages]); ASSIGN (locale, [[self resourceManager] localeForLanguageNamed: language]); } @@ -536,7 +538,6 @@ static SoProduct *commonProduct = nil; - (NSString *) labelForKey: (NSString *) _str withResourceManager: (WOResourceManager *) rm { - NSArray *languages; NSString *lKey, *lTable, *lVal; NSRange r; @@ -546,10 +547,6 @@ static SoProduct *commonProduct = nil; if (rm == nil) [self warnWithFormat:@"missing resource manager!"]; - /* lookup languages */ - - languages = [context resourceLookupLanguages]; - /* get parameters */ r = [_str rangeOfString:@"/"]; @@ -710,9 +707,27 @@ static SoProduct *commonProduct = nil; - (WOResponse *) redirectToLocation: (NSString *) newLocation { WOResponse *response; + NSURL *url; + NSMutableString *location; + NSString *theme, *query; + + location = [NSMutableString stringWithString: newLocation]; + theme = [[context request] formValueForKey: @"theme"]; + if ([theme length]) + { + url = [NSURL URLWithString: newLocation]; + query = [url query]; + if ([query length]) + { + if ([query rangeOfString: @"theme="].length == 0) + [location appendFormat: @"&theme=%@", theme]; + } + else + [location appendFormat: @"?theme=%@", theme]; + } response = [self responseWithStatus: 302]; - [response setHeader: newLocation forKey: @"location"]; + [response setHeader: location forKey: @"location"]; return response; }