]> err.no Git - scalable-opengroupware.org/commitdiff
work on Sieve client
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 3 Dec 2004 21:42:40 +0000 (21:42 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 3 Dec 2004 21:42:40 +0000 (21:42 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@460 d1b88da0-ebda-0310-925b-ed51d893ca5b

12 files changed:
SOGo/SoObjects/SOGo/SOGoObject.h
SOGo/SoObjects/Sieve/ChangeLog
SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h
SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m
SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.h
SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m
SOGo/SoObjects/Sieve/Version
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxFilterList.m
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/mailer.js
SOGo/UI/Mailer/product.plist

index b072828f81eb0af09d092133de43b56216da7895..c792d609e3e39c98fd88839df1a36663e67ea55f 100644 (file)
 
 #import <Foundation/NSObject.h>
 
+/*
+  SOGoObject
+  
+  This is the abstract class used by all SOGo SoObjects. It contains the
+  ability to track a container as well as the key the object was invoked with.
+  
+  In addition it provides some generic methods like user or group folder
+  lookup.
+*/
+
 @class NSString, NSArray, NSMutableString, NSException;
 @class OCSFolderManager, OCSFolder;
 @class SOGoUserFolder, SOGoGroupsFolder;
index 97db7522cc9406cef3d680e0988a5d38355cdfd0..366cc880e88fbd122efbdc1d9aa4f81b7f876613 100644 (file)
@@ -1,12 +1,15 @@
 2004-12-03  Helge Hess  <helge.hess@skyrix.com>
-
+       
+       * SOGoSieveScriptObject.m, SOGoSieveScriptsFolder.m: added script
+         activation action (v0.9.4)
+       
        * v0.9.3
        
        * SOGoSieveScriptObject.m: added ability to fetch content
        
        * SOGoSieveScriptsFolder.m: added ability to lookup/construct
          SOGoSieveScriptObject's
-
+       
 2004-11-28  Helge Hess  <helge.hess@skyrix.com>
        
        * added list capability, does not work with 'dotted' logins? (v0.9.2)
index 7f8fcf8f575d807dbcceb79b7d3dc86e16a72412..8d6f2dd23ae19cfd9a62d93ad6d1b1d69c0468be 100644 (file)
@@ -37,7 +37,6 @@
 {
 }
 
-
 @end
 
 #endif /* __Sieve_SOGoSieveScriptObject_H__ */
index 07f9e70d596cede54670f2d6e8807612896f7944..bb8bbbdc111dc44dc8cc3dd9878240428a519280 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "SOGoSieveScriptObject.h"
+#include "SOGoSieveScriptsFolder.h"
 #include "common.h"
 #include <NGImap4/NGSieveClient.h>
 
   return [[self contentAsString] dataUsingEncoding:NSUTF8StringEncoding];
 }
 
+/* operations */
+
+- (NSException *)delete {
+  NSDictionary *res;
+  NSString *r;
+  
+  res = [[self sieveClient] deleteScript:[self nameInContainer]];
+  if ([[res valueForKey:@"result"] boolValue])
+    return nil;
+  
+  // TODO: make it a debug log
+  [self logWithFormat:@"sieve delete failed: %@", res];
+  
+  r = [@"Sieve delete failed: " stringByAppendingString:[res description]];
+  return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+                     reason:r];
+}
+
+- (NSException *)activate {
+  return [[self container] activateScript:[self nameInContainer]];
+}
+
 /* name lookup */
 
 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
@@ -58,4 +81,6 @@
   return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
 }
 
+/* WebDAV */
+
 @end /* SOGoSieveScriptObject */
index acaf78fecfb1d9651c76f812210c39012f034496..c711f3629102fee4d38782234013d02e39d8f2f3 100644 (file)
   server.
 */
 
-@class NSDictionary;
+@class NSString, NSException, NSDictionary;
 
 @interface SOGoSieveScriptsFolder : SOGoSieveBaseObject
 {
   NSDictionary *listedScripts;
 }
 
+/* operations */
+
+- (NSException *)activateScript:(NSString *)_name;
 
 @end
 
index 4c14d81257f69d2c8af1dc4e425d00b1e417c78a..37f8c25a5ec5839b64213dd72b42d48e2c4364b1 100644 (file)
   return [[self fetchScripts] allKeys];
 }
 
+/* operations */
+
+- (NSException *)activateScript:(NSString *)_name {
+  NSDictionary *res;
+  NSString *r;
+  
+  res = [[self sieveClient] setActiveScript:_name];
+  if ([[res valueForKey:@"result"] boolValue])
+    return nil;
+
+  // TODO: make it a debug log
+  [self logWithFormat:@"sieve activate failed: %@", res];
+  
+  r = [@"Script activation failed: " 
+       stringByAppendingString:[res description]];
+  return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+                     reason:r];
+}
+
 /* name lookup */
 
 - (NSString *)lookupScript:(NSString *)_key inContext:(id)_ctx {
index 9ccde9779bba7e3129968cdc26f1470723dbf30d..60cc37e507c360a94653ae0659ba641958c82430 100644 (file)
@@ -1,5 +1,5 @@
 # Version file
 
-SUBMINOR_VERSION:=3
+SUBMINOR_VERSION:=4
 
 # v0.9.1 requires libNGMime v4.3.194
index eaa3de02f5c1e370d339f84e131d9dd35819459d..31195dd32efe757b67257447319cf142eff76a8e 100644 (file)
@@ -1,5 +1,9 @@
 2004-12-03  Helge Hess  <helge.hess@skyrix.com>
 
+       * v0.9.69
+
+       * UIxFilterList.m: added support for script creation
+
        * v0.9.68
        
        * UIxFilterList.m: added ability to trigger new editor
index bebe2fc19b1c83c4c8201ad2d27ef1846ee8da1f..d6d99966bd857ecce9b1132f70af4e03b5aec538 100644 (file)
@@ -69,6 +69,8 @@
   return self->filters;
 }
 
+/* JavaScript code */
+
 - (NSString *)clickedFilterJS {
   /* return 'false' aborts processing */
   return [NSString stringWithFormat:
                     [self filter]];
 }
 
+/* creating scripts */
+
+- (NSString *)newScriptName {
+  NSCalendarDate *now;
+  
+  now = [NSCalendarDate date];
+  return [NSString stringWithFormat:@"MyFilter-%04d%02d%02d-%02d%02d%02d",
+                  [now yearOfCommonEra], [now monthOfYear], 
+                  [now dayOfMonth],
+                  [now hourOfDay], [now minuteOfHour], [now secondOfMinute]];
+}
+
 /* actions */
 
 - (id)defaultAction {
-  // TODO: remove log
-  [self logWithFormat:@"default action ..."];
-  
-  [self logWithFormat:@"should fetch scripts in: %@", [self clientObject]];
+  [self debugWithFormat:@"fetch scripts in: %@", [self clientObject]];
   self->filters = [[[self clientObject] toOneRelationshipKeys] copy];
-  
   return self;
 }
 
+- (id)createAction {
+  NSString *newURL;
+  
+  newURL = [[self clientObject] baseURLInContext:[self context]];
+  if (![newURL hasSuffix:@"/"]) newURL = [newURL stringByAppendingString:@"/"];
+  newURL = [newURL stringByAppendingString:[self newScriptName]];
+  newURL = [newURL stringByAppendingString:@"/edit"];
+  
+  return [self redirectToLocation:newURL];
+}
+
 @end /* UIxFilterList */
index e1edb0f7efe596a3ca941c6ee0cacaad6680c682..8bbbec8f5d26e8882816797423c0950b1ccb362f 100644 (file)
@@ -1,7 +1,8 @@
 # version file
 
-SUBMINOR_VERSION:=68
+SUBMINOR_VERSION:=69
 
+# v0.9.69 requires libNGMime   v4.5.203
 # v0.9.50 requires libNGMime   v4.3.190
 # v0.9.43 requires libNGObjWeb v4.3.73
 # v0.9.42 requires libNGObjWeb v4.3.72
index bd970ce52e306ddce7484b45914bf4eda04d9bb0..8b6d9e50c8fa46fc47fe91e6a77e6934ffa1c495 100644 (file)
@@ -129,3 +129,13 @@ function clickedFilter(sender, scriptname) {
              "location=0,directories=0,status=0,menubar=0,copyhistory=0")
   return true;
 }
+
+function clickedNewFilter(sender) {
+  var urlstr;
+  
+  urlstr = "create";
+  window.open(urlstr, "SOGo_filter",
+             "width=680,height=480,resizable=1,scrollbars=1,toolbar=0," +
+             "location=0,directories=0,status=0,menubar=0,copyhistory=0");
+  return false; /* stop following the link */
+}
index 64e63db1a6ee2fba880dff78eb838823da5ed8c6..7eb6a814e8b63f92fb8cd39fcb9a077ef996fd7b 100644 (file)
               },
               {
                 link     = "#"; // "compose"; // target = "_blank";
-                onclick  = "clickedNewFilter(this);return false;";
+                onclick  = "clickedNewFilter(this); return false";
                 cssClass = "tbicon_compose"; label = "New Filter";
               },
             ),
           protectedBy = "View";
           pageName    = "UIxFilterList"; 
         };
+        create = {
+          protectedBy = "View";
+          pageName    = "UIxFilterList"; 
+          actionName  = "create";
+        };
       };
     };