mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-12 02:11:23 +00:00
Monotone-Parent: abac840ff3b9ff48b85eea3e57a9fd3122ec461f
Monotone-Revision: b008761331f87b28af61153588a5722a842c7ce1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-15T21:09:50 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
21
ChangeLog
21
ChangeLog
@@ -1,5 +1,26 @@
|
||||
2007-08-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame
|
||||
-mailAccounts]): rewrote method to return the name of the mail
|
||||
accounts now available with the -[SOGoUser mailAccounts] method.
|
||||
([UIxMailMainFrame -showLinkBanner]): removed method.
|
||||
([UIxMailMainFrame -bannerToolbarStyle]): removed method.
|
||||
([UIxMailMainFrame -bannerConsumeStyle]): removed method.
|
||||
([UIxMailMainFrame -rootURL]): removed method.
|
||||
([UIxMailMainFrame -userRootURL]): removed method.
|
||||
([UIxMailMainFrame -calendarRootURL]): removed method.
|
||||
([UIxMailMainFrame -contactsRootURL]): removed method.
|
||||
([UIxMailMainFrame -hasErrorText])
|
||||
([UIxMailMainFrame -errorText])
|
||||
([UIxMailMainFrame -errorAlertJavaScript]): removed methods.
|
||||
([-composeAction]): removed method. Now provided by
|
||||
UIxMailAccountActions.
|
||||
([UIxMailMainFrame -setHideFolderTree:_flag]): removed method.
|
||||
([UIxMailMainFrame -hideFolderTree]): removed method.
|
||||
([UIxMailMainFrame -treeRootClassName]): removed method.
|
||||
([UIxMailMainFrame +initialize]): removed method.
|
||||
SOGoMailTreeRootClass userdefaults will no longer have any effect.
|
||||
|
||||
* UI/Common/WODirectAction+SOGo.m ([WODirectAction
|
||||
-redirectToLocation:newLocation]): new method that implements the
|
||||
same functionality as WOComponent.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* UIxMailMainFrame.h - this file is part of $PROJECT_NAME_HERE$
|
||||
/* UIxMailMainFrame.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
@@ -23,21 +23,9 @@
|
||||
#ifndef UIXMAILMAINFRAME_H
|
||||
#define UIXMAILMAINFRAME_H
|
||||
|
||||
#import "../Common/UIxPageFrame.h"
|
||||
#import "../Common/UIxComponent.h"
|
||||
|
||||
@interface UIxMailMainFrame : UIxPageFrame
|
||||
{
|
||||
NSString *rootURL;
|
||||
NSString *userRootURL;
|
||||
struct {
|
||||
int hideFolderTree:1;
|
||||
int reserved:31;
|
||||
} mmfFlags;
|
||||
}
|
||||
|
||||
- (NSString *)rootURL;
|
||||
- (NSString *)userRootURL;
|
||||
- (NSString *)calendarRootURL;
|
||||
@interface UIxMailMainFrame : UIxComponent
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -26,54 +26,27 @@
|
||||
|
||||
#import <SoObjects/Mailer/SOGoMailObject.h>
|
||||
#import <SoObjects/Mailer/SOGoMailAccounts.h>
|
||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
#import "UIxMailMainFrame.h"
|
||||
|
||||
@implementation UIxMailMainFrame
|
||||
|
||||
static NSString *treeRootClassName = nil;
|
||||
|
||||
+ (void)initialize {
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
treeRootClassName = [[ud stringForKey:@"SOGoMailTreeRootClass"] copy];
|
||||
if (treeRootClassName)
|
||||
NSLog(@"Note: use class '%@' as root for mail tree.", treeRootClassName);
|
||||
else
|
||||
treeRootClassName = @"SOGoMailAccounts";
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self->rootURL release];
|
||||
[self->userRootURL release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
- (NSString *) mailAccounts
|
||||
{
|
||||
SOGoMailAccounts *co;
|
||||
NSArray *accounts, *accountNames;
|
||||
|
||||
co = [self clientObject];
|
||||
accounts = [[context activeUser] mailAccounts];
|
||||
accountNames = [accounts objectsForKey: @"name"];
|
||||
|
||||
return [[co fetchAllIdentities] jsonRepresentation];
|
||||
return [accountNames jsonRepresentation];
|
||||
}
|
||||
|
||||
- (NSString *)treeRootClassName {
|
||||
return treeRootClassName;
|
||||
}
|
||||
|
||||
- (void)setHideFolderTree:(BOOL)_flag {
|
||||
self->mmfFlags.hideFolderTree = _flag ? 1 : 0;
|
||||
}
|
||||
- (BOOL)hideFolderTree {
|
||||
return self->mmfFlags.hideFolderTree ? YES : NO;
|
||||
}
|
||||
|
||||
- (NSString *) pageFormURL {
|
||||
- (NSString *) pageFormURL
|
||||
{
|
||||
NSString *u;
|
||||
NSRange r;
|
||||
|
||||
@@ -117,136 +90,4 @@ static NSString *treeRootClassName = nil;
|
||||
return [u hasSuffix:@"/"] ? @"view" : @"#";
|
||||
}
|
||||
|
||||
- (BOOL)showLinkBanner {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *)bannerToolbarStyle {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)bannerConsumeStyle {
|
||||
return nil;
|
||||
}
|
||||
|
||||
/* URL generation */
|
||||
// TODO: I think all this should be done by the clientObject?!
|
||||
// TODO: is the stuff below necessary at all in the mailer frame?
|
||||
|
||||
- (NSString *)rootURL {
|
||||
WOContext *ctx;
|
||||
NSArray *traversalObjects;
|
||||
|
||||
if (self->rootURL != nil)
|
||||
return self->rootURL;
|
||||
|
||||
ctx = [self context];
|
||||
traversalObjects = [ctx objectTraversalStack];
|
||||
self->rootURL = [[[traversalObjects objectAtIndex:0]
|
||||
rootURLInContext:ctx]
|
||||
copy];
|
||||
return self->rootURL;
|
||||
}
|
||||
|
||||
- (NSString *)userRootURL {
|
||||
WOContext *ctx;
|
||||
NSArray *traversalObjects;
|
||||
|
||||
if (self->userRootURL)
|
||||
return self->userRootURL;
|
||||
|
||||
ctx = [self context];
|
||||
traversalObjects = [ctx objectTraversalStack];
|
||||
self->userRootURL = [[[[traversalObjects objectAtIndex:1]
|
||||
baseURLInContext:ctx]
|
||||
stringByAppendingString:@"/"]
|
||||
retain];
|
||||
return self->userRootURL;
|
||||
}
|
||||
|
||||
- (NSString *)calendarRootURL {
|
||||
return [[self userRootURL] stringByAppendingString:@"Calendar/"];
|
||||
}
|
||||
|
||||
- (NSString *)contactsRootURL {
|
||||
return [[self userRootURL] stringByAppendingString:@"Contacts/"];
|
||||
}
|
||||
|
||||
/* error handling */
|
||||
|
||||
- (BOOL)hasErrorText {
|
||||
return [[[[self context] request] formValueForKey:@"error"] length] > 0
|
||||
? YES : NO;
|
||||
}
|
||||
- (NSString *)errorText {
|
||||
return [[[self context] request] formValueForKey:@"error"];
|
||||
}
|
||||
|
||||
- (NSString *)errorAlertJavaScript {
|
||||
NSString *errorText;
|
||||
|
||||
if ([(errorText = [self errorText]) length] == 0)
|
||||
return nil;
|
||||
|
||||
// TODO: proper JavaScript escaping
|
||||
errorText = [errorText stringByEscapingHTMLString];
|
||||
errorText = [errorText stringByReplacingString:@"\"" withString:@"'"];
|
||||
|
||||
return [NSString stringWithFormat:
|
||||
@"<script language=\"JavaScript\">"
|
||||
@"alert(\"%@\");"
|
||||
@"</script>", errorText];
|
||||
}
|
||||
|
||||
/* FIXME: migrated methods which might not work yet... */
|
||||
// #warning check this
|
||||
// - (NSString *) mailFolderName
|
||||
// {
|
||||
// NSMutableArray *mailboxes;
|
||||
// SOGoMailObject *currentObject;
|
||||
|
||||
// mailboxes = [NSMutableArray new];
|
||||
// [mailboxes autorelease];
|
||||
|
||||
// currentObject = [self clientObject];
|
||||
// while (![currentObject isKindOfClass: [SOGoMailAccounts class]])
|
||||
// {
|
||||
// [mailboxes insertObject: [currentObject nameInContainer] atIndex: 0];
|
||||
// currentObject = [currentObject container];
|
||||
// }
|
||||
|
||||
// return [NSString stringWithFormat: @"/%@",
|
||||
// [mailboxes componentsJoinedByString: @"/"]];
|
||||
// }
|
||||
|
||||
- (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: @"%@/folderINBOX",
|
||||
[c objectAtIndex: 0]];
|
||||
url = [inbox composeURLWithAction: @"compose"
|
||||
parameters: urlParams
|
||||
andHash: NO];
|
||||
actionResult = [self redirectToLocation: url];
|
||||
}
|
||||
else
|
||||
actionResult = self;
|
||||
|
||||
return actionResult;
|
||||
}
|
||||
|
||||
@end /* UIxMailMainFrame */
|
||||
|
||||
Reference in New Issue
Block a user