]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@135 d1b88da0-ebda-0310-925b-ed51d...
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 1 Jul 2004 22:34:37 +0000 (22:34 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 1 Jul 2004 22:34:37 +0000 (22:34 +0000)
SOGo/Main/README
SOGo/Main/sogod.m
SOGo/SoObjects/Appointments/ChangeLog [new file with mode: 0644]
SOGo/SoObjects/Appointments/SOGoAppointmentFolder.m
SOGo/SoObjects/SOGo/SOGoContentObject.h
SOGo/SoObjects/SOGo/SOGoContentObject.m
SOGo/UI/Common/ChangeLog
SOGo/UI/Common/UIxTabView.m
SOGo/UI/Scheduler/UIxAppointmentEditor.m

index 9d7a9ab6d9aa17224b15b524b21e53b5b6bf1de9..e228602f3ea81e4933f6222e96a31873b9cd9558 100644 (file)
@@ -11,3 +11,8 @@ Setup
   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
index 36f296f4eec9b0141b95f7eb074a121c1b548c21..c1ff3ae824f20a07a7eee54d414f3a08a9e2a565 100644 (file)
 @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 */
     
@@ -172,6 +175,15 @@ static unsigned int vMemSizeLimit = 0;
   return resp;
 }
 
+/* session management */
+
+- (WOSession *)createSessionForRequest:(WORequest *)_request {
+  [self logWithFormat:@"WARNING: session creation requested!"];
+  if (doCrashOnSessionCreate)
+    abort();
+  return [super createSessionForRequest:_request];
+}
+
 @end /* SOGo */
 
 
diff --git a/SOGo/SoObjects/Appointments/ChangeLog b/SOGo/SoObjects/Appointments/ChangeLog
new file mode 100644 (file)
index 0000000..b3888f9
--- /dev/null
@@ -0,0 +1,6 @@
+2004-07-01  Helge Hess  <helge.hess@opengroupware.org>
+       
+       * redirect to weekoverview if GET is run on the folder itself
+       
+       * created ChangeLog
+
index 3013b40be3c5780c8533ffb152a4c0477464fdaf..6019eee564897f1d2a2f174259f546a7c437d477 100644 (file)
@@ -29,6 +29,8 @@
 
 @implementation SOGoAppointmentFolder
 
+static BOOL debugOn = NO;
+
 + (NSString *)globallyUniqueObjectId {
 /*
 4C08AE1A-A808-11D8-AC5A-000393BBAFF6
@@ -174,7 +176,8 @@ printf( "%x", *(int *) &f);
   }
   
   records = [self fixupRecords:records];
-  [self logWithFormat:@"fetched %i records: %@", [records count], records];
+  if (debugOn)
+    [self logWithFormat:@"fetched %i records: %@", [records count], records];
   return records;
 }
 
index c85ee07c6f2549ce232bde244b97dec6b93b18c4..1bb949c07c5c0b441534b34820870f0ca6b3cb04 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <SOGo/SOGoObject.h>
 
-@class NSString;
+@class NSString, NSException;
 
 @interface SOGoContentObject : SOGoObject
 {
@@ -46,6 +46,7 @@
 /* content */
 
 - (NSString *)contentAsString;
+- (NSException *)saveContentString:(NSString *)_str;
 
 @end
 
index b9c3162d7531971797c45894a859b0bc48afef7c..4713650f61d5e49c1892fb2c3824e75f71327065 100644 (file)
   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 {
index 50aaf5911f18a01a9dd39665fe40f9c7434b32aa..3ef4e3b26cbca71b5df2c4df6c0982609676a72d 100644 (file)
@@ -1,3 +1,7 @@
+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
index ac635c3e2269faba89f9d29a7cad82b19961870b..041761e2bda8784e001fbbcd4c23a72a0e42d0d5 100644 (file)
@@ -291,11 +291,9 @@ static NSNumber *YesNumber;
   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;
 
@@ -337,14 +335,7 @@ static NSNumber *YesNumber;
 
   [_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:
@@ -360,75 +351,6 @@ static NSNumber *YesNumber;
   [_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
@@ -441,7 +363,7 @@ static NSNumber *YesNumber;
         toResponse:_response
         inContext:_ctx
         isActive:_isActive isLeft:_left
-        doScript:_doScript   keys:_keys];
+        doScript:NO keys:_keys];
 }
 
 - (void)_appendTabViewJSScriptToResponse:(WOResponse *)_response
@@ -525,7 +447,7 @@ static NSNumber *YesNumber;
             inContext:_ctx
             isActive:isActive
             isLeft:(i == 0) ? YES : NO
-            doScript:doScript
+            doScript:NO
             keys:keys];
     }
     else {
@@ -535,7 +457,7 @@ static NSNumber *YesNumber;
             inContext:_ctx
             isActive:isActive
             isLeft:(i == 0) ? YES : NO
-            doScript:doScript
+            doScript:NO
             keys:keys];
     }
     
@@ -571,44 +493,23 @@ static NSNumber *YesNumber;
   /* 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:@"&nbsp;"];
-    [_response appendContentString:@"</div>"];
-  }
-  else if (isLeftActive)
+  if (isLeftActive)
     [_response appendContentString:@"&nbsp;"];
   
-  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:@"&nbsp;"];
   }
-  if (doScript)
-    [_response appendContentString:@"</div>"];
-
-  [_response appendContentString:@"</td>\n"];
+  
+  [_response appendContentString:@"</td>"];
 
   /* right corner */
   [_response appendContentString:@"    <td align=\"right\">"];
@@ -708,31 +609,14 @@ static NSNumber *YesNumber;
   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];
@@ -760,17 +644,8 @@ static NSNumber *YesNumber;
     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)]
@@ -788,20 +663,11 @@ static NSNumber *YesNumber;
   
   [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
index db63474adf64f36122cf3f959116a1535717c529..0a2bf3095bc52d9005604b2507af6f08283f213c 100644 (file)
 /* 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 */