From 6d93652deab1da6d3e279b0548d1ed3ac566645c Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 18 Oct 2007 20:08:35 +0000 Subject: [PATCH] Monotone-Parent: 0ed0ef307cb74b67ba17424e0e8a0e04a8364e9f Monotone-Revision: eeaa9b56be0dd1eff991c0e1fe8ba2884de77fe0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-18T20:08:35 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ UI/Common/UIxPageFrame.h | 6 ++++++ UI/Common/UIxPageFrame.m | 40 ++++++++++++++++++++++++++++++++-------- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf2628c5b..83e939081 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,12 @@ product-specific translation dictionary as a JSON hash. ([UIxPageFrame -commonLocalizableStrings]): same as above but for the "Common" framework. + ([UIxPageFrame -setJsFiles:newJSFiles]): new setter that enables + the requestor components to require additional Javascript files. + This is useful now that all the scripts are loaded at the end of + the HTML code. + ([UIxPageFrame -additionalJSFiles]): new getter related to the + above. 2007-10-17 Wolfgang Sourdeau diff --git a/UI/Common/UIxPageFrame.h b/UI/Common/UIxPageFrame.h index 04c9b4de1..1c3094a56 100644 --- a/UI/Common/UIxPageFrame.h +++ b/UI/Common/UIxPageFrame.h @@ -25,6 +25,9 @@ #import #import +@class NSString; +@class NSMutableArray; + @interface WOComponent (PopupExtension) - (BOOL) isPopup; @@ -37,6 +40,7 @@ NSString *toolbar; id item; BOOL isPopup; + NSMutableArray *additionalJSFiles; } - (NSString *) commonLocalizableStrings; @@ -47,6 +51,8 @@ - (BOOL) hasPageSpecificJavaScript; - (BOOL) hasProductSpecificJavaScript; +- (NSArray *) additionalJSFiles; + - (NSString *) pageCSSURL; - (NSString *) productCSSURL; - (BOOL) hasPageSpecificCSS; diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index 97754c853..447572b0b 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -38,7 +38,10 @@ { if ((self = [super init])) { + item = nil; + title = nil; toolbar = nil; + additionalJSFiles = nil; } return self; @@ -48,8 +51,8 @@ { [item release]; [title release]; - if (toolbar) - [toolbar release]; + [toolbar release]; + [additionalJSFiles release]; [super dealloc]; } @@ -57,7 +60,7 @@ - (void) setTitle: (NSString *) _value { - ASSIGNCOPY(title, _value); + ASSIGN (title, _value); } - (NSString *) title @@ -70,7 +73,7 @@ - (void) setItem: (id) _item { - ASSIGN(item, _item); + ASSIGN (item, _item); } - (id) item @@ -170,8 +173,8 @@ - (NSString *) _stringsForFramework: (NSString *) framework { - NSDictionary *table; NSString *language, *frameworkName; + id table; frameworkName = [NSString stringWithFormat: @"%@.SOGo", (framework ? framework : [self frameworkName])]; @@ -180,10 +183,9 @@ = [[self resourceManager] stringTableWithName: @"Localizable" inFramework: frameworkName languages: [NSArray arrayWithObject: language]]; - /* table is not really an NSDict44ionary but a hackish variation thereof */ - table = [NSDictionary dictionaryWithDictionary: table]; - return [table jsonRepresentation]; + /* table is not really an NSDictionary but a hackish variation thereof */ + return [[NSDictionary dictionaryWithDictionary: table] jsonRepresentation]; } - (NSString *) commonLocalizableStrings @@ -236,6 +238,28 @@ return ([[self productJavaScriptURL] length] > 0); } +- (void) setJsFiles: (NSString *) newJSFiles +{ + NSEnumerator *jsFiles; + NSString *currentFile, *filename; + + [additionalJSFiles release]; + additionalJSFiles = [NSMutableArray new]; + + jsFiles = [[newJSFiles componentsSeparatedByString: @","] objectEnumerator]; + while ((currentFile = [jsFiles nextObject])) + { + filename = [self urlForResourceFilename: + [currentFile stringByTrimmingSpaces]]; + [additionalJSFiles addObject: filename]; + } +} + +- (NSArray *) additionalJSFiles +{ + return additionalJSFiles; +} + - (NSString *) pageCSSURL { WOComponent *page;