From 746063a94038d872f1bbc1602dd201ba88e9f6ec Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:23:17 +0000 Subject: [PATCH 1/9] Monotone-Parent: 7ee0c1dd084226bd61d44f69428903723aac6bbc Monotone-Revision: 99aecefc3b45bf70dccf3bc8c5f60e6017e3935b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:23:17 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++ SoObjects/Mailer/NSData+Mail.h | 36 ++++++++++++++++++++++ SoObjects/Mailer/NSData+Mail.m | 55 ++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 SoObjects/Mailer/NSData+Mail.h create mode 100644 SoObjects/Mailer/NSData+Mail.m diff --git a/ChangeLog b/ChangeLog index 9cc24ef9f..42ab637ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-10-25 Wolfgang Sourdeau + + * SoObjects/Mailer/NSData+Mail.[hm]: new extension module that + extends the NSData class with utility methods useful for handling + mail. + 2007-10-23 Wolfgang Sourdeau * SoObjects/SOGo/NSArray+Utilities.m diff --git a/SoObjects/Mailer/NSData+Mail.h b/SoObjects/Mailer/NSData+Mail.h new file mode 100644 index 000000000..45e033f74 --- /dev/null +++ b/SoObjects/Mailer/NSData+Mail.h @@ -0,0 +1,36 @@ +/* NSData+Mail.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef NSDATA_MAIL_H +#define NSDATA_MAIL_H + +#import + +@class NSString; + +@interface NSData (SOGoMailUtilities) + +- (NSData *) bodyDataFromEncoding: (NSString *) encoding; + +@end + +#endif /* NSDATA_MAIL_H */ diff --git a/SoObjects/Mailer/NSData+Mail.m b/SoObjects/Mailer/NSData+Mail.m new file mode 100644 index 000000000..eb3051f6f --- /dev/null +++ b/SoObjects/Mailer/NSData+Mail.m @@ -0,0 +1,55 @@ +/* NSData+Mail.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +#import +#import + +#import "NSData+Mail.h" + +@implementation NSData (SOGoMailUtilities) + +- (NSData *) bodyDataFromEncoding: (NSString *) encoding +{ + NSString *realEncoding; + NSData *decodedData; + + realEncoding = [encoding lowercaseString]; + + if ([realEncoding isEqualToString: @"7bit"] + || [realEncoding isEqualToString: @"8bit"]) + decodedData = self; + else if ([realEncoding isEqualToString: @"base64"]) + decodedData = [self dataByDecodingBase64]; + else if ([realEncoding isEqualToString: @"quoted-printable"]) + decodedData = [self dataByDecodingQuotedPrintable]; + else + { + decodedData = nil; + NSLog (@"encoding '%@' unknown, returning nil data", realEncoding); + } + + return decodedData; +} + +@end From 854ee96841c727f94954733e3d9742d248ebdf66 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:23:25 +0000 Subject: [PATCH 2/9] Monotone-Parent: 99aecefc3b45bf70dccf3bc8c5f60e6017e3935b Monotone-Revision: f6dcf8a9dfda51ed37550dae7830efbd1d417317 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:23:25 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/GNUmakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SoObjects/Mailer/GNUmakefile b/SoObjects/Mailer/GNUmakefile index cc04cf258..381e3fbdd 100644 --- a/SoObjects/Mailer/GNUmakefile +++ b/SoObjects/Mailer/GNUmakefile @@ -30,7 +30,9 @@ Mailer_OBJC_FILES += \ SOGoDraftsFolder.m \ SOGoDraftObject.m \ \ - SOGoMailForward.m + SOGoMailForward.m \ + \ + NSData+Mail.m Mailer_RESOURCE_FILES += \ Version \ From ec5b15c2bb2be4e1ff58f4944b8eaff805ab0cdb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:25:39 +0000 Subject: [PATCH 3/9] Monotone-Parent: f6dcf8a9dfda51ed37550dae7830efbd1d417317 Monotone-Revision: a0db3f538581c7b491b49f0e21b754544b33477b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:25:39 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++ SoObjects/Mailer/SOGoDraftObject.m | 51 +++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42ab637ac..ee6cebee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-10-25 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject + -fetchMailForEditing:sourceMail]): work-around a bug in SOPE-mime + where only the body part of the first of the keys fetched was + returned. Also decodes the body parts properly following their + encoding. + * SoObjects/Mailer/NSData+Mail.[hm]: new extension module that extends the NSData class with utility methods useful for handling mail. diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 3aa25f15e..2cc71010e 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -56,6 +56,8 @@ #import #import #import + +#import "NSData+Mail.h" #import "SOGoMailAccount.h" #import "SOGoMailFolder.h" #import "SOGoMailObject.h" @@ -411,30 +413,49 @@ static BOOL showTextAttachmentsInline = NO; } } +- (NSArray *) _attachmentBodiesFromPaths: (NSArray *) paths + fromResponseFetch: (NSDictionary *) fetch; +{ + NSEnumerator *attachmentKeys; + NSMutableArray *bodies; + NSString *currentKey; + NSDictionary *body; + + bodies = [NSMutableArray array]; + + attachmentKeys = [paths objectEnumerator]; + while ((currentKey = [attachmentKeys nextObject])) + { + body = [fetch objectForKey: [currentKey lowercaseString]]; + [bodies addObject: [body objectForKey: @"data"]]; + } + + return bodies; +} + - (void) _fetchAttachments: (NSArray *) parts fromMail: (SOGoMailObject *) sourceMail { unsigned int count, max; - NSDictionary *currentPart, *attachment, *body; - NSArray *paths, *result; + NSArray *paths, *bodies; + NSData *body; + NSDictionary *currentInfo; + NGHashMap *response; max = [parts count]; if (max > 0) { paths = [parts keysWithFormat: @"BODY[%{path}]"]; - result = [[sourceMail fetchParts: paths] objectForKey: @"fetch"]; + response = [[sourceMail fetchParts: paths] objectForKey: @"RawResponse"]; + bodies = [self _attachmentBodiesFromPaths: paths + fromResponseFetch: [response objectForKey: @"fetch"]]; for (count = 0; count < max; count++) { - currentPart = [parts objectAtIndex: count]; - body = [[result objectAtIndex: count] objectForKey: @"body"]; - attachment = [NSDictionary dictionaryWithObjectsAndKeys: - [currentPart objectForKey: @"filename"], - @"filename", - [currentPart objectForKey: @"mimetype"], - @"mime-type", - nil]; - [self saveAttachment: [body objectForKey: @"data"] - withMetadata: attachment]; + currentInfo = [parts objectAtIndex: count]; + body = [[bodies objectAtIndex: count] + bodyDataFromEncoding: [currentInfo + objectForKey: @"encoding"]]; + [self saveAttachment: body withMetadata: currentInfo]; } } } @@ -529,7 +550,7 @@ static BOOL showTextAttachmentsInline = NO; // error = [newDraft saveAttachment:content withName:@"forward.mail"]; attachment = [NSDictionary dictionaryWithObjectsAndKeys: [sourceMail filenameForForward], @"filename", - @"message/rfc822", @"mime-type", + @"message/rfc822", @"mimetype", nil]; [self saveAttachment: [sourceMail content] withMetadata: attachment]; @@ -639,7 +660,7 @@ static BOOL showTextAttachmentsInline = NO; reason: @"Could not write attachment to draft!"]; } - mimeType = [metadata objectForKey: @"mime-type"]; + mimeType = [metadata objectForKey: @"mimetype"]; if ([mimeType length] > 0) { p = [self pathToAttachmentWithName: From 0b7a73dc68f7583d5566a7aae161ac1534385f87 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:26:54 +0000 Subject: [PATCH 4/9] Monotone-Parent: a0db3f538581c7b491b49f0e21b754544b33477b Monotone-Revision: a8160f433740ec8b2a14452d63e845319427b8a9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:26:54 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 +++ SoObjects/Mailer/SOGoMailObject.m | 42 +++++++++++++------------------ 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee6cebee9..45ee2293e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-10-25 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject + -stringForData:_datapartInfo:_info]): simplified by invoking + -bodyDataFromEncoding: from our new NSData category methods. + * SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject -fetchMailForEditing:sourceMail]): work-around a bug in SOPE-mime where only the body part of the first of the keys fetched was diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index cd2e8d481..86eb94e8e 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -31,10 +31,8 @@ #import #import #import -#import #import #import -#import #import #import #import @@ -44,6 +42,8 @@ #import #import + +#import "NSData+Mail.h" #import "SOGoMailFolder.h" #import "SOGoMailAccount.h" #import "SOGoMailManager.h" @@ -619,37 +619,29 @@ static BOOL debugSoParts = NO; } /* convert parts to strings */ - - (NSString *) stringForData: (NSData *) _data partInfo: (NSDictionary *) _info { - NSString *charset, *encoding, *s; + NSString *charset, *s; NSData *mailData; - if (![_data isNotNull]) - return nil; - - s = nil; - - encoding = [[_info objectForKey: @"encoding"] lowercaseString]; - - if ([encoding isEqualToString: @"7bit"] - || [encoding isEqualToString: @"8bit"]) - mailData = _data; - else if ([encoding isEqualToString: @"base64"]) - mailData = [_data dataByDecodingBase64]; - else if ([encoding isEqualToString: @"quoted-printable"]) - mailData = [_data dataByDecodingQuotedPrintable]; - - charset = [[_info valueForKey: @"parameterList"] valueForKey: @"charset"]; - if (![charset length]) + if ([_data isNotNull]) { - s = [[NSString alloc] initWithData:mailData encoding:NSUTF8StringEncoding]; - [s autorelease]; + mailData + = [_data bodyDataFromEncoding: [_info objectForKey: @"encoding"]]; + + charset = [[_info valueForKey: @"parameterList"] valueForKey: @"charset"]; + if (![charset length]) + { + s = [[NSString alloc] initWithData: mailData encoding: NSUTF8StringEncoding]; + [s autorelease]; + } + else + s = [NSString stringWithData: mailData + usingEncodingNamed: charset]; } else - s = [NSString stringWithData: mailData - usingEncodingNamed: charset]; + s = nil; return s; } From 3c1bb5f1d8c6a91388cf931d78167306430e4f60 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:28:06 +0000 Subject: [PATCH 5/9] Monotone-Parent: a8160f433740ec8b2a14452d63e845319427b8a9 Monotone-Revision: 6942fad37af1688fabf9fedce658eafff7ae9cf7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:28:06 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ SoObjects/Mailer/SOGoMailObject+Draft.m | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45ee2293e..20e432708 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-10-25 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject + -fetchFileAttachmentKeys]): fetch the attachment encoding as well. + * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject -stringForData:_datapartInfo:_info]): simplified by invoking -bodyDataFromEncoding: from our new NSData category methods. diff --git a/SoObjects/Mailer/SOGoMailObject+Draft.m b/SoObjects/Mailer/SOGoMailObject+Draft.m index 18e6e0f2f..ebe7e04a7 100644 --- a/SoObjects/Mailer/SOGoMailObject+Draft.m +++ b/SoObjects/Mailer/SOGoMailObject+Draft.m @@ -232,20 +232,22 @@ intoArray: (NSMutableArray *) keys withPath: (NSString *) path { - NSDictionary *parameters, *currentFile; + NSDictionary *disposition, *currentFile; NSString *filename, *mimeType; - parameters = [[part objectForKey: @"disposition"] - objectForKey: @"parameterList"]; - if (parameters) + disposition = [part objectForKey: @"disposition"]; + filename = [[disposition objectForKey: @"parameterList"] + objectForKey: @"filename"]; + if (filename) { - filename = [parameters objectForKey: @"filename"]; mimeType = [NSString stringWithFormat: @"%@/%@", [part objectForKey: @"type"], [part objectForKey: @"subtype"]]; currentFile = [NSDictionary dictionaryWithObjectsAndKeys: filename, @"filename", [mimeType lowercaseString], @"mimetype", + [part + objectForKey: @"encoding"], @"encoding", path, @"path", nil]; [keys addObject: currentFile]; } From 52cee6495ac61057405d305914d14917b8a405d8 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:28:14 +0000 Subject: [PATCH 6/9] Monotone-Parent: 6942fad37af1688fabf9fedce658eafff7ae9cf7 Monotone-Revision: 324953981461ad15df80c3193646a4ca4e57d5b5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:28:14 Monotone-Branch: ca.inverse.sogo --- UI/MailerUI/UIxMailEditor.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index a2eb9ee00..2950bd39d 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -280,13 +280,14 @@ static NSArray *infoKeys = nil; for (count = 0; count < max; count++) { part = [parts objectAtIndex: count]; - header = (NGMimeContentDispositionHeaderField *) [part headerForKey: @"content-disposition"]; - mimeType = [(NGMimeType *) [part headerForKey: @"content-type"] stringValue]; + header = (NGMimeContentDispositionHeaderField *) + [part headerForKey: @"content-disposition"]; + mimeType = [(NGMimeType *) + [part headerForKey: @"content-type"] stringValue]; attachment = [NSDictionary dictionaryWithObjectsAndKeys: [header filename], @"filename", - mimeType, @"mime-type", nil]; - [filenames setObject: attachment - forKey: [header name]]; + mimeType, @"mimetype", nil]; + [filenames setObject: attachment forKey: [header name]]; } return filenames; From cbd3b01764aad15288671a0ffe0891a7ddd3d651 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 15:28:59 +0000 Subject: [PATCH 7/9] Monotone-Parent: 324953981461ad15df80c3193646a4ca4e57d5b5 Monotone-Revision: 5510a075ff0317a22da3bd5c546abb2ce9386a21 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T15:28:59 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 20e432708..1fd10a59b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-10-25 Wolfgang Sourdeau + * SoObjects/Mailer/NSData+Mail.m ([NSData + -bodyDataFromEncoding:encoding]): new utility method that decodes + the NSData instance properly depending on the encoding string + passed as parameter. + * SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject -fetchFileAttachmentKeys]): fetch the attachment encoding as well. From bd499b0c88848077906d165d9ce14954f8fd8710 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 17:34:27 +0000 Subject: [PATCH 8/9] Monotone-Parent: aac6a8a6798d9e703464623588abec8ba095b7e3 Monotone-Revision: df36a823f379fbf4d30f5a90eb58b5634c9c54c2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T17:34:27 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxMailEditor.js | 60 ++++++++++++++++---------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 5e94ed0b2..22bb86ff6 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -143,6 +143,10 @@ function clickedEditorSend(sender) { if (!validateEditorInput(sender)) return false; + var input = currentAttachmentInput(); + if (input) + input.parentNode.removeChild(input); + window.shouldPreserve = true; document.pageform.action = "send"; document.pageform.submit(); @@ -150,30 +154,39 @@ function clickedEditorSend(sender) { return false; } -function clickedEditorAttach(sender) { - var area = $("attachmentsArea"); +function currentAttachmentInput() { + var input = null; - if (!area.style.display) { - area.setStyle({ display: "block" }); - onWindowResize(null); - } - - var inputs = area.getElementsByTagName("input"); - - // Verify if there's already a visible file input field - for (var i = 0; i < inputs.length; i++) + var inputs = $("attachmentsArea").getElementsByTagName("input"); + var i = 0; + while (!input && i < inputs.length) if ($(inputs[i]).hasClassName("currentAttachment")) - return false; - - // Add new file input field - var attachmentName = "attachment" + inputs.length; - var newAttachment = createElement("input", attachmentName, - "currentAttachment", null, - { type: "file", - name: attachmentName }, - area); - Event.observe(newAttachment, "change", - onAttachmentChange.bindAsEventListener(newAttachment)); + input = inputs[i]; + else + i++; + + return input; +} + +function clickedEditorAttach(sender) { + var input = currentAttachmentInput(); + if (!input) { + var area = $("attachmentsArea"); + + if (!area.style.display) { + area.setStyle({ display: "block" }); + onWindowResize(null); + } + var inputs = area.getElementsByTagName("input"); + var attachmentName = "attachment" + inputs.length; + var newAttachment = createElement("input", attachmentName, + "currentAttachment", null, + { type: "file", + name: attachmentName }, + area); + Event.observe(newAttachment, "change", + onAttachmentChange.bindAsEventListener(newAttachment)); + } return false; } @@ -211,6 +224,9 @@ function createAttachment(node, list) { } function clickedEditorSave(sender) { + var input = currentAttachmentInput(); + if (input) + input.parentNode.removeChild(input); window.shouldPreserve = true; document.pageform.action = "save"; document.pageform.submit(); From 2ee860c330c5fbe05f915b4d395ad11e9a023549 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2007 17:56:47 +0000 Subject: [PATCH 9/9] Monotone-Parent: df36a823f379fbf4d30f5a90eb58b5634c9c54c2 Monotone-Revision: 411e18da9b8303cd9a4927e92d807baf5025523f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-25T17:56:47 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxMailEditor.js | 55 +++++++++++++++----------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 22bb86ff6..8720dd56c 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -16,7 +16,7 @@ function onContactAdd() { w.focus(); return false; - } +} function addContact(tag, fullContactName, contactId, contactName, contactEmail) { if (!mailIsRecipient(contactEmail)) { @@ -121,37 +121,41 @@ function updateInlineAttachmentList(sender, attachments) { /* mail editor */ function validateEditorInput(sender) { - var errortext = ""; - var field; + var errortext = ""; + var field; - field = document.pageform.subject; - if (field.value == "") - errortext = errortext + labels["error_missingsubject"] + "\n"; + field = document.pageform.subject; + if (field.value == "") + errortext = errortext + labels["error_missingsubject"] + "\n"; - if (!UIxRecipientSelectorHasRecipients()) - errortext = errortext + labels["error_missingrecipients"] + "\n"; + if (!UIxRecipientSelectorHasRecipients()) + errortext = errortext + labels["error_missingrecipients"] + "\n"; - if (errortext.length > 0) { - alert(labels["error_validationfailed"] + ":\n" + errortext); - return false; - } + if (errortext.length > 0) { + alert(labels["error_validationfailed"] + ":\n" + errortext); + return false; + } - return true; + return true; } function clickedEditorSend(sender) { - if (!validateEditorInput(sender)) - return false; + if (!validateEditorInput(sender)) + return false; - var input = currentAttachmentInput(); - if (input) - input.parentNode.removeChild(input); + var input = currentAttachmentInput(); + if (input) + input.parentNode.removeChild(input); + + var toolbar = document.getElementById("toolbar"); + if (!document.busyAnim) + document.busyAnim = startAnimation(toolbar); - window.shouldPreserve = true; - document.pageform.action = "send"; - document.pageform.submit(); + window.shouldPreserve = true; + document.pageform.action = "send"; + document.pageform.submit(); - return false; + return false; } function currentAttachmentInput() { @@ -183,7 +187,7 @@ function clickedEditorAttach(sender) { "currentAttachment", null, { type: "file", name: attachmentName }, - area); + area); Event.observe(newAttachment, "change", onAttachmentChange.bindAsEventListener(newAttachment)); } @@ -227,6 +231,11 @@ function clickedEditorSave(sender) { var input = currentAttachmentInput(); if (input) input.parentNode.removeChild(input); + + var toolbar = document.getElementById("toolbar"); + if (!document.busyAnim) + document.busyAnim = startAnimation(toolbar); + window.shouldPreserve = true; document.pageform.action = "save"; document.pageform.submit();