Index: typo3/template.php =================================================================== --- typo3/template.php (revision 4652) +++ typo3/template.php (working copy) @@ -1295,8 +1295,58 @@ } } - /** + * Includes extJS library + * + * @param string adapters as commalist, possible values are prototype/ext + * @param boolean if set, ext-all.css will be added to head section (possible override with $GLOBALS['TBE_STYLES']['extJS']['ext-all']) + * @param boolean if set, xtheme-gray.css will be added to head section (possible override with $GLOBALS['TBE_STYLES']['extJS']['ext-theme']) + * @param boolean if set, ext-all-debug.js will be included instead of ext-all.js. This is useful for develop + * + * @return void + */ + + function loadExtJS($adapters = '', $includeCSS = true, $includeTheme = true, $debug = false) { + // load adapters and extJS-library + if ($adapters) { + $adapter = t3lib_div::trimExplode(',', $adapters, true); + if (count($adapter)) { + foreach($adapter as $lib) { + switch ($lib) { + case 'prototype': + $this->loadJavascriptLib('contrib/extjs/adapter/prototype/ext-prototype-adapter.js'); + break; + case 'ext': + $this->loadJavascriptLib('contrib/extjs/adapter/ext/ext-base.js'); + break; + } + } + } + } + $this->loadJavascriptLib('contrib/extjs/' . ($debug ? 'ext-all-debug.js' : 'ext-all.js')); + + // set clear.gif + $this->JScodeArray[] = 'Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(t3lib_div::locationHeaderUrl('gfx/clear.gif')) . '";'; + + // include CSS + if ($includeCSS) { + if (isset($GLOBALS['TBE_STYLES']['extJS']['ext-all'])) { + $this->addStyleSheet('ext-all', $GLOBALS['TBE_STYLES']['extJS']['ext-all'], 'ext-all'); + } else { + $this->addStyleSheet('ext-all', 'contrib/extjs/resources/css/ext-all.css', 'ext-all'); + } + } + if ($includeTheme) { + if (isset($GLOBALS['TBE_STYLES']['extJS']['ext-theme'])) { + $this->addStyleSheet('ext-theme', $GLOBALS['TBE_STYLES']['extJS']['ext-theme'], 'ext-theme'); + } else { + $this->addStyleSheet('ext-theme', 'contrib/extjs/resources/css/xtheme-gray.css', 'ext-theme'); + } + } + + } + + /** * Includes the necessary Javascript function for the clickmenu (context sensitive menus) in the document * * @return array Deprecated: Includes the code already in the doc, so the return array is always empty.