Bug #8895: Fix quickreply
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 3 Mar 2010 05:37:55 +0000 (22:37 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 3 Mar 2010 05:38:03 +0000 (22:38 -0700)
imp/js/compose-base.js
imp/js/compose-dimp.js
imp/js/fullmessage-dimp.js

index 48177df..e8f837c 100644 (file)
@@ -10,11 +10,11 @@ var IMP_Compose_Base = {
 
     // Vars defaulting to null: editor_on, identities
 
-    getIdentity: function(id)
+    getIdentity: function(id, editor_on)
     {
         return {
             id: this.identities[id],
-            sig: this.identities[id][(this.editor_on ? 'sig_html' : 'sig')].replace(/^\n/, '')
+            sig: this.identities[id][((editor_on || this.editor_on) ? 'sig_html' : 'sig')].replace(/^\n/, '')
         };
     },
 
index ea71ed6..7a3d2da 100644 (file)
@@ -18,7 +18,8 @@ var DimpCompose = {
         if (window.confirm(DIMP.text_compose.cancel)) {
             if ((this.is_popup || DIMP.conf_compose.popup) &&
                 DIMP.baseWindow &&
-                DIMP.baseWindow.DimpBase) {
+                DIMP.baseWindow.DimpBase &&
+                !DIMP.conf_compose.qreply) {
                 DIMP.baseWindow.focus();
             }
             DimpCore.doAction(DIMP.conf_compose.auto_save_interval_val ? 'DeleteDraft' : 'CancelCompose', { imp_compose: $F('composeCache') }, { ajaxopts: { asynchronous: DIMP.conf_compose.qreply } });
@@ -390,6 +391,7 @@ var DimpCompose = {
     setMessageText: function(r)
     {
         var ta = $('composeMessage');
+
         if (!ta) {
             $('composeMessageParent').insert(new Element('TEXTAREA', { id: 'composeMessage', name: 'message', style: 'width:100%' }).insert(r.response.text));
         } else {
@@ -401,7 +403,7 @@ var DimpCompose = {
         }
     },
 
-    // opts = auto, focus, fwd_list, noupdate
+    // opts = auto, focus, fwd_list, noupdate, show_editor
     fillForm: function(msg, header, opts)
     {
         // On IE, this can get loaded before DOM:loaded.
@@ -428,8 +430,6 @@ var DimpCompose = {
             this.auto_save_interval.execute();
         }
 
-        this.setBodyText(msg, true);
-
         $('to').setValue(header.to);
         if (header.cc) {
             $('cc').setValue(header.cc);
@@ -476,7 +476,10 @@ var DimpCompose = {
             break;
         }
 
-        if (DIMP.conf_compose.show_editor) {
+        this.setBodyText(msg);
+        this.resizeMsgArea();
+
+        if (DIMP.conf_compose.show_editor || opts.show_editor) {
             if (!IMP_Compose_Base.editor_on) {
                 this.toggleHtmlEditor(opts.noupdate);
             }
@@ -603,9 +606,11 @@ var DimpCompose = {
              * size by the available height, round down to the lowest integer
              * row, and resize the textarea. */
             rows = parseInt(mah / (msg.clientHeight / msg.getAttribute('rows')), 10);
-            msg.writeAttribute({ rows: rows, disabled: false });
-            if (de.scrollHeight - de.clientHeight) {
-                msg.writeAttribute('rows', rows - 1);
+            if (!isNaN(rows)) {
+                msg.writeAttribute({ rows: rows, disabled: false });
+                if (de.scrollHeight - de.clientHeight) {
+                    msg.writeAttribute('rows', rows - 1);
+                }
             }
         }
     },
index a230f6a..7125faa 100644 (file)
@@ -45,19 +45,19 @@ var DimpFullmessage = {
             return;
         }
 
-        var r = result.response,
-            editor_on = ((r.format == 'html') && !DimpCompose.editor_on),
-            id = (r.identity === null) ? $F('identity') : r.identity,
-            i = DimpCompose.getIdentity(id, editor_on);
+        var i,
+            r = result.response,
+            id = (r.identity === null) ? $F('identity') : r.identity;
+
+        r.opts.noupdate = true;
+        r.opts.show_editor = (r.format == 'html');
+
+        i = IMP_Compose_Base.getIdentity(id, r.opts.show_editor);
 
         $('identity', 'last_identity').invoke('setValue', id);
 
         DimpCompose.fillForm((i.id[2]) ? ("\n" + i.sig + r.body) : (r.body + "\n" + i.sig), r.header, r.opts);
 
-        if (editor_on) {
-            DimpCompose.toggleHtmlEditor(true);
-        }
-
         if (r.imp_compose) {
             $('composeCache').setValue(r.imp_compose);
         }