return NO;
}
+- (id)redirectToParentFolder {
+ id url;
+
+ url = [[[self clientObject] container] baseURLInContext:[self context]];
+ 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) {
// TODO: improve error handling
+ id url;
+
[self debugWithFormat:@"failed to delete: %@", ex];
- return ex;
+
+ url = [[ex reason] stringByEscapingURL];
+ url = [@"view?error=" stringByAppendingString:url];
+ return [self redirectToLocation:url];
+ //return ex;
}
if (![self isInlineViewer]) {
[page takeValue:@"YES" forKey:@"refreshOpener"];
return page;
}
- else {
- id url;
-
- url = [[[self clientObject] container] baseURLInContext:[self context]];
- return [self redirectToLocation:url];
- }
+
+ return [self redirectToParentFolder];
}
- (id)getMailAction {