include $(GNUSTEP_MAKEFILES)/common.make
WOAPP_NAME = sogod
+TOOL_NAME = sogod
BUNDLE_NAME = MainUI
BUNDLE_EXTENSION = .SOGo
BUNDLE_INSTALL_DIR = $(GNUSTEP_USER_ROOT)/Library/SOGo
MainUI_PRINCIPAL_CLASS = MainUIProduct
-sogod_LANGUAGES = English French
+MainUI_LANGUAGES = English French
-sogod_OBJC_FILES += \
+MainUI_OBJC_FILES += \
MainUIProduct.m \
SOGoRootPage.m \
SOGoUserHomePage.m \
SOGoGroupPage.m \
SOGoGroupsPage.m \
-sogod_RESOURCE_FILES += \
+MainUI_RESOURCE_FILES += \
Version \
product.plist \
\
SOGoGroupPage.wox \
SOGoGroupsPage.wox \
-sogod_LOCALIZED_RESOURCE_FILES += \
+MainUI_LOCALIZED_RESOURCE_FILES += \
Locale default.strings
+# woapp support
+
+ifneq ($(tool),yes)
+sogod_OBJC_FILES += $(MainUI_OBJC_FILES)
+sogod_RESOURCE_FILES += $(MainUI_RESOURCE_FILES)
+sogod_LOCALIZED_RESOURCE_FILES += $(MainUI_LOCALIZED_RESOURCE_FILES)
+endif
+
+
-include GNUmakefile.preamble
+ifeq ($(tool),yes)
+include $(GNUSTEP_MAKEFILES)/bundle.make
+include $(GNUSTEP_MAKEFILES)/tool.make
+else
include $(GNUSTEP_MAKEFILES)/woapp.make
-#include $(GNUSTEP_MAKEFILES)/bundle.make
+endif
-include GNUmakefile.postamble
autorelease];
}
+- (void)_setupLocaleInContext:(WOContext *)_ctx {
+ NSArray *langs;
+ NSDictionary *locale;
+
+ if ([[_ctx valueForKey:@"locale"] isNotNull])
+ return;
+
+ langs = [[(WOContext *)_ctx request] browserLanguages];
+ locale = [self currentLocaleConsideringLanguages:langs];
+ [_ctx takeValue:locale forKey:@"locale"];
+}
+
- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
id obj;
/* put locale info into the context in case it's not there */
- if (![_ctx valueForKey:@"locale"]) {
- NSArray *langs;
- NSDictionary *locale;
-
- langs = [[(WOContext *)_ctx request] browserLanguages];
- locale = [self currentLocaleConsideringLanguages:langs];
- [_ctx takeValue:locale forKey:@"locale"];
- }
-
-#if 0 // znek: explain why you did that?
- /* set SoRootURL */
- if ([_ctx valueForKey:@"SoRootURL"] == nil) {
- [_ctx takeValue:@"/sogod.woa/so/" forKey:@"SoRootURL"];
- }
-#endif
+ [self _setupLocaleInContext:_ctx];
/* first check attributes directly bound to the application */
if ((obj = [super lookupName:_key inContext:_ctx acquire:_flag]))
lname = [_langs objectAtIndex:i];
locale = [self localeForLanguageNamed:lname];
- if (locale)
+ if (locale != nil)
return locale;
}
/* no appropriate language, fallback to default */
}
- (NSDictionary *)localeForLanguageNamed:(NSString *)_name {
- NSString *lpath;
- id data;
+ NSString *lpath;
+ id data;
NSDictionary *locale;
-
- NSAssert(_name != nil, @"_name MUST NOT be nil!");
- if((locale = [self->localeLUT objectForKey:_name]) != nil)
+
+ if (![_name isNotNull]) {
+ [self logWithFormat:@"ERROR(%s): name parameter must not be nil!",
+ __PRETTY_FUNCTION__];
+ return nil;
+ }
+
+ if ((locale = [self->localeLUT objectForKey:_name]) != nil)
return locale;
+
lpath = [[self resourceManager]
- pathForResourceNamed:@"Locale"
- inFramework:nil
- languages:[NSArray arrayWithObject:_name]];
-
- data = [NSData dataWithContentsOfFile:lpath];
- if(data == nil) {
- NSLog(@"%s didn't find locale with name:%@",
- __PRETTY_FUNCTION__,
- _name);
+ pathForResourceNamed:@"Locale"
+ inFramework:nil
+ languages:[NSArray arrayWithObject:_name]];
+ if (![lpath isNotNull]) {
+ [self logWithFormat:@"ERROR: did not find Locale for language: %@", _name];
+ return nil;
+ }
+
+ if ((data = [NSData dataWithContentsOfFile:lpath]) == nil) {
+ [self logWithFormat:@"%s didn't find locale with name:%@",
+ __PRETTY_FUNCTION__,
+ _name];
return nil;
}
data = [[[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
locale = [data propertyList];
- if(locale == nil) {
- NSLog(@"%s couldn't load locale with name:%@",
- __PRETTY_FUNCTION__,
- _name);
+ if (locale == nil) {
+ [self logWithFormat:@"%s couldn't load locale with name:%@",
+ __PRETTY_FUNCTION__,
+ _name];
return nil;
}
[self->localeLUT setObject:locale forKey:_name];
/*
- Copyright (C) 2004 SKYRIX Software AG
+ Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of OpenGroupware.org.
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#include "SOGoProductLoader.h"
#include "common.h"
fm = [NSFileManager defaultManager];
pathes = [[self productSearchPathes] objectEnumerator];
- while ((lpath = [pathes nextObject])) {
+ while ((lpath = [pathes nextObject]) != nil) {
NSEnumerator *productNames;
NSString *productName;
productNames = [[fm directoryContentsAtPath:lpath] objectEnumerator];
- while ((productName = [productNames nextObject])) {
+ while ((productName = [productNames nextObject]) != nil) {
NSString *bpath;
bpath = [lpath stringByAppendingPathComponent:productName];