]> err.no Git - scalable-opengroupware.org/commitdiff
work on sieve support
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 3 Dec 2004 20:41:45 +0000 (20:41 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 3 Dec 2004 20:41:45 +0000 (20:41 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@459 d1b88da0-ebda-0310-925b-ed51d893ca5b

12 files changed:
SOGo/SoObjects/Sieve/ChangeLog
SOGo/SoObjects/Sieve/SOGoSieveScriptObject.m
SOGo/SoObjects/Sieve/SOGoSieveScriptsFolder.m
SOGo/SoObjects/Sieve/Version
SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/GNUmakefile
SOGo/UI/Mailer/UIxFilterList.m
SOGo/UI/Mailer/UIxSieveEditor.m [new file with mode: 0644]
SOGo/UI/Mailer/UIxSieveEditor.wox [new file with mode: 0644]
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/mailer.js
SOGo/UI/Mailer/product.plist

index cb375fee6fa188b0cc0f309ca5a0047eca15a94a..97db7522cc9406cef3d680e0988a5d38355cdfd0 100644 (file)
@@ -1,3 +1,12 @@
+2004-12-03  Helge Hess  <helge.hess@skyrix.com>
+
+       * 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 301d79b7a8b35a384db857c973bd1c1f744e6b19..07f9e70d596cede54670f2d6e8807612896f7944 100644 (file)
 
 #include "SOGoSieveScriptObject.h"
 #include "common.h"
+#include <NGImap4/NGSieveClient.h>
 
 @implementation SOGoSieveScriptObject
 
+/* script */
+
+- (NSString *)fetchScript {
+  NGSieveClient *client;
+  
+  if ((client = [self sieveClient]) == nil)
+    return nil;
+  
+  return [client getScript:[self nameInContainer]];
+}
+
+/* content */
+
+- (NSString *)contentAsString {
+  return [self fetchScript];
+}
+- (NSData *)content {
+  return [[self contentAsString] dataUsingEncoding:NSUTF8StringEncoding];
+}
+
+/* name lookup */
+
+- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+  id obj;
+  
+  /* first check attributes directly bound to the object */
+  if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
+    return obj;
+  
+  /* return 404 to stop acquisition */
+  return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
+}
+
 @end /* SOGoSieveScriptObject */
index c8287516092c010616fe73e7c17b311457ce1a25..4c14d81257f69d2c8af1dc4e425d00b1e417c78a 100644 (file)
   return [[self fetchScripts] allKeys];
 }
 
+/* name lookup */
+
+- (NSString *)lookupScript:(NSString *)_key inContext:(id)_ctx {
+  Class clazz;
+  
+  clazz = NSClassFromString(@"SOGoSieveScriptObject");
+  return [[[clazz alloc] initWithName:_key inContainer:self] autorelease];
+}
+
+- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+  id obj;
+  
+  /* first check attributes directly bound to the object */
+  if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
+    return obj;
+  
+  /* lookup script */
+  if ((obj = [self lookupScript:_key inContext:_ctx]))
+    return obj;
+  
+  /* return 404 to stop acquisition */
+  return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
+}
+
 @end /* SOGoSieveScriptsFolder */
index 4ba9ab796af585b2331d4aec58e7d77c370f40f1..9ccde9779bba7e3129968cdc26f1470723dbf30d 100644 (file)
@@ -1,5 +1,5 @@
 # Version file
 
-SUBMINOR_VERSION:=2
+SUBMINOR_VERSION:=3
 
 # v0.9.1 requires libNGMime v4.3.194
index a6cca0fea9c0d580567b1282548065a3173e2c17..eaa3de02f5c1e370d339f84e131d9dd35819459d 100644 (file)
@@ -1,7 +1,13 @@
 2004-12-03  Helge Hess  <helge.hess@skyrix.com>
 
+       * v0.9.68
+       
+       * UIxFilterList.m: added ability to trigger new editor
+       
+       * started UIxSieveEditor
+       
        * UIxFilterList.wox: minor fix to table layout (v0.9.67)
-
+       
 2004-11-28  Helge Hess  <helge.hess@skyrix.com>
 
        * UIxFilterList.m: use toOneRelationshipKeys to retrieve the filters
index cbeac454bb6916c689b6cab4b6eb4255b741db84..0fd99b7369c629aa16b539411a811b39d1e8c623 100644 (file)
@@ -42,6 +42,7 @@ MailerUI_OBJC_FILES += \
        UIxMailPartAlternativeViewer.m  \
        \
        UIxFilterList.m                 \
+       UIxSieveEditor.m                \
 
 MailerUI_RESOURCE_FILES += \
        Version                 \
@@ -70,6 +71,7 @@ MailerUI_RESOURCE_FILES += \
        UIxMailPartAlternativeViewer.wox\
        \
        UIxFilterList.wox               \
+       UIxSieveEditor.wox              \
 
 MailerUI_RESOURCE_FILES += \
        uix.css                 \
index 958777b8cf84e9f00e6a8f7c3a264e0fbc0fa527..bebe2fc19b1c83c4c8201ad2d27ef1846ee8da1f 100644 (file)
   return self->filters;
 }
 
+- (NSString *)clickedFilterJS {
+  /* return 'false' aborts processing */
+  return [NSString stringWithFormat:
+                    @"clickedFilter(this, '%@'); return false", 
+                    [self filter]];
+}
+
 /* actions */
 
 - (id)defaultAction {
diff --git a/SOGo/UI/Mailer/UIxSieveEditor.m b/SOGo/UI/Mailer/UIxSieveEditor.m
new file mode 100644 (file)
index 0000000..7a25bde
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+  Copyright (C) 2004 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#include <SOGoUI/UIxComponent.h>
+
+/*
+  UIxSieveEditor
+  
+  An editor component which works on SOGoSieveScriptObject's.
+*/
+
+@class NSArray, NSString;
+
+@interface UIxSieveEditor : UIxComponent
+{
+  NSString *scriptName;
+  NSString *scriptText;
+}
+
+@end
+
+#include <SOGo/SoObjects/Sieve/SOGoSieveScriptObject.h>
+#include "common.h"
+
+@implementation UIxSieveEditor
+
+- (void)dealloc {
+  [self->scriptText release];
+  [self->scriptName release];
+  [super dealloc];
+}
+
+/* accessors */
+
+- (void)setScriptName:(NSString *)_value {
+  ASSIGNCOPY(self->scriptName, _value);
+}
+- (NSString *)scriptName {
+  return self->scriptName ? self->scriptName : @"";
+}
+
+- (void)setScriptText:(NSString *)_value {
+  ASSIGNCOPY(self->scriptText, _value);
+}
+- (NSString *)scriptText {
+  return [self->scriptText isNotNull] ? self->scriptText : @"";
+}
+
+/* requests */
+
+- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c {
+  return YES;
+}
+
+/* actions */
+
+- (id)defaultAction {
+  return [self redirectToLocation:@"edit"];
+}
+
+- (id)editAction {
+  [self logWithFormat:@"edit action, load content from: %@",
+         [self clientObject]];
+  
+  [self setScriptName:[[self clientObject] nameInContainer]];
+  [self setScriptText:[[self clientObject] contentAsString]];
+  
+  return self;
+}
+
+- (id)saveAction {
+  [self logWithFormat:@"TODO: should save script!"];
+  return self;
+}
+
+- (id)deleteAction {
+  NSException *error;
+  
+  if ((error = [[self clientObject] delete]) != nil)
+    return error;
+  
+  return nil;
+}
+
+@end /* UIxSieveEditor */
diff --git a/SOGo/UI/Mailer/UIxSieveEditor.wox b/SOGo/UI/Mailer/UIxSieveEditor.wox
new file mode 100644 (file)
index 0000000..34b7099
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version='1.0' standalone='yes'?>
+<var:component
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:var="http://www.skyrix.com/od/binding"
+  xmlns:const="http://www.skyrix.com/od/constant"
+  xmlns:uix="OGo:uix"
+  xmlns:rsrc="OGo:url"
+  xmlns:label="OGo:label"
+  className="UIxMailMainFrame"
+  title="name"
+  const:hideFolderTree="1"
+>
+ <div id="compose_panel">
+  <div id="compose_subject">
+    <table border="0" width="100%">
+      <tr>
+        <td class="compose_label" width="15%">
+          <!-- TODO: localize -->
+          Scriptname:
+        </td>
+        <td width="85%"><input name="scriptName" 
+                               id="compose_subject_input" type="text" 
+                              var:value="scriptName" /></td>
+      </tr>
+    </table>
+  </div>
+
+  <!-- separator line -->
+  <div id="compose_text">
+    <textarea name="scriptContent" var:value="scriptText" />
+  </div>
+ </div>
+</var:component>
index 79f209d1478ee2589d15a93b45622ce2d00c8b3f..e1edb0f7efe596a3ca941c6ee0cacaad6680c682 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=67
+SUBMINOR_VERSION:=68
 
 # v0.9.50 requires libNGMime   v4.3.190
 # v0.9.43 requires libNGObjWeb v4.3.73
index 8c6f1166cb60e3e98c385593f13dccc2e2c9517c..bd970ce52e306ddce7484b45914bf4eda04d9bb0 100644 (file)
@@ -117,3 +117,15 @@ function openAddressbook(sender) {
                       "scrollbars=yes,directories=no,status=no");
   w.focus();
 }
+
+/* filters */
+
+function clickedFilter(sender, scriptname) {
+  var urlstr;
+  
+  urlstr = scriptname + "/edit";
+  window.open(urlstr, "SOGo_filter_" + scriptname,
+             "width=640,height=480,resizable=1,scrollbars=1,toolbar=0," +
+             "location=0,directories=0,status=0,menubar=0,copyhistory=0")
+  return true;
+}
index cc97dcbb0af3765933b6d5c3c8395f8c10410152..64e63db1a6ee2fba880dff78eb838823da5ed8c6 100644 (file)
         };
       };
     };
+
     SOGoSieveScriptObject = {
+      slots = {
+        toolbar = {
+          protectedBy = "View";
+          value = ( /* the toolbar groups */
+            ( /* first group */
+              { link  = "#"; 
+                onclick  = "clickedEditorSave(this);return false;";
+                cssClass = "tbicon_save"; label = "Save"; },
+              { link = "#"; 
+                onclick  = "clickedEditorDelete(this);return false;";
+                cssClass = "tbicon_delete"; label = "Delete"; },
+            )
+          );
+        };
+      };
+      methods = {
+        edit = {
+          protectedBy = "View";
+          pageName    = "UIxSieveEditor"; 
+          actionName  = "edit";
+        };
+        save = {
+          protectedBy = "View";
+          pageName    = "UIxSieveEditor"; 
+          actionName  = "save";
+        };
+        delete = {
+          protectedBy = "View";
+          pageName    = "UIxSieveEditor"; 
+          actionName  = "delete";
+        };
+      };
     };
   };
 }