From 19ea16d5baf13db6aa88e70b1e0a010e4018db20 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 29 May 2012 14:20:06 +0000 Subject: [PATCH] See ChangeLog. Monotone-Parent: 0bc4e04aaead15b626a732a223ebf47ee22e73f0 Monotone-Revision: 28cde64403e65a1ebeda3a984650fd31d8614f29 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-05-29T14:20:06 --- ChangeLog | 15 ++++ UI/MailPartViewers/UIxMailPartMessageViewer.m | 2 +- UI/MailerUI/English.lproj/Localizable.strings | 6 +- UI/MailerUI/UIxMailEditor.m | 5 +- UI/MailerUI/UIxMailListActions.m | 2 +- UI/MailerUI/UIxMailView.m | 2 - UI/WebServerResources/ContactsUI.js | 19 ----- UI/WebServerResources/UIxMailEditor.css | 2 +- UI/WebServerResources/UIxMailEditor.js | 76 +++++++++---------- 9 files changed, 57 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2321bbc06..d31ae0065 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2012-05-29 Francis Lachapelle + + * UI/WebServerResources/UIxMailEditor.js (validateEditorInput): + merged with onValidate. + (onValidate): don't force the subject to be defined, but alert + the user. + + * UI/MailerUI/UIxMailView.m (-messageSubject): don't set the + subject to "Untitled" if it's not set. + + * UI/MailPartViewers/UIxMailPartMessageViewer.m (-messageSubject): idem. + + * UI/MailerUI/UIxMailEditor.m (-validateForSend): don't force the + subject to be defined. + 2012-05-28 Francis Lachapelle * UI/WebServerResources/SchedulerUI.js (validateUploadForm): hide diff --git a/UI/MailPartViewers/UIxMailPartMessageViewer.m b/UI/MailPartViewers/UIxMailPartMessageViewer.m index 0fd3a7c90..7e18cb703 100644 --- a/UI/MailPartViewers/UIxMailPartMessageViewer.m +++ b/UI/MailPartViewers/UIxMailPartMessageViewer.m @@ -165,7 +165,7 @@ subject = [baseSubject decodedHeader]; if (![subject length]) - subject = [self labelForKey: @"Untitled"]; + subject = @""; return subject; } diff --git a/UI/MailerUI/English.lproj/Localizable.strings b/UI/MailerUI/English.lproj/Localizable.strings index ae23ec20e..4ae64d679 100644 --- a/UI/MailerUI/English.lproj/Localizable.strings +++ b/UI/MailerUI/English.lproj/Localizable.strings @@ -283,9 +283,9 @@ = "The messages could not be moved to the trash folder. Would you like to delete them immediately?"; /* Message editing */ -"error_validationfailed" = "Validation failed"; -"error_missingsubject" = "Subject is missing"; -"error_missingrecipients" = "No recipients specified"; +"error_missingsubject" = "The message has no subject. Are you sure you want to send it?"; +"error_missingrecipients" = "Please specify at least one recipient."; +"Send Anyway" = "Send Anyway"; /* Message sending */ "cannot send message: (smtp) all recipients discarded" = "Cannot send message: all recipients are invalid."; diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index aa32a7a59..95609e19b 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -653,10 +653,7 @@ static NSArray *infoKeys = nil; if (![self hasOneOrMoreRecipients]) error = [NSException exceptionWithHTTPStatus: 400 /* Bad Request */ - reason: @"Please select a recipient!"]; - else if ([[self subject] length] == 0) - error = [NSException exceptionWithHTTPStatus: 400 /* Bad Request */ - reason: @"Please set a subject!"]; + reason: [self labelForKey: @"error_missingrecipients"]]; else error = nil; diff --git a/UI/MailerUI/UIxMailListActions.m b/UI/MailerUI/UIxMailListActions.m index 240b175c0..b6c2e6e4e 100644 --- a/UI/MailerUI/UIxMailListActions.m +++ b/UI/MailerUI/UIxMailListActions.m @@ -192,7 +192,7 @@ baseSubject = [[message valueForKey: @"envelope"] subject]; subject = [baseSubject decodedHeader]; if (![subject length]) - subject = [self labelForKey: @"Untitled"]; + subject = @""; return [subject stringByEscapingHTMLString]; } diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index f9d104dce..48dac90ba 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -96,8 +96,6 @@ static NSString *mailETag = nil; NSString *subject; subject = [[self clientObject] decodedSubject]; - if (![subject length]) - subject = [self labelForKey: @"Untitled"]; return subject; } diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 7a87247da..f836a7166 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -12,25 +12,6 @@ var Contact = { deleteContactsRequestCount: null }; -function validateEditorInput(sender) { - var errortext = ""; - var field; - - field = document.pageform.subject; - if (field.value == "") - errortext = errortext + labels.error_missingsubject + "\n"; - - if (!hasRecipients()) - errortext = errortext + labels.error_missingrecipients + "\n"; - - if (errortext.length > 0) { - alert(labels.error_validationfailed + ":\n" - + errortext); - return false; - } - return true; -} - function openContactsFolder(contactsFolder, reload, idx) { if ((contactsFolder && contactsFolder != Contact.currentAddressBook) || reload) { diff --git a/UI/WebServerResources/UIxMailEditor.css b/UI/WebServerResources/UIxMailEditor.css index 7d047bea8..bb3374a7b 100644 --- a/UI/WebServerResources/UIxMailEditor.css +++ b/UI/WebServerResources/UIxMailEditor.css @@ -237,7 +237,7 @@ TABLE#contactsList TD#mailHeader DIV.contactSelection { - z-index: 10; + z-index: 1; background: inherit; position: absolute; bottom: 0em; diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 0f12384e2..31bd83a45 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -107,51 +107,45 @@ function insertContact(inputNode, contactName, contactEmail) { /* mail editor */ -function validateEditorInput() { - var errortext = ""; - var field; - - field = document.pageform.subject; - if (field.value == "") - errortext = errortext + _("error_missingsubject") + "\n"; - - if (!hasRecipients()) - errortext = errortext + _("error_missingrecipients") + "\n"; - - if (errortext.length > 0) { - alert(_("error_validationfailed") + ":\n" + errortext); - return false; +function onValidate(onSuccess) { + if (document.pageform.action != "send") { + + if (!hasRecipients()) { + showAlertDialog(_("error_missingrecipients")); + } + else if (document.pageform.subject.value == "") { + showConfirmDialog(_("Warning"), _("error_missingsubject"), onValidateDone.bind(this, onSuccess), null, _("Send anyway"), _("Cancel")); + } + else { + onValidateDone(onSuccess); + } } - - return true; } -function onValidate(event) { - var rc = false; +function onValidateDone(onSuccess) { + var input = currentAttachmentInput(); + if (input) + input.parentNode.removeChild(input); - if (document.pageform.action != "send" - && validateEditorInput()) { - var input = currentAttachmentInput(); - if (input) - input.parentNode.removeChild(input); - - var toolbar = document.getElementById("toolbar"); - if (!document.busyAnim) - document.busyAnim = startAnimation(toolbar); - - var lastRow = $("lastRow"); - lastRow.down("select").name = "popup_last"; + var toolbar = document.getElementById("toolbar"); + if (!document.busyAnim) + document.busyAnim = startAnimation(toolbar); - window.shouldPreserve = true; + var lastRow = $("lastRow"); + lastRow.down("select").name = "popup_last"; + + window.shouldPreserve = true; + + document.pageform.action = "send"; + + AIM.submit($(document.pageform), {'onComplete' : onPostComplete}); + + if (typeof onSuccess == 'function') + onSuccess(); - document.pageform.action = "send"; + disposeDialog(); - AIM.submit($(document.pageform), {'onComplete' : onPostComplete}); - - rc = true; - } - - return rc; + return true; } function onPostComplete(response) { @@ -184,9 +178,9 @@ function onPostComplete(response) { } function clickedEditorSend() { - if (onValidate()) { - document.pageform.submit(); - } + onValidate(function() { + document.pageform.submit(); + }); return false; }