--- /dev/null
+// $Id$
+
+#include <NGObjWeb/SoComponent.h>
+
+@interface SOGoRootPage : SoComponent
+{
+ NSString *userName;
+}
+
+@end
+
+#include "common.h"
+
+@implementation SOGoRootPage
+
+- (id)initWithContext:(id)_ctx {
+ if ((self = [super initWithContext:_ctx])) {
+ }
+ return self;
+}
+
+- (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];
+}
+
+/* response generation */
+
+- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
+ NSString *rhk;
+
+ 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 */
--- /dev/null
+<?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>
+ </body>
+</html>
"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";
+ };
};
};
};
if ((self = [super init])) {
[[SOGoProductLoader productLoader] loadProducts];
+#if 0 /* enable, if we added the value class */
/* setup some WebDAV type mappings required for Evolution */
[EOQualifier registerValueClass:NSClassFromString(@"dateTime")
forTypeName:@"dateTime"];
[EOQualifier registerValueClass:NSClassFromString(@"dateTime")
forTypeName:@"dateTime.tz"];
+#endif
}
return self;