From fe0077cf812507dd2bbef78a7e071064f9c6ac9b Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 3 Nov 2009 17:53:15 +0100 Subject: [PATCH] We only have a single window in ajax kronolith, so load all scripts at once. --- kronolith/index.php | 13 +------------ kronolith/lib/Kronolith.php | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/kronolith/index.php b/kronolith/index.php index 9aa50532a..88a705f24 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -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 "\n"; require KRONOLITH_TEMPLATES . '/index/index.inc'; Horde::includeScriptFiles(); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 5078b085a..54b97b0d1 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -60,30 +60,24 @@ class Kronolith /** * Output everything for the AJAX interface up to but not including the * 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 '' . "\n" . (!empty($GLOBALS['language']) ? '\n". "\n" . - '' . htmlspecialchars($page_title) . "\n" . + '' . htmlspecialchars($GLOBALS['registry']->get('name')) . "\n" . '\n". Horde::wrapInlineScript(self::includeJSVars()); -- 2.11.0