2004-10-11 Helge Hess <helge.hess@opengroupware.org>
+ * SOGoDraftsFolder.m: added methods to deal with new draft objects
+ (v0.9.33)
+
* started SOGoDraftObject (v0.9.32)
2004-10-10 Helge Hess <helge.hess@opengroupware.org>
{
}
+/* new objects */
+
+- (NSString *)makeNewObjectNameInContext:(id)_ctx;
+- (NSString *)newObjectBaseURLInContext:(id)_ctx;
+- (id)newObjectInContext:(id)_ctx;
+
@end
#endif /* __Mailer_SOGoDraftsFolder_H__ */
#include <SOGo/SOGoUserFolder.h>
#include <NGExtensions/NSFileManager+Extensions.h>
#include "common.h"
+#include <unistd.h>
@implementation SOGoDraftsFolder
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 {
# $Id$
-SUBMINOR_VERSION:=32
+SUBMINOR_VERSION:=33
2004-10-11 Helge Hess <helge.hess@opengroupware.org>
- * 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)
@end
#include <SOGo/SoObjects/Mailer/SOGoDraftsFolder.h>
+#include <SOGo/SoObjects/Mailer/SOGoMailAccount.h>
#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 {
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 */
<tr class="tableview">
<!-- TODO: see AB for sorting -->
- <td class="tbtv_headercell" width="60%">
+ <td class="tbtv_headercell" width="50%">
<a href="view" _sort="subject">
<var:string label:value="Subject" />
<var:if condition="imap4SortKey" const:value="SUBJECT">
# $Id$
-SUBMINOR_VERSION:=28
+SUBMINOR_VERSION:=29
.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 */
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 = "#";
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";
};
};
};
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";
};