From 001a0692617a179cea80b3a20350f5938faa171d Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 1 Aug 2005 12:14:35 +0000 Subject: [PATCH] copied Main as MainUI to UI/ git-svn-id: http://svn.opengroupware.org/SOGo/trunk@927 d1b88da0-ebda-0310-925b-ed51d893ca5b --- UI/MainUI/ChangeLog | 205 ++++++++++++++ UI/MainUI/English.lproj/Locale | 35 +++ UI/MainUI/English.lproj/Localizable.strings | 12 + UI/MainUI/French.lproj/Locale | 35 +++ UI/MainUI/French.lproj/Localizable.strings | 12 + UI/MainUI/GNUmakefile | 52 ++++ UI/MainUI/GNUmakefile.preamble | 40 +++ UI/MainUI/MainUIProduct.m | 47 ++++ UI/MainUI/README | 68 +++++ UI/MainUI/SOGo.m | 297 ++++++++++++++++++++ UI/MainUI/SOGoGroupPage.m | 31 ++ UI/MainUI/SOGoGroupPage.wox | 27 ++ UI/MainUI/SOGoGroupsPage.m | 35 +++ UI/MainUI/SOGoGroupsPage.wox | 18 ++ UI/MainUI/SOGoProductLoader.h | 44 +++ UI/MainUI/SOGoProductLoader.m | 174 ++++++++++++ UI/MainUI/SOGoRootPage.m | 154 ++++++++++ UI/MainUI/SOGoRootPage.wox | 24 ++ UI/MainUI/SOGoUserHomePage.m | 233 +++++++++++++++ UI/MainUI/SOGoUserHomePage.wox | 120 ++++++++ UI/MainUI/TODO | 1 + UI/MainUI/Version | 7 + UI/MainUI/common.h | 34 +++ UI/MainUI/homepage.js | 49 ++++ UI/MainUI/product.plist | 106 +++++++ UI/MainUI/sogod.m | 38 +++ 26 files changed, 1898 insertions(+) create mode 100644 UI/MainUI/ChangeLog create mode 100644 UI/MainUI/English.lproj/Locale create mode 100644 UI/MainUI/English.lproj/Localizable.strings create mode 100644 UI/MainUI/French.lproj/Locale create mode 100644 UI/MainUI/French.lproj/Localizable.strings create mode 100644 UI/MainUI/GNUmakefile create mode 100644 UI/MainUI/GNUmakefile.preamble create mode 100644 UI/MainUI/MainUIProduct.m create mode 100644 UI/MainUI/README create mode 100644 UI/MainUI/SOGo.m create mode 100644 UI/MainUI/SOGoGroupPage.m create mode 100644 UI/MainUI/SOGoGroupPage.wox create mode 100644 UI/MainUI/SOGoGroupsPage.m create mode 100644 UI/MainUI/SOGoGroupsPage.wox create mode 100644 UI/MainUI/SOGoProductLoader.h create mode 100644 UI/MainUI/SOGoProductLoader.m create mode 100644 UI/MainUI/SOGoRootPage.m create mode 100644 UI/MainUI/SOGoRootPage.wox create mode 100644 UI/MainUI/SOGoUserHomePage.m create mode 100644 UI/MainUI/SOGoUserHomePage.wox create mode 100644 UI/MainUI/TODO create mode 100644 UI/MainUI/Version create mode 100644 UI/MainUI/common.h create mode 100644 UI/MainUI/homepage.js create mode 100644 UI/MainUI/product.plist create mode 100644 UI/MainUI/sogod.m diff --git a/UI/MainUI/ChangeLog b/UI/MainUI/ChangeLog new file mode 100644 index 00000000..10f55760 --- /dev/null +++ b/UI/MainUI/ChangeLog @@ -0,0 +1,205 @@ +2005-07-21 Helge Hess + + * product.plist: protect homepage using SOPE access control (v0.9.38) + + * SOGoRootPage.m: redirect authenticated users to their login page + (v0.9.37) + +2005-07-21 Marcus Mueller + + * homepage.js: fixed post to send an empty string instead of null - + this works in Firefox on MacOSX but fails on Windows (v0.9.36) + +2005-07-20 Marcus Mueller + + * v0.9.35 + + * README: updated with new default description + + * SOGoUserHomePage.wox: in case user is not authorized to change the + internet access flag, the rendered text is different now + + * English.lproj/Localizable.strings: provide new label for case that + user is not allowed to change internet access + +2005-07-15 Helge Hess + + * GNUmakefile.preamble: fixed Cocoa compilation (v0.9.34) + +2005-07-14 Helge Hess + + * moved SOGoUser and SOGoAuthenticator to libSOGo (v0.9.33) + +2005-07-14 Marcus Mueller + + * SOGoUserHomePage.m: vacation message state is now properly being + retrieved from AgenorUserManager (v0.9.32) + + * v0.9.31 + + * SOGoUserHomePage.[m, wox]: added internet access lock + display/modification and vacation state (currently only faked) + + * homepage.js: JavaScript in use on the homepage + + * English.lproj/Localizable.strings: removed old labels and added a + bunch of new labels + +2005-07-12 Helge Hess + + * v0.9.30 + + * SOGoAuthenticator.m: create SOGoUser objects + + * added 'SOGoUser' object/class as a subclass of SoUser, using this + object various Agenor properties like cn or email can be determined + (will use the AgenorUserManager to retrieve such) + +2005-07-08 Marcus Mueller + + * README: updated for new default 'SOGoAllowsUnrestrictedAccess' + +2005-07-05 Marcus Mueller + + * v0.9.29 + + * README: updated defaults documentation + + * SOGo.m: added new default 'SOGoEnableDoubleReleaseCheck' for + debugging of NSAutoreleasePool issues + +2005-03-28 Helge Hess + + * SOGoProductLoader.m: do not try to load directories without + extensions (v0.9.28) + +2005-03-23 Marcus Mueller + + * renamed "default.strings" to "Localizable.strings" (v0.9.27) + +2005-02-21 Helge Hess + + * GNUmakefile: properly install bundle in FHS (v0.9.26) + +2005-02-20 Helge Hess + + * SOGoProductLoader.m: fixed product loader for FHS and Cocoa (0.9.25) + +2005-02-17 Helge Hess + + * SOGo.m: added a proper application 'name' for the WEResourceManager, + use WEResourceManager per default (v0.9.24) + +2005-02-12 Marcus Mueller + + * SOGo.m: corrected incorrect use of logging (v0.9.23) + +2005-02-10 Helge Hess + + * GNUmakefile.preamble: fixed linking on MacOSX (v0.9.22) + + * v0.9.21 + + * SOGoProductLoader.m: perform properly versioned plugin lookups (load + bundles from Library/SOGo-0.9 instead of Library/SOGo) + + * sogod is now a tool, not a .woa anymore + + * SOGo.m: minor cleanup in locale code, removed some dead code + (v0.9.20) + + * GNUmakefile: some support for tool compilation (does not work yet) + + * sogod.m: moved application class to own file, started to work on + daemon/product separation (v0.9.19) + +2004-01-07 Marcus Mueller + + * {English/French}.lproj/default.strings: changed encoding from + ISO-Latin-1 to UTF-8, which is now the default (v0.9.18) + +2004-12-15 Marcus Mueller + + * SOGoUserHomePage.m: added defaultAction to redirect to + "Calendar/" (v0.9.17) + +2004-12-08 Marcus Mueller + + * SOGoProductLoader.m, sogod.m: changed to use NGLogging (v0.9.16) + +2004-10-19 Marcus Mueller + + * SOGoUserHomePage.[wox|m]: changed hrefs to be computed dynamically + instead of being static (v0.9.15) + +2004-10-18 Marcus Mueller + + * v0.9.14 + + * SOGoUserHomePage.wox: Changed label for "eMail" to "Mail" for + consistency + + * *.lproj/default.strings: added label "Mail" + +2004-09-26 Helge Hess + + * sogod.m: return 404 for favicon.ico queries (v0.9.13) + + * fixed title bindings to const: in .wox (should be label:?) (v0.9.12) + +2004-09-25 Helge Hess + + * sogod.m: fixed a compile warning on OSX (v0.9.11) + +2004-09-20 Helge Hess + + * SOGoUserHomePage.wox: added link to Mail (v0.9.10) + +2004-08-27 Marcus Mueller + + * v0.9.9 + + * English.lproj/default.strings, French.lproj/default.strings: + dictionaries for labels + + * SOGoUserHomePage.wox: replaced constant strings with labels + +2004-08-26 Helge Hess + + * GNUmakefile.preamble: fixed superflous libjs (v0.9.8) + +2004-08-11 Helge Hess + + * added SOGoGroupPage and SOGoGroupsPage (default views for the group + folders) (v0.9.7) + + * sogod.m: do not set SoRootURL manually (v0.9.6) + +2004-08-10 Marcus Mueller + + * French.lproj/Locale: minor changes to capitalization (v0.9.5) + +2004-07-27 Marcus Mueller + + * sogod.m: added static SoRootURL to context (v0.9.4) + +2004-07-19 Marcus Mueller + + * sogod.m, */Locale: converted to UTF-8 for better editability (v0.9.3) + +2004-07-19 Marcus Mueller + + * v0.9.2 + + * sogod.m: added localization methods. Current locale is put into + WOContext upon first request. All locales are cached in the + application object. + + * [English,French].lproj: created. Put appropriate Locale + representations here. + + * GNUmakefile: added LANGUAGES and LOCALIZED_RESOURCES. + + * SOGoRootPage.wox: some debug code (for locales). + + * created ChangeLog. diff --git a/UI/MainUI/English.lproj/Locale b/UI/MainUI/English.lproj/Locale new file mode 100644 index 00000000..ac087fc2 --- /dev/null +++ b/UI/MainUI/English.lproj/Locale @@ -0,0 +1,35 @@ +/* English */ +{ + NSLanguageName = "English"; + NSFormalName = "English"; + NSLocaleCode = "en"; /* ISO 639-1 */ + NSLanguageCode = "eng"; /* ISO 639-2 */ + NSParentContext = ""; + + NSAMPMDesignation = (AM, PM); + NSCurrencySymbol = "$"; + NSDateFormatString = "%A, %B %e, %Y"; + NSDateTimeOrdering = MDYH; + NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); + NSDecimalSeparator = "."; + NSEarlierTimeDesignations = (prior, last, past, ago); + NSHourNameDesignations = ((0, midnight), (10, morning), (12, noon, lunch), (14, afternoon), (19, dinner)); + NSInternationalCurrencyString = USD; /* ISO 4217 */ + NSLaterTimeDesignations = (next); + NSMonthNameArray = (January, February, March, April, May, June, July, August, September, October, November, December); + NSNextDayDesignations = (tomorrow); + NSNextNextDayDesignations = (nextday); + NSPriorDayDesignations = (yesterday); + NSShortDateFormatString = "%1m/%e/%y"; + NSShortMonthNameArray = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); + NSShortTimeDateFormatString = "%1m/%e/%y %1I:%M %p"; + NSShortWeekDayNameArray = (Sun, Mon, Tue, Wed, Thu, Fri, Sat); + NSThisDayDesignations = (today, now); + NSThousandsSeparator = ","; + NSTimeDateFormatString = "%A, %B %e, %Y %1I:%M:%S %p %Z"; + NSTimeFormatString = "%1I:%M:%S %p"; + NSWeekDayNameArray = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); + NSYearMonthWeekDesignations = (year, month, week); + NSPositiveCurrencyFormatString = "$9,999.00"; + NSNegativeCurrencyFormatString = "-$9,999.00"; +} diff --git a/UI/MainUI/English.lproj/Localizable.strings b/UI/MainUI/English.lproj/Localizable.strings new file mode 100644 index 00000000..ae3e21df --- /dev/null +++ b/UI/MainUI/English.lproj/Localizable.strings @@ -0,0 +1,12 @@ +/* this file is in UTF-8 format! */ + +"Homepage" = "Homepage"; + +"Internet access unauthorized and" = "Internet access unauthorized and"; +"Internet access authorized and" = "Internet access authorized and"; +"internetAccessState_0" = "CLOSED"; +"internetAccessState_1" = "OPEN"; + +"Automatic vacation messages activation" = "Automatic vacation messages activation"; +"Internet" = "Internet"; +"Intranet" = "Intranet"; diff --git a/UI/MainUI/French.lproj/Locale b/UI/MainUI/French.lproj/Locale new file mode 100644 index 00000000..70b8a2f6 --- /dev/null +++ b/UI/MainUI/French.lproj/Locale @@ -0,0 +1,35 @@ +/* French */ +{ + NSLanguageName = "French"; + NSFormalName = "Français"; + NSLocaleCode = "fr"; /* ISO 639-1 */ + NSLanguageCode = "fra"; /* ISO 639-2 */ + NSParentContext = ""; + + NSCurrencySymbol = " €"; + NSDateFormatString = "%A %e %B %Y"; + NSDateTimeOrdering = DMYH; + NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); + NSDecimalSeparator = ","; + NSEarlierTimeDesignations = (dernier, "dernière", derniers, "dernières"); + NSHourNameDesignations = ((0, minuit), (12, midi), (10, matin), (14, "après-midi"), (19, soir)); + NSInternationalCurrencyString = EUR; /* ISO 4217 */ + NSLaterTimeDesignations = (prochain, prochaine, prochains, prochaines); + NSMonthNameArray = (Janvier, "Février", Mars, Avril, Mai, Juin, Juillet, "Août", Septembre, Octobre, Novembre, "Décembre"); + NSNextDayDesignations = (demain); + NSNextNextDayDesignations = ("après-demain"); + NSPriorDayDesignations = (hier); + NSShortDateFormatString = "%e/%m/%y"; + NSShortMonthNameArray = (Jan, "Fév", Mar, Avr, Mai, Jun, Jul, "Aoû", Sep, Oct, Nov, "Déc"); + NSShortTimeDateFormatString = "%e/%m/%y %1H:%M"; + NSShortWeekDayNameArray = (Dim, Lun, Mar, Mer, Jeu, Ven, Sam); + NSThisDayDesignations = ("aujourd'hui"); + NSThousandsSeparator = " "; /* space */ + NSTimeDateFormatString = "%A %e %B %Y %1H:%M:%S %Z"; + NSTimeFormatString = "%1H:%M:%S"; /* no space before and after colons*/ + NSWeekDayNameArray = (Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi); + NSYearMonthWeekDesignations = ("année", mois, semaine); + NSAMPMDesignation = (AM, PM); + NSPositiveCurrencyFormatString = "9,999.00$"; + NSNegativeCurrencyFormatString = "-9,999.00$"; +} diff --git a/UI/MainUI/French.lproj/Localizable.strings b/UI/MainUI/French.lproj/Localizable.strings new file mode 100644 index 00000000..880d737e --- /dev/null +++ b/UI/MainUI/French.lproj/Localizable.strings @@ -0,0 +1,12 @@ +/* this file is in UTF-8 format! */ + +"Homepage" = "Accueil"; + +"Internet access authorized and" = "L'accès depuis internet est autorisé et "; +"Internet access unauthorized and" = "L'accès depuis internet est interdit et "; +"internetAccessState_0" = "FERMÉ" +"internetAccessState_1" = "OUVERT"; + +"Automatic vacation messages activation" = "Activation du message de réponse automatique "; +"Internet" = "Internet"; +"Intranet" = "Intranet"; diff --git a/UI/MainUI/GNUmakefile b/UI/MainUI/GNUmakefile new file mode 100644 index 00000000..8cbc220c --- /dev/null +++ b/UI/MainUI/GNUmakefile @@ -0,0 +1,52 @@ +# GNUstep makefile + +-include ../config.make +include $(GNUSTEP_MAKEFILES)/common.make +include ../Version +include ./Version + +SOGOD = sogod-$(MAJOR_VERSION).$(MINOR_VERSION) +TOOL_NAME = $(SOGOD) +BUNDLE_NAME = MainUI +BUNDLE_EXTENSION = .SOGo +BUNDLE_INSTALL_DIR = $(GNUSTEP_USER_ROOT)/Library/SOGo-$(MAJOR_VERSION).$(MINOR_VERSION) + +# daemon tool + +$(SOGOD)_OBJC_FILES += \ + sogod.m \ + SOGo.m \ + SOGoProductLoader.m \ + +# product + +MainUI_PRINCIPAL_CLASS = MainUIProduct + +MainUI_LANGUAGES = English French + +MainUI_OBJC_FILES += \ + MainUIProduct.m \ + SOGoRootPage.m \ + SOGoUserHomePage.m \ + SOGoGroupPage.m \ + SOGoGroupsPage.m \ + +MainUI_RESOURCE_FILES += \ + Version \ + product.plist \ + \ + SOGoRootPage.wox \ + SOGoUserHomePage.wox \ + SOGoGroupPage.wox \ + SOGoGroupsPage.wox \ + \ + homepage.js \ + +MainUI_LOCALIZED_RESOURCE_FILES += \ + Locale Localizable.strings + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/bundle.make +include $(GNUSTEP_MAKEFILES)/tool.make +-include GNUmakefile.postamble +include ../fhsbundle.make diff --git a/UI/MainUI/GNUmakefile.preamble b/UI/MainUI/GNUmakefile.preamble new file mode 100644 index 00000000..dc434140 --- /dev/null +++ b/UI/MainUI/GNUmakefile.preamble @@ -0,0 +1,40 @@ +# compile settings + +ADDITIONAL_CPPFLAGS += \ + -DSOGO_MAJOR_VERSION=$(MAJOR_VERSION) \ + -DSOGO_MINOR_VERSION=$(MINOR_VERSION) \ + -DSOGO_SUBMINOR_VERSION=$(SUBMINOR_VERSION) + +ADDITIONAL_INCLUDE_DIRS += \ + -I../SoObjects/ \ + -I../.. + +ADDITIONAL_LIB_DIRS += \ + -L../SoObjects/SOGo/$(GNUSTEP_OBJ_DIR)/ \ + -L../OGoContentStore/$(GNUSTEP_OBJ_DIR)/ + +SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib + +MainUI_BUNDLE_LIBS += \ + -lSOGo \ + -lOGoContentStore \ + -lGDLContentStore \ + -lGDLAccess \ + -lNGiCal \ + -lNGObjWeb \ + -lNGMime -lNGLdap \ + -lNGStreams -lNGExtensions -lEOControl \ + -lDOM -lXmlRpc -lSaxObjC + + +$(SOGOD)_TOOL_LIBS += \ + -lSOGo \ + -lOGoContentStore \ + -lGDLContentStore \ + -lGDLAccess \ + -lWEExtensions \ + -lNGiCal \ + -lNGObjWeb \ + -lNGMime -lNGLdap \ + -lNGStreams -lNGExtensions -lEOControl \ + -lDOM -lXmlRpc -lSaxObjC diff --git a/UI/MainUI/MainUIProduct.m b/UI/MainUI/MainUIProduct.m new file mode 100644 index 00000000..1018ad73 --- /dev/null +++ b/UI/MainUI/MainUIProduct.m @@ -0,0 +1,47 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#import + +@interface MainUIProduct : NSObject +{ +} + +@end + +#import + +@implementation MainUIProduct + ++ (NSString *)pathToLocaleForLanguageNamed:(NSString *)_name { + // TODO: this is kind of a hack, we reuse the class registry to find + // resources ... + NSBundle *bundle; + NSString *ldir, *path; + + bundle = [NSBundle bundleForClass:self]; + ldir = [_name stringByAppendingPathExtension:@"lproj"]; + path = [bundle pathForResource:@"Locale" ofType:nil inDirectory:ldir]; + + return path; +} + +@end /* MainUIProduct */ diff --git a/UI/MainUI/README b/UI/MainUI/README new file mode 100644 index 00000000..36c80043 --- /dev/null +++ b/UI/MainUI/README @@ -0,0 +1,68 @@ +SOGo +==== + +Master Daemon, loads the functionality from product bundles in Library/SOGo. + +Setup +===== + + Defaults write sogod NGBundlePath '"$HOME/Library/SOGo"' + => otherwise some bundles will clash with "fat" OGo + => the UIx .wox driver must be found + +Defaults +======== + + SOGoDefaultLanguage - string - currently used for selecting the language of + the mail templates. Default is "French". + + SOGoCrashOnSessionCreate - bool - crash the server if a session is created + => useful for debugging + + SOGoEnableDoubleReleaseCheck - bool - call + +[NSAutoreleasePool enableDoubleReleaseCheck:YES] upon start + => useful for debugging + +SOGoInternetDetectQualifier +- an EOQualifier to detect whether a set of HTTP headers is from the outside, + eg: "NOT (minequprovenance = 'intranet')" + -SOGoInternetDetectQualifier '"NOT (minequprovenance = \"intranet\")"' + Note: all header field names are lowercase + Testing: -SOGoInternetDetectQualifier '"host = \"agenor.opengroupware.org\""' + +AgenorProfileURL - URL +- configure database location of the user profile + eg: http://postgres:@agenor-db:5432/test/sogo_user_profile + +SOGoDoNotRedirectRootPage - YES|NO +- do not redirect to home-folder for authenticated users but show the + root page (with the login name) + +What it does +============ +- provides locale support +- preloads the SOGo products (SOGoProductLoader) +- provides the root object (the application object with user lookup) +- sets the authenticator +- does some process limits and restart support + +Apache Setup +============ + + AliasMatch /SOGoHH/so/ControlPanel/Products/(.*)/Resources/(.*) \ + /home/helge/GNUstep/Library/SOGo-0.9/$1.SOGo/Resources/$2 + + + AuthName "Agenor LDAP" + AuthType Basic + AuthLDAPEnabled on + AuthLDAPUrl ldap://agenor-ldap:389/ou=organisation,dc=equipement,dc=gouv,dc=fr??sub?(&(objectClass=person)(uid=*)) + require valid-user + + SetHandler ngobjweb-adaptor + SetAppPort 9000 + + + + SetHandler default-handler + diff --git a/UI/MainUI/SOGo.m b/UI/MainUI/SOGo.m new file mode 100644 index 00000000..d68e81ad --- /dev/null +++ b/UI/MainUI/SOGo.m @@ -0,0 +1,297 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +@interface SOGo : SoApplication +{ + NSMutableDictionary *localeLUT; +} + +- (NSDictionary *)currentLocaleConsideringLanguages:(NSArray *)_langs; +- (NSDictionary *)localeForLanguageNamed:(NSString *)_name; + +@end + +#include "SOGoProductLoader.h" +#include +#include +#include +#include "common.h" + +@implementation SOGo + +static unsigned int vMemSizeLimit = 0; +static BOOL doCrashOnSessionCreate = NO; + ++ (void)initialize { + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + id tmp; + + doCrashOnSessionCreate = [ud boolForKey:@"SOGoCrashOnSessionCreate"]; + + /* vMem size check - default is 200MB */ + + tmp = [ud objectForKey:@"SxVMemLimit"]; + vMemSizeLimit = (tmp != nil) + ? [tmp intValue] + : 200; + if (vMemSizeLimit > 0) { + NSLog(@"Note: vmem size check enabled: shutting down app when " + @"vmem > %d MB", vMemSizeLimit); + } +#if LIB_FOUNDATION_LIBRARY + if ([ud boolForKey:@"SOGoEnableDoubleReleaseCheck"]) + [NSAutoreleasePool enableDoubleReleaseCheck:YES]; +#endif +} + +- (id)init { + if ((self = [super init])) { + WOResourceManager *rm; + + self->localeLUT = [[NSMutableDictionary alloc] initWithCapacity:2]; + [[SOGoProductLoader productLoader] loadProducts]; + + rm = [[WEResourceManager alloc] init]; + [self setResourceManager:rm]; + } + return self; +} + +- (void)dealloc { + [self->localeLUT release]; + [super dealloc]; +} + +/* authenticator */ + +- (id)authenticatorInContext:(WOContext *)_ctx { + return [SOGoAuthenticator sharedSOGoAuthenticator]; +} + +/* name lookup */ + +- (BOOL)isUserName:(NSString *)_key inContext:(id)_ctx { + if ([_key length] < 1) + return NO; + + if (isdigit([_key characterAtIndex:0])) + return NO; + + return YES; +} + +- (id)lookupUser:(NSString *)_key inContext:(id)_ctx { + return [[[NSClassFromString(@"SOGoUserFolder") alloc] + initWithName:_key inContainer:self] 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 */ + [self _setupLocaleInContext:_ctx]; + + /* first check attributes directly bound to the application */ + if ((obj = [super lookupName:_key inContext:_ctx acquire:_flag])) + return obj; + + /* + The problem is, that at this point we still get request for resources, + eg 'favicon.ico'. + + Addition: we also get queries for various other methods, like "GET" if + no method was provided in the query path. + */ + + if ([_key isEqualToString:@"favicon.ico"]) + return nil; + + if ([self isUserName:_key inContext:_ctx]) + return [self lookupUser:_key inContext:_ctx]; + + return nil; +} + +/* WebDAV */ + +- (NSString *)davDisplayName { + /* this is used in the UI, eg in the navigation */ + return @"SOGo"; +} + +/* exception handling */ + +- (WOResponse *)handleException:(NSException *)_exc + inContext:(WOContext *)_ctx +{ + printf("EXCEPTION: %s\n", [[_exc description] cString]); + abort(); +} + +/* runtime maintenance */ + +- (void)checkIfDaemonHasToBeShutdown { + unsigned int limit, vmem; + + if ((limit = vMemSizeLimit) == 0) + return; + + vmem = [[NSProcessInfo processInfo] virtualMemorySize]/1048576; + + if (vmem > limit) { + [self logWithFormat: + @"terminating app, vMem size limit (%d MB) has been reached" + @" (currently %d MB)", + limit, vmem]; + [self terminate]; + } +} + +- (WOResponse *)dispatchRequest:(WORequest *)_request { + static NSArray *runLoopModes = nil; + WOResponse *resp; + + resp = [super dispatchRequest:_request]; + + if ([self isTerminating]) + return resp; + + if (runLoopModes == nil) + runLoopModes = [[NSArray alloc] initWithObjects:NSDefaultRunLoopMode, nil]; + + // TODO: a bit complicated? (-perform:afterDelay: doesn't work?) + [[NSRunLoop currentRunLoop] performSelector: + @selector(checkIfDaemonHasToBeShutdown) + target:self argument:nil + order:1 modes:runLoopModes]; + return resp; +} + +/* session management */ + +- (WOSession *)createSessionForRequest:(WORequest *)_request { + [self warnWithFormat:@"session creation requested!"]; + if (doCrashOnSessionCreate) + abort(); + return [super createSessionForRequest:_request]; +} + +/* localization */ + +- (NSDictionary *)currentLocaleConsideringLanguages:(NSArray *)_langs { + unsigned i, count; + + /* assume _langs is ordered by priority */ + count = [_langs count]; + for (i = 0; i < count; i++) { + NSString *lname; + NSDictionary *locale; + + lname = [_langs objectAtIndex:i]; + locale = [self localeForLanguageNamed:lname]; + if (locale != nil) + return locale; + } + /* no appropriate language, fallback to default */ + return [self localeForLanguageNamed:@"English"]; +} + +- (NSString *)pathToLocaleForLanguageNamed:(NSString *)_name { + static Class MainProduct = Nil; + NSString *lpath; + + lpath = [[self resourceManager] pathForResourceNamed:@"Locale" + inFramework:nil + languages:[NSArray arrayWithObject:_name]]; + if ([lpath isNotNull]) + return lpath; + + if (MainProduct == Nil) { + if ((MainProduct = NSClassFromString(@"MainUIProduct")) == Nil) + [self errorWithFormat:@"did not find MainUIProduct class!"]; + } + + lpath = [(id)MainProduct pathToLocaleForLanguageNamed:_name]; + if ([lpath isNotNull]) + return lpath; + + return nil; +} + +- (NSDictionary *)localeForLanguageNamed:(NSString *)_name { + NSString *lpath; + id data; + NSDictionary *locale; + + if (![_name isNotNull]) { + [self errorWithFormat:@"%s: name parameter must not be nil!", + __PRETTY_FUNCTION__]; + return nil; + } + + if ((locale = [self->localeLUT objectForKey:_name]) != nil) + return locale; + + if ((lpath = [self pathToLocaleForLanguageNamed:_name]) == nil) { + [self errorWithFormat:@"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) { + [self logWithFormat:@"%s couldn't load locale with name:%@", + __PRETTY_FUNCTION__, + _name]; + return nil; + } + [self->localeLUT setObject:locale forKey:_name]; + return locale; +} + +/* name (used by the WEResourceManager) */ + +- (NSString *)name { + return @"SOGo-0.9"; +} + +@end /* SOGo */ diff --git a/UI/MainUI/SOGoGroupPage.m b/UI/MainUI/SOGoGroupPage.m new file mode 100644 index 00000000..f157417e --- /dev/null +++ b/UI/MainUI/SOGoGroupPage.m @@ -0,0 +1,31 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +@interface SOGoGroupPage : SoComponent +@end + +#include "common.h" + +@implementation SOGoGroupPage + +@end /* SOGoGroupPage */ diff --git a/UI/MainUI/SOGoGroupPage.wox b/UI/MainUI/SOGoGroupPage.wox new file mode 100644 index 00000000..3a8d7365 --- /dev/null +++ b/UI/MainUI/SOGoGroupPage.wox @@ -0,0 +1,27 @@ + + +

+ OpenGroupware.org: + +

+ +

Actions

+ + +

Group Members

+
    + +
  • +
    +
+ +
diff --git a/UI/MainUI/SOGoGroupsPage.m b/UI/MainUI/SOGoGroupsPage.m new file mode 100644 index 00000000..fe6e10eb --- /dev/null +++ b/UI/MainUI/SOGoGroupsPage.m @@ -0,0 +1,35 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id: SOGoGroupsPage.m 106 2004-06-30 09:44:35Z helge $ + +#include + +@interface SOGoGroupsPage : SoComponent +{ +} + +@end + +#include "common.h" + +@implementation SOGoGroupsPage + +@end /* SOGoGroupsPage */ diff --git a/UI/MainUI/SOGoGroupsPage.wox b/UI/MainUI/SOGoGroupsPage.wox new file mode 100644 index 00000000..5b102100 --- /dev/null +++ b/UI/MainUI/SOGoGroupsPage.wox @@ -0,0 +1,18 @@ + + +

+ OpenGroupware.org: + +

+ +

+ This is an (intentionally) empty page, go back. +

+
diff --git a/UI/MainUI/SOGoProductLoader.h b/UI/MainUI/SOGoProductLoader.h new file mode 100644 index 00000000..f5941672 --- /dev/null +++ b/UI/MainUI/SOGoProductLoader.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + +#ifndef __Main_SOGoProductLoader_H__ +#define __Main_SOGoProductLoader_H__ + +#import + +@class NSString, NSArray; + +@interface SOGoProductLoader : NSObject +{ + NSString *productDirectoryName; + NSArray *searchPathes; +} + ++ (id)productLoader; + +/* operations */ + +- (void)loadProducts; + +@end + +#endif /* __Main_SOGoProductLoader_H__ */ diff --git a/UI/MainUI/SOGoProductLoader.m b/UI/MainUI/SOGoProductLoader.m new file mode 100644 index 00000000..2d994ea2 --- /dev/null +++ b/UI/MainUI/SOGoProductLoader.m @@ -0,0 +1,174 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include "SOGoProductLoader.h" +#include "common.h" + +@implementation SOGoProductLoader + ++ (int)sogoMajorVersion { + return SOGO_MAJOR_VERSION; +} ++ (int)sogoMinorVersion { + return SOGO_MINOR_VERSION; +} + ++ (id)productLoader { + return [[[self alloc] init] autorelease]; +} + +- (id)init { + if ((self = [super init])) { + self->productDirectoryName = + [[NSString alloc] initWithFormat:@"SOGo-%i.%i", + [[self class] sogoMajorVersion], + [[self class] sogoMinorVersion]]; + } + return self; +} + +- (void)dealloc { + [self->productDirectoryName release]; + [self->searchPathes release]; + [super dealloc]; +} + +/* loading */ + +- (void)_addCocoaSearchPathesToArray:(NSMutableArray *)ma { + id tmp; + + tmp = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory, + NSAllDomainsMask, + YES); + if ([tmp count] > 0) { + NSEnumerator *e; + + e = [tmp objectEnumerator]; + while ((tmp = [e nextObject])) { + tmp = [tmp stringByAppendingPathComponent:self->productDirectoryName]; + if (![ma containsObject:tmp]) + [ma addObject:tmp]; + } + } +} + +- (void)_addGNUstepSearchPathesToArray:(NSMutableArray *)ma { + NSDictionary *env; + id tmp; + + env = [[NSProcessInfo processInfo] environment]; + if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil) + tmp = [env objectForKey:@"GNUSTEP_PATHLIST"]; + + tmp = [tmp componentsSeparatedByString:@":"]; + if ([tmp count] > 0) { + NSEnumerator *e; + + e = [tmp objectEnumerator]; + while ((tmp = [e nextObject])) { + tmp = [tmp stringByAppendingPathComponent:@"Library"]; + tmp = [tmp stringByAppendingPathComponent:self->productDirectoryName]; + if (![ma containsObject:tmp]) + [ma addObject:tmp]; + } + } + else { + NSLog(@"%s: empty library search path !", __PRETTY_FUNCTION__); + } +} + +- (void)_addFHSPathesToArray:(NSMutableArray *)ma { + NSString *s; + + s = @"sogod-0.9"; + [ma addObject:[@"/usr/local/lib/" stringByAppendingString:s]]; + [ma addObject:[@"/usr/lib/" stringByAppendingString:s]]; +} + +- (NSArray *)productSearchPathes { + NSMutableArray *ma; + BOOL hasGNUstepEnv; + + if (self->searchPathes != nil) + return self->searchPathes; + + hasGNUstepEnv = [[[[NSProcessInfo processInfo] environment] + objectForKey:@"GNUSTEP_USER_ROOT"] length] > 0 ? YES : NO; + + ma = [NSMutableArray arrayWithCapacity:6]; + + if (hasGNUstepEnv) + [self _addGNUstepSearchPathesToArray:ma]; +#if COCOA_Foundation_LIBRARY + else + [self _addCocoaSearchPathesToArray:ma]; +#endif + + [self _addFHSPathesToArray:ma]; + + self->searchPathes = [ma copy]; + + if ([self->searchPathes count] == 0) { + [self logWithFormat:@"%s: no search pathes were found !", + __PRETTY_FUNCTION__]; + } + + return self->searchPathes; +} + +- (void)loadProducts { + SoProductRegistry *registry = nil; + NSFileManager *fm; + NSEnumerator *pathes; + NSString *lpath; + + registry = [SoProductRegistry sharedProductRegistry]; + fm = [NSFileManager defaultManager]; + + pathes = [[self productSearchPathes] objectEnumerator]; + while ((lpath = [pathes nextObject]) != nil) { + NSEnumerator *productNames; + NSString *productName; + + [self logWithFormat:@"scanning SOGo products in: %@", lpath]; + + productNames = [[fm directoryContentsAtPath:lpath] objectEnumerator]; + + while ((productName = [productNames nextObject]) != nil) { + NSString *bpath; + + if ([[productName pathExtension] length] == 0) + /* filter out directories without extensions */ + continue; + + bpath = [lpath stringByAppendingPathComponent:productName]; + [self logWithFormat:@" register SOGo product: %@", + [bpath lastPathComponent]]; + [registry registerProductAtPath:bpath]; + } + } + + if (![registry loadAllProducts]) + [self warnWithFormat:@"could not load all products !"]; +} + +@end /* SOGoProductLoader */ diff --git a/UI/MainUI/SOGoRootPage.m b/UI/MainUI/SOGoRootPage.m new file mode 100644 index 00000000..788662f3 --- /dev/null +++ b/UI/MainUI/SOGoRootPage.m @@ -0,0 +1,154 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +@interface SOGoRootPage : SoComponent +{ + NSString *userName; +} + +@end + +#include +#include "common.h" + +@implementation SOGoRootPage + +static BOOL doNotRedirect = NO; + ++ (void)initialize { + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + + if ((doNotRedirect = [ud boolForKey:@"SOGoDoNotRedirectRootPage"])) + NSLog(@"SOGoRootPage: home-page redirect is disabled."); +} + +- (void)dealloc { + [self->userName release]; + [super dealloc]; +} + +/* accessors */ + +- (void)setUserName:(NSString *)_value { + ASSIGNCOPY(self->userName, _value); +} +- (NSString *)userName { + return self->userName; +} + +/* actions */ + +- (id)connectAction { + NSString *url; + + [self takeFormValuesForKeys:@"userName", nil]; + + if ([[self userName] length] == 0) + return nil; + + url = [@"/" stringByAppendingString:[[self userName] stringByEscapingURL]]; + if (![url hasSuffix:@"/"]) + url = [url stringByAppendingString:@"/"]; + + url = [[self context] urlWithRequestHandlerKey:@"so" + path:url queryString:nil]; + return [self redirectToLocation:url]; +} + +- (id)defaultAction { + WOResponse *r; + NSString *login, *rhk; + id auth, user; + id home, base; + + if (doNotRedirect) + return self; + + /* + Note: ctx.activeUser is NOT set here. Don't know why, so we retrieve + the user from the authenticator. + */ + + auth = [[self clientObject] authenticatorInContext:[self context]]; + user = [auth userInContext:[self context]]; + login = [user login]; + + if ([login isEqualToString:@"anonymous"]) { + /* use root page for unauthenticated users */ + return self; + } + + /* check base */ + + base = [self application]; + rhk = [[[self context] request] requestHandlerKey]; + if (([rhk length] == 0) || ([base requestHandlerForKey:rhk] == nil)) { + base = [base lookupName:@"so" inContext:[self context] acquire:NO]; + + if (![base isNotNull] || [base isKindOfClass:[NSException class]]) { + /* use root page if home could not be found */ + [self errorWithFormat:@"Did not find 'so' request handler!"]; + return self; + } + } + + /* lookup home-page */ + + home = [base lookupName:login inContext:[self context] acquire:NO]; + if (![home isNotNull] || [home isKindOfClass:[NSException class]]) { + /* use root page if home could not be found */ + return self; + } + + /* redirect to home-page */ + + r = [[self context] response]; + [r setStatus:302 /* moved */]; + [r setHeader:[home baseURLInContext:[self context]] forKey:@"location"]; + return r; +} + +/* response generation */ + +- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { + NSString *rhk; + + // TODO: we might also want to look into the HTTP basic-auth to redirect to + // the login URL! + + rhk = [[_ctx request] requestHandlerKey]; + if ([rhk length]==0 || [[self application] requestHandlerForKey:rhk]==nil) { + /* a small hack to redirect to a valid URL */ + NSString *url; + + url = [_ctx urlWithRequestHandlerKey:@"so" path:@"/" queryString:nil]; + [_response setStatus:302 /* moved */]; + [_response setHeader:url forKey:@"location"]; + [self logWithFormat:@"URL: %@", url]; + return; + } + + [super appendToResponse:_response inContext:_ctx]; +} + +@end /* SOGoRootPage */ diff --git a/UI/MainUI/SOGoRootPage.wox b/UI/MainUI/SOGoRootPage.wox new file mode 100644 index 00000000..5cf9a093 --- /dev/null +++ b/UI/MainUI/SOGoRootPage.wox @@ -0,0 +1,24 @@ + + + + Scalable OGo Homepage + + + +

Scalable OGo Homepage

+ +
+ Login: + + +
+ + + diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m new file mode 100644 index 00000000..564fe0d2 --- /dev/null +++ b/UI/MainUI/SOGoUserHomePage.m @@ -0,0 +1,233 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +@interface SOGoUserHomePage : SoComponent +{ + id item; +} + +- (NSString *)ownPath; +- (NSString *)userFolderPath; +- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub; + +- (NSString *)relativeCalendarPath; +- (NSString *)relativeContactsPath; +- (NSString *)relativeMailPath; + +@end + +#include +#include +#include +#include "common.h" + +@implementation SOGoUserHomePage + +static NSArray *internetAccessStates = nil; + ++ (void)initialize { + static BOOL didInit = NO; + + if (didInit) return; + didInit = YES; + + internetAccessStates = [[NSArray alloc] initWithObjects:@"0", @"1", nil]; +} + +- (void)dealloc { + [self->item release]; + [super dealloc]; +} + +/* lookup */ + +- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag { + // Note: we do no acquisition + id obj; + + /* first check attributes directly bound to the object */ + if ((obj = [super lookupName:_key inContext:_ctx acquire:NO])) + return obj; + + return nil; +} + +/* accessors */ + +- (void)setItem:(id)_item { + ASSIGN(self->item, _item); +} +- (id)item { + return self->item; +} + +- (NSArray *)internetAccessStates { + return internetAccessStates; +} + +- (NSString *)internetAccessState { + NSUserDefaults *ud; + NSNumber *value; + + ud = [[[self context] activeUser] userDefaults]; + value = [ud objectForKey:@"allowinternet"]; + return [NSString stringWithFormat:@"%d", [value boolValue]]; +} +- (void)setInternetAccessState:(NSString *)_internetAccessState { + NSUserDefaults *ud; + + ud = [[[self context] activeUser] userDefaults]; + [ud setObject:_internetAccessState forKey:@"allowinternet"]; + [ud synchronize]; +} + +- (NSString *)itemInternetAccessStateText { + NSString *key; + + key = [NSString stringWithFormat:@"internetAccessState_%@", self->item]; + return key; +} + +/* paths */ + +- (NSString *)ownPath { + NSString *uri; + NSRange r; + + uri = [[[self context] request] uri]; + + /* first: cut off query parameters */ + + r = [uri rangeOfString:@"?" options:NSBackwardsSearch]; + if (r.length > 0) + uri = [uri substringToIndex:r.location]; + return uri; +} + +- (NSString *)userFolderPath { + WOContext *ctx; + NSArray *traversalObjects; + NSString *url; + + ctx = [self context]; + traversalObjects = [ctx objectTraversalStack]; + url = [[traversalObjects objectAtIndex:1] + baseURLInContext:ctx]; + return [[NSURL URLWithString:url] path]; +} + +- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub { + NSString *dst, *rel; + + dst = [[self userFolderPath] stringByAppendingPathComponent:_sub]; + rel = [dst urlPathRelativeToPath:[self ownPath]]; + return rel; +} + +- (NSString *)relativeCalendarPath { + return [self relativePathToUserFolderSubPath:@"Calendar/"]; +} + +- (NSString *)relativeContactsPath { + return [self relativePathToUserFolderSubPath:@"Contacts/"]; +} + +- (NSString *)relativeMailPath { + return [self relativePathToUserFolderSubPath:@"Mail/"]; +} + +/* objects */ + +- (id)calendarFolder { + return [[self clientObject] lookupName:@"Calendar" + inContext:[self context] + acquire:NO]; +} + +/* checking access */ + +- (BOOL)canAccess { + WOContext *ctx; + NSString *owner; + + ctx = [self context]; + owner = [[self clientObject] ownerInContext:ctx]; + return [owner isEqualToString:[[ctx activeUser] login]]; +} + +- (BOOL)isNotAllowedToChangeInternetAccess { + // TODO: should be a SOGoUser method + AgenorUserManager *um; + WOContext *ctx; + NSString *uid; + + ctx = [self context]; + /* do not allow changes when access is from Internet */ + if (![ctx isAccessFromIntranet]) + return YES; + um = [AgenorUserManager sharedUserManager]; + uid = [[ctx activeUser] login]; + return [um isUserAllowedToChangeSOGoInternetAccess:uid] ? NO : YES; +} + +- (BOOL)isVacationMessageEnabledForInternet { + // TODO: should be a SOGoUser method + AgenorUserManager *um; + NSString *uid; + + um = [AgenorUserManager sharedUserManager]; + uid = [[[self context] activeUser] login]; + return [um isInternetAutoresponderEnabledForUser:uid]; +} + +- (BOOL)isVacationMessageEnabledForIntranet { + // TODO: should be a SOGoUser method + AgenorUserManager *um; + NSString *uid; + + um = [AgenorUserManager sharedUserManager]; + uid = [[[self context] activeUser] login]; + return [um isIntranetAutoresponderEnabledForUser:uid]; +} + +/* actions */ + +#if 0 +- (id)defaultAction { + return [self redirectToLocation:[self relativeCalendarPath]]; +} +#endif + +/* this is triggered by an XMLHTTPRequest */ +- (id)saveInternetAccessStateAction { + NSString *state; + + if ([self isNotAllowedToChangeInternetAccess]) + return [NSException exceptionWithHTTPStatus:403 /* Forbidden */]; + + state = [[[self context] request] formValueForKey:@"allowinternet"]; + [self setInternetAccessState:state]; + return [NSException exceptionWithHTTPStatus:200 /* OK */]; +} + +@end /* SOGoUserHomePage */ diff --git a/UI/MainUI/SOGoUserHomePage.wox b/UI/MainUI/SOGoUserHomePage.wox new file mode 100644 index 00000000..d09439a0 --- /dev/null +++ b/UI/MainUI/SOGoUserHomePage.wox @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + +
+
+

+ + + + + + +
+ : + + + +

+

+ +

+
+ + + + + + + + + + + +
+
+ + + +
+ + +
+
+
+
+
diff --git a/UI/MainUI/TODO b/UI/MainUI/TODO new file mode 100644 index 00000000..fbbab2d1 --- /dev/null +++ b/UI/MainUI/TODO @@ -0,0 +1 @@ +# $Id$ diff --git a/UI/MainUI/Version b/UI/MainUI/Version new file mode 100644 index 00000000..092b6114 --- /dev/null +++ b/UI/MainUI/Version @@ -0,0 +1,7 @@ +# Version file + +SUBMINOR_VERSION:=38 + +# v0.9.32 requires libSOGo v0.9.57 +# v0.9.24 requires libWEExtensions v4.5.67 +# v0.9.16 requires libNGExtensions v4.5.136 diff --git a/UI/MainUI/common.h b/UI/MainUI/common.h new file mode 100644 index 00000000..ea6a4dbf --- /dev/null +++ b/UI/MainUI/common.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + +#import + +#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY +# include +# include +#endif + +#include +#include +#include + +#include diff --git a/UI/MainUI/homepage.js b/UI/MainUI/homepage.js new file mode 100644 index 00000000..b98b9a17 --- /dev/null +++ b/UI/MainUI/homepage.js @@ -0,0 +1,49 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + */ +/* JavaScript for SOGo Homepage */ + +function toggleInternetAccessState(sender) { +// var form = document.getElementById("syncDefaultsForm"); +// document.syncDefaultsForm.action="saveInternetAccessState:method"; +// form.submit(); + this.postInternetAccessState(sender, sender.value); + return true; +} + +function postInternetAccessState(sender, state) { + var url; + var http = createHTTPClient(); + + url = "edit?allowinternet=" + state; + + if (http) { + http.open("POST", url, false); + http.send(""); + if (http.status != 200) { + alert("Failed to change state: " + http.statusText); + window.location.reload(); + } + } + else { + alert("Unable to retrieve HTTPClient object!"); + window.location.href = url; + } +} diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist new file mode 100644 index 00000000..c989288b --- /dev/null +++ b/UI/MainUI/product.plist @@ -0,0 +1,106 @@ +{ + requires = ( MAIN ); + + publicResources = ( + ); + + classes = { + SOGo = { + superclass = "SoApplication"; + protectedBy = "View"; + defaultAccess = "allow"; + defaultRoles = { + "View" = "Authenticated"; + "WebDAV Access" = "Authenticated"; + }; + methods = { + index = { + protectedBy = "View"; + pageName = "SOGoRootPage"; + }; + GET = { // more or less a hack, see README of dbd + protectedBy = "View"; + pageName = "SOGoRootPage"; + }; + connect = { + protectedBy = "View"; + pageName = "SOGoRootPage"; + actionName = "connect"; + }; + }; + }; + + SOGoRootPage = { + superclass = "SoComponent"; + protectedBy = "View"; + defaultRoles = { + "View" = "Authenticated"; + }; + }; + + SOGoObject = { + protectedBy = "View"; + defaultAccess = "allow"; + defaultRoles = { + "View" = "Authenticated"; + "WebDAV Access" = "Authenticated"; + }; + }; + SOGoContentObject = { + superclass = "SOGoObject"; + }; + SOGoFolder = { + superclass = "SOGoObject"; + }; + + SOGoUserFolder = { + superclass = "SOGoFolder"; + + defaultRoles = { + "HomePage Access" = "Owner"; + }; + + methods = { + view = { + protectedBy = "HomePage Access"; + pageName = "SOGoUserHomePage"; + }; + edit = { + protectedBy = "HomePage Access"; + pageName = "SOGoUserHomePage"; + actionName = "saveInternetAccessState"; + }; + /* + GET = { // more or less a hack, see README of dbd + protectedBy = "HomePage Access"; + pageName = "SOGoUserHomePage"; + }; + */ + }; + }; + + SOGoGroupsFolder = { + superclass = "SOGoObject"; + methods = { + index = { + protectedBy = "View"; + pageName = "SOGoGroupsPage"; + }; + }; + }; + SOGoGroupFolder = { + superclass = "SOGoObject"; + methods = { + index = { + protectedBy = "View"; + pageName = "SOGoGroupPage"; + }; + }; + }; + SOGoCustomGroupFolder = { + superclass = "SOGoGroupFolder"; + methods = { + }; + }; + }; +} diff --git a/UI/MainUI/sogod.m b/UI/MainUI/sogod.m new file mode 100644 index 00000000..314a248c --- /dev/null +++ b/UI/MainUI/sogod.m @@ -0,0 +1,38 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include +#include "common.h" + +int main(int argc, char **argv, char **env) { + NSAutoreleasePool *pool; + + pool = [[NSAutoreleasePool alloc] init]; +#if LIB_FOUNDATION_LIBRARY + [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; +#endif + [NGBundleManager defaultBundleManager]; + + WOWatchDogApplicationMain(@"SOGo", argc, (void*)argv); + + [pool release]; + return 0; +} -- 2.39.5