We only have a single window in ajax kronolith, so load all scripts at once.
authorJan Schneider <jan@horde.org>
Tue, 3 Nov 2009 16:53:15 +0000 (17:53 +0100)
committerJan Schneider <jan@horde.org>
Tue, 3 Nov 2009 16:53:15 +0000 (17:53 +0100)
kronolith/index.php
kronolith/lib/Kronolith.php

index 9aa5053..88a705f 100644 (file)
@@ -26,18 +26,7 @@ if ($help_link) {
 $today = Kronolith::currentDate();
 $_SESSION['horde_prefs']['nomenu'] = true;
 
-$datejs = str_replace('_', '-', $language) . '.js';
-if (!file_exists($registry->get('jsfs') . '/' . $datejs)) {
-    $datejs = 'en-US.js';
-}
-$scripts = array(
-    array($datejs, 'kronolith', true),
-    array('date.js', 'kronolith', true),
-    array('dhtmlHistory.js', 'horde', true),
-    array('redbox.js', 'horde', true),
-    array('tooltips.js', 'horde', true),
-);
-Kronolith::header('', $scripts);
+Kronolith::header();
 echo "<body class=\"kronolithAjax\">\n";
 require KRONOLITH_TEMPLATES . '/index/index.inc';
 Horde::includeScriptFiles();
index 5078b08..54b97b0 100644 (file)
@@ -60,30 +60,24 @@ class Kronolith
     /**
      * Output everything for the AJAX interface up to but not including the
      * <body> tag.
-     *
-     * @param string $title   The title of the page.
-     * @param array $scripts  Any additional scripts that need to be loaded.
-     *                        Each entry contains the three elements necessary
-     *                        for a Horde::addScriptFile() call.
      */
-    public static function header($title, $scripts = array())
+    public static function header()
     {
         // Need to include script files before we start output
+        $datejs = str_replace('_', '-', $GLOBALS['language']) . '.js';
+        if (!file_exists($GLOBALS['registry']->get('jsfs') . '/' . $datejs)) {
+            $datejs = 'en-US.js';
+        }
         Horde::addScriptFile('effects.js', 'horde');
         Horde::addScriptFile('horde.js', 'horde');
         Horde::addScriptFile('dragdrop2.js', 'horde');
         Horde::addScriptFile('Growler.js', 'horde');
+        Horde::addScriptFile('dhtmlHistory.js', 'horde');
+        Horde::addScriptFile('redbox.js', 'horde');
+        Horde::addScriptFile('tooltips.js', 'horde');
         Horde::addScriptFile('kronolith.js', 'kronolith');
-
-        // Add other scripts now
-        foreach ($scripts as $val) {
-            call_user_func_array(array('Horde', 'addScriptFile'), $val);
-        }
-
-        $page_title = $GLOBALS['registry']->get('name');
-        if (!empty($title)) {
-            $page_title .= ' :: ' . $title;
-        }
+        Horde::addScriptFile($datejs, 'kronolith');
+        Horde::addScriptFile('date.js', 'kronolith');
 
         // No IE 8 code at the moment.
         header('X-UA-Compatible: IE=7');
@@ -96,7 +90,7 @@ class Kronolith
         echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">' . "\n" .
              (!empty($GLOBALS['language']) ? '<html lang="' . strtr($GLOBALS['language'], '_', '-') . '"' : '<html') . ">\n".
              "<head>\n" .
-             '<title>' . htmlspecialchars($page_title) . "</title>\n" .
+             '<title>' . htmlspecialchars($GLOBALS['registry']->get('name')) . "</title>\n" .
              '<link href="' . $GLOBALS['registry']->getImageDir() . "/favicon.ico\" rel=\"SHORTCUT ICON\" />\n".
              Horde::wrapInlineScript(self::includeJSVars());