Bug #18028 » reloadMenuOnExtInstall.diff
t3lib/config_default.php (working copy) | ||
---|---|---|
'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',
|
||
'ModuleMenu::saveMenuState' => 'typo3/classes/class.modulemenu.php:ModuleMenu->saveMenuState'
|
||
'ModuleMenu::saveMenuState' => 'typo3/classes/class.modulemenu.php:ModuleMenu->saveMenuState',
|
||
'ModuleMenu::render' => 'typo3/classes/class.modulemenu.php:ModuleMenu->renderAjax'
|
||
),
|
||
),
|
||
'FE' => Array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend!
|
typo3/backend.php (working copy) | ||
---|---|---|
}
|
||
}
|
||
'.$goToModuleSwitch.'
|
||
/**
|
||
* reloads the menu frame
|
||
* Function used to switch modules
|
||
*/
|
||
function refreshMenu() {
|
||
top.'.$menuFrameName.'.location.href = top.'.$menuFrameName.'.document.URL
|
||
}
|
||
var currentModuleLoaded = "";
|
||
var goToModule = '.$goToModuleSwitch.'
|
||
/**
|
||
* Frameset Module object
|
typo3/classes/class.modulemenu.php (working copy) | ||
---|---|---|
***************************************************************/
|
||
if(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
|
||
require_once(PATH_typo3.'sysext/lang/lang.php');
|
||
$GLOBALS['LANG'] = t3lib_div::makeInstance('language');
|
||
$GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']);
|
||
$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
|
||
}
|
||
/**
|
||
* class to render the TYPO3 backend menu for the modules
|
||
*
|
||
... | ... | |
/**
|
||
* 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() {
|
||
public function render($wrapInUl = true) {
|
||
$menu = '';
|
||
$onBlur = $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : '';
|
||
... | ... | |
$menu .= '</li>'."\n";
|
||
}
|
||
return '<ul id="typo3-menu">'."\n".$menu.'</ul>'."\n";
|
||
return $wrapInUl ? '<ul id="typo3-menu">'."\n".$menu.'</ul>'."\n" : $menu;
|
||
}
|
||
/**
|
||
* renders the backend menu as unordered list as an AJAX response without
|
||
* the wrapping ul tags
|
||
*
|
||
* @param array array of parameters from the AJAX interface, currently unused
|
||
* @param TYPO3AJAX object of type TYPO3AJAX
|
||
* @return void
|
||
*/
|
||
public function renderAjax($params = array(), TYPO3AJAX &$ajaxObj = null) {
|
||
$menu = $this->render(false);
|
||
$menuSwitch = $this->getGotoModuleJavascript();
|
||
// JS rocks: we can just overwrite a function with a new definition.
|
||
// and yes, we actually do that =)
|
||
$menuSwitchUpdate = '
|
||
<script type="text/javascript">
|
||
top.goToModule = '.$menuSwitch.';
|
||
</script>';
|
||
$ajaxObj->addContent('typo3-menu', $menu.$menuSwitchUpdate);
|
||
}
|
||
/**
|
||
... | ... | |
}
|
||
$modules[$moduleKey] = array(
|
||
'name' => $moduleName,
|
||
'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey],
|
||
'onclick' => 'top.goToModule(\''.$moduleName.'\');',
|
||
'cssId' => $moduleCssId,
|
||
'icon' => $moduleIcon,
|
||
'link' => $moduleLink,
|
||
'prefix' => $moduleNavigationFramePrefix,
|
||
'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey.'label']
|
||
'name' => $moduleName,
|
||
'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey],
|
||
'onclick' => 'top.goToModule(\''.$moduleName.'\');',
|
||
'cssId' => $moduleCssId,
|
||
'icon' => $moduleIcon,
|
||
'link' => $moduleLink,
|
||
'prefix' => $moduleNavigationFramePrefix,
|
||
'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey.'label']
|
||
);
|
||
if(is_array($moduleData['sub'])) {
|
||
... | ... | |
$submoduleNavigationFrameScript = $this->appendQuestionmarkToLink($submoduleNavigationFrameScript).$subModuleData['navigationFrameScript'];
|
||
$javascriptCommand = '
|
||
if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$parentModuleName.'") {
|
||
top.currentSubScript="'.$subModuleData['originalLink'].'";
|
||
top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($subModuleData['originalLink']).'"'.$additionalJavascript.'+additionalGetVariables);
|
||
if(top.currentSubNavScript!="'.$submoduleNavigationFrameScript.'") {
|
||
top.currentSubNavScript="'.$submoduleNavigationFrameScript.'";
|
||
top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$submoduleNavigationFrameScript.'");
|
||
}
|
||
} else {
|
||
top.content.location=top.TS.PATH_typo3+(
|
||
top.nextLoadModuleUrl?
|
||
"'.($subModuleData['prefix'] ? $this->appendQuestionmarkToLink($subModuleData['link']).'&exScript=' : '').'listframe_loader.php":
|
||
"'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.'+additionalGetVariables
|
||
);
|
||
top.fsMod.currentMainLoaded="'.$parentModuleName.'";
|
||
top.currentSubScript="'.$subModuleData['originalLink'].'";
|
||
}
|
||
if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$parentModuleName.'") {
|
||
top.currentSubScript="'.$subModuleData['originalLink'].'";
|
||
top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($subModuleData['originalLink']).'"'.$additionalJavascript.'+additionalGetVariables);
|
||
if(top.currentSubNavScript!="'.$submoduleNavigationFrameScript.'") {
|
||
top.currentSubNavScript="'.$submoduleNavigationFrameScript.'";
|
||
top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$submoduleNavigationFrameScript.'");
|
||
}
|
||
} else {
|
||
top.content.location=top.TS.PATH_typo3+(
|
||
top.nextLoadModuleUrl?
|
||
"'.($subModuleData['prefix'] ? $this->appendQuestionmarkToLink($subModuleData['link']).'&exScript=' : '').'listframe_loader.php":
|
||
"'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.'+additionalGetVariables
|
||
);
|
||
top.fsMod.currentMainLoaded="'.$parentModuleName.'";
|
||
top.currentSubScript="'.$subModuleData['originalLink'].'";
|
||
}
|
||
';
|
||
}
|
||
... | ... | |
}
|
||
$javascriptCommand .= '
|
||
top.highlightModuleMenuItem("'.$subModuleData['cssId'].'");
|
||
top.highlightModuleMenuItem("'.$subModuleData['cssId'].'");
|
||
';
|
||
$moduleJavascriptCommands[] = "case '".$subModuleData['name']."': \n ".$javascriptCommand." \n break;";
|
||
$moduleJavascriptCommands[] = " case '".$subModuleData['name']."': \n ".$javascriptCommand." \n break;";
|
||
}
|
||
}
|
||
} elseif(!$mainModuleData['subitems'] && !empty($mainModuleData['link'])) {
|
||
// main module has no sub modules but instead is linked itself (doc module)
|
||
// main module has no sub modules but instead is linked itself (doc module f.e.)
|
||
$javascriptCommand = '
|
||
top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($mainModuleData['link']).'"+additionalGetVariables);
|
||
top.highlightModuleMenuItem("'.$mainModuleData['cssId'].'", 1);
|
||
... | ... | |
top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($mainModuleData['link']).'"+additionalGetVariables);
|
||
top.highlightModuleMenuItem("'.$mainModuleData['cssId'].'", 1);
|
||
';
|
||
$moduleJavascriptCommands[] = "case '".$mainModuleData['name']."': \n ".$javascriptCommand." \n break;";
|
||
$moduleJavascriptCommands[] = " case '".$mainModuleData['name']."': \n ".$javascriptCommand." \n break;";
|
||
}
|
||
}
|
||
$javascriptCode = '
|
||
/**
|
||
* Function used to switch switch module.
|
||
*/
|
||
var currentModuleLoaded = "";
|
||
function goToModule(modName,cMR_flag,addGetVars) { //
|
||
$javascriptCode = 'function(modName, cMR_flag, addGetVars) {
|
||
var additionalGetVariables = "";
|
||
if (addGetVars) additionalGetVariables = addGetVars;
|
||
typo3/js/modulemenu.js (working copy) | ||
---|---|---|
* @author Steffen Kamper
|
||
* @author Ingo Renner
|
||
*/
|
||
var ModuleMenu = {
|
||
var ModuleMenu = Class.create({
|
||
/**
|
||
* initially register event listeners
|
||
*/
|
||
initialize: function() {
|
||
Event.observe(document, 'dom:loaded', function(){
|
||
this.registerEventListeners();
|
||
}.bind(this));
|
||
},
|
||
/**
|
||
* 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);
|
||
},
|
||
/**
|
||
* toggles the associated submodule menu when clicking a main module header
|
||
*/
|
||
toggleMenu: function(event) {
|
||
var mainModuleHeader = Event.element(event);
|
||
... | ... | |
});
|
||
subModulesMenu.toggle();
|
||
},
|
||
/**
|
||
* refreshes the complete module menu
|
||
*/
|
||
refreshMenu: function() {
|
||
new Ajax.Updater('typo3-menu', TS.PATH_typo3 + 'ajax.php', {
|
||
parameters : 'ajaxID=ModuleMenu::render',
|
||
asynchronous : false,
|
||
evalScripts : true
|
||
});
|
||
this.registerEventListeners();
|
||
}
|
||
}
|
||
// initialize event listening
|
||
Event.observe(document, 'dom:loaded', function() {
|
||
$$('#typo3-menu li.menuSection div').each(function(mainModuleHeader) {
|
||
mainModuleHeader.observe('click', ModuleMenu.toggleMenu)
|
||
});
|
||
});
|
||
var TYPO3ModuleMenu = new ModuleMenu();
|
||
typo3/mod/tools/em/class.em_index.php (working copy) | ||
---|---|---|
// Reload left frame menu
|
||
if ($this->CMD['refreshMenu']) {
|
||
$this->doc->JScode .= $this->doc->wrapScriptTags('top.refreshMenu();');
|
||
$this->doc->JScode .= $this->doc->wrapScriptTags('
|
||
if(top.refreshMenu) {
|
||
top.refreshMenu();
|
||
} else {
|
||
top.TYPO3ModuleMenu.refreshMenu();
|
||
}
|
||
');
|
||
}
|
||
$this->doc->form = '<form action="index.php" method="post" name="pageform">';
|