Fix toggling wysiwyg editor.
authorJan Schneider <jan@horde.org>
Wed, 29 Jul 2009 07:36:30 +0000 (09:36 +0200)
committerJan Schneider <jan@horde.org>
Wed, 29 Jul 2009 16:53:25 +0000 (18:53 +0200)
imp/compose.php
imp/js/src/compose.js
imp/lib/api.php

index 00626a6..42808fe 100644 (file)
@@ -713,12 +713,12 @@ if ($get_sig && isset($msg) && !empty($sig)) {
 /* Open the passphrase window here. */
 if ($pgp_passphrase_dialog || $pgp_symmetric_passphrase_dialog) {
     if ($pgp_passphrase_dialog) {
-        $notification->push(IMP::passphraseDialogJS('PGPPersonal', 'uniqSubmit(\'send_message\')'), 'javascript');
+        $notification->push(IMP::passphraseDialogJS('PGPPersonal', 'ImpCompose.uniqSubmit(\'send_message\')'), 'javascript');
     } else {
-        $notification->push(IMP::passphraseDialogJS('PGPSymmetric', 'uniqSubmit(\'send_message\')', array('symmetricid' => 'imp_compose_' . $composeCacheID)), 'javascript');
+        $notification->push(IMP::passphraseDialogJS('PGPSymmetric', 'ImpCompose.uniqSubmit(\'send_message\')', array('symmetricid' => 'imp_compose_' . $composeCacheID)), 'javascript');
     }
 } elseif ($smime_passphrase_dialog) {
-    $notification->push(IMP::passphraseDialogJS('SMIMEPersonal', 'uniqSubmit(\'send_message\')'), 'javascript');
+    $notification->push(IMP::passphraseDialogJS('SMIMEPersonal', 'ImpCompose.uniqSubmit(\'send_message\')'), 'javascript');
 }
 
 /* If PGP encryption is set by default, and we have a recipient list on first
@@ -822,7 +822,7 @@ if ($redirect) {
         $t->set('has_search', true);
         $t->set('abook', Horde::link('#', _("Address Book"), 'widget', null, 'window.open(\'' . Horde_Util::addParameter(Horde::applicationUrl('contacts.php'), array('formname' => 'redirect', 'to_only' => 1)) . '\', \'contacts\', \'toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=550,height=300,left=100,top=100\'); return false;') . Horde::img('addressbook_browse.png') . '<br />' . _("Address Book") . '</a>');
         if (!$has_js) {
-            $t->set('expand', Horde::link('#', _("Expand Names"), 'widget', null, "$('actionID').value='redirect_expand_addr';uniqSubmit();return false;") . Horde::img('expand.png') . '<br />' . _("Expand Names") . '</a>', true);
+            $t->set('expand', Horde::link('#', _("Expand Names"), 'widget', null, "$('actionID').value='redirect_expand_addr';ImpCompose.uniqSubmit();return false;") . Horde::img('expand.png') . '<br />' . _("Expand Names") . '</a>', true);
         }
     }
 
@@ -1059,7 +1059,7 @@ if ($redirect) {
             $compose_options[] = array(
                 'url' => Horde::link(
                     '#', '', 'widget', null,
-                    "uniqSubmit('compose_expand_addr'); return false;",
+                    "ImpCompose.uniqSubmit('compose_expand_addr'); return false;",
                     '', '', array('name' => 'btn_compose_expand_addr')),
                 'img' => Horde::img('expand.png'),
                 'label' => $show_text ? _("Expand Names") : '');
@@ -1119,7 +1119,7 @@ if ($redirect) {
     $t->set('compose_html', (!is_null($rtemode) && !$prefs->isLocked('compose_html')));
     if ($t->get('compose_html')) {
         $t->set('html_img', Horde::img('compose.png', _("Switch Composition Method")));
-        $t->set('html_switch', Horde::link('#', _("Switch Composition Method"), '', '', "$('rtemode').value='" . ($rtemode ? 0 : 1) . "';uniqSubmit();return false;"));
+        $t->set('html_switch', Horde::link('#', _("Switch Composition Method"), '', '', "$('rtemode').value='" . ($rtemode ? 0 : 1) . "';ImpCompose.uniqSubmit('toggle_editor');return false;"));
         $t->set('rtemode', $rtemode);
     }
 
index e552387..23b58fe 100644 (file)
@@ -151,7 +151,9 @@ var ImpCompose = {
     {
         var form;
 
-        e.stop();
+        if (!Object.isUndefined(e)) {
+            e.stop();
+        }
 
         switch (actionID) {
         case 'redirect':
@@ -192,6 +194,10 @@ var ImpCompose = {
             $('actionID').setValue(actionID);
             break;
 
+        case 'toggle_editor':
+            form = $('compose');
+            break;
+
         default:
             return;
         }
index 3d8b7f0..c8a979c 100644 (file)
@@ -573,7 +573,7 @@ function _imp_cacheOutput($params)
                 'FCKConfig.ToolbarSets["ImpToolbar"] = ' . $GLOBALS['prefs']->getValue('fckeditor_buttons') . ";\n" .
                 /* To more closely match "normal" textarea behavior, send
                  * send <BR> on enter instead of <P>. */
-                "FCKConfig.EnterMode = \'br\';\n" .
+                "FCKConfig.EnterMode = 'br';\n" .
                 'FCKConfig.ShiftEnterMode = \'p\';',
             'type' => 'text/javascript'
         );