mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-05 08:34:30 +00:00
see ChangeLog
Monotone-Revision: 9054022ef1ca8aeba6e34842d27d9b94ce002b89 Monotone-Author: dev-unix.inverse.qc.ca Monotone-Date: 2006-06-15T19:34:10 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
2005-08-01 Helge Hess <helge.hess@skyrix.com>
|
||||
|
||||
* product.plist: moved security declarations of core classes to the
|
||||
+initialize method of the classes,
|
||||
add SOGo application object methods in a category (was a class)
|
||||
(v0.9.2)
|
||||
|
||||
* created UI/MainUI product bundle from sources in Main (v0.9.1)
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
@@ -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";
|
||||
@@ -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$";
|
||||
}
|
||||
@@ -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";
|
||||
@@ -0,0 +1,35 @@
|
||||
# GNUstep makefile
|
||||
|
||||
-include ../common.make
|
||||
|
||||
BUNDLE_NAME = MainUI
|
||||
|
||||
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 GNUmakefile.postamble
|
||||
include ../../fhsbundle.make
|
||||
@@ -0,0 +1,6 @@
|
||||
# compile settings
|
||||
|
||||
ADDITIONAL_CPPFLAGS += \
|
||||
-DSOGO_MAJOR_VERSION=$(MAJOR_VERSION) \
|
||||
-DSOGO_MINOR_VERSION=$(MINOR_VERSION) \
|
||||
-DSOGO_SUBMINOR_VERSION=$(SUBMINOR_VERSION)
|
||||
@@ -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 <Foundation/NSObject.h>
|
||||
|
||||
@interface MainUIProduct : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@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 */
|
||||
@@ -0,0 +1,4 @@
|
||||
MainUI
|
||||
======
|
||||
|
||||
TODO: document
|
||||
@@ -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 <NGObjWeb/SoComponent.h>
|
||||
|
||||
@interface SOGoGroupPage : SoComponent
|
||||
@end
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@implementation SOGoGroupPage
|
||||
|
||||
@end /* SOGoGroupPage */
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<var:component
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:uix="OGo:uix"
|
||||
className="UIxPageFrame"
|
||||
const:title="SOGo User Homepage"
|
||||
>
|
||||
<h3 class="window_label">
|
||||
OpenGroupware.org:
|
||||
<var:string value="clientObject.davDisplayName" />
|
||||
</h3>
|
||||
|
||||
<h4>Actions</h4>
|
||||
<ul>
|
||||
<li><a href="Calendar/weekoverview">Calendar</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Group Members</h4>
|
||||
<ul>
|
||||
<var:foreach list="clientObject.uids" item="item">
|
||||
<li><var:string value="item" /></li>
|
||||
</var:foreach>
|
||||
</ul>
|
||||
|
||||
</var:component>
|
||||
@@ -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 <NGObjWeb/SoComponent.h>
|
||||
|
||||
@interface SOGoGroupsPage : SoComponent
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@implementation SOGoGroupsPage
|
||||
|
||||
@end /* SOGoGroupsPage */
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<var:component
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:uix="OGo:uix"
|
||||
className="UIxPageFrame"
|
||||
const:title="SOGo User Homepage"
|
||||
>
|
||||
<h3 class="window_label">
|
||||
OpenGroupware.org:
|
||||
<var:string value="clientObject.davDisplayName" />
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
This is an (intentionally) empty page, <a href="..">go back</a>.
|
||||
</p>
|
||||
</var:component>
|
||||
@@ -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 <NGObjWeb/SoComponent.h>
|
||||
|
||||
@interface SOGoRootPage : SoComponent
|
||||
{
|
||||
NSString *userName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#include <SOGo/SOGoAuthenticator.h>
|
||||
#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<WOActionResults>)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 */
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<html
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
>
|
||||
<head>
|
||||
<title>Scalable OGo Homepage</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>Scalable OGo Homepage</h3>
|
||||
|
||||
<form href="connect">
|
||||
Login:
|
||||
<input name="userName" type="text" var:value="userName" />
|
||||
<input name="submit" type="submit" value="connect" />
|
||||
</form>
|
||||
<!--
|
||||
<hr />
|
||||
Current locale: <pre><var:string value="context.locale" /></pre>
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
@@ -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 <NGObjWeb/SoComponent.h>
|
||||
|
||||
@interface SOGoUserHomePage : SoComponent
|
||||
{
|
||||
id item;
|
||||
}
|
||||
|
||||
- (NSString *)ownPath;
|
||||
- (NSString *)userFolderPath;
|
||||
- (NSString *)relativePathToUserFolderSubPath:(NSString *)_sub;
|
||||
|
||||
- (NSString *)relativeCalendarPath;
|
||||
- (NSString *)relativeContactsPath;
|
||||
- (NSString *)relativeMailPath;
|
||||
|
||||
@end
|
||||
|
||||
#include <SOGo/AgenorUserManager.h>
|
||||
#include <SOGo/WOContext+Agenor.h>
|
||||
#include <SOGo/SOGoUser.h>
|
||||
#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 */
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version='1.0' standalone='yes'?>
|
||||
<var:component xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
xmlns:const="http://www.skyrix.com/od/constant"
|
||||
xmlns:rsrc="OGo:url"
|
||||
xmlns:label="OGo:label"
|
||||
xmlns:uix="OGo:uix"
|
||||
className="UIxPageFrame"
|
||||
title="name"
|
||||
>
|
||||
<var:if condition="canAccess" const:negate="YES">
|
||||
<var:string label:value="Forbidden" const:style="window_label" />
|
||||
</var:if>
|
||||
<var:if condition="canAccess">
|
||||
<script rsrc:src="generic.js" > <!-- space required --></script>
|
||||
<script rsrc:src="homepage.js" > <!-- space required --></script>
|
||||
<table id="skywintable"
|
||||
class="wintable"
|
||||
cellspacing="0"
|
||||
cellpadding="5"
|
||||
width="100%"
|
||||
>
|
||||
<tr>
|
||||
<td class="wintitle">
|
||||
<table cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td width="5"/>
|
||||
<td class="wintitle">
|
||||
<span class="window_label">
|
||||
<var:string label:value="Homepage"/>
|
||||
</span>
|
||||
</td>
|
||||
<td width="36" align="right" valign="center">
|
||||
<var:component className="UIxWinClose"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="wincontent">
|
||||
<p class="homepagefont">
|
||||
<var:if condition="isNotAllowedToChangeInternetAccess">
|
||||
<var:string label:value="Internet access unauthorized and"
|
||||
/> <var:popup const:name="allowinternet"
|
||||
list="internetAccessStates"
|
||||
item="item"
|
||||
label:string="$itemInternetAccessStateText"
|
||||
label:selection="internetAccessState_0"
|
||||
const:disabled="YES"
|
||||
/>
|
||||
</var:if>
|
||||
<var:if condition="isNotAllowedToChangeInternetAccess"
|
||||
const:negate="YES"
|
||||
>
|
||||
<var:string label:value="Internet access authorized and"
|
||||
/> <var:popup const:name="allowinternet"
|
||||
list="internetAccessStates"
|
||||
item="item"
|
||||
label:string="$itemInternetAccessStateText"
|
||||
selection="internetAccessState"
|
||||
const:onchange="toggleInternetAccessState(this)"
|
||||
/>
|
||||
</var:if>
|
||||
<br />
|
||||
<var:string label:value="Automatic vacation messages activation" />:
|
||||
<input type="checkbox"
|
||||
var:selection="isVacationMessageEnabledForInternet"
|
||||
var:checked="isVacationMessageEnabledForInternet"
|
||||
disabled="YES"
|
||||
/> <var:string label:value="Internet" />
|
||||
<input type="checkbox"
|
||||
var:selection="isVacationMessageEnabledForIntranet"
|
||||
var:checked="isVacationMessageEnabledForIntranet"
|
||||
disabled="YES"
|
||||
/> <var:string label:value="Intranet" />
|
||||
<input type="submit"
|
||||
value="SaveInternetAccessState"
|
||||
name="saveInternetAccessState:method"
|
||||
style="display: none;"
|
||||
/>
|
||||
</p>
|
||||
<p>
|
||||
<var:component className="UIxCalScheduleOverview"
|
||||
clientObject="calendarFolder"
|
||||
/>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="wincontent">
|
||||
<table border="0" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#F5F5E9">
|
||||
<td align="left" width="10">
|
||||
<var:entity const:name="nbsp"/>
|
||||
</td>
|
||||
<td align="right">
|
||||
<img border="0"
|
||||
alt=""
|
||||
rsrc:src="corner_right.gif"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" bgcolor="#F5F5E9">
|
||||
<table border="0" width="100%" cellpadding="10" cellspacing="0">
|
||||
<tr/>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</var:if>
|
||||
</var:component>
|
||||
@@ -0,0 +1,5 @@
|
||||
# Version file
|
||||
|
||||
SUBMINOR_VERSION:=2
|
||||
|
||||
# v0.9.1 requires Main v0.9.59
|
||||
@@ -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: common.h 91 2004-06-30 07:48:53Z helge $
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY
|
||||
# include <NGExtensions/NGObjectMacros.h>
|
||||
# include <NGExtensions/NSString+Ext.h>
|
||||
#endif
|
||||
|
||||
#include <NGExtensions/NGExtensions.h>
|
||||
#include <NGObjWeb/NGObjWeb.h>
|
||||
#include <NGObjWeb/SoObjects.h>
|
||||
|
||||
#include <GDLAccess/GDLAccess.h>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
requires = ( MAIN );
|
||||
|
||||
publicResources = (
|
||||
);
|
||||
|
||||
categories = {
|
||||
SOGo = { // TODO: move decls to class
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
classes = {
|
||||
SOGoRootPage = {
|
||||
superclass = "SoComponent";
|
||||
protectedBy = "View";
|
||||
defaultRoles = {
|
||||
"View" = "Authenticated";
|
||||
};
|
||||
};
|
||||
|
||||
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 = {
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user