Bug #16944
closedGMenu and TMenu: Rendering "borderswithin" doesn't work with Firefox and Doctype HTML 4.01 Transitional
0%
Description
When using the Doctype HTML 4.01 Transitional the menu option "borderswithin" (which makes sure that submenus stay within a certain frame) won't work. Might also be an issue with other Doctypes, have only tested it on 4.01 yet.
Already found out how to fix it.
The problem is in the following files:
tmenu_layers.php and gmenu_layers.php
These files are found in:
typo3_src/typo3/sysext/cms/tslib/media/scripts/
It's the function extCalcBorderWithin
Original script:
function extCalcBorderWithin($kind,$integer) {
if ($integer) {
switch($kind) {
case 'right':
case 'bottom':
$add='';
if ($kind=='right') {$add='GL_getObj(id).width'; $key = 'left';}
if ($kind=='bottom') {$add='GL_getObj(id).height'; $key = 'top';}
$str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.';';
break;
default:
$str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.';';
break;
}
}
return $str;
}
-----------------------------
It creates the Javascript that corrects the position if the x- or y-value plus the width or height exceed the borders. The line to be corrected is the following one:
$str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.';';
it should say :
$str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.'+"px";';
Same with the other line:
$str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.';';
it should say:
$str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.'+"px";';
Problem occured on a menu like this:
MAINNAV=HMENUMAINNAV{
- the following offsets were needed in my case, might depend on the CSS you use
yPosOffset=100
topOffset=105
NO=1 - the following creates up to four columns of four items per column
NO.linkWrap=|<br> || |<br> || |<br> || |<br> || </td><td class="myclass" valign="top">|<br> || |<br> || |<br> || |<br> || </td><td class="myclass" valign="top">|<br> || |<br> || |<br> || |<br> || </td><td class="myclass" valign="top">| || | || | ||
}
2.wrap=<table valign="top"><tr><td class="myclass" valign="top">|</td></tr></table>
}
special=directory
special.value=25
entryLevel=0
expAll=1
1=GMENU_LAYERS
1{
freezeMouseover=1
layerStyle = position:absolute;VISIBILITY:hidden;
lockPosition=y
leftOffset=12
yPosOffset=-10
topOffset = 102
hideMenuWhenNotOver = 50
hideMenuTimer = 70
dontFollowMouse=0
directionUp=0
relativeToTriggerItem=1
blankStrEqFalse=0
bordersWithin=0,0,789,250,0,0
}
1.NO=1
1.expAll=1
1.NO{
XY=[10.w]+16,18
10=TEXT
10.text.field=title
10.fontColor=#666666
10.fontFile=fileadmin/fonts/myfont.ttf
10.fontSize=11
10.niceText=1
10.offset=12,12
wrap=<td>|</td>
}
1.wrap=<table align="right" cellpadding="0" cellspacing="0" border="0"><tr>|</tr></table>
1.RO < .1.NO
1.RO.10.fontColor=black
2=TMENU_LAYERS
2{
lockPosition=x
layerStyle=position:absolute;VISIBILITY:visible;
relativeToParentLayer=0
relativeToTriggerItem=0
Doctype was set like this:
page.config.doctype=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
(issue imported from #M6029)