Add showAjaxView().
authorJan Schneider <jan@horde.org>
Tue, 20 Jul 2010 20:38:35 +0000 (22:38 +0200)
committerJan Schneider <jan@horde.org>
Mon, 26 Jul 2010 21:34:07 +0000 (23:34 +0200)
kronolith/index.php
kronolith/lib/Kronolith.php

index daee5c6..48287b1 100644 (file)
@@ -10,9 +10,7 @@ require_once dirname(__FILE__) . '/lib/Application.php';
 Horde_Registry::appInit('kronolith');
 
 /* Load traditional interface? */
-if (!$prefs->getValue('dynamic_view') || !$browser->hasFeature('xmlhttpreq') ||
-    ($browser->isBrowser('msie') && $browser->getMajor() < 7) ||
-    ($browser->hasFeature('issafari') && $browser->getMajor() < 2)) {
+if (!Kronolith::showAjaxView()) {
     if ($prefs->getValue('dynamic_view')) {
         $notification->push(_("Your browser is too old to display the dynamic mode. Using traditional mode instead."), 'horde.warning');
     }
index ec1da44..5b205c6 100644 (file)
@@ -2881,6 +2881,21 @@ class Kronolith
     }
 
     /**
+     * Returns whether to display the ajax view.
+     *
+     * return boolean  True if the ajax view should be displayed.
+     */
+    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);
+    }
+
+    /**
      * Used with usort() to sort events based on their start times.
      */
     public static function _sortEventStartTime($a, $b)