From: helge Date: Wed, 6 Jul 2005 15:50:40 +0000 (+0000) Subject: improved error handling in mail-view X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e765e2551f20f189d66404336b9df5c06506351a;p=scalable-opengroupware.org improved error handling in mail-view git-svn-id: http://svn.opengroupware.org/SOGo/trunk@670 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index 48862a75..ce1bdbb7 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,3 +1,14 @@ +2005-07-06 Helge Hess + + * v0.9.124 + + * UIxMailView.m: improved error handling in case the delete flag could + not be set + + * UIxMailMainFrame.m: added -hasErrorText / -errorText / + -errorAlertJavaScript methods to deal with errors encoded in the + 'error' form parameter + 2005-03-24 Helge Hess * v0.9.123 diff --git a/SOGo/UI/MailerUI/README b/SOGo/UI/MailerUI/README index 60b6beb3..7d61fac7 100644 --- a/SOGo/UI/MailerUI/README +++ b/SOGo/UI/MailerUI/README @@ -20,6 +20,45 @@ UIxMailMainFrame.wox UIxMailTree.wox UIxMailView.wox +Class Hierarchy +=============== + +[NSObject] + MailerUIProduct + [WOComponent] + [SoComponent] + + UIxFilterList + UIxMailAccountView + UIxMailAccountsView + UIxMailAddressbook + UIxMailEditor + (Scheduler_Privates) + UIxMailListView + UIxMailMainFrame + UIxMailToSelection + UIxMailToolbar + UIxMailTree + UIxMailView + UIxSieveEditor + UIxMailSortableTableHeader + UIxMailEditorAttach.m + UIxMailFilterPanel + UIxMailMoveToPopUp + UIxMailWindowCloser + [WODirectAction] + UIxMailEditorAction + UIxMailForwardAction + UIxMailReplyAction + [NSFormatter] + UIxMailFormatter + UIxMailDateFormatter + UIxSubjectFormatter + UIxEnvelopeAddressFormatter + UIxMailTreeBlock + [WOContext] + (UIxMailer) + Defaults ======== diff --git a/SOGo/UI/MailerUI/UIxMailMainFrame.m b/SOGo/UI/MailerUI/UIxMailMainFrame.m index 1917e7c4..5a4ced7e 100644 --- a/SOGo/UI/MailerUI/UIxMailMainFrame.m +++ b/SOGo/UI/MailerUI/UIxMailMainFrame.m @@ -158,4 +158,30 @@ static NSString *treeRootClassName = nil; 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: + @"", errorText]; +} + @end /* UIxMailMainFrame */ diff --git a/SOGo/UI/MailerUI/UIxMailView.m b/SOGo/UI/MailerUI/UIxMailView.m index 917feebe..ffe89b11 100644 --- a/SOGo/UI/MailerUI/UIxMailView.m +++ b/SOGo/UI/MailerUI/UIxMailView.m @@ -121,19 +121,37 @@ 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]) { @@ -144,12 +162,8 @@ [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 { diff --git a/SOGo/UI/Templates/MailerUI/UIxMailMainFrame.wox b/SOGo/UI/Templates/MailerUI/UIxMailMainFrame.wox index 6e80dcf9..8b183415 100644 --- a/SOGo/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/SOGo/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -91,6 +91,8 @@ + +