Fixed bug #15686: Call the list module through the dispatcher instead directly (Thank...
[Packages/TYPO3.CMS.git] / typo3 / template.php
index ecd2ac4..2f15932 100644 (file)
@@ -216,6 +216,14 @@ class template {
                'visual' => 'stylesheets/visual/',
        );
 
+       /**
+        * JavaScript files loaded for every page in the Backend
+        * @var array
+        */
+       protected $jsFiles = array(
+               'modernizr' => 'contrib/modernizr/modernizr.min.js',
+       );
+
                // DEV:
        var $parseTimeFlag = 0;                 // Will output the parsetime of the scripts in milliseconds (for admin-users). Set this to false when releasing TYPO3. Only for dev.
 
@@ -315,6 +323,11 @@ class template {
                        $this->pageRenderer->enableConcatenateFiles();
                        $this->pageRenderer->enableCompressCss();
                        $this->pageRenderer->enableCompressJavascript();
+
+                               // add all JavaScript files defined in $this->jsFiles to the PageRenderer
+                       foreach ($this->jsFiles as $file) {
+                               $this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file);
+                       }
                }
                if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) === 1) {
                        $this->pageRenderer->enableDebugMode();
@@ -374,12 +387,13 @@ class template {
         */
        function viewPageIcon($id,$backPath,$addParams='hspace="3"')    {
                global $BE_USER;
-               $str = '';
                        // If access to Web>List for user, then link to that module.
-               $str .= t3lib_extMgm::createListViewLink(
-                       $id,
-                       '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')),
-                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', TRUE)
+               $str = t3lib_BEfunc::getListViewLink(
+                       array(
+                               'id' => $id,
+                               'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI'),
+                       ),
+                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')
                );
 
                        // Make link to view page
@@ -914,6 +928,7 @@ $str.=$this->docBodyTagBegin().
                $pageContent = $this->startPage($title, $includeCsh);
                $pageContent .= $content;
                $pageContent .= $this->endPage();
+
                return $this->insertStylesAndJS($pageContent);
        }
 
@@ -2209,8 +2224,8 @@ class frontendDoc extends template {
 }
 
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php'])     {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/template.php']);
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/template.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/template.php']);
 }