Bug #8203: Fix redirect compose
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 23 Apr 2009 17:47:30 +0000 (11:47 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 23 Apr 2009 17:47:52 +0000 (11:47 -0600)
imp/js/src/compose.js
imp/lib/UI/Compose.php

index d813676..3ce9960 100644 (file)
@@ -149,24 +149,19 @@ var ImpCompose = {
 
     uniqSubmit: function(actionID, e)
     {
+        var form;
+
         e.stop();
 
         if (actionID == 'redirect') {
             if ($F('to') == '') {
                 alert(IMP.text.compose_recipient);
                 $('to').focus();
-            } else {
-                // Ticket #6727; this breaks on WebKit w/FCKeditor.
-                if (!Prototype.Browser.WebKit) {
-                    $('redirect').setStyle({ cursor: 'wait' });
-                }
-                this.display_unload_warning = false;
+                return;
             }
 
-            return;
-        }
-
-        if (actionID == 'send_message') {
+            form = $('redirect');
+        } else if (actionID == 'send_message') {
             if (($F('subject') == '') &&
                 !window.confirm(IMP.text.compose_nosubject)) {
                 return;
@@ -180,30 +175,31 @@ var ImpCompose = {
                 return;
             }
 
-        }
+            this.skip_spellcheck = false;
 
-        this.skip_spellcheck = false;
+            if (IMP.SpellCheckerObject) {
+                IMP.SpellCheckerObject.resume();
+            }
 
-        if (IMP.SpellCheckerObject) {
-            IMP.SpellCheckerObject.resume();
+            form = $('compose');
+            $('actionID').setValue('send_message');
         }
 
         // Ticket #6727; this breaks on WebKit w/FCKeditor.
         if (!Prototype.Browser.WebKit) {
-            $('compose').setStyle({ cursor: 'wait' });
+            form.setStyle({ cursor: 'wait' });
         }
 
         this.display_unload_warning = false;
-        $('actionID').setValue(actionID);
-        this._uniqSubmit();
+        this._uniqSubmit(form);
     },
 
-    _uniqSubmit: function()
+    _uniqSubmit: function(form)
     {
         if (this.textarea_ready) {
-            $('compose').submit();
+            form.submit();
         } else {
-            this._uniqSubmit.defer();
+            this._uniqSubmit.bind(this, form).defer();
         }
     },
 
@@ -253,7 +249,7 @@ var ImpCompose = {
         if (typeof IMP.SpellCheckerObject != 'object') {
             // If we fired before the onload that initializes the spellcheck,
             // wait.
-            this.initializeSpellChecker.defer();
+            this.initializeSpellChecker.bind(this).defer();
             return;
         }
 
index 9112cc2..bfd2e0b 100644 (file)
@@ -62,9 +62,8 @@ class IMP_UI_Compose
             IMP_Maillog::log('redirect', $headers->getValue('message-id'), $recipients);
         }
 
-        $bodytext = $contents->getBody();
         try {
-            $imp_compose->sendMessage($recipients, $headers, $bodytext, $charset);
+            $imp_compose->sendMessage($recipients, $headers, $mime_message, $charset);
         } catch (IMP_Compose_Exception $e) {
             throw new Horde_Exception($e);
         }