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>
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;
# Version file
-SUBMINOR_VERSION:=5
+SUBMINOR_VERSION:=6
+# v0.9.6 requires libNGMime v4.5.207
# v0.9.1 requires libNGMime v4.3.194
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
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.");
}
NSException *error;
NSString *mailPath;
+ // TODO: need to validate whether we have a To etc
+
/* first, save form data */
if (![self _saveFormInfo])
<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>
}
- (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;
}
# 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
function clickedEditorSend(sender) {
if (!validateEditorInput(sender))
return false;
+
+ // TODO: validate whether we have a recipient! (#1220)
document.pageform.action="send";
document.pageform.submit();
{ 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"; },