Use new browser sniffing for Fckeditor availability
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 20 Jan 2009 05:57:53 +0000 (22:57 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 20 Jan 2009 05:58:43 +0000 (22:58 -0700)
RTE now able to be used w/Safari 3+ and Chrome.

imp/compose-dimp.php
imp/compose.php
imp/lib/Compose.php
imp/lib/Session.php
imp/lib/UI/Compose.php
imp/lib/Views/Compose.php

index 1b0c17b..d12fcbe 100644 (file)
@@ -269,10 +269,7 @@ case 'resume':
     break;
 
 case 'new':
-    $rte = ($browser->hasFeature('rte') && $prefs->getValue('compose_html'));
-    if ($rte) {
-        $show_editor = true;
-    }
+    $rte = $show_editor = ($prefs->getValue('compose_html') && $_SESSION['imp']['rteavail']);
     break;
 }
 
index 7383362..8752a7d 100644 (file)
@@ -187,7 +187,7 @@ $isPopup = (($prefs->getValue('compose_popup') || Util::getFormData('popup')) &&
 /* Determine the composition type - text or HTML.
    $rtemode is null if browser does not support it. */
 $rtemode = null;
-if ($browser->hasFeature('rte')) {
+if ($_SESSION['imp']['rteavail']) {
     if ($prefs->isLocked('compose_html')) {
         $rtemode = $prefs->getValue('compose_html');
     } else {
index 89996a4..4ca5e3d 100644 (file)
@@ -2163,8 +2163,7 @@ class IMP_Compose
         $body_id = null;
         $mode = 'text';
 
-        if (!empty($options['html']) &&
-            $GLOBALS['browser']->hasFeature('rte')) {
+        if (!empty($options['html']) && $_SESSION['imp']['rteavail']) {
             $body_id = $contents->findBody('html');
             if (!is_null($body_id)) {
                 $mode = 'html';
index 40eb08a..6f3e137 100644 (file)
@@ -41,6 +41,7 @@ class IMP_Session
      * 'maildomain'    -- See config/servers.php.
      * 'notepadavail'  -- Is listing of notepads available?
      * 'protocol'      -- Either 'imap' or 'pop'.
+     * 'rteavail'      -- Is the HTML editor available?
      * 'search'        -- Settings used by the IMP_Search library.
      * 'smime'         -- Settings related to the S/MIME viewer.
      * 'smtp'          -- SMTP options ('host' and 'port')
@@ -168,6 +169,11 @@ class IMP_Session
             $sess['notepadavail'] = true;
         }
 
+        /* Is the HTML editor available? */
+        $imp_ui = new IMP_UI_Compose();
+        $editor = $imp_ui->initRTE(null, true);
+        $sess['rteavail'] = $editor->supportedByBrowser();
+
         /* Cache autologin check. */
         $sess['autologin'] = self::canAutologin();
 
index cbf5562..b896bc6 100644 (file)
@@ -188,9 +188,12 @@ class IMP_UI_Compose
 
     /**
      */
-    function initRTE($mode = 'imp')
+    function initRTE($mode = 'imp', $editoronly = false)
     {
         $editor = &Horde_Editor::singleton('Fckeditor', array('id' => 'message', 'no_notify' => true));
+        if ($editoronly) {
+            return $editor;
+        }
 
         $fck_buttons = $GLOBALS['prefs']->getValue('fckeditor_buttons');
         if (!empty($fck_buttons)) {
index 51ebd21..4122d47 100644 (file)
@@ -88,7 +88,7 @@ class IMP_Views_Compose
         );
 
         $compose_html = $rte = false;
-        if ($GLOBALS['browser']->hasFeature('rte')) {
+        if ($_SESSION['imp']['rteavail']) {
             $compose_html = $GLOBALS['prefs']->getValue('compose_html');
             $rte = true;