Bug #18043 ยป 7251.diff
t3lib/config_default.php (working copy) | ||
---|---|---|
'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',
|
||
... | ... | |
'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!
|
typo3/classes/class.modulemenu.php (working copy) | ||
---|---|---|
}
|
||
/**
|
||
* 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
|
||
... | ... | |
$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 = '<a href="#" onclick="top.goToModule(\''.$moduleData['name'].'\');'.$onBlur.'return false;">'.$moduleLabel.'</a>';
|
||
}
|
||
... | ... | |
}
|
||
//TODO make icon a background image using css
|
||
$menu .= '<li><div>'.$moduleData['icon']['html'].' '.$moduleLabel.'</div>';
|
||
$menu .= '<li id="'.$moduleKey.'" class="menuSection"><div>'.$moduleData['icon']['html'].' '.$moduleLabel.'</div>';
|
||
// traverse submodules
|
||
if(is_array($moduleData['subitems'])) {
|
||
$menu .= $this->renderSubModules($moduleData['subitems']);
|
||
$menu .= $this->renderSubModules($moduleData['subitems'], $menuState);
|
||
}
|
||
$menu .= '</li>'."\n";
|
||
... | ... | |
* 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();' : '';
|
||
... | ... | |
$moduleMenu .= '<li>'.$submoduleLink.'</li>'."\n";
|
||
}
|
||
return '<ul>'."\n".$moduleMenu.'</ul>'."\n";
|
||
return '<ul'.($menuState ? ' style="display:none;"' : '').'>'."\n".$moduleMenu.'</ul>'."\n";
|
||
}
|
||
/**
|
typo3/js/backend.js (working copy) | ||
---|---|---|
/**
|
||
* 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);
|
||