Bug #19202 » 20080921_less_js_in_backend.patch
typo3/js/modulemenu.js (working copy) | ||
---|---|---|
var mainMenuId = mainModuleHeader.up().identify();
|
||
var subModulesMenu = mainModuleHeader.next('ul');
|
||
if (!subModulesMenu) return;
|
||
var state = subModulesMenu.visible();
|
||
// save state
|
||
... | ... | |
this.currentlyHighLightedMainModule = mainModule;
|
||
}
|
||
this.currentlyHighlightedModuleId = moduleId;
|
||
// backwards compatibility, remove in TYPO3 4.5
|
||
top.currentlyHighLightedId = moduleId;
|
||
top.currentlyHighLightedMain = mainModule;
|
||
}
|
||
});
|
||
... | ... | |
var currentlyHighLightedMain = '';
|
||
function highlightModuleMenuItem(trId, mainModule) {
|
||
TYPO3ModuleMenu.highlightModule(trId, mainModule);
|
||
currentlyHighLightedId = trId;
|
||
currentlyHighLightedMain = mainModule;
|
||
}
|
||
typo3/classes/class.modulemenu.php (working copy) | ||
---|---|---|
$moduleLabel = '<a href="#" onclick="top.goToModule(\''.$moduleData['name'].'\');'.$onBlur.'return false;">'.$moduleLabel.'</a>';
|
||
}
|
||
$menu .= '<li id="'.$moduleKey.'" class="menuSection" title="'.$moduleData['description'].'"><div class="'.($menuState ? 'collapsed' : 'expanded').'">'.$moduleData['icon']['html'].' '.$moduleLabel.'</div>';
|
||
$menu .= '<li id="modmenu_' . $moduleData['name'] . '" class="menuSection" title="' . $moduleData['description'] . '"><div class="' . ($menuState ? 'collapsed' : 'expanded') . '">' . $moduleData['icon']['html'] . ' ' . $moduleLabel . '</div>';
|
||
// traverse submodules
|
||
if(is_array($moduleData['subitems'])) {
|
||
... | ... | |
.'</a>';
|
||
}
|
||
$moduleMenu .= '<li id="'.$moduleData['cssId'].'">'.$submoduleLink.'</li>'."\n";
|
||
$moduleMenu .= '<li id="modmenu_' . $moduleData['name'] . '">' . $submoduleLink . '</li>' . "\n";
|
||
}
|
||
return '<ul'.($menuState ? ' style="display:none;"' : '').'>'."\n".$moduleMenu.'</ul>'."\n";
|
||
... | ... | |
$moduleLink = t3lib_div::resolveBackPath($moduleLink);
|
||
$moduleKey = $moduleName.'_tab';
|
||
$moduleCssId = 'ID_'.t3lib_div::md5int($moduleName);
|
||
$moduleIcon = $this->getModuleIcon($moduleKey);
|
||
if($moduleLink && $moduleNavigationFramePrefix) {
|
||
... | ... | |
'name' => $moduleName,
|
||
'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey],
|
||
'onclick' => 'top.goToModule(\''.$moduleName.'\');',
|
||
'cssId' => $moduleCssId,
|
||
'icon' => $moduleIcon,
|
||
'link' => $moduleLink,
|
||
'prefix' => $moduleNavigationFramePrefix,
|
||
... | ... | |
$submoduleNavigationFramePrefix = $this->getNavigationFramePrefix($moduleData, $submoduleData);
|
||
$submoduleKey = $moduleName.'_'.$submoduleName.'_tab';
|
||
$submoduleCssId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$submoduleName);
|
||
$submoduleIcon = $this->getModuleIcon($submoduleKey);
|
||
$submoduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$submoduleKey.'label'];
|
||
... | ... | |
'name' => $moduleName.'_'.$submoduleName,
|
||
'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$submoduleKey],
|
||
'onclick' => 'top.goToModule(\''.$moduleName.'_'.$submoduleName.'\');',
|
||
'cssId' => $submoduleCssId,
|
||
'icon' => $submoduleIcon,
|
||
'link' => $submoduleLink,
|
||
'originalLink' => $originalLink,
|
||
... | ... | |
protected function getModuleIconAbsolute($iconFilename) {
|
||
if(!t3lib_div::isAbsPath($iconFilename)) {
|
||
$iconFilename = $this->backPath.$iconFilename;
|
||
$iconFilename = $this->backPath . $iconFilename;
|
||
}
|
||
return $iconFilename;
|
||
... | ... | |
* @see getModuleIconAbsolute()
|
||
*/
|
||
protected function getModuleIconRelative($iconFilename) {
|
||
if(t3lib_div::isAbsPath($iconFilename)) {
|
||
$iconFilename = '../'.substr($iconFilename, strlen(PATH_site));
|
||
if (t3lib_div::isAbsPath($iconFilename)) {
|
||
$iconFilename = '../' . substr($iconFilename, strlen(PATH_site));
|
||
}
|
||
return $this->backPath.$iconFilename;
|
||
}
|
||
... | ... | |
$moduleJavascriptCommands = array();
|
||
$rawModuleData = $this->getRawModuleData();
|
||
$navFrameScripts = array();
|
||
foreach($rawModuleData as $mainModuleKey => $mainModuleData) {
|
||
if($mainModuleData['subitems']) {
|
||
foreach($mainModuleData['subitems'] as $subModuleKey => $subModuleData) {
|
||
if ($mainModuleData['subitems']) {
|
||
foreach ($mainModuleData['subitems'] as $subModuleKey => $subModuleData) {
|
||
$parentModuleName = substr($subModuleData['name'], 0, strpos($subModuleData['name'], '_'));
|
||
$javascriptCommand = '';
|
||
... | ... | |
$additionalJavascript = "+'&id='+top.rawurlencode(top.fsMod.recentIds['".$parentModuleName."'])";
|
||
}
|
||
if($subModuleData['link'] && $this->linkModules) {
|
||
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':'')";
|
||
if ($additionalJavascript && $GLOBALS['BE_USER']->uc['condensedMode']) {
|
||
$additionalJavascript .= "+(cMR ? '&cMR=1' : '')";
|
||
}
|
||
$javascriptCommand = '
|
||
$(\'content\').src = top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.'+additionalGetVariables);
|
||
top.fsMod.currentMainLoaded="'.$parentModuleName.'";
|
||
';
|
||
modScriptURL = "'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.';';
|
||
if($subModuleData['navFrameScript']) {
|
||
if ($subModuleData['navFrameScript']) {
|
||
$javascriptCommand .= '
|
||
top.currentSubScript="'.$subModuleData['originalLink'].'";';
|
||
top.currentSubScript="'.$subModuleData['originalLink'].'";';
|
||
}
|
||
if(!$GLOBALS['BE_USER']->uc['condensedMode'] && $subModuleData['parentNavigationFrameScript']) {
|
||
if (!$GLOBALS['BE_USER']->uc['condensedMode'] && $subModuleData['parentNavigationFrameScript']) {
|
||
$additionalJavascript = "+'&id='+top.rawurlencode(top.fsMod.recentIds['".$parentModuleName."'])";
|
||
$submoduleNavigationFrameScript = $subModuleData['navigationFrameScript'] ? $subModuleData['navigationFrameScript'] : $subModuleData['parentNavigationFrameScript'];
|
||
... | ... | |
// add GET parameters for sub module to the navigation script
|
||
$submoduleNavigationFrameScript = $this->appendQuestionmarkToLink($submoduleNavigationFrameScript).$subModuleData['navigationFrameScript'];
|
||
$navFrameScripts[$parentModuleName] = $submoduleNavigationFrameScript;
|
||
$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.'");
|
||
}
|
||
top.currentSubScript = "'.$subModuleData['originalLink'].'";
|
||
if (top.content.list_frame && top.fsMod.currentMainLoaded == mainModName) {
|
||
modScriptURL = "'.$this->appendQuestionmarkToLink($subModuleData['originalLink']).'"'.$additionalJavascript.';
|
||
} else if (top.nextLoadModuleUrl) {
|
||
modScriptURL = "'.($subModuleData['prefix'] ? $this->appendQuestionmarkToLink($subModuleData['link']) . '&exScript=' : '') . 'listframe_loader.php";
|
||
} else {
|
||
$(\'content\').src = 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'].'";
|
||
}
|
||
';
|
||
modScriptURL = "'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.' + additionalGetVariables;
|
||
}';
|
||
}
|
||
$javascriptCommand .= '
|
||
top.highlightModuleMenuItem("'.$subModuleData['cssId'].'");
|
||
';
|
||
$moduleJavascriptCommands[] = " case '".$subModuleData['name']."': \n ".$javascriptCommand." \n break;";
|
||
}
|
||
$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 = '
|
||
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;";
|
||
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;
|
||
if (addGetVars) {
|
||
additionalGetVariables = addGetVars;
|
||
}
|
||
var cMR = 0;
|
||
if (cMR_flag) cMR = 1;
|
||
var cMR = (cMR_flag ? 1 : 0);
|
||
var modScriptURL = "";
|
||
currentModuleLoaded = modName;
|
||
switch(modName) {'
|
||
."\n".implode("\n", $moduleJavascriptCommands)."\n".'
|
||
}
|
||
var navFrames = {};';
|
||
foreach ($navFrameScripts as $mainMod => $frameScript) {
|
||
$javascriptCode .= '
|
||
navFrames["'.$mainMod.'"] = "'.$frameScript.'";';
|
||
}
|
||
$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 {
|
||
$("content").src = top.TS.PATH_typo3 + modScriptURL;
|
||
}
|
||
} else if (modScriptURL) {
|
||
$("content").src = top.getModuleUrl(top.TS.PATH_typo3 + modScriptURL + additionalGetVariables);
|
||
}
|
||
currentModuleLoaded = modName;
|
||
top.fsMod.currentMainLoaded = mainModName;
|
||
TYPO3ModuleMenu.highlightModule("modmenu_" + modName, (modName == mainModName ? 1 : 0));
|
||
}';
|
||
return $javascriptCode;
|