From 4292a8bf503d7f414068474a9c8beb934d039983 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sat, 18 Aug 2007 20:37:18 +0000 Subject: [PATCH] Monotone-Parent: cc054885aad697b7949d4593db97e45d30d2e276 Monotone-Revision: 7abad0bacab329e28e1ff4cdfbdc624f171b7132 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-18T20:37:18 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 ++++++ UI/MailerUI/UIxMailActions.m | 45 ++++++++++++++++++++++++++++++++++++ UI/MailerUI/product.plist | 10 ++++++++ 3 files changed, 62 insertions(+) diff --git a/ChangeLog b/ChangeLog index ce0a28a82..17ad6ecd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2007-08-18 Wolfgang Sourdeau + * UI/MailerUI/UIxMailActions.m ([UIxMailActions -deleteAction]): + new category method to reponds to the "delete" web command on + drafts. + ([UIxMailActions -deleteAttachmentAction]): new category method to + reponds to the "deleteAttachment" web command on drafts, taking + the "filename" url parameter into account. + * SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject -contentForEditing]): new method that retrieve the editable mail content. diff --git a/UI/MailerUI/UIxMailActions.m b/UI/MailerUI/UIxMailActions.m index 7e177cda3..b8ca9cf9f 100644 --- a/UI/MailerUI/UIxMailActions.m +++ b/UI/MailerUI/UIxMailActions.m @@ -22,6 +22,9 @@ #import +#import +#import +#import #import #import #import @@ -104,4 +107,46 @@ return [self redirectToLocation: newLocation]; } +/* SOGoDraftObject */ +- (id) deleteAction +{ + SOGoDraftObject *draft; + NSException *error; + id response; + + draft = [self clientObject]; + error = [draft delete]; + if (error) + response = error; + else + { + response = [context response]; + [response setStatus: 204]; + } + + return response; +} + +- (WOResponse *) deleteAttachmentAction +{ + WOResponse *response; + NSString *filename; + + response = [context response]; + + filename = [[context request] formValueForKey: @"filename"]; + if ([filename length] > 0) + { + [[self clientObject] deleteAttachmentWithName: filename]; + [response setStatus: 204]; + } + else + { + [response setStatus: 500]; + [response appendContentString: @"How did you end up here?"]; + } + + return response; +} + @end diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index f974b0728..843c51c08 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -342,6 +342,16 @@ categories = { pageName = "UIxMailEditor"; actionName = "send"; }; + delete = { + protectedBy = "View"; + actionClass = "UIxMailActions"; + actionName = "delete"; + }; + deleteAttachment = { + protectedBy = "View"; + actionClass = "UIxMailActions"; + actionName = "deleteAttachment"; + }; }; };