Monotone-Parent: 48ab3ba04ae37aa55ddec9a67b39c8be57786c6d

Monotone-Revision: 66fc4d9ee925358de80c05092a80e0b39ae6c95d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-11T19:41:40
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-09-11 19:41:40 +00:00
parent 956f628360
commit f2e7a70a2c
5 changed files with 54 additions and 88 deletions
+14
View File
@@ -1,5 +1,19 @@
2007-09-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailActions.m ([UIxMailActions -markMessageUnreadAction])
([UIxMailActions -markMessageReadAction]): new methods moved from
UIxMailListView and adapted to invoke the client object directly,
since the previous versions had to to a lookup from the parent
SOGoMailFolder.
* UI/MailerUI/UIxMailListView.m ([-markMessageUnreadAction]): move
method into UIxMailActions.
([-markMessageReadAction]): same as above.
([-viewAction]): removed useless method.
([-javaScriptOK]): removed useless method.
([-isJavaScriptRequest]): removed useless method.
([-lookupActiveMessage]): removed useless method.
* UI/Common/WODirectAction+SOGo.m ([WODirectAction
-responseWithStatus:status]): new method that returns a WOResponse
initialized with the specified status code.
+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?"];
}
-61
View File
@@ -421,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;
@@ -523,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?
+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 -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