mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-24 04:45:24 +00:00
Monotone-Parent: 426b535e2da36fbf5368515550e8353fd5148bc7
Monotone-Revision: 325588b39d451a573e15dab87f6ccb9fd342a2f0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-09-10T15:08:32 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -201,119 +201,6 @@ static NSString *mailETag = nil;
|
||||
return [self redirectToLocation: url];
|
||||
}
|
||||
|
||||
- (id) deleteAction
|
||||
{
|
||||
NSException *ex;
|
||||
|
||||
if (![self isDeletableClientObject]) {
|
||||
return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
|
||||
reason:@"method cannot be invoked on "
|
||||
@"the specified object"];
|
||||
}
|
||||
|
||||
if ([self isInvokedBySafeMethod]) {
|
||||
// TODO: fix UI to use POST for unsafe actions
|
||||
[self logWithFormat:@"WARNING: method is invoked using safe HTTP method!"];
|
||||
}
|
||||
|
||||
if ((ex = [[self clientObject] delete]) != nil) {
|
||||
id url;
|
||||
|
||||
url = [[ex reason] stringByEscapingURL];
|
||||
url = [@"view?error=" stringByAppendingString:url];
|
||||
return [self redirectToLocation:url];
|
||||
//return ex;
|
||||
}
|
||||
|
||||
if (![self isInlineViewer]) {
|
||||
// if everything is ok, close the window (send a JS closing the Window)
|
||||
id page;
|
||||
|
||||
page = [self pageWithName:@"UIxMailWindowCloser"];
|
||||
[page takeValue:@"YES" forKey:@"refreshOpener"];
|
||||
return page;
|
||||
}
|
||||
|
||||
return [self redirectToParentFolder];
|
||||
}
|
||||
|
||||
- (id) trashAction
|
||||
{
|
||||
NSException *ex;
|
||||
|
||||
if ([self isInvokedBySafeMethod]) {
|
||||
// TODO: fix UI to use POST for unsafe actions
|
||||
[self logWithFormat:@"WARNING: method is invoked using safe HTTP method!"];
|
||||
}
|
||||
|
||||
if ((ex = [[self clientObject] trashInContext:context]) != nil) {
|
||||
id url;
|
||||
|
||||
if ([[[context request] formValueForKey:@"jsonly"] boolValue])
|
||||
/* called using XMLHttpRequest */
|
||||
return ex;
|
||||
|
||||
url = [[ex reason] stringByEscapingURL];
|
||||
url = [@"view?error=" stringByAppendingString:url];
|
||||
return [self redirectToLocation:url];
|
||||
}
|
||||
|
||||
if ([[[context request] formValueForKey:@"jsonly"] boolValue]) {
|
||||
/* called using XMLHttpRequest */
|
||||
[[context response] setStatus:200 /* OK */];
|
||||
return [context response];
|
||||
}
|
||||
|
||||
if (![self isInlineViewer]) {
|
||||
// if everything is ok, close the window (send a JS closing the Window)
|
||||
id page;
|
||||
|
||||
page = [self pageWithName:@"UIxMailWindowCloser"];
|
||||
[page takeValue:@"YES" forKey:@"refreshOpener"];
|
||||
return page;
|
||||
}
|
||||
|
||||
return [self redirectToParentFolder];
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) moveAction
|
||||
{
|
||||
id <WOActionResults> result;
|
||||
NSString *destinationFolder;
|
||||
id url;
|
||||
|
||||
if ([self isInvokedBySafeMethod]) {
|
||||
// TODO: fix UI to use POST for unsafe actions
|
||||
[self logWithFormat:@"WARNING: method is invoked using safe HTTP method!"];
|
||||
}
|
||||
|
||||
destinationFolder = [self queryParameterForKey: @"tofolder"];
|
||||
if ([destinationFolder length] > 0)
|
||||
{
|
||||
result = [[self clientObject] moveToFolderNamed: destinationFolder
|
||||
inContext: context];
|
||||
if (result)
|
||||
{
|
||||
if (![[[context request] formValueForKey:@"jsonly"] boolValue])
|
||||
{
|
||||
url = [NSString stringWithFormat: @"view?error=%@",
|
||||
[[result reason] stringByEscapingURL]];
|
||||
result = [self redirectToLocation: url];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = [context response];
|
||||
[result setStatus: 200];
|
||||
}
|
||||
}
|
||||
else
|
||||
result = [NSException exceptionWithHTTPStatus:500 /* Server Error */
|
||||
reason: @"No destination folder given"];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* generating response */
|
||||
|
||||
- (void) appendToResponse: (WOResponse *) _response
|
||||
|
||||
Reference in New Issue
Block a user