02111-1307, USA.
*/
-#include <SOGoUI/UIxComponent.h>
+#import <Foundation/NSUserDefaults.h>
+#import <NGObjWeb/WORequest.h>
+#import <NGObjWeb/SoComponent.h>
+#import <NGExtensions/NSString+misc.h>
-@interface UIxMailMainFrame : UIxComponent
-{
- NSString *title;
- NSString *rootURL;
- NSString *userRootURL;
- id item;
- struct {
- int hideFolderTree:1;
- int hideFrame:1; /* completely disables all the frame around the comp. */
- int reserved:30;
- } mmfFlags;
-}
-
-- (NSString *)rootURL;
-- (NSString *)userRootURL;
-- (NSString *)calendarRootURL;
-
-@end
-
-@interface UIxMailPanelFrame : UIxMailMainFrame
-@end
+#import <SoObjects/Mailer/SOGoMailObject.h>
+#import <SoObjects/Mailer/SOGoMailAccounts.h>
+#import <SoObjects/SOGo/NSString+Utilities.h>
+#import <SoObjects/SOGo/NSObject+Utilities.h>
+#import <SOGoUI/UIxComponent.h>
-#include "common.h"
-#include <NGObjWeb/SoComponent.h>
+#import "UIxMailMainFrame.h"
@implementation UIxMailMainFrame
}
- (void)dealloc {
- [self->item release];
- [self->title release];
[self->rootURL release];
[self->userRootURL release];
[super dealloc];
}
/* accessors */
+- (NSString *) mailAccounts
+{
+ SOGoMailAccounts *co;
+
+ co = [self clientObject];
+
+ return [[co fetchAllIdentities] jsonRepresentation];
+}
- (NSString *)treeRootClassName {
return treeRootClassName;
return self->mmfFlags.hideFolderTree ? YES : NO;
}
-- (void)setHideFrame:(BOOL)_flag {
- self->mmfFlags.hideFrame = _flag ? 1 : 0;
-}
-- (BOOL)hideFrame {
- return self->mmfFlags.hideFrame ? YES : NO;
-}
-
-- (void)setTitle:(NSString *)_value {
- ASSIGNCOPY(self->title, _value);
-}
-- (NSString *)title {
- if ([self->title length] == 0)
- return @"OpenGroupware.org";
-
- return self->title;
-}
-
-- (void)setItem:(id)_item {
- ASSIGN(self->item, _item);
-}
-- (id)item {
- return self->item;
-}
-
-- (NSString *)pageFormURL {
+- (NSString *) pageFormURL {
NSString *u;
NSRange r;
}
- (BOOL)showLinkBanner {
- if ([self hideFolderTree]) return NO;
return YES;
}
+
- (NSString *)bannerToolbarStyle {
-#if 0 // 32x32
- return [self showLinkBanner] ? @"top: 58px;" : nil /* fallback to CSS */;
-#else // 24x24
- return [self showLinkBanner] ? @"top: 58px;" : nil /* fallback to CSS */;
-#endif
+ return nil;
}
-- (NSString *)bannerConsumeStyle {
-#if 0 // 32x32
- return [self showLinkBanner] ? @"height: 116px;" : nil /* fallback to CSS */;
-#else // 24x24
- return [self showLinkBanner] ? @"height: 110px;" : nil /* fallback to CSS */;
-#endif
-}
-
-/* notifications */
-- (void)sleep {
- [self->item release]; self->item = nil;
- [super sleep];
+- (NSString *)bannerConsumeStyle {
+ return nil;
}
/* URL generation */
- (NSString *)calendarRootURL {
return [[self userRootURL] stringByAppendingString:@"Calendar/"];
}
+
- (NSString *)contactsRootURL {
return [[self userRootURL] stringByAppendingString:@"Contacts/"];
}
@"</script>", errorText];
}
-/* URLs */
+/* FIXME: migrated methods which might not work yet... */
+// #warning check this
+// - (NSString *) mailFolderName
+// {
+// NSMutableArray *mailboxes;
+// SOGoMailObject *currentObject;
-- (NSString *)relativeHomePath {
- return [self relativePathToUserFolderSubPath:@""];
-}
-
-- (NSString *)relativeCalendarPath {
- return [self relativePathToUserFolderSubPath:@"Calendar/"];
-}
-
-- (NSString *)relativeContactsPath {
- return [self relativePathToUserFolderSubPath:@"Contacts/"];
-}
+// mailboxes = [NSMutableArray new];
+// [mailboxes autorelease];
-- (NSString *)relativeMailPath {
- return [self relativePathToUserFolderSubPath:@"Mail/"];
-}
+// currentObject = [self clientObject];
+// while (![currentObject isKindOfClass: [SOGoMailAccounts class]])
+// {
+// [mailboxes insertObject: [currentObject nameInContainer] atIndex: 0];
+// currentObject = [currentObject container];
+// }
-@end /* UIxMailMainFrame */
+// return [NSString stringWithFormat: @"/%@",
+// [mailboxes componentsJoinedByString: @"/"]];
+// }
-@implementation UIxMailPanelFrame
+- (id) composeAction
+{
+ NSArray *c;
+ NSString *inbox, *url, *parameter;
+ NSMutableDictionary *urlParams;
+ id actionResult;
+
+ c = [[self clientObject] toManyRelationshipKeys];
+ if ([c count] > 0)
+ {
+ urlParams = [NSMutableDictionary new];
+ [urlParams autorelease];
+
+ parameter = [self queryParameterForKey: @"mailto"];
+ if (parameter)
+ [urlParams setObject: parameter
+ forKey: @"mailto"];
+ inbox = [NSString stringWithFormat: @"%@/INBOX",
+ [c objectAtIndex: 0]];
+ url = [inbox composeURLWithAction: @"compose"
+ parameters: urlParams
+ andHash: NO];
+ actionResult = [self redirectToLocation: url];
+ }
+ else
+ actionResult = self;
-- (BOOL)hideFolderTree {
- return YES;
-}
-- (BOOL)showLinkBanner {
- return NO;
+ return actionResult;
}
-@end /* UIxMailPanelFrame */
+@end /* UIxMailMainFrame */