Fixed bug #13693: Backend doesn't use pageRenderer methods
authorSteffen Kamper <info@sk-typo3.de>
Thu, 8 Apr 2010 10:46:48 +0000 (10:46 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Thu, 8 Apr 2010 10:46:48 +0000 (10:46 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7253 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/backend.php
typo3/js/backend.js

index a68df23..e4708c7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-08  Steffen Kamper  <info@sk-typo3.de>
+
+       * Fixed bug #13693: Backend doesn't use pageRenderer methods
+
 2010-04-07  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #13956: htmlArea RTE: Editing area is collapsed when the RTE is loaded inside a hidden tab in Safari
index 3bbd8f9..a5ef9a6 100644 (file)
@@ -76,6 +76,13 @@ class TYPO3backend {
        protected $moduleMenu;
 
        /**
+        * Pagerenderer
+        *
+        * @var $pageRenderer t3lib_PageRenderer
+        */
+       protected $pageRenderer;
+
+       /**
         * constructor
         *
         * @return      void
@@ -88,6 +95,23 @@ class TYPO3backend {
 
                $this->moduleMenu = t3lib_div::makeInstance('ModuleMenu');
 
+               $this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
+               $this->pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
+               $this->pageRenderer->loadExtJS();
+
+                       // register the extDirect API providers
+                       // Note: we need to iterate thru the object, because the addProvider method
+                       // does this only with multiple arguments
+               $this->pageRenderer->addExtOnReadyCode(
+                       'for (var api in Ext.app.ExtDirectAPI) {
+                               Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);
+                       }
+                       TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
+                       ',
+                       TRUE
+               );
+
+
                        // add default BE javascript
                $this->js      = '';
                $this->jsFiles = array(
@@ -103,15 +127,13 @@ class TYPO3backend {
                        'js/iecompatibility.js',
                        'js/flashupload.js',
                        '../t3lib/jsfunc.evalfield.js',
-                       'ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Backend'
-               );
-
-               $this->jsFilesAfterInline = array(
+                       'ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Backend',
                        'js/backend.js',
                        'js/loginrefresh.js',
                        'js/extjs/viewport.js',
                        'js/extjs/viewportConfiguration.js',
                );
+
                        // add default BE css
                $this->css      = '';
                $this->cssFiles = array(
@@ -203,58 +225,27 @@ class TYPO3backend {
                 * now put the complete backend document together
                 ******************************************************/
 
-               /** @var $pageRenderer t3lib_PageRenderer */
-               $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
-               $pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
-               $pageRenderer->loadExtJS();
-
-                       // register the extDirect API providers
-                       // Note: we need to iterate thru the object, because the addProvider method
-                       // does this only with multiple arguments
-               $pageRenderer->addExtOnReadyCode('
-                       for (var api in Ext.app.ExtDirectAPI) {
-                               Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]);
-                       }',
-                       TRUE
-               );
-
-                       // initiates the ExtJS based backend viewport
-               $pageRenderer->addExtOnReadyCode('
-                       TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);',
-                       TRUE
-               );
-
-                       // remove duplicate entries
-               $this->jsFiles = array_unique($this->jsFiles);
-
-                       // add javascript
-               foreach($this->jsFiles as $jsFile) {
-                       $GLOBALS['TBE_TEMPLATE']->loadJavascriptLib($jsFile);
-               }
-               $GLOBALS['TBE_TEMPLATE']->JScode .= chr(10);
-               $this->generateJavascript();
-               $GLOBALS['TBE_TEMPLATE']->JScode .= $GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->js) . chr(10);
-
-               foreach($this->jsFilesAfterInline as $jsFile) {
-                       $GLOBALS['TBE_TEMPLATE']->JScode .= '
-                       <script type="text/javascript" src="' . $jsFile . '"></script>';
-               }
-
-
-                       // FIXME abusing the JS container to add CSS, need to fix template.php
                foreach($this->cssFiles as $cssFileName => $cssFile) {
-                       $GLOBALS['TBE_TEMPLATE']->addStyleSheet($cssFileName, $cssFile);
+                       $this->pageRenderer->addCssFile($cssFile);
 
                                // load addditional css files to overwrite existing core styles
                        if(!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
-                               $GLOBALS['TBE_TEMPLATE']->addStyleSheet($cssFileName . 'TBE_STYLES', $GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
+                               $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
                        }
                }
 
                if(!empty($this->css)) {
-                       $GLOBALS['TBE_TEMPLATE']->inDocStylesArray['backend.php'] = $this->css;
+                       $this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
                }
 
+               foreach ($this->jsFiles as $jsFile) {
+                       $this->pageRenderer->addJsFile($jsFile);
+               }
+
+               $this->generateJavascript();
+               $this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js);
+
+
                        // set document title:
                $title = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
                        ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].' [TYPO3 '.TYPO3_version.']'
@@ -658,14 +649,10 @@ class TYPO3backend {
        public function addCssFile($cssFileName, $cssFile) {
                $cssFileAdded = false;
 
-                       //TODO add more checks if neccessary
-               if(file_exists(t3lib_div::resolveBackPath(PATH_typo3.$cssFile))) {
-                               // prevent overwriting existing css files
-                       if(empty($this->cssFiles[$cssFileName])) {
-                               $this->cssFiles[$cssFileName] = $cssFile;
-                               $cssFileAdded = true;
-                       }
-               }
+               if(empty($this->cssFiles[$cssFileName])) {
+                       $this->cssFiles[$cssFileName] = $cssFile;
+                       $cssFileAdded = true;
+               }
 
                return $cssFileAdded;
        }
index 6e0b4bd..e8b2684 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 
-
+Ext.ns('TYPO3.configuration');
 
 /**
  * jump the backend to a module