Index: t3lib/config_default.php =================================================================== --- t3lib/config_default.php (revision 2932) +++ t3lib/config_default.php (working copy) @@ -174,7 +174,7 @@ 'AJAX' => array( // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information. 'SC_alt_db_navframe::expandCollapse' => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse', 'SC_alt_file_navframe::expandCollapse' => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse', - 't3lib_TCEforms_inline::createNewRecord' => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest', + 't3lib_TCEforms_inline::createNewRecord' => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest', 't3lib_TCEforms_inline::setExpandedCollapsedState' => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest', 'ShortcutMenu::getGroups' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->getAjaxShortcutGroups', 'ShortcutMenu::saveShortcut' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->setAjaxShortcut', @@ -180,7 +180,8 @@ 'ShortcutMenu::saveShortcut' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->setAjaxShortcut', 'ShortcutMenu::render' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->renderAjax', 'ShortcutMenu::delete' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->deleteAjaxShortcut', - 'ShortcutMenu::create' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->createAjaxShortcut' + 'ShortcutMenu::create' => 'typo3/classes/class.shortcutmenu.php:ShortcutMenu->createAjaxShortcut', + 'ModuleMenu::saveMenuState' => 'typo3/classes/class.modulemenu.php:ModuleMenu->saveMenuState' ), ), 'FE' => Array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend! Index: typo3/classes/class.modulemenu.php =================================================================== --- typo3/classes/class.modulemenu.php (revision 2932) +++ typo3/classes/class.modulemenu.php (working copy) @@ -105,6 +105,21 @@ } /** + * saves the menu's toggle state in the backend user's uc + * + * @param array array of parameters from the AJAX interface, currently unused + * @param TYPO3AJAX object of type TYPO3AJAX + * @return void + */ + public function saveMenuState($params, &$ajaxObj) { + $menuItem = t3lib_div::_POST('menuid'); + $state = t3lib_div::_POST('state') === 'true' ? 1 : 0; + + $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$menuItem] = $state; + $GLOBALS['BE_USER']->writeUC(); + } + + /** * renders the backend menu as unordered list * * @return string menu html code to use in the backend @@ -116,8 +131,9 @@ $rawModuleData = $this->getRawModuleData(); foreach($rawModuleData as $moduleKey => $moduleData) { + $menuState = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey]; + $moduleLabel = $moduleData['title']; - $moduleLabel = $moduleData['title']; if($moduleData['link'] && $this->linkModules) { $moduleLabel = ''.$moduleLabel.''; } @@ -123,11 +139,11 @@ } //TODO make icon a background image using css - $menu .= '
  • '.$moduleData['icon']['html'].' '.$moduleLabel.'
    '; + $menu .= '
  • '."\n"; @@ -140,9 +156,10 @@ * 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) { + public function renderSubModules($modules, $menuState=false) { $moduleMenu = ''; $onBlur = $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : ''; @@ -167,7 +184,7 @@ $moduleMenu .= '
  • '.$submoduleLink.'
  • '."\n"; } - return ''."\n"; + return ''."\n".$moduleMenu.''."\n"; } /** Index: typo3/js/backend.js =================================================================== --- typo3/js/backend.js (revision 2932) +++ typo3/js/backend.js (working copy) @@ -68,6 +68,31 @@ +/** + * observes clicks on menuHeader and toggles child ul + */ +var ModuleMenuToggle = { + + toggleMenu: function() { + $$('li.menuSection div').each(function(element) { + element.observe('click', function(){ + var li = element.up(); + var ul = li.down(2); + var state = ul.visible(); + + // save state + new Ajax.Request('ajax.php', { + method: 'post', + parameters: 'ajaxID=ModuleMenu::saveMenuState&menuid=' + li.id + '&state=' + state, + }); + + ul.toggle(); + }); + }); + } +} + +Event.observe(document, 'dom:loaded', ModuleMenuToggle.toggleMenu.bindAsEventListener(ModuleMenuToggle), true);