forked from science-ation/science-ation
Make the translations page much more compact
Backport translations dropdown fix from branch
This commit is contained in:
parent
fde29e7a91
commit
065cb658bb
@ -129,7 +129,7 @@ echo "<th>".i18n("English")." / ".$translangname."</th></tr>\n";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td valign=\"top\">";
|
||||
echo "<td valign=\"top\" rowspan=\"2\">";
|
||||
echo "<input type=\"checkbox\" name=\"delete[]\" value=\"$r->strmd5\">\n";
|
||||
echo "</td><td>";
|
||||
echo htmlspecialchars($r->str);
|
||||
@ -138,10 +138,8 @@ while($r=mysql_fetch_object($q))
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>";
|
||||
echo "<td></td>";
|
||||
echo "<td valign=\"top\"><input id=\"val_{$r->strmd5}\" onchange=\"return doFocus('{$r->strmd5}');\" style=\"width: 95%\" type=\"text\" name=\"val[{$r->strmd5}]\" value=\"".htmlspecialchars($r->val)."\" /></td>";
|
||||
echo "</tr>";
|
||||
echo "<tr><td colspan=\"2\"><hr /></td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save")."\">";
|
||||
|
@ -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)
|
||||
{
|
||||
@ -110,15 +121,17 @@ function translateDropdown(o)
|
||||
{
|
||||
translationObject=document.getElementById(o);
|
||||
var d=document.getElementById('translationdropdown');
|
||||
if(translateOpen)
|
||||
if(translateOpen) {
|
||||
d.style.visibility="hidden";
|
||||
selectVisibility("visible");
|
||||
}
|
||||
else
|
||||
{
|
||||
getTranslations(o);
|
||||
objItem=translationObject;
|
||||
|
||||
var tagheight=objItem.offsetHeight;
|
||||
var tagwidth=objItem.offsetWidth;
|
||||
var tagwidth=objItem.offsetWidth+75;
|
||||
|
||||
//alert('tagheight='+tagheight+' tagwidth='+tagwidth);
|
||||
|
||||
@ -134,14 +147,16 @@ function translateDropdown(o)
|
||||
} while(objParent!="BODY");
|
||||
|
||||
d.style.top=inty+tagheight+"px";
|
||||
d.style.left=intx+"px";
|
||||
d.style.width=tagwidth+"px";
|
||||
d.style.left=(intx-75)+"px";
|
||||
d.style.width=(tagwidth)+"px";
|
||||
// d.style.height=dropdownheight+"px";
|
||||
d.style.visibility="visible";
|
||||
|
||||
oButton=document.getElementById('buttonsavetranslations');
|
||||
oButton.value="<?=i18n("Save Translations")?>";
|
||||
|
||||
selectVisibility("hidden");
|
||||
|
||||
}
|
||||
translateOpen=!translateOpen;
|
||||
return false;
|
||||
@ -198,19 +213,37 @@ function handleSaveResponse()
|
||||
|
||||
<?
|
||||
$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">
|
||||
<table width="95%">
|
||||
<table cellspacing=0 cellpadding=0 border=0 style="width: 99%; font-size: 0.8em;">
|
||||
<?
|
||||
foreach($config['languages'] AS $l=>$ln)
|
||||
{
|
||||
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>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user