+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)
#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 */
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 */
# Version file
-SUBMINOR_VERSION:=2
+SUBMINOR_VERSION:=3
# v0.9.1 requires libNGMime v4.3.194
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
UIxMailPartAlternativeViewer.m \
\
UIxFilterList.m \
+ UIxSieveEditor.m \
MailerUI_RESOURCE_FILES += \
Version \
UIxMailPartAlternativeViewer.wox\
\
UIxFilterList.wox \
+ UIxSieveEditor.wox \
MailerUI_RESOURCE_FILES += \
uix.css \
return self->filters;
}
+- (NSString *)clickedFilterJS {
+ /* return 'false' aborts processing */
+ return [NSString stringWithFormat:
+ @"clickedFilter(this, '%@'); return false",
+ [self filter]];
+}
+
/* actions */
- (id)defaultAction {
--- /dev/null
+/*
+ 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 */
--- /dev/null
+<?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>
# version file
-SUBMINOR_VERSION:=67
+SUBMINOR_VERSION:=68
# v0.9.50 requires libNGMime v4.3.190
# v0.9.43 requires libNGObjWeb v4.3.73
"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;
+}
};
};
};
+
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";
+ };
+ };
};
};
}