forked from science-ation/science-ation
Fix translations dropdown to work in IE
This commit is contained in:
parent
b9253d4114
commit
4316d2bb71
@ -42,6 +42,17 @@ var jsTranslateLangs=new Array();
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
function selectVisibility(vis) {
|
||||||
|
//we'll always have form0=translationdropdownform, form1=langselectform, form2...infinity=forms on the page
|
||||||
|
for(x=2;x<document.forms.length;x++) {
|
||||||
|
var frm=document.forms[x];
|
||||||
|
for(y=0;y<frm.elements.length;y++) {
|
||||||
|
var e=frm.elements[y];
|
||||||
|
if(e.type=="select-one")
|
||||||
|
e.style.visibility=vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getTranslations(o)
|
function getTranslations(o)
|
||||||
{
|
{
|
||||||
@ -110,15 +121,17 @@ function translateDropdown(o)
|
|||||||
{
|
{
|
||||||
translationObject=document.getElementById(o);
|
translationObject=document.getElementById(o);
|
||||||
var d=document.getElementById('translationdropdown');
|
var d=document.getElementById('translationdropdown');
|
||||||
if(translateOpen)
|
if(translateOpen) {
|
||||||
d.style.visibility="hidden";
|
d.style.visibility="hidden";
|
||||||
|
selectVisibility("visible");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getTranslations(o);
|
getTranslations(o);
|
||||||
objItem=translationObject;
|
objItem=translationObject;
|
||||||
|
|
||||||
var tagheight=objItem.offsetHeight;
|
var tagheight=objItem.offsetHeight;
|
||||||
var tagwidth=objItem.offsetWidth;
|
var tagwidth=objItem.offsetWidth+75;
|
||||||
|
|
||||||
//alert('tagheight='+tagheight+' tagwidth='+tagwidth);
|
//alert('tagheight='+tagheight+' tagwidth='+tagwidth);
|
||||||
|
|
||||||
@ -134,14 +147,16 @@ function translateDropdown(o)
|
|||||||
} while(objParent!="BODY");
|
} while(objParent!="BODY");
|
||||||
|
|
||||||
d.style.top=inty+tagheight+"px";
|
d.style.top=inty+tagheight+"px";
|
||||||
d.style.left=intx+"px";
|
d.style.left=(intx-75)+"px";
|
||||||
d.style.width=tagwidth+"px";
|
d.style.width=(tagwidth)+"px";
|
||||||
// d.style.height=dropdownheight+"px";
|
// d.style.height=dropdownheight+"px";
|
||||||
d.style.visibility="visible";
|
d.style.visibility="visible";
|
||||||
|
|
||||||
oButton=document.getElementById('buttonsavetranslations');
|
oButton=document.getElementById('buttonsavetranslations');
|
||||||
oButton.value="<?=i18n("Save Translations")?>";
|
oButton.value="<?=i18n("Save Translations")?>";
|
||||||
|
|
||||||
|
selectVisibility("hidden");
|
||||||
|
|
||||||
}
|
}
|
||||||
translateOpen=!translateOpen;
|
translateOpen=!translateOpen;
|
||||||
return false;
|
return false;
|
||||||
@ -198,19 +213,37 @@ function handleSaveResponse()
|
|||||||
|
|
||||||
<?
|
<?
|
||||||
$num=count($config['languages'])-1; //subtract 1 for english
|
$num=count($config['languages'])-1; //subtract 1 for english
|
||||||
$divheight=($num*30)+50;
|
$divheight=($num*25)+50;
|
||||||
?>
|
?>
|
||||||
<div name="translationdropdown" id="translationdropdown" style="background-color: white; visibility: hidden; position: absolute; border: 1px solid grey; top:0px; left:0px; width:300px; height:<?=$divheight?>px; overflow: auto">
|
<style type="text/css">
|
||||||
|
.translationdropdown
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
z-index: 100;
|
||||||
|
overflow: auto;
|
||||||
|
width: 300px;
|
||||||
|
background-color: #669966;
|
||||||
|
visibility: hidden;
|
||||||
|
border: 0px;
|
||||||
|
top: 0px;
|
||||||
|
left:0px;
|
||||||
|
width:300px;
|
||||||
|
height:<?=$divheight?>px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<div class="translationdropdown" name="translationdropdown" id="translationdropdown">
|
||||||
<form name="translationform" method="get">
|
<form name="translationform" method="get">
|
||||||
<table width="95%">
|
<table cellspacing=0 cellpadding=0 border=0 style="width: 99%; font-size: 0.8em;">
|
||||||
<?
|
<?
|
||||||
foreach($config['languages'] AS $l=>$ln)
|
foreach($config['languages'] AS $l=>$ln)
|
||||||
{
|
{
|
||||||
if($l=="en") continue;
|
if($l=="en") continue;
|
||||||
echo "<tr><td>$ln</td><td><input type=\"text\" style=\"width: 100%\" id=\"translation[$l]\" name=\"translation[$l]\"></td></tr>";
|
echo "<tr><td style=\"width: 75px;\">$ln:</td><td><input type=\"text\" style=\"width: 100%;\" id=\"translation[$l]\" name=\"translation[$l]\"></td></tr>";
|
||||||
}
|
}
|
||||||
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"button\" id=\"buttonsavetranslations\" onclick=\"return savetranslations()\" value=\"".i18n("Save Translations")."\"></td></tr>";
|
echo "</table>\n";
|
||||||
|
echo "<input type=\"button\" id=\"buttonsavetranslations\" onclick=\"return savetranslations()\" value=\"".i18n("Save Translations")."\">";
|
||||||
?>
|
?>
|
||||||
</table>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user