From ba5eca09419892c5b50fa37406ea0ec03634a084 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 7 Jul 2006 21:19:48 +0000 Subject: [PATCH] - see ChangeLog; Monotone-Parent: 568b85ef47fb295fcbb767ce70799e2091003ad6 Monotone-Revision: d3c9c2e311e8b691ae22a71396569a698fc505e6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-07-07T21:19:48 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++ UI/Common/UIxPageFrame.m | 76 ++++++++++++++++++++++++++++++----- UI/Templates/UIxPageFrame.wox | 5 +++ 3 files changed, 79 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdda29f60..2fdfadb67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2006-07-07 Wsourdeau Sourdeau + * UI/Common/UIxPageFrame.m ([UIxPageFrame -productJavaScriptURL]): + added method to determine the possible URL for a product-specific + javascript filename of the forme .js. + ([UIxPageFrame -hasProductSpecificJavaScript]): new method. + ([UIxPageFrame -isPopup]): new method to determine whether the + application navigator bar should be displayed (main page) or not + (popup page). + * SoObjects/SOGo/SOGoAuthenticator.m ([SOGoAuthenticator -LDAPCheckLogin:_loginpassword:_pwd]): new method to authenticate the user through LDAP. diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index 4845e2283..91eec7d93 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -19,7 +19,14 @@ 02111-1307, USA. */ -#include +#import +#import + +@interface WOComponent (PopupExtension) + +- (BOOL) isPopup; + +@end @interface UIxPageFrame : UIxComponent { @@ -109,7 +116,18 @@ return rm; } -- (NSString *)pageJavaScriptURL { +- (BOOL) isPopup +{ + WOComponent *page; + + page = [[self context] page]; + + return ([page respondsToSelector: @selector(isPopup)] + && [page isPopup]); +} + +- (NSString *) pageJavaScriptURL +{ static NSMutableDictionary *pageToURL = nil; WOResourceManager *rm; WOComponent *page; @@ -122,26 +140,64 @@ if ((url = [pageToURL objectForKey:pageName]) != nil) return [url isNotNull] ? url : nil; - + if (pageToURL == nil) pageToURL = [[NSMutableDictionary alloc] initWithCapacity:32]; rm = [self pageResourceManager]; jsname = [pageName stringByAppendingString:@".js"]; - - url = [rm urlForResourceNamed:jsname - inFramework: - [[NSBundle bundleForClass:[page class]] bundlePath] + + url = [rm urlForResourceNamed: jsname + inFramework: [[NSBundle bundleForClass: [page class]] bundlePath] languages:nil request:[[self context] request]]; - + /* cache */ [pageToURL setObject:(url ? url : (id)[NSNull null]) forKey:pageName]; + return url; } -- (BOOL)hasPageSpecificJavaScript { - return [[self pageJavaScriptURL] length] > 0 ? YES : NO; +- (NSString *) productJavaScriptURL +{ + static NSMutableDictionary *pageToURL = nil; + WOResourceManager *rm; + WOComponent *page; + NSString *jsname, *pageName; + NSString *url; + + page = [[self context] page]; + pageName = NSStringFromClass([page class]); + // TODO: does not seem to work! (gets reset): pageName = [page name]; + + if ((url = [pageToURL objectForKey:pageName]) != nil) + return [url isNotNull] ? url : nil; + + if (pageToURL == nil) + pageToURL = [[NSMutableDictionary alloc] initWithCapacity:32]; + + rm = [self pageResourceManager]; + jsname = [[page frameworkName] stringByAppendingString:@".js"]; + + url = [rm urlForResourceNamed: jsname + inFramework: [[NSBundle bundleForClass: [page class]] bundlePath] + languages:nil + request:[[self context] request]]; + + /* cache */ + [pageToURL setObject:(url ? url : (id)[NSNull null]) forKey:pageName]; + + return url; +} + +- (BOOL) hasPageSpecificJavaScript +{ + return ([[self pageJavaScriptURL] length] > 0); +} + +- (BOOL) hasProductSpecificJavaScript +{ + return ([[self productJavaScriptURL] length] > 0); } @end /* UIxPageFrame */ diff --git a/UI/Templates/UIxPageFrame.wox b/UI/Templates/UIxPageFrame.wox index b6ff117d5..69d6732bb 100644 --- a/UI/Templates/UIxPageFrame.wox +++ b/UI/Templates/UIxPageFrame.wox @@ -19,12 +19,16 @@ + + + +
| @@ -37,6 +41,7 @@
+