From: helge Date: Mon, 11 Oct 2004 15:11:48 +0000 (+0000) Subject: more mailer changes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2d272cd0a817ef52ed2640d60390ef9ed8a8200;p=scalable-opengroupware.org more mailer changes git-svn-id: http://svn.opengroupware.org/SOGo/trunk@379 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index f850c375..2198a063 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,5 +1,8 @@ 2004-10-11 Helge Hess + * SOGoDraftsFolder.m: added methods to deal with new draft objects + (v0.9.33) + * started SOGoDraftObject (v0.9.32) 2004-10-10 Helge Hess diff --git a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h index 9d6ab06c..b938b1dd 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.h @@ -39,6 +39,12 @@ { } +/* new objects */ + +- (NSString *)makeNewObjectNameInContext:(id)_ctx; +- (NSString *)newObjectBaseURLInContext:(id)_ctx; +- (id)newObjectInContext:(id)_ctx; + @end #endif /* __Mailer_SOGoDraftsFolder_H__ */ diff --git a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m index d15cb76a..80cf46d7 100644 --- a/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoDraftsFolder.m @@ -25,6 +25,7 @@ #include #include #include "common.h" +#include @implementation SOGoDraftsFolder @@ -40,6 +41,30 @@ static NSString *spoolFolder = nil; NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder); } +/* new objects */ + +- (NSString *)makeNewObjectNameInContext:(id)_ctx { + static int counter = 1; // THREAD + return [NSString stringWithFormat:@"draft_%08d_%08x", getpid(), counter++]; +} + +- (NSString *)newObjectBaseURLInContext:(id)_ctx { + NSString *s, *n; + + n = [self makeNewObjectNameInContext:_ctx]; + if (![n isNotNull]) return nil; + + s = [self baseURLInContext:_ctx]; + if (![s isNotNull]) return nil; + if (![s hasSuffix:@"/"]) s = [s stringByAppendingString:@"/"]; + return [s stringByAppendingString:n]; +} + +- (id)newObjectInContext:(id)_ctx { + return [self lookupName:[self makeNewObjectNameInContext:_ctx] + inContext:_ctx acquire:NO]; +} + /* draft folder functionality */ - (NSFileManager *)spoolFileManager { diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 97a71362..a416fb2d 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=32 +SUBMINOR_VERSION:=33 diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index e36606c7..191c64c5 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,6 +1,18 @@ 2004-10-11 Helge Hess - * started UIxMailEditorAction object which will contains all the + * v0.9.29 + + * product.plist: trigger UIxMailEditorAction for compose instead of + returning the mail editor page, mapped missing toolbar actions + + * UIxMailEditorAction.m: implemented -compose as a redirect to a new + object in the account draft folder + + * UIxMailListView.wox: reduced subject width to 50% + + * mailer.css: added send icon class, icon itself still missing + + * started UIxMailEditorAction object which will contain all the redirects from the buttons to the mail editor (working on draft objects in the drafts folder) (v0.9.28) diff --git a/SOGo/UI/Mailer/UIxMailEditorAction.m b/SOGo/UI/Mailer/UIxMailEditorAction.m index d5aa505f..69d64667 100644 --- a/SOGo/UI/Mailer/UIxMailEditorAction.m +++ b/SOGo/UI/Mailer/UIxMailEditorAction.m @@ -34,10 +34,27 @@ @end #include +#include #include "common.h" @implementation UIxMailEditorAction +/* lookups */ + +- (SOGoDraftsFolder *)draftsFolder { + /* + Note: we cannot use acquisition to find the nearest drafts folder, because + the IMAP4 server might contains an own Drafts folder. + */ + SOGoDraftsFolder *drafts; + id client; + + client = [self clientObject]; + drafts = [[client mailAccountFolder] + lookupName:@"Drafts" inContext:[self context] acquire:NO]; + return drafts; +} + /* errors */ - (id)didNotFindDraftsError { @@ -45,22 +62,37 @@ return [@"did not find drafts folder in object: " stringByAppendingString:[[self clientObject] description]]; } +- (id)couldNotCreateDraftError:(SOGoDraftsFolder *)_draftsFolder { + return [@"could not create a new draft in folder: " + stringByAppendingString:[_draftsFolder description]]; +} /* actions */ - (id)composeAction { SOGoDraftsFolder *drafts; - id client; + WOResponse *r; + NSString *url; - client = [self clientObject]; - drafts = [client lookupName:@"Drafts" inContext:[self context] acquire:YES]; + drafts = [self draftsFolder]; if (![drafts isNotNull]) return [self didNotFindDraftsError]; if ([drafts isKindOfClass:[NSException class]]) return drafts; - [self logWithFormat:@"compose on %@: %@", client, drafts]; - return nil; + url = [drafts newObjectBaseURLInContext:[self context]]; + if (![url isNotNull]) + return [self couldNotCreateDraftError:drafts]; + + if (![url hasSuffix:@"/"]) url = [url stringByAppendingString:@"/"]; + url = [url stringByAppendingString:@"edit"]; + + [self logWithFormat:@"compose on %@: %@", drafts, url]; + + r = [[self context] response]; + [r setStatus:302 /* moved */]; + [r setHeader:url forKey:@"location"]; + return r; } @end /* UIxMailEditorAction */ diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index 5d90729c..f30e5e51 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -27,7 +27,7 @@ - + diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 42d0a3b8..3631f8fc 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=28 +SUBMINOR_VERSION:=29 diff --git a/SOGo/UI/Mailer/mailer.css b/SOGo/UI/Mailer/mailer.css index 8af0f0d4..07824347 100644 --- a/SOGo/UI/Mailer/mailer.css +++ b/SOGo/UI/Mailer/mailer.css @@ -139,6 +139,8 @@ .tbicon_print { background-image: url(tbtb_print.png); } .tbicon_stop { background-image: url(tbtb_deletedoc.png); } +/* TODO: add proper compose icons! */ +.tbicon_send { background-image: url(tbtb_compose.png); } /* mail tableview */ diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index 124b7c93..7c42053c 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -154,11 +154,12 @@ cssClass = "tbicon_addressbook"; label = "Addressbook"; } ), ( /* second group */ - { link = "#"; + { link = "reply"; cssClass = "tbicon_reply"; label = "Reply"; }, - { link = "#"; + { link = "replyall"; cssClass = "tbicon_replyall"; label = "Reply All"; }, - { link = "#"; cssClass = "tbicon_forward"; label = "Forward"; }, + { link = "forward"; + cssClass = "tbicon_forward"; label = "Forward"; }, ), ( /* third group */ { link = "#"; @@ -190,14 +191,35 @@ pageName = "UIxMailView"; actionName = "delete"; }; + junk = { + protectedBy = "View"; + pageName = "UIxMailView"; + actionName = "junk"; + }; edit = { protectedBy = "View"; pageName = "UIxMailEditor"; }; - save = { + + compose = { protectedBy = "View"; - pageName = "UIxMailEditor"; - actionName = "save"; + actionClass = "UIxMailEditorAction"; + actionName = "compose"; + }; + reply = { + protectedBy = "View"; + actionClass = "UIxMailEditorAction"; + actionName = "reply"; + }; + replyall = { + protectedBy = "View"; + actionClass = "UIxMailEditorAction"; + actionName = "replyall"; + }; + forward = { + protectedBy = "View"; + actionClass = "UIxMailEditorAction"; + actionName = "forward"; }; }; }; @@ -271,6 +293,34 @@ pageName = "UIxMailListView"; }; compose = { + protectedBy = "View"; + actionClass = "UIxMailEditorAction"; + actionName = "compose"; + }; + }; + }; + + SOGoDraftObject = { + slots = { + toolbar = { /* need the 'send' toolbar here */ + protectedBy = "View"; + value = ( /* the toolbar groups */ + ( /* first group */ + { link = "send"; + cssClass = "tbicon_send"; + label = "Send"; }, + { link = "contacts"; target = "addressbook"; + cssClass = "tbicon_addressbook"; label = "Contacts"; }, + ) + ); + }; + }; + methods = { + view = { /* somewhat hackish */ + protectedBy = "View"; + pageName = "UIxMailEditor"; + }; + edit = { protectedBy = "View"; pageName = "UIxMailEditor"; };