merge of 'baf4c7f8461dec960162ae0da21047d576421c14'

and 'fefb3f05edb2d5e5ba63661ae145d0369e47b444'

Monotone-Parent: baf4c7f8461dec960162ae0da21047d576421c14
Monotone-Parent: fefb3f05edb2d5e5ba63661ae145d0369e47b444
Monotone-Revision: 9ef1fb2c66953b8ada0d55d0eec183621a71ebab

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-11T20:58:35
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-09-11 20:58:35 +00:00
32 changed files with 611 additions and 476 deletions
+7 -15
View File
@@ -37,6 +37,8 @@
#import <SoObjects/SOGo/SOGoObject.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import "WODirectAction+SOGo.h"
#import "UIxFolderActions.h"
@implementation UIxFolderActions
@@ -89,10 +91,9 @@
NSMutableDictionary *folderSubscription;
NSString *mailInvitationURL;
response = [context response];
if ([owner isEqualToString: login])
{
[response setStatus: 403];
response = [self responseWithStatus: 403];
[response appendContentString:
@"You cannot (un)subscribe to a folder that you own!"];
}
@@ -119,12 +120,12 @@
mailInvitationURL
= [[clientObject soURLToBaseContainerForCurrentUser]
absoluteString];
[response setStatus: 302];
response = [self responseWithStatus: 302];
[response setHeader: mailInvitationURL
forKey: @"location"];
}
else
[response setStatus: 204];
response = [self responseWith204];
}
return response;
@@ -162,22 +163,14 @@
- (WOResponse *) canAccessContentAction
{
WOResponse *response;
response = [context response];
[response setStatus: 204];
return response;
return [self responseWith204];
}
- (WOResponse *) _realFolderActivation: (BOOL) makeActive
{
WOResponse *response;
NSMutableDictionary *folderSubscription, *folderDict;
NSNumber *active;
response = [context response];
[self _setupContext];
active = [NSNumber numberWithBool: makeActive];
if ([owner isEqualToString: login])
@@ -196,9 +189,8 @@
}
[ud synchronize];
[response setStatus: 204];
return response;
return [self responseWith204];
}
- (WOResponse *) activateFolderAction
+2
View File
@@ -30,6 +30,8 @@
@interface WODirectAction (SOGoExtension)
- (WOResponse *) responseWithStatus: (unsigned int) status;
- (WOResponse *) responseWith204;
- (WOResponse *) redirectToLocation: (NSString *) newLocation;
@end
+17 -2
View File
@@ -28,15 +28,30 @@
@implementation WODirectAction (SOGoExtension)
- (WOResponse *) redirectToLocation: (NSString *) newLocation
- (WOResponse *) responseWithStatus: (unsigned int) status
{
WOResponse *response;
response = [context response];
[response setStatus: 302 /* moved */];
[response setStatus: status];
return response;
}
- (WOResponse *) responseWith204
{
return [self responseWithStatus: 204];
}
- (WOResponse *) redirectToLocation: (NSString *) newLocation
{
WOResponse *response;
response = [self responseWithStatus: 302];
[response setHeader: newLocation forKey: @"location"];
return response;
}
@end
+8 -6
View File
@@ -52,8 +52,7 @@
WORequest *request;
folders = [self clientObject];
action = [NSString stringWithFormat: @"../%@/%@",
[folders defaultSourceName],
action = [NSString stringWithFormat: @"../personal/%@",
actionName];
request = [[self context] request];
@@ -82,7 +81,11 @@
name = [self queryParameterForKey: @"name"];
if ([name length] > 0)
response = [[self clientObject] newFolderWithName: name];
{
response = [[self clientObject] newFolderWithName: name];
if (!response)
response = [self responseWith204];
}
else
response = [NSException exceptionWithHTTPStatus: 400
reason: @"The name is missing"];
@@ -111,8 +114,7 @@
{
uid = [currentContact objectForKey: @"c_uid"];
if (uid && ![results objectForKey: uid])
[results setObject: currentContact
forKey: uid];
[results setObject: currentContact forKey: uid];
currentContact = [folderResults nextObject];
}
}
@@ -202,7 +204,7 @@
gcsFolders = [NSMutableArray new];
[gcsFolders autorelease];
contactSubfolders = [[contactFolders contactFolders] objectEnumerator];
contactSubfolders = [[contactFolders subFolders] objectEnumerator];
currentContactFolder = [contactSubfolders nextObject];
while (currentContactFolder)
{
+2 -1
View File
@@ -29,6 +29,7 @@
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/Contacts/SOGoContactFolder.h>
#import <SoObjects/Contacts/SOGoContactFolders.h>
#import "UIxContactsListViewContainer.h"
@@ -115,7 +116,7 @@
folderContainer = [[self clientObject] container];
return [folderContainer contactFolders];
return [folderContainer subFolders];
}
- (NSString *) currentContactFolderId
+1 -2
View File
@@ -108,8 +108,7 @@
rawFolders = [co allFolderPaths];
folders = [self _jsonFolders: [rawFolders objectEnumerator]];
response = [context response];
[response setStatus: 200];
response = [self responseWithStatus: 200];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: [folders jsonRepresentation]];
+29 -16
View File
@@ -94,10 +94,7 @@
response = [[self clientObject] trashInContext: context];
if (!response)
{
response = [context response];
[response setStatus: 204];
}
response = [self responseWith204];
return response;
}
@@ -113,10 +110,7 @@
response = [[self clientObject] moveToFolderNamed: destinationFolder
inContext: context];
if (!response)
{
response = [context response];
[response setStatus: 204];
}
response = [self responseWith204];
}
else
response = [NSException exceptionWithHTTPStatus: 500 /* Server Error */
@@ -125,6 +119,30 @@
return response;
}
/* active message */
- (id) markMessageUnreadAction
{
id response;
response = [[self clientObject] removeFlags: @"seen"];
if (!response)
response = [self responseWith204];
return response;
}
- (id) markMessageReadAction
{
id response;
response = [[self clientObject] addFlags: @"seen"];
if (!response)
response = [self responseWith204];
return response;
}
/* SOGoDraftObject */
- (WOResponse *) editAction
{
@@ -158,10 +176,7 @@
if (error)
response = error;
else
{
response = [context response];
[response setStatus: 204];
}
response = [self responseWith204];
return response;
}
@@ -171,17 +186,15 @@
WOResponse *response;
NSString *filename;
response = [context response];
filename = [[context request] formValueForKey: @"filename"];
if ([filename length] > 0)
{
response = [self responseWith204];
[[self clientObject] deleteAttachmentWithName: filename];
[response setStatus: 204];
}
else
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"How did you end up here?"];
}
+1 -4
View File
@@ -404,10 +404,7 @@ static NSArray *infoKeys = nil;
{
result = [[self clientObject] save];
if (!result)
{
result = [context response];
[result setStatus: 204];
}
result = [self responseWith204];
}
else
result = [self failedToSaveFormResponse];
+16 -21
View File
@@ -36,6 +36,8 @@
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <UI/Common/WODirectAction+SOGo.h>
#import "UIxMailFolderActions.h"
@implementation UIxMailFolderActions
@@ -49,7 +51,6 @@
NSString *folderName;
co = [self clientObject];
response = [context response];
folderName = [[context request] formValueForKey: @"name"];
if ([folderName length] > 0)
@@ -58,15 +59,15 @@
error = [connection createMailbox: folderName atURL: [co imap4URL]];
if (error)
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Unable to create folder."];
}
else
[response setStatus: 204];
response = [self responseWith204];
}
else
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Missing 'name' parameter."];
}
@@ -100,7 +101,6 @@
NSURL *srcURL, *destURL;
co = [self clientObject];
response = [context response];
folderName = [[context request] formValueForKey: @"name"];
if ([folderName length] > 0)
@@ -112,15 +112,15 @@
toURL: destURL];
if (error)
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Unable to rename folder."];
}
else
[response setStatus: 204];
response = [self responseWith204];
}
else
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Missing 'name' parameter."];
}
@@ -154,7 +154,6 @@
NSURL *srcURL, *destURL;
co = [self clientObject];
response = [context response];
connection = [co imap4Connection];
srcURL = [co imap4URL];
destURL = [self _trashedURLOfFolder: srcURL
@@ -164,11 +163,11 @@
toURL: destURL];
if (error)
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Unable to move folder."];
}
else
[response setStatus: 204];
response = [self responseWith204];
return response;
}
@@ -180,18 +179,17 @@
WOResponse *response;
co = [self clientObject];
response = [context response];
error = [co expunge];
if (error)
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Unable to expunge folder."];
}
else
{
[co flushMailCaches];
[response setStatus: 204];
response = [self responseWith204];
}
return response;
@@ -207,7 +205,6 @@
NSURL *currentURL;
co = [self clientObject];
response = [context response];
error = [co addFlagsToAllMessages: @"deleted"];
if (!error)
@@ -226,11 +223,11 @@
}
if (error)
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"Unable to empty the trash folder."];
}
else
[response setStatus: 204];
response = [self responseWith204];
return response;
}
@@ -242,7 +239,6 @@
WOResponse *response;
SOGoMailFolder *clientObject;
response = [context response];
mailInvitationParam
= [[context request] formValueForKey: @"mail-invitation"];
if ([mailInvitationParam boolValue])
@@ -257,7 +253,7 @@
}
else
{
[response setStatus: 500];
response = [self responseWithStatus: 500];
[response appendContentString: @"How did you end up here?"];
}
@@ -283,8 +279,7 @@
NGImap4Client *client;
NSString *responseString;
response = [context response];
[response setStatus: 200];
response = [self responseWithStatus: 200];
[response setHeader: @"text/plain; charset=UTF-8"
forKey: @"content-type"];
+16 -64
View File
@@ -221,10 +221,24 @@ static int attachmentFlagSize = 8096;
- (NSArray *) sortedUIDs
{
EOQualifier *fetchQualifier, *notDeleted;
if (!sortedUIDs)
{
notDeleted = [EOQualifier qualifierWithQualifierFormat:
@"(not (flags = %@))",
@"deleted"];
if (qualifier)
{
fetchQualifier = [[EOAndQualifier alloc] initWithQualifiers:
notDeleted, qualifier,
nil];
[fetchQualifier autorelease];
}
else
fetchQualifier = notDeleted;
sortedUIDs
= [[self clientObject] fetchUIDsMatchingQualifier: qualifier
= [[self clientObject] fetchUIDsMatchingQualifier: fetchQualifier
sortOrdering: [self imap4SortOrdering]];
[sortedUIDs retain];
}
@@ -407,36 +421,8 @@ static int attachmentFlagSize = 8096;
return [self redirectToLocation:url];
}
/* active message */
- (SOGoMailObject *) lookupActiveMessage
{
NSString *uid;
if ((uid = [[context request] formValueForKey: @"uid"]) == nil)
return nil;
return [[self clientObject] lookupName: uid
inContext: context
acquire: NO];
}
/* actions */
- (BOOL) isJavaScriptRequest
{
return [[[context request] formValueForKey:@"jsonly"] boolValue];
}
- (id) javaScriptOK
{
WOResponse *r;
r = [context response];
[r setStatus:200 /* OK */];
return r;
}
- (int) firstMessageOfPageFor: (int) messageNbr
{
NSArray *messageNbrs;
@@ -462,8 +448,7 @@ static int attachmentFlagSize = 8096;
if ([criteria isEqualToString: @"subject"])
qualifier = [EOQualifier qualifierWithQualifierFormat:
@"(subject doesContain: %@)",
value];
@"(subject doesContain: %@)", value];
else if ([criteria isEqualToString: @"sender"])
qualifier = [EOQualifier qualifierWithQualifierFormat:
@"(sender doesContain: %@)", value];
@@ -510,39 +495,6 @@ static int attachmentFlagSize = 8096;
return self;
}
- (id) viewAction
{
return [self defaultAction];
}
- (id) markMessageUnreadAction
{
NSException *error;
if ((error = [[self lookupActiveMessage] removeFlags:@"seen"]) != nil)
// TODO: improve error handling
return error;
if ([self isJavaScriptRequest])
return [self javaScriptOK];
return [self redirectToLocation:@"view"];
}
- (id) markMessageReadAction
{
NSException *error;
if ((error = [[self lookupActiveMessage] addFlags:@"seen"]) != nil)
// TODO: improve error handling
return error;
if ([self isJavaScriptRequest])
return [self javaScriptOK];
return [self redirectToLocation:@"view"];
}
- (id) getMailAction
{
// TODO: we might want to flush the caches?
+3 -2
View File
@@ -25,6 +25,8 @@
#import <Foundation/NSString.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <UI/Common/WODirectAction+SOGo.h>
#import "UIxMailSourceView.h"
@implementation UIxMailSourceView
@@ -36,8 +38,7 @@
source = [[self clientObject] contentAsString];
response = [context response];
[response setStatus: 200];
response = [self responseWithStatus: 200];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: source];
+30 -25
View File
@@ -142,37 +142,42 @@ static NSString *mailETag = nil;
- (id) defaultAction
{
WOResponse *response;
NSString *s;
/* check etag to see whether we really must rerender */
if (mailETag != nil ) {
/*
Note: There is one thing which *can* change for an existing message,
those are the IMAP4 flags (and annotations, which we do not use).
Since we don't render the flags, it should be OK, if this changes
we must embed the flagging into the etag.
*/
NSString *s;
if ((s = [[context request] headerForKey:@"if-none-match"])) {
if ([s rangeOfString:mailETag].length > 0) { /* not perfectly correct */
/* client already has the proper entity */
// [self logWithFormat:@"MATCH: %@ (tag %@)", s, mailETag];
if (![[self clientObject] doesMailExist]) {
return [NSException exceptionWithHTTPStatus:404 /* Not Found */
reason:@"message got deleted"];
if (mailETag)
{
/*
Note: There is one thing which *can* change for an existing message,
those are the IMAP4 flags (and annotations, which we do not use).
Since we don't render the flags, it should be OK, if this changes
we must embed the flagging into the etag.
*/
s = [[context request] headerForKey: @"if-none-match"];
if (s)
{
if ([s rangeOfString:mailETag].length > 0) /* not perfectly correct */
{
/* client already has the proper entity */
// [self logWithFormat:@"MATCH: %@ (tag %@)", s, mailETag];
if (![[self clientObject] doesMailExist]) {
return [NSException exceptionWithHTTPStatus:404 /* Not Found */
reason:@"message got deleted"];
}
response = [context response];
[response setStatus: 304 /* Not Modified */];
return response;
}
}
[[context response] setStatus:304 /* Not Modified */];
return [context response];
}
}
}
if ([self message] == nil) {
// TODO: redirect to proper error
if (![self message]) // TODO: redirect to proper error
return [NSException exceptionWithHTTPStatus:404 /* Not Found */
reason:@"did not find specified message!"];
}
return self;
}
+10 -10
View File
@@ -115,16 +115,6 @@
protectedBy = "View";
pageName = "UIxMailListView";
};
markMessageUnread = {
protectedBy = "View";
pageName = "UIxMailListView";
actionName = "markMessageUnread";
};
markMessageRead = {
protectedBy = "View";
pageName = "UIxMailListView";
actionName = "markMessageRead";
};
getMail = {
protectedBy = "View";
pageName = "UIxMailListView";
@@ -235,6 +225,16 @@
actionClass = "UIxMailActions";
actionName = "forward";
};
markMessageUnread = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "markMessageUnread";
};
markMessageRead = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "markMessageRead";
};
};
};
+1 -2
View File
@@ -69,7 +69,7 @@
auth = [[WOApplication application]
authenticatorInContext: context];
response = [context response];
response = [self responseWith204];
cookieString = [NSString stringWithFormat: @"%@:%@",
[self queryParameterForKey: @"userName"],
[self queryParameterForKey: @"password"]];
@@ -78,7 +78,6 @@
authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
value: cookieValue];
[authCookie setPath: @"/"];
[response setStatus: 204];
[response addCookie: authCookie];
return response;
+10 -8
View File
@@ -68,25 +68,25 @@
/* date selection */
- (NSCalendarDate *) selectedDate;
- (NSString *)dateStringForDate:(NSCalendarDate *)_date;
- (NSString *) dateStringForDate: (NSCalendarDate *)_date;
- (BOOL) hideFrame;
- (UIxComponent *) jsCloseWithRefreshMethod: (NSString *) methodName;
/* SoUser */
- (NSString *)shortUserNameForDisplay;
- (NSString *) shortUserNameForDisplay;
/* labels */
- (NSString *)labelForKey:(NSString *)_key;
- (NSString *) labelForKey:(NSString *)_key;
- (NSString *)localizedNameForDayOfWeek:(unsigned)_dayOfWeek;
- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek;
- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear;
- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear;
- (NSString *) localizedNameForDayOfWeek:(unsigned)_dayOfWeek;
- (NSString *) localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek;
- (NSString *) localizedNameForMonthOfYear:(unsigned)_monthOfYear;
- (NSString *) localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear;
/* HTTP method safety */
- (BOOL)isInvokedBySafeMethod;
- (BOOL) isInvokedBySafeMethod;
/* locale */
- (NSDictionary *)locale;
@@ -95,6 +95,8 @@
- (WOResourceManager *) pageResourceManager;
- (NSString *) urlForResourceFilename: (NSString *) filename;
- (WOResponse *) responseWith204;
/* Debugging */
- (BOOL)isUIxDebugEnabled;
+11 -1
View File
@@ -400,7 +400,7 @@ static BOOL uixDebugEnabled = NO;
userTimeZone = [[context activeUser] timeZone];
[_date setTimeZone: userTimeZone];
return [_date descriptionWithCalendarFormat:@"%Y%m%d"];
return [_date descriptionWithCalendarFormat: @"%Y%m%d"];
}
- (BOOL) hideFrame
@@ -569,6 +569,16 @@ static BOOL uixDebugEnabled = NO;
return url;
}
- (WOResponse *) responseWith204
{
WOResponse *response;
response = [context response];
[response setStatus: 204];
return response;
}
/* debugging */
- (BOOL)isUIxDebugEnabled {
+3 -2
View File
@@ -39,6 +39,8 @@
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <UI/Common/WODirectAction+SOGo.h>
#import "NSArray+Scheduler.h"
#import "UIxCalListingActions.h"
@@ -289,10 +291,9 @@
{
WOResponse *response;
response = [context response];
response = [self responseWithStatus: 200];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response setStatus: 200];
[response appendContentString: [data jsonRepresentation]];
return response;
@@ -63,7 +63,6 @@
var:class="messageSubjectCellStyleClass"
var:id="msgDivID"
><var:string value="message.envelope.subject"
formatter="context.mailSubjectFormatter"
/></td
><td class="messageAddressColumn"
+1 -1
View File
@@ -149,7 +149,7 @@ function openMessageWindowsForSelection(action, firstOnly) {
function mailListMarkMessage(event) {
var http = createHTTPClient();
var url = ApplicationBaseURL + currentMailbox + "/" + action + "?uid=" + msguid;
var url = ApplicationBaseURL + currentMailbox + "/" + msguid + "/" + action;
if (http) {
// TODO: add parameter to signal that we are only interested in OK