From 9edc5a9206dedb01391bbd49675615a5871120f4 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 25 Oct 2004 23:04:35 +0000 Subject: [PATCH] added some attach functionality git-svn-id: http://svn.opengroupware.org/SOGo/trunk@423 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/SOGoDraftObject.h | 2 + SOGo/UI/Mailer/ChangeLog | 5 + SOGo/UI/Mailer/GNUmakefile | 2 + SOGo/UI/Mailer/UIxMailEditor.wox | 1 + SOGo/UI/Mailer/UIxMailEditorAttach.m | 141 ++++++++++++++++++++++++ SOGo/UI/Mailer/UIxMailEditorAttach.wox | 58 ++++++++++ SOGo/UI/Mailer/Version | 2 +- SOGo/UI/Mailer/mailer.js | 11 +- SOGo/UI/Mailer/product.plist | 14 ++- 9 files changed, 230 insertions(+), 6 deletions(-) create mode 100644 SOGo/UI/Mailer/UIxMailEditorAttach.m create mode 100644 SOGo/UI/Mailer/UIxMailEditorAttach.wox diff --git a/SOGo/SoObjects/Mailer/SOGoDraftObject.h b/SOGo/SoObjects/Mailer/SOGoDraftObject.h index 6e4cda41..9107366c 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftObject.h +++ b/SOGo/SoObjects/Mailer/SOGoDraftObject.h @@ -47,6 +47,8 @@ - (BOOL)storeInfo:(NSDictionary *)_info; - (NSArray *)fetchAttachmentNames; +- (BOOL)isValidAttachmentName:(NSString *)_name; +- (BOOL)saveAttachment:(NSData *)_attachment withName:(NSString *)_name; @end diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 75de6540..121db387 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,3 +1,8 @@ +2004-10-26 Helge Hess + + * added new UIxMailEditorAttach component to manage draft attachments + (v0.9.46) + 2004-10-25 Helge Hess * v0.9.45 diff --git a/SOGo/UI/Mailer/GNUmakefile b/SOGo/UI/Mailer/GNUmakefile index fe9ba40c..35fce169 100644 --- a/SOGo/UI/Mailer/GNUmakefile +++ b/SOGo/UI/Mailer/GNUmakefile @@ -28,6 +28,7 @@ MailerUI_OBJC_FILES += \ UIxMailSortableTableHeader.m \ \ UIxMailEditor.m \ + UIxMailEditorAttach.m \ UIxMailEditorAction.m \ UIxMailToSelection.m \ UIxMailAddressbook.m \ @@ -54,6 +55,7 @@ MailerUI_RESOURCE_FILES += \ UIxMailSortableTableHeader.wox \ \ UIxMailEditor.wox \ + UIxMailEditorAttach.wox \ UIxMailToSelection.wox \ UIxMailAddressbook.wox \ \ diff --git a/SOGo/UI/Mailer/UIxMailEditor.wox b/SOGo/UI/Mailer/UIxMailEditor.wox index e23d3faf..2c685d77 100644 --- a/SOGo/UI/Mailer/UIxMailEditor.wox +++ b/SOGo/UI/Mailer/UIxMailEditor.wox @@ -34,6 +34,7 @@
+ Subject: + +/* + UIxMailEditorAction + + An mail editor component which works on SOGoDraftObject's. This component + manages the attachments of a draft object. +*/ + +@class NSArray, NSString, NSData; + +@interface UIxMailEditorAttach : UIxComponent +{ + NSString *filePath1; + NSString *filePath2; + NSString *filePath3; + NSData *fileData1; + NSData *fileData2; + NSData *fileData3; +} + +@end + +#include +#include "common.h" + +@implementation UIxMailEditorAttach + +- (void)dealloc { + [self->filePath1 release]; + [self->filePath2 release]; + [self->filePath3 release]; + [self->fileData1 release]; + [self->fileData2 release]; + [self->fileData3 release]; + [super dealloc]; +} + +/* accessors */ + +- (void)setFilePath1:(NSString *)_value { + ASSIGNCOPY(self->filePath1, _value); +} +- (NSString *)filePath1 { + return self->filePath1; +} + +- (void)setFilePath2:(NSString *)_value { + ASSIGNCOPY(self->filePath2, _value); +} +- (NSString *)filePath2 { + return self->filePath2; +} + +- (void)setFilePath3:(NSString *)_value { + ASSIGNCOPY(self->filePath3, _value); +} +- (NSString *)filePath3 { + return self->filePath3; +} + +- (void)setFileData1:(NSData *)_data { + ASSIGN(self->fileData1, _data); +} +- (NSData *)fileData1 { + return self->fileData1; +} + +- (void)setFileData2:(NSData *)_data { + ASSIGN(self->fileData2, _data); +} +- (NSData *)fileData2 { + return self->fileData2; +} + +- (void)setFileData3:(NSData *)_data { + ASSIGN(self->fileData3, _data); +} +- (NSData *)fileData3 { + return self->fileData3; +} + +/* requests */ + +- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{ + return YES; +} + +/* operations */ + +- (BOOL)saveFileData:(NSData *)_data name:(NSString *)_name { + [self logWithFormat:@"TODO: save attachment %@, length %d", + _name, [_data length]]; + return NO; +} + +/* actions */ + +- (id)viewAttachmentsAction { + [self logWithFormat:@"view attachments ..."]; + return self; +} + +- (id)attachAction { + [self logWithFormat:@"should save ..."]; + + // TODO: error handling! + + if ([self->fileData1 length] > 0) + [self saveFileData:self->fileData1 name:[self filePath1]]; + if ([self->fileData2 length] > 0) + [self saveFileData:self->fileData2 name:[self filePath2]]; + if ([self->fileData3 length] > 0) + [self saveFileData:self->fileData3 name:[self filePath3]]; + + return self; +} + +@end /* UIxMailEditorAttach */ diff --git a/SOGo/UI/Mailer/UIxMailEditorAttach.wox b/SOGo/UI/Mailer/UIxMailEditorAttach.wox new file mode 100644 index 00000000..fbb566d1 --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailEditorAttach.wox @@ -0,0 +1,58 @@ + + + + Attach ... + + + + + + + + + + + +
+

Attach

+ + + + + + + + + + +
+ + +
+ +

Attachments

+ +
+ + + + + + +
+
+ + diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index cd774cc6..1493e282 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,6 +1,6 @@ # $Id$ -SUBMINOR_VERSION:=45 +SUBMINOR_VERSION:=46 # v0.9.43 requires NGObjWeb v4.3.73 # v0.9.42 requires NGObjWeb v4.3.72 diff --git a/SOGo/UI/Mailer/mailer.js b/SOGo/UI/Mailer/mailer.js index 821b78e2..c88ffa33 100644 --- a/SOGo/UI/Mailer/mailer.js +++ b/SOGo/UI/Mailer/mailer.js @@ -72,10 +72,15 @@ function clickedEditorSend(sender) { } function clickedEditorAttach(sender) { - document.pageform.action="save"; - document.pageform.submit(); - return true; + var urlstr; + + urlstr = "viewAttachments"; + window.open(urlstr, "SOGo_attach", + "width=320,height=320,resizable=1,scrollbars=1,toolbar=0," + + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); + return false; /* stop following the link */ } + function clickedEditorSave(sender) { document.pageform.action="save"; document.pageform.submit(); diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index ec3fe7cb..fa297475 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -322,8 +322,8 @@ { link = "#"; target = "anais"; onclick = "openAnais(this);return false;"; cssClass = "tbicon_addressbook"; label = "Anais"; }, - { link = "#"; - onclick = "clickedEditorAttach(this);return false;"; + { link = "#"; + onclick = "clickedEditorAttach(this)"; cssClass = "tbicon_attach"; label = "Attach"; }, { link = "#"; onclick = "clickedEditorSave(this);return false;"; @@ -347,6 +347,16 @@ pageName = "UIxMailEditor"; actionName = "save"; }; + viewAttachments = { + protectedBy = "View"; + pageName = "UIxMailEditorAttach"; + actionName = "viewAttachments"; + }; + attach = { + protectedBy = "View"; + pageName = "UIxMailEditorAttach"; + actionName = "attach"; + }; send = { protectedBy = "View"; pageName = "UIxMailEditor"; -- 2.39.5