Defaults write sogod NGBundlePath '"$HOME/Library/SOGo"'
=> otherwise some bundles will clash with "fat" OGo
=> the UIx .wox driver must be found
+
+Defaults
+========
+
+ SOGoCrashOnSessionCreate - bool - crash the server is a session is created
@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 */
return resp;
}
+/* session management */
+
+- (WOSession *)createSessionForRequest:(WORequest *)_request {
+ [self logWithFormat:@"WARNING: session creation requested!"];
+ if (doCrashOnSessionCreate)
+ abort();
+ return [super createSessionForRequest:_request];
+}
+
@end /* SOGo */
--- /dev/null
+2004-07-01 Helge Hess <helge.hess@opengroupware.org>
+
+ * redirect to weekoverview if GET is run on the folder itself
+
+ * created ChangeLog
+
@implementation SOGoAppointmentFolder
+static BOOL debugOn = NO;
+
+ (NSString *)globallyUniqueObjectId {
/*
4C08AE1A-A808-11D8-AC5A-000393BBAFF6
}
records = [self fixupRecords:records];
- [self logWithFormat:@"fetched %i records: %@", [records count], records];
+ if (debugOn)
+ [self logWithFormat:@"fetched %i records: %@", [records count], records];
return records;
}
#include <SOGo/SOGoObject.h>
-@class NSString;
+@class NSString, NSException;
@interface SOGoContentObject : SOGoObject
{
/* content */
- (NSString *)contentAsString;
+- (NSException *)saveContentString:(NSString *)_str;
@end
return self->content;
}
+- (NSException *)saveContentString:(NSString *)_str {
+ OCSFolder *folder;
+ NSException *ex;
+
+ if ((folder = [self ocsFolder]) == nil) {
+ [self logWithFormat:@"did not find folder of appointment."];
+ return nil;
+ }
+
+ if ((ex = [folder writeContent:_str toName:[self nameInContainer]])) {
+ [self logWithFormat:@"write failed: %@", ex];
+ return ex;
+ }
+
+ return nil;
+}
+
/* description */
- (void)appendAttributesToDescription:(NSMutableString *)_ms {
+2004-07-01 Helge Hess <helge.hess@opengroupware.org>
+
+ * UIxTabView.m: removed JavaScript and the involved access of -session
+
2004-06-30 Helge Hess <helge.hess@opengroupware.org>
* product.plist: make categories on SOGoObject instead of SxFolder
isActive:(BOOL)_isActive isLeft:(BOOL)_isLeft
doScript:(BOOL)_doScript keys:(NSArray *)_keys
{
- NSString *headUri = nil;
- NSString *label = nil;
- NSString *scriptHref = nil;
- NSString *styleName = nil;
-
+ NSString *headUri = nil;
+ NSString *label = nil;
+ NSString *styleName = nil;
WEClientCapabilities *ccaps;
WOComponent *comp;
[_response appendContentString:@"<a href=\""];
- if (_doScript && (_info->isScript || _isActive)) {
- scriptHref =
- [self scriptHref:_info inContext:_ctx isLeft:_isLeft keys:_keys];
- [_response appendContentHTMLAttributeValue:scriptHref];
- }
- else {
- [_response appendContentHTMLAttributeValue:headUri];
- }
+ [_response appendContentHTMLAttributeValue:headUri];
[_response appendContentString:@"\" "];
[_response appendContentString:
[_response appendContentString:@"</a>"];
[_response appendContentString:@"</td>"];
-
-#if 0
- if (_doScript && (_info->isScript || _isActive)) {
- NSString *k; // key
- NSString *s; // selected tab icon
- NSString *u; // unselected tab icon
- //NSString *out;
-
- k = _info->key;
- s = _info->selIcon; // selectedTabIcon
- u = (_isLeft) ? _info->leftIcon : _info->tabIcon;
-
- s = WEUriOfResource(s, _ctx);
- u = WEUriOfResource(u, _ctx);
-
- s = ([s length] < 1) ? imgUri : s;
- u = ([u length] < 1) ? imgUri : u;
-
-#if 0
- out = [NSString alloc];
- out = [out initWithFormat:
- @"<script language=\"JavaScript\">\n"
- @"<!--\n"
- @"var %@Tab = new Array();\n"
- @"%@Tab[\"link\"] = %@TabLink;\n"
- @"%@Tab[\"href1\"] = \"%@\";\n"
- @"%@Tab[\"href2\"] = \"%@\";\n"
- @"%@Tab[\"Img\"] = window.document.%@TabImg;\n"
- @"%@Tab[\"Ar\"] = new Array();\n"
- @"%@Tab[\"Ar\"][0] = new Image();\n"
- @"%@Tab[\"Ar\"][0].src = \"%@\";\n"
- @"%@Tab[\"Ar\"][1] = new Image();\n"
- @"%@Tab[\"Ar\"][1].src = \"%@\";\n"
- @"//-->\n</script>",
- k, k, k, k, scriptHref, k, headUri,
- k, k, k, k,
- k, u, k, k, s
- ];
-
- [_response appendContentString:out];
- RELEASE(out);
-#else
-# define _appendStr_(_str_) [_response appendContentString:_str_]
- _appendStr_(@"<script language=\"JavaScript\">\n<!--\nvar ");
- _appendStr_(k); _appendStr_(@"Tab = new Array();\n");
-
- _appendStr_(k); _appendStr_(@"Tab[\"link\"] = ");
- _appendStr_(k); _appendStr_(@"TabLink;\n"); // linkName
-
- _appendStr_(k); _appendStr_(@"Tab[\"href1\"] = \"");
- _appendStr_(scriptHref); _appendStr_(@"\";\n"); // scriptHref
-
- _appendStr_(k); _appendStr_(@"Tab[\"href2\"] = \"");
- _appendStr_(_info->uri); _appendStr_(@"\";\n"); // actionHref
-
- _appendStr_(k); _appendStr_(@"Tab[\"Img\"] = window.document.");
- _appendStr_(k); _appendStr_(@"TabImg;\n");
- _appendStr_(k); _appendStr_(@"Tab[\"Ar\"] = new Array();\n");
- _appendStr_(k); _appendStr_(@"Tab[\"Ar\"][0] = new Image();\n");
- _appendStr_(k); _appendStr_(@"Tab[\"Ar\"][0].src = \"");
- _appendStr_(u); _appendStr_(@"\";\n"); // unselected img
- _appendStr_(k); _appendStr_(@"Tab[\"Ar\"][1] = new Image();\n");
- _appendStr_(k); _appendStr_(@"Tab[\"Ar\"][1].src = \"");
- _appendStr_(s); _appendStr_(@"\";\n"); // selected img
- _appendStr_(@"//-->\n</script>");
-#undef _appendStr_
-#endif
- }
-#endif
}
- (void)appendSubmitButton:(UIxTabItemInfo *)_info
toResponse:_response
inContext:_ctx
isActive:_isActive isLeft:_left
- doScript:_doScript keys:_keys];
+ doScript:NO keys:_keys];
}
- (void)_appendTabViewJSScriptToResponse:(WOResponse *)_response
inContext:_ctx
isActive:isActive
isLeft:(i == 0) ? YES : NO
- doScript:doScript
+ doScript:NO
keys:keys];
}
else {
inContext:_ctx
isActive:isActive
isLeft:(i == 0) ? YES : NO
- doScript:doScript
+ doScript:NO
keys:keys];
}
/* left corner */
[_response appendContentString:@" <td align=\"left\" width=\"10\">"];
- if (doScript) {
- [_response appendContentString:@"<div id=\"tabCorner"];
- [_response appendContentString:[self _tabViewCountInContext:_ctx]];
- [_response appendContentString:@"\" "];
- [_response appendContentString:@"style=\"display: "];
- [_response appendContentString:(isLeftActive) ? @"" : @"none"];
- [_response appendContentString:@";\">"];
- [_response appendContentString:@" "];
- [_response appendContentString:@"</div>"];
- }
- else if (isLeftActive)
+ if (isLeftActive)
[_response appendContentString:@" "];
- if (doScript) {
- [_response appendContentString:@"<div id=\"tabCornerLeft"];
- [_response appendContentString:[self _tabViewCountInContext:_ctx]];
- [_response appendContentString:@"\" "];
- [_response appendContentString:@"style=\"display: "];
- [_response appendContentString:(!isLeftActive) ? @"visible" : @"none"];
- [_response appendContentString:@";\">"];
- }
-
- if (!isLeftActive || doScript) {
+ if (!isLeftActive) {
NSString *uri;
uri = [self->leftCornerIcon stringValueInComponent:[_ctx component]];
if ((uri = WEUriOfResource(uri, _ctx))) {
[_response appendContentString:@"<img border=\"0\" alt=\"\" src=\""];
[_response appendContentString:uri];
- [_response appendContentString:@"\">"];
+ [_response appendContentString:@"\" />"];
}
else
[_response appendContentString:@" "];
}
- if (doScript)
- [_response appendContentString:@"</div>"];
-
- [_response appendContentString:@"</td>\n"];
+
+ [_response appendContentString:@"</td>"];
/* right corner */
[_response appendContentString:@" <td align=\"right\">"];
WOComponent *cmp;
NSString *bgcolor;
BOOL isLeftActive;
- BOOL doScript;
id nestedState;
NSString *activeKey;
NSArray *keys;
int tabViewCount; /* used for image id's and writing script once */
- doScript = NO; /* perform tab-clicks on browser (use javascript) */
tabViewCount = [[_ctx valueForKey:@"UIxTabViewScriptDone"] intValue];
cmp = [_ctx component];
- /* check for browser */
- {
- WEClientCapabilities *ccaps;
- //BOOL isJavaScriptBrowser;
-
- ccaps = [[_ctx request] clientCapabilities];
- doScript = [ccaps isInternetExplorer] && [ccaps isJavaScriptBrowser];
- doScript = (doScript &&
- [[[cmp session]
- valueForKey:@"isJavaScriptEnabled"] boolValue]);
- }
-
- /* disable javascript */
- doScript = NO;
-
/* save state */
nestedState = [self saveNestedStateInContext:_ctx];
if ([self->selection isValueSettable])
[self->selection setValue:activeKey inComponent:[_ctx component]];
}
-
- if (doScript) {
- doScript = [[keys valueForKey:@"isScript"] containsObject:YesNumber];
- [_ctx setObject:[NSNumber numberWithBool:doScript]
- forKey:UIxTabView_SCRIPT];
- }
-
- /* start appending */
- if ((doScript) && (tabViewCount == 0))
- [self _appendTabViewJSScriptToResponse:_response inContext:_ctx];
+ /* start appending */
/* count up for unique tabCorner/tabCornerLeft images */
[_ctx takeValue:[NSNumber numberWithInt:(tabViewCount + 1)]
[self _appendHeaderRowToResponse:_response inContext:_ctx
keys:keys activeKey:activeKey
- doScript:doScript];
+ doScript:NO];
[_ctx deleteLastElementIDComponent]; // 'h' for head
[_ctx removeObjectForKey:UIxTabView_HEAD];
-#if 0
- /* header foot row */
-
- [self _appendHeaderFootRowToResponse:_response inContext:_ctx
- bgcolor:bgcolor
- doScript:doScript
- isLeftActive:isLeftActive];
-#endif
-
/* body row */
[self _appendBodyRowToResponse:_response inContext:_ctx
/* helper */
- (NSString *)uriAsFormat {
- NSString *uri, *qp;
- NSRange r;
+ NSString *uri, *qp;
+ NSRange r;
- uri = [[[self context] request] uri];
+ uri = [[[self context] request] uri];
- /* first: identify query parameters */
- r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
- if (r.length > 0) {
- uri = [uri substringToIndex:r.location];
- qp = [uri substringFromIndex:r.location];
- }
- else {
- qp = nil;
- }
+ /* first: identify query parameters */
+ r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
+ if (r.length > 0) {
+ uri = [uri substringToIndex:r.location];
+ qp = [uri substringFromIndex:r.location];
+ }
+ else
+ qp = nil;
- /* next: strip trailing slash */
- if([uri hasSuffix:@"/"])
- uri = [uri substringToIndex:([uri length] - 1)];
- r = [uri rangeOfString:@"/" options:NSBackwardsSearch];
+ /* next: strip trailing slash */
+ if ([uri hasSuffix:@"/"])
+ uri = [uri substringToIndex:([uri length] - 1)];
+ r = [uri rangeOfString:@"/" options:NSBackwardsSearch];
- /* then: cut of last path component */
- if(r.location == NSNotFound) { // no slash? are we at root?
- uri = @"/";
- }
- else {
- uri = [uri substringToIndex:(r.location + 1)];
- }
- /* next: append format token */
- uri = [uri stringByAppendingString:@"%@"];
- if(qp != nil)
- uri = [uri stringByAppendingString:qp];
- return uri;
+ /* then: cut of last path component */
+ if (r.length == 0) // no slash? are we at root?
+ uri = @"/";
+ else
+ uri = [uri substringToIndex:(r.location + 1)];
+
+ /* next: append format token */
+ uri = [uri stringByAppendingString:@"%@"];
+ if(qp != nil)
+ uri = [uri stringByAppendingString:qp];
+ return uri;
}
method?
*/
objectId = [NSClassFromString(@"SOGoAppointmentFolder")
- globallyUniqueObjectId];
+ globallyUniqueObjectId];
nextMethod = [NSString stringWithFormat:@"%@/edit", objectId];
uriFormat = [self uriAsFormat];
- (id)saveAction {
- SOGoAppointment *apt;
- NSString *iCalString, *summary, *location, *nextMethod, *uri, *uriFormat;
- NSCalendarDate *sd, *ed;
- NSArray *ps;
- unsigned i, count;
- WOResponse *r;
- WORequest *req;
-
- req = [[self context] request];
-
- /* get iCalString from hidden input */
- iCalString = [req formValueForKey:@"ical"];
- apt = [[SOGoAppointment alloc] initWithICalString:iCalString];
-
- /* merge in form values */
- sd = [NSCalendarDate dateWithString:[req formValueForKey:@"startDate"]
- calendarFormat:@"%Y-%m-%d %H:%M"];
- [apt setStartDate:sd];
- ed = [NSCalendarDate dateWithString:[req formValueForKey:@"endDate"]
- calendarFormat:@"%Y-%m-%d %H:%M"];
- [apt setEndDate:ed];
- summary = [req formValueForKey:@"summary"];
- [apt setSummary:summary];
- location = [req formValueForKey:@"location"];
- [apt setLocation:location];
-
- [apt removeAllAttendees]; /* clean up */
- ps = [[req formValueForKey:@"participants"]
- componentsSeparatedByString:@"\n"];
- count = [ps count];
- for(i = 0; i < count; i++) {
- NSString *email;
-
- email = [ps objectAtIndex:i];
- if([email length] > 0) {
- iCalPerson *p;
- NSRange cnr;
-
- p = [[iCalPerson alloc] init];
- [p setEmail:[NSString stringWithFormat:@"mailto:%@", email]];
- /* construct a fake CN */
- cnr = [email rangeOfString:@"@"];
- if(cnr.location != NSNotFound) {
- [p setCn:[email substringToIndex:cnr.location]];
- }
- [apt addToAttendees:p];
- [p release];
- }
- }
-
- /* receive current representation for save operation */
- iCalString = [apt iCalString];
- [apt release];
-
-
- /* determine what's to do and where to go next */
- if([self isNewAppointment]) {
- nextMethod = @"duhduh";
- }
- else {
- nextMethod = @"view";
- }
+ SOGoAppointment *apt;
+ NSString *iCalString;
+ NSString *summary, *location, *nextMethod, *uri, *uriFormat;
+ NSCalendarDate *sd, *ed;
+ NSArray *ps;
+ unsigned i, count;
+ WOResponse *r;
+ WORequest *req;
- NSLog(@"%s new iCalString:\n%@", __PRETTY_FUNCTION__, iCalString);
+ req = [[self context] request];
- uriFormat = [self uriAsFormat];
- uri = [NSString stringWithFormat:uriFormat, nextMethod];
+ /* get iCalString from hidden input */
+ iCalString = [req formValueForKey:@"ical"];
+ apt = [[SOGoAppointment alloc] initWithICalString:iCalString];
+
+ /* merge in form values */
+ sd = [NSCalendarDate dateWithString:[req formValueForKey:@"startDate"]
+ calendarFormat:@"%Y-%m-%d %H:%M"];
+ [apt setStartDate:sd];
+ ed = [NSCalendarDate dateWithString:[req formValueForKey:@"endDate"]
+ calendarFormat:@"%Y-%m-%d %H:%M"];
+ [apt setEndDate:ed];
+ summary = [req formValueForKey:@"summary"];
+ [apt setSummary:summary];
+ location = [req formValueForKey:@"location"];
+ [apt setLocation:location];
+
+ [apt removeAllAttendees]; /* clean up */
+ ps = [[req formValueForKey:@"participants"]
+ componentsSeparatedByString:@"\n"];
+ count = [ps count];
+ for (i = 0; i < count; i++) {
+ NSString *email;
+ iCalPerson *p;
+ NSRange cnr;
+
+ email = [ps objectAtIndex:i];
+ if ([email length] == 0)
+ continue;
+
+ p = [[iCalPerson alloc] init];
+ [p setEmail:[@"mailto:" stringByAppendingString:[email stringValue]]];
+ /* construct a fake CN */
+ cnr = [email rangeOfString:@"@"];
+ if (cnr.length > 0)
+ [p setCn:[email substringToIndex:cnr.location]];
+ [apt addToAttendees:p];
+ [p release];
+ }
+
+ /* receive current representation for save operation */
+ iCalString = [apt iCalString];
+ [apt release]; apt = nil;
+
+ /* determine what's to do and where to go next */
+ if([self isNewAppointment])
+ nextMethod = @"duhduh";
+ else
+ nextMethod = @"view";
+
+#if 0
+ NSLog(@"%s new iCalString:\n%@", __PRETTY_FUNCTION__, iCalString);
+#else
+ {
+ NSException *ex;
+
+ ex = [[self clientObject] saveContentString:iCalString];
+ if (ex) return ex;
+ // TODO: add some error handling in form! (eg like in Zope)
+ }
+#endif
+
+ uriFormat = [self uriAsFormat];
+ uri = [NSString stringWithFormat:uriFormat, nextMethod];
- r = [WOResponse responseWithRequest:req];
- [r setStatus:302 /* moved */];
- [r setHeader:uri forKey:@"location"];
- return r;
+ r = [WOResponse responseWithRequest:req];
+ [r setStatus:302 /* moved */];
+ [r setHeader:uri forKey:@"location"];
+ return r;
}
-@end
+@end /* UIxAppointmentEditor */