]> err.no Git - scalable-opengroupware.org/commitdiff
implemented basic Sieve script upload
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 30 Jan 2005 20:24:10 +0000 (20:24 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Sun, 30 Jan 2005 20:24:10 +0000 (20:24 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@509 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Sieve/ChangeLog
SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m
SOGo/SoObjects/Sieve/Version
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxMailEditor.m
SOGo/UI/Mailer/UIxMailToSelection.wox
SOGo/UI/Mailer/UIxSieveEditor.m
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/mailer.js
SOGo/UI/Mailer/product.plist

index 2706045fa71e564c2b52a240a9a427f70030db86..0684990f3b90597aa40c072c0e43ed57d980e5e6 100644 (file)
@@ -1,5 +1,7 @@
 2005-01-30  Helge Hess  <helge.hess@opengroupware.org>
 
+       * SOGoSieveScriptObject.m: implemented Sieve script upload (v0.9.6)
+
        * some work on script upload (v0.9.5)
 
 2004-12-03  Helge Hess  <helge.hess@skyrix.com>
index 37ad358bc30db05d7d1c567f80664ccda3ea3d1a..eebc5df9a1abe391466e3d7d3d6d36e9ce2149b1 100644 (file)
   return [[self contentAsString] dataUsingEncoding:NSUTF8StringEncoding];
 }
 
+- (NSException *)exceptionForFailedPutResult:(NSDictionary *)_result {
+  NSString *reason;
+  
+  /* Note: valueForKey:@"reason" does not work?! */
+  reason = [[_result valueForKey:@"RawResponse"] objectForKey:@"reason"];
+  [self logWithFormat:@"REASON: %@", reason];
+  if (![reason isNotNull])
+    reason = @"Failed to upload Sieve script.";
+  
+  return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+                     reason:reason];
+}
+
 - (NSException *)writeContent:(id)_content {
+  NGSieveClient *client;
+  NSDictionary  *result;
+  
   if (_content == nil) {
     return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
                        reason:@"Missing content to write!"];
   }
   
-  return [NSException exceptionWithHTTPStatus:501 /* Not Implemented */
-                     reason:@"Does not implement script upload yet!"];
+  if ((client = [self sieveClient]) == nil) {
+    return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+                       reason:@"Failed to create NGSieveClient object"];
+  }
+  
+  result = [client putScript:[self nameInContainer] script:_content];
+  if (![[result valueForKey:@"result"] boolValue])
+    return [self exceptionForFailedPutResult:result];
+  
+  return nil; /* everything is great */
 }
 
 /* operations */
 
 - (id)PUTAction:(id)_context {
   NSException *e;
-  NSData *content;
+  NSString *content;
 
-  content = [[_context request] content];
+  content = [[_context request] contentAsString];
   
   if ((e = [self writeContent:content]))
     return e;
index 298ef851be9e4fe2110fc13f5d457bc1767108ba..29dc46309a5dcac1b3cd85e70f110a68044488bb 100644 (file)
@@ -1,5 +1,6 @@
 # Version file
 
-SUBMINOR_VERSION:=5
+SUBMINOR_VERSION:=6
 
+# v0.9.6 requires libNGMime v4.5.207
 # v0.9.1 requires libNGMime v4.3.194
index 5559e5efa08e927408f7351864f7bd3e390b7afc..04b698ecc426de6ff049b1269a6c4a3da4443492 100644 (file)
@@ -1,4 +1,11 @@
 2005-01-30  Helge Hess  <helge.hess@opengroupware.org>
+       
+       * v0.9.81
+       
+       * UIxSieveEditor.m: call proper save method in Sieve SoObject
+       
+       * UIxMailEditor.m: added 'SOGoMailEditorKeepTmpFile' default to debug
+         MIME generation
 
        * v0.9.80
 
index 627052d2038df7b4af33049ceaaf7bf525a7ecd0..b79884a981f97deb23861b7294b78e0ccdb14d89 100644 (file)
@@ -59,11 +59,14 @@ static BOOL keepMailTmpFile    = NO;
 static NSArray *infoKeys = nil;
 
 + (void)initialize {
+  NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+  
   infoKeys = [[NSArray alloc] initWithObjects:
                                @"subject", @"text", @"to", @"cc", @"bcc", 
                                @"from", @"replyTo",
                              nil];
   
+  keepMailTmpFile = [ud boolForKey:@"SOGoMailEditorKeepTmpFile"];
   if (keepMailTmpFile)
     NSLog(@"WARNING: keeping mail files.");
 }
@@ -242,6 +245,8 @@ static NSArray *infoKeys = nil;
   NSException *error;
   NSString *mailPath;
   
+  // TODO: need to validate whether we have a To etc
+  
   /* first, save form data */
   
   if (![self _saveFormInfo])
index a74d881e57c74fd02f7c381105a044ab71aeebf1..92d2bd34d3098441e7affebb0a0794279d219c57 100644 (file)
@@ -10,7 +10,7 @@
   <script language="JavaScript"> <!-- TODO: use a resource -->
     <var:string value="jsCode" const:escapeHTML="NO" />
   </script>
-  
+
   <table id="addr_table" style="width: 100%;">
     <var:foreach list="addressLists" item="addressList">
       <var:foreach list="addressList" item="address">
     </var:foreach>
     <tr id="row_last">
       <td width="20%">
+        <!-- todo: use stylesheet? -->
         <select style="width: 100%;" disabled="1">
           <option value="to" ><var:string label:value="to" />:</option>
         </select>
       </td>
       <td width="80%">
-        <input onfocus="fancyAddRow(true,'');" type="text" style="width: 100%;" />
+        <!-- todo: use stylesheet? -->
+        <input onfocus="fancyAddRow(true,'');" type="text" 
+               style="width: 100%;" />
       </td>
     </tr>
   </table>
index 1046401d657393650db0339b6811914911ca118d..a9dd7021af4c047cec51fb95036486c0c7743cea 100644 (file)
 }
 
 - (id)saveAction {
-  [self logWithFormat:@"TODO: should save script!"];
+  NSException *error;
+  NSString *text;
+  
+  text = [self scriptText];
+  if ((error = [[self clientObject] writeContent:text]) != nil)
+    return error;
+  
   return self;
 }
 
index cbd97192a091f6cf9adc80e018eef8d6a505d820..e846368e81f44c2d315cc7779349cd3920f14010 100644 (file)
@@ -1,7 +1,8 @@
 # version file
 
-SUBMINOR_VERSION:=80
+SUBMINOR_VERSION:=81
 
+# v0.9.81 requires SoObjects/Sieve  v0.9.5
 # v0.9.80 requires SoObjects/Mailer v0.9.59
 # v0.9.78 requires SoObjects/Mailer v0.9.58
 # v0.9.77 requires SoObjects/Mailer v0.9.57
index 8b6d9e50c8fa46fc47fe91e6a77e6934ffa1c495..2927ffc2481558b7d9fcd2801544d2b5c29ff5a0 100644 (file)
@@ -64,6 +64,8 @@ function validateEditorInput(sender) {
 function clickedEditorSend(sender) {
   if (!validateEditorInput(sender))
     return false;
+
+  // TODO: validate whether we have a recipient! (#1220)
   
   document.pageform.action="send";
   document.pageform.submit();
index c35e679d9ae7feb14d9ca823332de462c5d75151..c9508f414a75f23ebe600aae382e5d34bb1dec9b 100644 (file)
               { link  = "compose"; target = "_blank";
                 cssClass = "tbicon_compose"; label = "Write"; },
             ),
-/* TODO: enable when implemented
+//* TODO: enable when implemented
             ( // second group
               { link = "reply"; 
                 cssClass = "tbicon_reply";    label = "Reply";     },
               { link = "forward"; 
                 cssClass = "tbicon_forward";  label = "Forward";   },
             ),
-*/
+//*/
             ( // third group
               { link = "delete"; 
                 cssClass = "tbicon_delete"; label = "Delete"; },