Add Horde::ajaxAvailable()
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 6 Aug 2010 17:33:02 +0000 (11:33 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 6 Aug 2010 18:10:00 +0000 (12:10 -0600)
framework/Core/lib/Horde.php
imp/lib/Auth.php
kronolith/lib/Kronolith.php

index 4c521c0..d65f35e 100644 (file)
@@ -2025,4 +2025,18 @@ HTML;
         self::$_metaTags = array();
     }
 
+    /**
+     * Is an AJAX view supported/available on the current browser?
+     *
+     * return boolean  True if the AJAX view can be displayed.
+     */
+    static public function ajaxAvailable()
+    {
+        global $browser;
+
+        return $browser->hasFeature('xmlhttpreq') &&
+            (!$browser->isBrowser('msie') || $browser->getMajor() >= 7) &&
+            (!$browser->hasFeature('issafari') || $browser->getMajor() >= 2);
+    }
+
 }
index c1a9ce5..f680708 100644 (file)
@@ -467,11 +467,7 @@ class IMP_Auth
 
         /* Enforce minimum browser standards for DIMP.
          * No IE < 7; Safari < 3 */
-        if (($sess['view'] == 'dimp') &&
-            (($GLOBALS['browser']->isBrowser('msie') &&
-              ($GLOBALS['browser']->getMajor() < 7)) ||
-             ($GLOBALS['browser']->hasFeature('issafari') &&
-              ($GLOBALS['browser']->getMajor() < 2)))) {
+        if (($sess['view'] == 'dimp') && !Horde::ajaxAvailable()) {
             $sess['view'] = 'imp';
             $GLOBALS['notification']->push(_("Your browser is too old to display the dynamic mode. Using traditional mode instead."), 'horde.warning');
         }
index a5c3fc9..6f9a45d 100644 (file)
@@ -2921,11 +2921,7 @@ class Kronolith
     public static function showAjaxView()
     {
         return $GLOBALS['prefs']->getValue('dynamic_view') &&
-            $GLOBALS['browser']->hasFeature('xmlhttpreq') &&
-            (!$GLOBALS['browser']->isBrowser('msie') ||
-             $GLOBALS['browser']->getMajor() >= 7) &&
-            (!$GLOBALS['browser']->hasFeature('issafari') ||
-             $GLOBALS['browser']->getMajor() >= 2);
+            Horde::ajaxAvailable();
     }
 
     /**