From 340546c975bca94526a3e16039895a6d0600828b Mon Sep 17 00:00:00 2001 From: alecpl Date: Tue, 31 May 2011 07:38:56 +0000 Subject: - Optimization for spellcheck_before_send: don't invoke new ajax request. While we already have mispellings, we can return them and enable spellchecker directly without querying the server again --- program/steps/mail/sendmail.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 80543041a..91d71a74f 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -411,7 +411,7 @@ if (!$savedraft) { // Check spelling before send if ($CONFIG['spellcheck_before_send'] && $CONFIG['enable_spellcheck'] - && empty($_SESSION['compose']['spell_checked']) + && empty($_SESSION['compose']['spell_checked']) && !empty($message_body) ) { $spellchecker = new rcube_spellchecker(get_input_value('_lang', RCUBE_INPUT_GPC)); $spell_result = $spellchecker->check($message_body, $isHtml); @@ -419,8 +419,9 @@ if (!$savedraft) { $_SESSION['compose']['spell_checked'] = true; if (!$spell_result) { + $result = $isHtml ? $spellchecker->get_words() : $spellchecker->get_xml(); $OUTPUT->show_message('mispellingsfound', 'error'); - $OUTPUT->command('command', 'spellcheck'); + $OUTPUT->command('spellcheck_resume', $isHtml, $result); $OUTPUT->send('iframe'); } } -- cgit v1.2.3