From a408234cdf05ef4b69682161d8e2198db71318fd Mon Sep 17 00:00:00 2001 From: Kay Strobach <typo3@kay-strobach.de> Date: Thu, 28 Jul 2011 13:26:02 +0200 Subject: [PATCH] [BUGFIX][!!!] Problems with new Card Layout in backend modules There are warnings with backend modules concerning the new _JSINIT array. To avoid these problems, this patch improves the way the module array is handled. Module names starting with an underscore character "_" are not considered anymore. Change-Id: Id749538dd8ee570581cb49df172800ec76242041 Releases: 4.6, 4.5 Resolves: #28523 Reviewed-on: http://review.typo3.org/3820 Reviewed-by: Oliver Hader Tested-by: Oliver Hader Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- t3lib/class.t3lib_loadmodules.php | 20 ++++++++------------ typo3/backend.php | 2 +- typo3/js/extjs/iframepanel.js | 6 +++--- typo3/js/extjs/viewportConfiguration.js | 4 ++-- typo3/js/modulemenu.js | 3 +++ 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/t3lib/class.t3lib_loadmodules.php b/t3lib/class.t3lib_loadmodules.php index 0813cea23387..507b1b4a094c 100644 --- a/t3lib/class.t3lib_loadmodules.php +++ b/t3lib/class.t3lib_loadmodules.php @@ -86,7 +86,6 @@ class t3lib_loadModules { } /* - $modulesArray might look like this when entering this function. Notice the two modules added by extensions - they have a path attached @@ -104,19 +103,11 @@ class t3lib_loadModules { ) ) + */ - */ - // + // Collect required module meta information $this->absPathArray = $modulesArray['_PATHS']; - unset($modulesArray['_PATHS']); - // unset the array for calling external backend module dispatchers in typo3/mod.php - unset($modulesArray['_dispatcher']); - // unset the array for calling backend modules based on external backend module dispatchers in typo3/mod.php - unset($modulesArray['_configuration']); - $this->navigationComponents = $modulesArray['_navigationComponents']; - unset($modulesArray['_navigationComponents']); - $theMods = $this->parseModulesArray($modulesArray); /* @@ -402,7 +393,12 @@ class t3lib_loadModules { $theMods = array(); if (is_array($arr)) { foreach ($arr as $mod => $subs) { - $mod = $this->cleanName($mod); // clean module name to alphanum + // Module names must not start with an underline character + if (strpos($mod, '_') === 0) { + continue; + } + // Module names must be alpha-numeric + $mod = $this->cleanName($mod); if ($mod) { if ($subs) { $subsArr = t3lib_div::trimExplode(',', $subs); diff --git a/typo3/backend.php b/typo3/backend.php index 334a5290205f..52fd7249bd42 100644 --- a/typo3/backend.php +++ b/typo3/backend.php @@ -155,7 +155,7 @@ class TYPO3backend { $this->executeHook('constructPostProcess'); // Add previously generated JS to the backend - if (is_array($GLOBALS['TBE_MODULES']['_JSINIT'])) { + if (isset($GLOBALS['TBE_MODULES']['_JSINIT']) && is_array($GLOBALS['TBE_MODULES']['_JSINIT'])) { foreach ($GLOBALS['TBE_MODULES']['_JSINIT'] as $value) { $this->js .= $value; } diff --git a/typo3/js/extjs/iframepanel.js b/typo3/js/extjs/iframepanel.js index db2708396f3b..ab517aa267ee 100644 --- a/typo3/js/extjs/iframepanel.js +++ b/typo3/js/extjs/iframepanel.js @@ -96,14 +96,14 @@ TYPO3.iframePanel = Ext.extend(Ext.Panel, { // Some modules generate wrong url with unneeded string at the end if (currentSource.substr(currentSource.length-1) == '?' || currentSource.substr(currentSource.length-1) == '&') { - currentSource = currentSource.substr(0,currentSource.length) + currentSource = currentSource.substr(0, currentSource.length) } - if (currentSource.substr(0,1) == '/') { + if (currentSource.substr(0, 1) == '/') { currentSource = currentSource.substr(1); } if (source.substr(source.length-1) == '?' || source.substr(source.length-1) == '&') { - source = source.substr(0,source.length-1) + source = source.substr(0, source.length-1) } // Check if new uri should be loaded diff --git a/typo3/js/extjs/viewportConfiguration.js b/typo3/js/extjs/viewportConfiguration.js index c3b9d9c29bbd..5bfb98821d65 100644 --- a/typo3/js/extjs/viewportConfiguration.js +++ b/typo3/js/extjs/viewportConfiguration.js @@ -39,14 +39,14 @@ TYPO3.Viewport.ContentCards = { * Add a card to either the config or if already rendered to the wrapper */ addContentCard: function(name,config) { - config.id='typo3-card-'+name; + config.id = 'typo3-card-' + name; if (Ext.ready) { Ext.getCmp('typo3-contentContainerWrapper').add(config); } else { this.cards.push(config); } }, - cards:[ + cards: [ { id: 'typo3-contentContainer', border: false, diff --git a/typo3/js/modulemenu.js b/typo3/js/modulemenu.js index ce02b2486428..9cbeec5513e2 100644 --- a/typo3/js/modulemenu.js +++ b/typo3/js/modulemenu.js @@ -223,6 +223,7 @@ TYPO3.ModuleMenu.App = { }, loadModuleComponents: function(record, params) { + var url; var mod = record.name; if (record.navigationComponentId) { this.loadNavigationComponent(record.navigationComponentId); @@ -320,6 +321,8 @@ TYPO3.ModuleMenu.App = { }, openInContentFrame: function(url, params) { + var urlToLoad, relatedCard; + if (top.nextLoadModuleUrl) { urlToLoad = top.nextLoadModuleUrl; top.nextLoadModuleUrl = ''; -- GitLab