+2004-10-11 Helge Hess <helge.hess@opengroupware.org>
+
+ * started SOGoDraftObject (v0.9.32)
+
2004-10-10 Helge Hess <helge.hess@opengroupware.org>
* SOGoDraftsFolder.m: added methods to be compatible with the mail
SOGoMailBodyPart.m \
\
SOGoDraftsFolder.m \
+ SOGoDraftObject.m \
Mailer_RESOURCE_FILES += \
Version \
--- /dev/null
+/*
+ Copyright (C) 2004 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#ifndef __Mailer_SOGoDraftObject_H__
+#define __Mailer_SOGoDraftObject_H__
+
+#include <Mailer/SOGoMailBaseObject.h>
+
+/*
+ SOGoDraftsFolder
+ Parent object: SOGoDraftsFolder
+ Child objects: draft attachments?
+
+ The SOGoDraftObject is used for composing new messages. It is necessary
+ because we can't cache objects in a session. So the contents of the drafts
+ folder are some kind of "mail creation transaction".
+*/
+
+@interface SOGoDraftObject : SOGoMailBaseObject
+{
+}
+
+@end
+
+#endif /* __Mailer_SOGoDraftObject_H__ */
--- /dev/null
+/*
+ Copyright (C) 2004 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "SOGoDraftObject.h"
+#include "common.h"
+
+@implementation SOGoDraftObject
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+@end /* SOGoDraftObject */
/*
SOGoDraftsFolder
Parent object: SOGoMailAccount
- Child objects: SOGoMailFolder
+ Child objects: SOGoDraftObject's
The SOGoDraftsFolder is used for composing new messages. It is necessary
because we can't cache objects in a session. So the contents of the drafts
// $Id$
#include "SOGoDraftsFolder.h"
+#include "SOGoDraftObject.h"
+#include <SOGo/SOGoUserFolder.h>
+#include <NGExtensions/NSFileManager+Extensions.h>
#include "common.h"
@implementation SOGoDraftsFolder
+static NSString *spoolFolder = nil;
+
++ (void)initialize {
+ NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+
+ spoolFolder = [[ud stringForKey:@"SOGoMailSpoolPath"] copy];
+ if ([spoolFolder length] < 3)
+ spoolFolder = @"/tmp/";
+
+ NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder);
+}
+
+/* draft folder functionality */
+
+- (NSFileManager *)spoolFileManager {
+ return [NSFileManager defaultManager];
+}
+
+- (NSString *)spoolFolderPath {
+ return spoolFolder;
+}
+- (NSString *)userSpoolFolderPath {
+ NSString *p, *n;
+
+ p = [self spoolFolderPath];
+ n = [[self lookupUserFolder] nameInContainer];
+ return [p stringByAppendingPathComponent:n];
+}
+
+- (BOOL)_ensureUserSpoolFolderPath {
+ NSFileManager *fm;
+
+ if ((fm = [self spoolFileManager]) == nil) {
+ [self logWithFormat:@"ERROR: missing spool file manager!"];
+ return NO;
+ }
+ return [fm createDirectoriesAtPath:[self userSpoolFolderPath]
+ attributes:nil];
+}
+
+- (NSArray *)fetchMailNames {
+ NSString *p;
+
+ if ((p = [self userSpoolFolderPath]) == nil)
+ return nil;
+
+ return [[self spoolFileManager] directoryContentsAtPath:p];
+}
+
/* folder methods (used by template) */
- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so {
// TODO: retrieve contained objects
- [self logWithFormat:@"TODO: should fetch uids (q=%@,so=%@)", _q, _so];
- return [NSArray array];
+ NSArray *allUids;
+
+ allUids = [self fetchMailNames];
+ if (![allUids isNotNull]) {
+ [self logWithFormat:@"Note: no uids in drafts folder: %@",
+ [self userSpoolFolderPath]];
+ return [NSArray array];
+ }
+
+ [self logWithFormat:@"TODO: should sort uids (q=%@,so=%@): %@", _q, _so,
+ allUids];
+ return allUids;
}
- (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts {
[self logWithFormat:@"TODO: fetch uids (parts=%@): %@", _parts, _uids];
return [NSArray array];
}
+/* name lookup */
+
+- (id)lookupDraftMessage:(NSString *)_key inContext:(id)_ctx {
+ // TODO: we might want to check for existence prior controller creation
+ return [[[SOGoDraftObject alloc] initWithName:_key
+ inContainer:self] autorelease];
+}
+
+- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+ id obj;
+
+ /* first check attributes directly bound to the application */
+ if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]) != nil)
+ return obj;
+
+ if ((obj = [self lookupDraftMessage:_key inContext:_ctx]) != nil)
+ return obj;
+
+ /* return 404 to stop acquisition */
+ return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
+}
+
/* WebDAV */
- (BOOL)davIsCollection {
# $Id$
-SUBMINOR_VERSION:=31
+SUBMINOR_VERSION:=32
SOGoMailBodyPart = {
superclass = "SOGoMailBaseObject";
};
+
+ SOGoDraftsFolder = {
+ superclass = "SOGoMailBaseObject";
+ };
+ SOGoDraftObject = {
+ superclass = "SOGoMailBaseObject";
+ };
};
}
+2004-10-11 Helge Hess <helge.hess@opengroupware.org>
+
+ * started UIxMailEditorAction object which will contains all the
+ redirects from the buttons to the mail editor (working on draft
+ objects in the drafts folder) (v0.9.28)
+
2004-10-10 Helge Hess <helge.hess@opengroupware.org>
* product.plist: added some configuration for the drafts folder
UIxMailListView.m \
UIxMailView.m \
UIxMailEditor.m \
+ UIxMailEditorAction.m \
\
UIxMailPartViewer.m \
UIxMailPartTextViewer.m \
@interface UIxMailEditor : UIxComponent
{
-
}
@end
--- /dev/null
+/*
+ Copyright (C) 2004 SKYRIX Software AG
+
+ This file is part of OpenGroupware.org.
+
+ OGo is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with OGo; see the file COPYING. If not, write to the
+ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+// $Id$
+
+#include <NGObjWeb/WODirectAction.h>
+
+/*
+ UIxMailEditorAction
+
+ This action implements the backend for the various buttons which invoke the
+ mail editor. The mail editor itself only works on a SOGoDraftObject which
+ needs to be created in advance.
+*/
+
+@interface UIxMailEditorAction : WODirectAction
+@end
+
+#include <SOGo/SoObjects/Mailer/SOGoDraftsFolder.h>
+#include "common.h"
+
+@implementation UIxMailEditorAction
+
+/* errors */
+
+- (id)didNotFindDraftsError {
+ // TODO: make a nice page
+ return [@"did not find drafts folder in object: "
+ stringByAppendingString:[[self clientObject] description]];
+}
+
+/* actions */
+
+- (id)composeAction {
+ SOGoDraftsFolder *drafts;
+ id client;
+
+ client = [self clientObject];
+ drafts = [client lookupName:@"Drafts" inContext:[self context] acquire:YES];
+ if (![drafts isNotNull])
+ return [self didNotFindDraftsError];
+ if ([drafts isKindOfClass:[NSException class]])
+ return drafts;
+
+ [self logWithFormat:@"compose on %@: %@", client, drafts];
+ return nil;
+}
+
+@end /* UIxMailEditorAction */
# $Id$
-SUBMINOR_VERSION:=27
+SUBMINOR_VERSION:=28
compose = {
protectedBy = "View";
- pageName = "UIxMailEditor";
+ actionClass = "UIxMailEditorAction";
+ actionName = "compose";
};
};
};
( /* first group */
{ link = "getMail";
cssClass = "tbicon_getmail"; label = "Get Mail"; },
+ {
+ link = "#"; // "compose"; // target = "_blank";
+ onclick = "clickedCompose(this);return false;";
+ cssClass = "tbicon_compose"; label = "Write";
+ },
{ link = "addressbook"; target = "addressbook";
- cssClass = "tbicon_addressbook"; label = "Addressbook"; }
+ cssClass = "tbicon_addressbook"; label = "Addressbook"; },
)
);
};
protectedBy = "View";
pageName = "UIxMailListView";
};
+ compose = {
+ protectedBy = "View";
+ pageName = "UIxMailEditor";
+ };
};
};
};