Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (revision 8782) +++ t3lib/class.t3lib_befunc.php (working copy) @@ -2933,8 +2933,8 @@ $signals[] = $params['JScode']; } else if ($set == 'updatePageTree' || $set == 'updateFolderTree') { $signals[] = ' - if (top && top.content && top.content.nav_frame && top.content.nav_frame.Tree) { - top.content.nav_frame.Tree.refresh(); + if (top && top.TYPO3.Backend.NavigationContainer) { + top.TYPO3.Backend.NavigationContainer.refresh(); }'; } } Index: t3lib/class.t3lib_loadmodules.php =================================================================== --- t3lib/class.t3lib_loadmodules.php (revision 8782) +++ t3lib/class.t3lib_loadmodules.php (working copy) @@ -454,7 +454,7 @@ for($i=0;$i < $slashes;$i++) { $destDir = '../'.$destDir; } - return $destDir; + return t3lib_div::resolveBackPath($destDir); } } Index: t3lib/config_default.php =================================================================== --- t3lib/config_default.php (revision 8783) +++ t3lib/config_default.php (working copy) @@ -282,6 +282,7 @@ 'ShortcutMenu::create' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->createAjaxShortcut', 'ModuleMenu::saveMenuState' => 'typo3/classes/class.modulemenu.php:ModuleMenu->saveMenuState', 'ModuleMenu::render' => 'typo3/classes/class.modulemenu.php:ModuleMenu->renderAjax', + 'ModuleMenu::getData' => 'typo3/classes/class.modulemenu.php:ModuleMenu->getModuleData', 'BackendLogin::login' => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->login', 'BackendLogin::logout' => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->logout', 'BackendLogin::refreshLogin' => 'typo3/classes/class.ajaxlogin.php:AjaxLogin->refreshLogin', Index: typo3/alt_db_navframe.php =================================================================== --- typo3/alt_db_navframe.php (revision 8782) +++ typo3/alt_db_navframe.php (working copy) @@ -179,13 +179,8 @@ theUrl += "?id=" + id } top.fsMod.currentBank = bank; + top.TYPO3.Backend.ContentContainer.setUrl(theUrl); - if (top.TYPO3.configuration.condensedMode) { - top.content.location.href = theUrl; - } else { - parent.list_frame.location.href=theUrl; - } - '.($this->doHighlight ? 'Tree.highlightActiveItem("web", highlightID + "_" + bank);' : '').' '.(!$GLOBALS['CLIENT']['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').' return false; Index: typo3/alt_file_navframe.php =================================================================== --- typo3/alt_file_navframe.php (revision 8782) +++ typo3/alt_file_navframe.php (working copy) @@ -195,13 +195,8 @@ theUrl += "?id=" + id } top.fsMod.currentBank = bank; + top.TYPO3.Backend.ContentContainer.setUrl(theUrl); - if (top.TYPO3.configuration.condensedMode) { - top.content.location.href = theUrl; - } else { - parent.list_frame.location.href=theUrl; - } - '.($this->doHighlight ? 'Tree.highlightActiveItem("file", highlightID + "_" + bank);' : '').' '.(!$CLIENT['FORMSTYLE'] ? '' : 'if (linkObj) linkObj.blur(); ').' return false; Index: typo3/backend.php =================================================================== --- typo3/backend.php (revision 8782) +++ typo3/backend.php (working copy) @@ -134,6 +134,7 @@ 'js/loginrefresh.js', 'js/extjs/debugPanel.js', 'js/extjs/viewport.js', + 'js/extjs/iframepanel.js', 'js/extjs/viewportConfiguration.js', ); @@ -197,34 +198,17 @@ $logo = t3lib_div::makeInstance('TYPO3Logo'); $logo->setLogo('gfx/typo3logo_mini.png'); - $menu = $this->moduleMenu->render(); - if ($this->menuWidth != $this->menuWidthDefault) { - $this->css .= ' - #typo3-top { - margin-left: ' . $this->menuWidth . 'px; - } - '; - } // create backend scaffolding $backendScaffolding = ' -
' . $this->renderToolbar() . '
-
-
' . - $menu . - '
-
- -
-
-
+ '; /****************************************************** @@ -351,7 +335,6 @@ protected function generateJavascript() { $pathTYPO3 = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/'; - $goToModuleSwitch = $this->moduleMenu->getGotoModuleJavascript(); $moduleFramesHelper = implode(LF, $this->moduleMenu->getFsMod()); // If another page module was specified, replace the default Page module with the new one @@ -483,9 +466,7 @@ this.denyFileTypes = TYPO3.configuration.denyFileTypes; } var TS = new typoSetup(); - - var currentModuleLoaded = ""; - + //backwards compatibility /** * Frameset Module object * @@ -500,16 +481,16 @@ this.currentMainLoaded=""; this.currentBank="0"; } - var fsMod = new fsModules();' . $moduleFramesHelper . ';'; + var fsMod = new fsModules();' . $moduleFramesHelper . '; - // add goToModule code - $this->pageRenderer->addExtOnReadyCode(' - top.goToModule = ' . $goToModuleSwitch . '; - '); + top.goToModule = function(modName, cMR_flag, addGetVars) { + ModuleMenu.App.showModule(modName, addGetVars); + } + ' . $this->setStartupModule(); // Check editing of page: $this->handlePageEditing(); - $this->setStartupModule(); + } /** @@ -586,17 +567,14 @@ $moduleParameters = t3lib_div::_GET('modParams'); if($startModule) { - $this->pageRenderer->addExtOnReadyCode(' - // start in module: - function startInModule(modName, cMR_flag, addGetVars) { - Ext.onReady(function() { - top.goToModule(modName, cMR_flag, addGetVars); - }); + return ' + // start in module: + top.startInModule = [\'' . $startModule . '\', ' . t3lib_div::quoteJSvalue($moduleParameters) . ']; + '; + } else { + return ''; } - startInModule(\''.$startModule.'\', false, '.t3lib_div::quoteJSvalue($moduleParameters).'); - '); - } } /** Index: typo3/classes/class.modulemenu.php =================================================================== --- typo3/classes/class.modulemenu.php (revision 8782) +++ typo3/classes/class.modulemenu.php (working copy) @@ -100,6 +100,76 @@ } /** + * ModuleMenu Store loading data + * + * @param array_type $params + * @param object $ajaxObj + */ + public function getModuleData($params, $ajaxObj) { + $data = array('success' => TRUE, 'root' => array()); + $rawModuleData = $this->getRawModuleData(); + $index = 0; + foreach($rawModuleData as $moduleKey => $moduleData) { + $key = substr($moduleKey, 8); + $num = count($data['root']); + if($moduleData['link'] != 'dummy.php' || ($moduleData['link'] == 'dummy.php' && is_array($moduleData['subitems'])) ) { + $data['root'][$num]['key'] = $key; + $data['root'][$num]['menuState'] = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey]; + $data['root'][$num]['label'] = $moduleData['title']; + $data['root'][$num]['subitems'] = is_array($moduleData['subitems']) ? count($moduleData['subitems']) : 0; + + + if($moduleData['link'] && $this->linkModules) { + $data['root'][$num]['link'] = 'top.goToModule(\'' . $moduleData['name'] . '\')'; + } + + // traverse submodules + if (is_array($moduleData['subitems'])) { + foreach($moduleData['subitems'] as $subKey => $subData) { + // Setting additional JavaScript + $additionalJavascript = ''; + if($subData['parentNavigationFrameScript']) { + $parentModuleName = substr($subData['name'], 0, strpos($subData['name'], '_')); + $additionalJavascript = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $parentModuleName . "'])"; + } + + if($subData['link'] && $this->linkModules) { + + $onClickString = htmlspecialchars('top.goToModule(\''.$subData['name'].'\');'.$onBlur.'return false;'); + $submoduleLink = '' + //TODO make icon a background image using css + .''.$subData['icon']['html'].'' + .''.htmlspecialchars($subData['title']).'' + .''; + } + $data['root'][$num]['sub'][] = array( + 'name' => $subData['name'], + 'description' => $subData['description'], + 'label' => $subData['title'], + 'icon' => $subData['icon']['filename'], + 'navframe' => $subData['parentNavigationFrameScript'], + 'link' => $subData['link'], + 'originalLink' => $subData['originalLink'], + 'index' => $index++, + 'navigationFrameScript' => $subData['navFrameScript'], + 'navigationFrameScriptParam' => $subData['navFrameScriptParam'], + ); + } + } + } + } + if ($ajaxObj) { + echo json_encode($data); + // why doesn't work following ? + //$ajaxObj->addContent('modulemenu', $data); + //$ajaxObj->setContentFormat('json'); + + } else { + return $data; + } + } + + /** * returns the loaded modules * * @return array array of loaded modules @@ -123,48 +193,7 @@ $GLOBALS['BE_USER']->writeUC(); } - /** - * renders the backend menu as unordered list - * - * @param boolean optional parameter used to switch wrapping the menu in ul tags off for AJAX calls - * @return string menu html code to use in the backend - */ - public function render($wrapInUl = true) { - $menu = ''; - $onBlur = $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : ''; - $tsConfiguration = $GLOBALS['BE_USER']->getTSConfig('options.moduleMenuCollapsable'); - $collapsable = (isset($tsConfiguration['value']) && $tsConfiguration['value'] == 0) ? 0 : 1; - - $rawModuleData = $this->getRawModuleData(); - - foreach($rawModuleData as $moduleKey => $moduleData) { - if($moduleData['link'] != 'dummy.php' || ($moduleData['link'] == 'dummy.php' && is_array($moduleData['subitems'])) ) { - $menuState = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey]; - $moduleLabel = $moduleData['title']; - - if($moduleData['link'] && $this->linkModules) { - $moduleLabel = '' . $moduleLabel . ''; - } - - $menu .= '
  • -
    ' . - $moduleData['icon']['html'] . ' ' . $moduleLabel . '
    '; - - // traverse submodules - if (is_array($moduleData['subitems'])) { - $menu .= $this->renderSubModules($moduleData['subitems'], $menuState); - } - - $menu .= '
  • ' . LF; - } - } - - return ($wrapInUl ? '' . LF : $menu); - } - /** * renders the backend menu as unordered list as an AJAX response without * the wrapping ul tags @@ -188,41 +217,6 @@ } /** - * renders submodules - * - * @param array array of (sub)module data - * @param boolean collapse state of menu item, defaults to false - * @return string (sub)module html code - */ - public function renderSubModules($modules, $menuState=false) { - $moduleMenu = ''; - $onBlur = $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : ''; - - foreach($modules as $moduleKey => $moduleData) { - // Setting additional JavaScript - $additionalJavascript = ''; - if($moduleData['parentNavigationFrameScript']) { - $parentModuleName = substr($moduleData['name'], 0, strpos($moduleData['name'], '_')); - $additionalJavascript = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $parentModuleName . "'])"; - } - - if($moduleData['link'] && $this->linkModules) { - - $onClickString = htmlspecialchars('top.goToModule(\''.$moduleData['name'].'\');'.$onBlur.'return false;'); - $submoduleLink = '' - //TODO make icon a background image using css - .''.$moduleData['icon']['html'].'' - .''.htmlspecialchars($moduleData['title']).'' - .''; - } - - $moduleMenu .= '
  • ' . $submoduleLink . '
  • ' . LF; - } - - return ''.LF.$moduleMenu.''.LF; - } - - /** * gets the raw module data * * @return array multi dimension array with module data @@ -402,137 +396,7 @@ return $prefix; } - /** - * generates javascript code to switch between modules - * - * @return string javascript code snippet to switch modules - */ - public function getGotoModuleJavascript() { - $moduleJavascriptCommands = array(); - $rawModuleData = $this->getRawModuleData(); - $navFrameScripts = array(); - - foreach($rawModuleData as $mainModuleKey => $mainModuleData) { - if ($mainModuleData['subitems']) { - foreach ($mainModuleData['subitems'] as $subModuleKey => $subModuleData) { - - $parentModuleName = substr($subModuleData['name'], 0, strpos($subModuleData['name'], '_')); - $javascriptCommand = ''; - - // Setting additional JavaScript if frameset script: - $additionalJavascript = ''; - if($subModuleData['parentNavigationFrameScript']) { - $additionalJavascript = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $parentModuleName . "'])"; - } - - if ($subModuleData['link'] && $this->linkModules) { - // For condensed mode, send &cMR parameter to frameset script. - if ($additionalJavascript && $GLOBALS['BE_USER']->uc['condensedMode']) { - $additionalJavascript .= "+(cMR ? '&cMR=1' : '')"; - } - - $javascriptCommand = ' - modScriptURL = "'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.';'; - - if ($subModuleData['navFrameScript']) { - $javascriptCommand .= ' - top.currentSubScript="'.$subModuleData['originalLink'].'";'; - } - - if (!$GLOBALS['BE_USER']->uc['condensedMode'] && $subModuleData['parentNavigationFrameScript']) { - $additionalJavascript = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $parentModuleName . "'])"; - - $submoduleNavigationFrameScript = $subModuleData['navigationFrameScript'] ? $subModuleData['navigationFrameScript'] : $subModuleData['parentNavigationFrameScript']; - $submoduleNavigationFrameScript = t3lib_div::resolveBackPath($submoduleNavigationFrameScript); - - // Add navigation script parameters if module requires them - if ($subModuleData['navigationFrameScriptParam']) { - $submoduleNavigationFrameScript = $this->appendQuestionmarkToLink($submoduleNavigationFrameScript) . $subModuleData['navigationFrameScriptParam']; - } - - $navFrameScripts[$parentModuleName] = $submoduleNavigationFrameScript; - - $javascriptCommand = ' - top.currentSubScript = "'.$subModuleData['originalLink'].'"; - if (top.content.list_frame && top.fsMod.currentMainLoaded == mainModName) { - modScriptURL = "'.$this->appendQuestionmarkToLink($subModuleData['originalLink']).'"'.$additionalJavascript.'; - '; - // Change link to navigation frame if submodule has it's own navigation - if ($submoduleNavigationFrameScript) { - $javascriptCommand .= 'navFrames["' . $parentModuleName . '"] = "'. $submoduleNavigationFrameScript . '";'; - } - $javascriptCommand .= ' - } else if (top.nextLoadModuleUrl) { - modScriptURL = "'.($subModuleData['prefix'] ? $this->appendQuestionmarkToLink($subModuleData['link']) . '&exScript=' : '') . 'listframe_loader.php"; - } else { - modScriptURL = "'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.' + additionalGetVariables; - }'; - } - } - $moduleJavascriptCommands[] = " - case '".$subModuleData['name']."':".$javascriptCommand." - break;"; - } - } elseif(!$mainModuleData['subitems'] && !empty($mainModuleData['link'])) { - // main module has no sub modules but instead is linked itself (doc module f.e.) - $javascriptCommand = ' - modScriptURL = "'.$this->appendQuestionmarkToLink($mainModuleData['link']).'";'; - $moduleJavascriptCommands[] = " - case '".$mainModuleData['name']."':".$javascriptCommand." - break;"; - } - } - - $javascriptCode = 'function(modName, cMR_flag, addGetVars) { - var useCondensedMode = '.($GLOBALS['BE_USER']->uc['condensedMode'] ? 'true' : 'false').'; - var mainModName = (modName.slice(0, modName.indexOf("_")) || modName); - - var additionalGetVariables = ""; - if (addGetVars) { - additionalGetVariables = addGetVars; - }'; - - $javascriptCode .= ' - var navFrames = {};'; - foreach ($navFrameScripts as $mainMod => $frameScript) { - $javascriptCode .= ' - navFrames["'.$mainMod.'"] = "'.$frameScript.'";'; - } - - $javascriptCode .= ' - - var cMR = (cMR_flag ? 1 : 0); - var modScriptURL = ""; - - switch(modName) {' - .LF.implode(LF, $moduleJavascriptCommands).LF.' - } - '; - - $javascriptCode .= ' - - if (!useCondensedMode && navFrames[mainModName]) { - if (top.content.list_frame && top.fsMod.currentMainLoaded == mainModName) { - top.content.list_frame.location = top.getModuleUrl(top.TS.PATH_typo3 + modScriptURL + additionalGetVariables); - if (top.currentSubNavScript != navFrames[mainModName]) { - top.currentSubNavScript = navFrames[mainModName]; - top.content.nav_frame.location = top.getModuleUrl(top.TS.PATH_typo3 + navFrames[mainModName]); - } - } else { - TYPO3.Backend.loadModule(mainModName, modName, modScriptURL + additionalGetVariables); - } - } else if (modScriptURL) { - TYPO3.Backend.loadModule(mainModName, modName, top.getModuleUrl(modScriptURL + additionalGetVariables)); - } - currentModuleLoaded = modName; - top.fsMod.currentMainLoaded = mainModName; - TYPO3ModuleMenu.highlightModule("modmenu_" + modName, (modName == mainModName ? 1 : 0)); - }'; - - return $javascriptCode; - } - /** * Appends a '?' if there is none in the string already * Index: typo3/js/backend.js =================================================================== --- typo3/js/backend.js (revision 8782) +++ typo3/js/backend.js (working copy) @@ -38,12 +38,13 @@ // clear information about which entry in nav. tree that might have been highlighted. top.fsMod.navFrameHighlightedID = []; - if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { - top.content.nav_frame.refresh_nav(); + if (TYPO3.Backend.NavigationContainer.isVisible()) { + TYPO3.Backend.NavigationContainer.refresh(); } top.nextLoadModuleUrl = url; - top.goToModule(modName); + ModuleMenu.App.showModule(modName); + } /** Index: typo3/js/extjs/backendsizemanager.js =================================================================== --- typo3/js/extjs/backendsizemanager.js (revision 8782) +++ typo3/js/extjs/backendsizemanager.js (working copy) @@ -47,8 +47,8 @@ height: (viewportHeight - topHeight - consoleHeight) + 'px' }; - Ext.get('typo3-side-menu').setStyle(styles); - Ext.get('content').setStyle(styles); + //TYPO3.Backend.ModuleMenuContainer.setSize(styles); + //TYPO3.Backend.ContentContainer.setSize(styles); }; Ext.EventManager.onWindowResize(resizeBackend); Index: typo3/js/extjs/iframepanel.js =================================================================== --- typo3/js/extjs/iframepanel.js (revision 0) +++ typo3/js/extjs/iframepanel.js (revision 0) @@ -0,0 +1,103 @@ +/*************************************************************** +* Copyright notice +* +* (c) 2010 Steffen Kamper +* All rights reserved +* +* This script is part of the TYPO3 project. The TYPO3 project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* A copy is found in the textfile GPL.txt and important notices to the license +* from the author is found in LICENSE.txt distributed with these scripts. +* +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + + +/** + * iFrame panel + * + * @author Steffen Kamper + */ + +Ext.ns('TYPO3'); + +TYPO3.iframePanel = Ext.extend(Ext.Panel, { + name: 'iframe', + iframe: null, + src: Ext.isIE && Ext.isSecure ? Ext.SSL_SECURE_URL : 'about:blank', + maskMessage: 'loading ...', + doMask: true, + + // component build + initComponent: function() { + this.bodyCfg = { + tag: 'iframe', + frameborder: '0', + src: this.src, + name: this.name + } + Ext.apply(this, { + + }); + TYPO3.iframePanel.superclass.initComponent.apply(this, arguments); + + // apply the addListener patch for 'message:tagging' + this.addListener = this.on; + + }, + + onRender : function() { + TYPO3.iframePanel.superclass.onRender.apply(this, arguments); + this.maskMessage = TYPO3.LLL.core.please_wait; + this.iframe = Ext.isIE ? this.body.dom.contentWindow : window.frames[this.name]; + this.body.dom[Ext.isIE ? 'onreadystatechange' : 'onload'] = this.loadHandler.createDelegate(this); + }, + + loadHandler: function() { + this.src = this.body.dom.src; + if (this.doMask) { + this.el.unmask(); + } + }, + + getIframe: function() { + return this.iframe; + }, + getUrl: function(src) { + return this.body.dom.src; + }, + + setUrl: function(src) { + if (this.doMask) { + this.el.mask(this.maskMessage, 'x-mask-loading'); + } + this.body.dom.src = src; + }, + + resetUrl: function() { + if (this.doMask) { + this.el.mask(this.maskMessage); + } + this.body.dom.src = this.src; + }, + + refresh: function() { + if (this.doMask) { + this.el.mask(this.maskMessage); + } + this.body.dom.src = this.body.dom.src; + } +}); +Ext.reg('iframePanel', TYPO3.iframePanel); Index: typo3/js/extjs/viewport.js =================================================================== --- typo3/js/extjs/viewport.js (revision 8782) +++ typo3/js/extjs/viewport.js (working copy) @@ -89,20 +89,27 @@ * @return void */ initComponent: function() { - // adjust the width of module menu and the height of the topbar + // adjust the module menu and the height of the topbar this.initialConfig.items[0].height = TYPO3.configuration.topBarHeight; - this.initialConfig.items[1].width = TYPO3.configuration.moduleMenuWidth; - + + var moduleMenu = this.initialConfig.items[1]; + moduleMenu.width = TYPO3.configuration.moduleMenuWidth; + if (!TYPO3.configuration.moduleMenuSplit) { + moduleMenu.split = false; + moduleMenu.collapsible = false; + moduleMenu.collapseMode = null + } + // call parent constructor TYPO3.Viewport.superclass.initComponent.apply(this, arguments); - this.ContentContainer = Ext.ComponentMgr.get('typo3-contentContainer'); - this.NavigationContainer = Ext.ComponentMgr.get('typo3-navigationContainer'); - this.Topbar = Ext.ComponentMgr.get('typo3-topbar'); - this.ModuleMenuContainer = Ext.ComponentMgr.get('typo3-module-menu'); - this.DebugConsole = Ext.ComponentMgr.get('typo3-debug-console'); + this.ContentContainer = Ext.getCmp('typo3-contentContainer'); + this.NavigationContainer = Ext.getCmp('typo3-navigationContainer'); + this.Topbar = Ext.getCmp('typo3-topbar'); + this.ModuleMenuContainer = Ext.getCmp('typo3-module-menu'); + this.DebugConsole = Ext.getCmp('typo3-debug-console'); }, - + /** * Loads a module into the content container * @@ -130,7 +137,7 @@ widget.hide(); } } - + if (navigationWidgetActive) { this.NavigationContainer.show(); } else { @@ -142,10 +149,8 @@ if (contentScript.indexOf(top.TS.PATH_typo3) !== 0) { contentScript = top.TS.PATH_typo3 + contentScript; } - Ext.get('content').set({ - src: contentScript - }); - + this.ContentContainer.setUrl(contentScript); + this.NavigationContainer.ownerCt.doLayout(); }, Index: typo3/js/extjs/viewportConfiguration.js =================================================================== --- typo3/js/extjs/viewportConfiguration.js (revision 8782) +++ typo3/js/extjs/viewportConfiguration.js (working copy) @@ -44,38 +44,45 @@ contentEl: 'typo3-top-container', border: false }, { - layout: 'absolute', + layout: 'fit', region: 'west', id: 'typo3-module-menu', - contentEl: 'typo3-side-menu', - width: 159, - anchor: '100% 100%', - border: false + collapsible: true, + collapseMode: 'mini', + floatable: true, + hideCollapseTool: true, + split: true, + border: false, + autoScroll: true }, { region: 'center', layout: 'border', border: false, items: [{ region: 'west', - layout: 'absolute', + layout: 'fit', id: 'typo3-navigationContainer', width: 300, + minWidth: 20, anchor: '100% 100%', + floatable: true, + split: true, collapsible: true, collapseMode: 'mini', hideCollapseTool: true, - animCollapse: false, - split: true, autoScroll: true, hidden: true, - border: false + border: false, + xtype: 'iframePanel', + name: 'navigationframe' }, { region: 'center', - layout: 'absolute', + layout: 'fit', id: 'typo3-contentContainer', - contentEl: 'typo3-content', anchor: '100% 100%', - border: false + border: false, + xtype: 'iframePanel', + name: 'contentframe' }] }, { region: 'south', Index: typo3/js/modulemenu.js =================================================================== --- typo3/js/modulemenu.js (revision 8782) +++ typo3/js/modulemenu.js (working copy) @@ -1,7 +1,7 @@ /*************************************************************** * Copyright notice * -* (c) 2007-2010 Ingo Renner +* (c) 2010 Steffen Kamper * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -26,143 +26,275 @@ /** - * observes clicks on menuHeader and toggles child ul + * Class to render the module menu and handle the BE navigation * - * @author Ingo Renner * @author Steffen Kamper */ -var ModuleMenu = Class.create({ - /** - * initially register event listeners - */ - initialize: function() { - // initialize event listeners - Event.observe(document, 'dom:loaded', function(){ - this.registerEventListeners(); - }.bind(this)); +Ext.ns('ModuleMenu'); - // initialize some variables - this.currentlyHighLightedMainModule = ''; - this.currentlyHighlightedModuleId = ''; - }, +ModuleMenu.recentIds = []; - /** - * registers the event listeners, can be used to re-register them after refreshing the menu - */ - registerEventListeners: function() { - $$('#typo3-menu li.menuSection div').invoke('observe', 'click', this.toggleMenu); - if (Prototype.Browser.IE) { - //mouseenter and mouseleave are only available but thats our target - $$('#typo3-menu li.menuSection li').invoke('observe', 'mouseenter', this.toggleHoverClass); - $$('#typo3-menu li.menuSection li').invoke('observe', 'mouseleave', this.toggleHoverClass); - } - }, +ModuleMenu.Store = new Ext.data.JsonStore({ + storeId: 'ModuleMenuStore', + root: 'root', + fields: [ + {name: 'index', type: 'int', mapping: 'sub.index'}, + {name: 'key', type: 'string'}, + {name: 'label', type: 'string'}, + {name: 'menuState', type: 'int'}, + {name: 'subitems', type: 'int'}, + 'sub' + ], + url: 'ajax.php?ajaxID=ModuleMenu::getData', + baseParams: { + 'action': 'getModules' + } - /** - * toggles the hover classname for IE menu hover support - */ - toggleHoverClass: function(event) { - var menuItem = Event.element(event); - menuItem.toggleClassName('hover'); - }, +}); - /** - * toggles the associated submodule menu when clicking a main module header - */ - toggleMenu: function(event) { - var mainModuleHeader = Event.element(event); - - var mainMenuId = mainModuleHeader.up().identify(); - var subModulesMenu = mainModuleHeader.next('ul'); - if (!subModulesMenu) { - return; +ModuleMenu.Template = new Ext.XTemplate( + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '', + { + getStateClass: function(value) { + return value.menuState ? 'collapsed' : 'expanded'; + }, + getStateStyle: function(value) { + return value.menuState ? 'style="display:none"' : ''; + } } - var state = subModulesMenu.visible(); +); - // save state - var save = new Ajax.Request('ajax.php', { - parameters : 'ajaxID=ModuleMenu::saveMenuState&menuid=' + mainMenuId + '&state=' + state +ModuleMenu.App = { + loadedModule: null, + + init: function() { + ModuleMenu.Store.load({ + scope: this, + callback: function(records, options) { + this.renderMenu(records); + if (top.startInModule) { + this.showModule(top.startInModule[0],top.startInModule[1]); + } + } }); + }, + + renderMenu: function(records) { + TYPO3.Backend.ModuleMenuContainer.removeAll(); + TYPO3.Backend.ModuleMenuContainer.add({ + xtype: 'dataview', + animCollapse: true, + store: ModuleMenu.Store, + tpl: ModuleMenu.Template, + singleSelect: true, + itemSelector: 'li.submodule', + overClass: 'x-view-over', + selectedClass: 'highlighted', + autoHeight: true, + itemId: 'modDataView', + tbar: [{text: 'test'}], + listeners: { + click: function(view, index, node, event) { + var el = Ext.fly(node); + if (el.hasClass('submodule')) { + ModuleMenu.App.showModule(el.getAttribute('id')); + } + }, + containerclick: function(view, event) { + var item = event.getTarget('li.menuSection', view.getEl()); + if (item) { + var el = Ext.fly(item); + var id = el.getAttribute('id'); + var section = el.first('div'), state; + if (section.hasClass('expanded')) { + state = true; + section.removeClass('expanded').addClass('collapsed'); + el.first('ul').slideOut('t', { + easing: 'easeOut', + duration: .2, + remove: false, + useDisplay: true + }); - if (state) { - Effect.BlindUp(subModulesMenu, {duration : 0.1}); - $(mainModuleHeader).removeClassName('expanded'); - $(mainModuleHeader).addClassName('collapsed'); + } else { + state = false; + section.removeClass('collapsed').addClass('expanded'); + el.first('ul').slideIn('t', { + easing: 'easeIn', + duration: .2, + remove: false, + useDisplay: true + }); + } + // save menu state + Ext.Ajax.request({ + url: 'ajax.php?ajaxID=ModuleMenu::saveMenuState', + params: { + 'menuid': 'modmenu_' + id, + 'state': state + } + }); + } + }, + scope: this + } + }); + TYPO3.Backend.ModuleMenuContainer.doLayout(); + }, + + getRecordFromIndex: function(index) { + var i, record; + for (i = 0; i < ModuleMenu.Store.getCount(); i++) { + record = ModuleMenu.Store.getAt(i); + if (index < record.data.subitems) { + return record.data.sub[index]; + } + index -= record.data.subitems; + } + }, + + getRecordFromName: function(name) { + var i, j, record; + for (i = 0; i < ModuleMenu.Store.getCount(); i++) { + record = ModuleMenu.Store.getAt(i); + for (j = 0; j < record.data.subitems; j++) { + if (record.data.sub[j].name === name) { + return record.data.sub[j]; + } + } + } + }, + + showModule: function(mod, params) { + params = params || ''; + this.selecteModule = mod; + var record = this.getRecordFromName(mod); + + if (record) { + + //get id + var section = mod.split('_')[0]; + if (top.fsMod.recentIds[section]) { + params = 'id=' + top.fsMod.recentIds[section] + params; + } + + if (record.navframe) { + this.openInNavFrame(record.navframe); + } else { + TYPO3.Backend.NavigationContainer.hide(); + } + this.openInContentFrame(record.originalLink, params); + this.loadedModule = mod; + this.highlightModuleMenuItem(mod); + + // compatibility + top.currentSubScript = record.originalLink; + top.currentModuleLoaded = mod; + + TYPO3.Backend.doLayout(); } else { - Effect.BlindDown(subModulesMenu, {duration : 0.1}); - $(mainModuleHeader).removeClassName('collapsed'); - $(mainModuleHeader).addClassName('expanded'); + console.log(mod + ' was not found in modules'); } }, - - /** - * refreshes the complete module menu - */ + + openInNavFrame: function(url, params) { + var navUrl = url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : ''); + var currentUrl = this.relativeUrl(TYPO3.Backend.NavigationContainer.getUrl()); + if (currentUrl !== navUrl) { + TYPO3.Backend.NavigationContainer.setUrl(navUrl); + } + TYPO3.Backend.NavigationContainer.show(); + }, + + openInContentFrame: function(url, params) { + if (top.nextLoadModuleUrl) { + TYPO3.Backend.ContentContainer.setUrl(top.nextLoadModuleUrl); + top.nextLoadModuleUrl = ''; + } else { + TYPO3.Backend.ContentContainer.setUrl(url + (params ? (url.indexOf('?') !== -1 ? '&' : '?') + params : '')); + } + }, + + highlightModuleMenuItem: function(module, mainModule) { + TYPO3.Backend.ModuleMenuContainer.getComponent('modDataView').select(module, false, false); + }, + + relativeUrl: function(url) { + return url.replace(TYPO3.configuration.siteUrl + 'typo3/', ''); + }, + refreshMenu: function() { - var refresh = new Ajax.Updater('typo3-menu', TS.PATH_typo3 + 'ajax.php', { - parameters : 'ajaxID=ModuleMenu::render', - asynchronous : false, - evalScripts : true + ModuleMenu.Store.load({ + scope: this, + callback: function(records, options) { + this.renderMenu(records); + if (this.loadedModule) { + this.highlightModuleMenuItem(this.loadedModule); + } + } }); - - this.registerEventListeners(); - this.highlightModule(this.currentlyHighlightedModuleId, this.currentlyHighLightedMainModule); }, + + reloadFrames: function() { + TYPO3.Backend.NavigationContainer.refresh(); + TYPO3.Backend.ContentContainer.refresh(); + } - /** - * de-highlights the old menu item and highlights the new one - * - * @param string css module id to highlight - */ - highlightModule: function(moduleId, mainModule) { - // reset the currently highlighted module - $$('#typo3-menu .highlighted').invoke('removeClassName', 'highlighted'); +}; - // highlight the new one - if ($(moduleId)) { - $(moduleId).addClassName('highlighted'); - } - if (undefined !== mainModule) { - this.currentlyHighLightedMainModule = mainModule; - } - this.currentlyHighlightedModuleId = moduleId; - // kept for backwards compatibility - // @TODO: remove in TYPO3 4.5 - // @deprecated since TYPO3 4.3, remove in 4.5 - top.currentlyHighLightedId = moduleId; - top.currentlyHighLightedMain = mainModule; +Ext.onReady(function() { + ModuleMenu.App.init(); + + // keep backward compatibility + top.list_frame = TYPO3.Backend.ContentContainer.getIframe(); + top.TYPO3ModuleMenu = ModuleMenu.App; + top.content = { + nav_frame: TYPO3.Backend.NavigationContainer.getIframe(), + list_frame: TYPO3.Backend.ContentContainer.getIframe() } - }); -var TYPO3ModuleMenu = new ModuleMenu(); - /******************************************************************************* - * - * Backwards compatability handling down here - * - ******************************************************************************/ +* +* Backwards compatability handling down here +* +******************************************************************************/ /** - * Highlight module: - */ +* Highlight module: +*/ var currentlyHighLightedId = ''; var currentlyHighLighted_restoreValue = ''; var currentlyHighLightedMain = ''; function highlightModuleMenuItem(trId, mainModule) { - TYPO3ModuleMenu.highlightModule(trId, mainModule); + ModuleMenu.App.highlightModule(trId, mainModule); } - - - - - - - - - Index: typo3/js/workspacemenu.js =================================================================== --- typo3/js/workspacemenu.js (revision 8782) +++ typo3/js/workspacemenu.js (working copy) @@ -168,11 +168,10 @@ // when in web module reload, otherwise send the user to the web module if (currentModuleLoaded.startsWith('web_')) { - // the boolean "true" makes the page reload from the server - $('content').contentWindow.location.reload(true); + top.ModuleMenu.App.reloadFrames(); } else { if (TYPO3.configuration.pageModule) { - top.goToModule(TYPO3.configuration.pageModule); + top.ModuleMenu.App.showModule(TYPO3.configuration.pageModule); } } Index: typo3/sysext/t3skin/extjs/xtheme-t3skin.css =================================================================== --- typo3/sysext/t3skin/extjs/xtheme-t3skin.css (revision 8782) +++ typo3/sysext/t3skin/extjs/xtheme-t3skin.css (working copy) @@ -478,7 +478,7 @@ */ .ext-el-mask { - background-color: #000; + background-color: #aaa; -moz-opacity: 0.75; opacity: .75; filter: alpha(opacity=75); @@ -2177,7 +2177,7 @@ /* Pagetree */ .x-layout-split { - background-color: #aeb6c1; + background-color: #dadada; } #widget-navigation-tree .x-panel-noborder .x-panel-body-noborder { Index: typo3/sysext/t3skin/stylesheets/visual/module_menu.css =================================================================== --- typo3/sysext/t3skin/stylesheets/visual/module_menu.css (revision 8782) +++ typo3/sysext/t3skin/stylesheets/visual/module_menu.css (working copy) @@ -13,6 +13,7 @@ #typo3-module-menu .x-panel-body { background-color: transparent; + overflow-x: hidden !important; /*temporary fix of horizontal scrollbar */ } #typo3-side-menu {