git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@549 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-01-22 17:29:11 +00:00
parent a4dfae74d4
commit 71430ee4b4
2 changed files with 17 additions and 5 deletions

View file

@ -225,8 +225,15 @@ function remove_row(button) {
} }
function type_change(type) { function type_change(type) {
var name = type.name.substr(0, type.name.length - 6); var name = type.name.substr(0, type.name.length - 6);
type.form[name + '[collation]'].style.display = (/char|text|enum|set/.test(type.options[type.selectedIndex].text) ? '' : 'none'); for (var i=0; i < type.form.elements.length; i++) {
type.form[name + '[unsigned]'].style.display = (/int|float|double|decimal/.test(type.options[type.selectedIndex].text) ? '' : 'none'); var el = type.form.elements[i];
if (el.name == name + '[collation]') {
el.style.display = (/char|text|enum|set/.test(type.options[type.selectedIndex].text) ? '' : 'none');
}
if (el.name == name + '[unsigned]') {
el.style.display = (/int|float|double|decimal/.test(type.options[type.selectedIndex].text) ? '' : 'none');
}
}
} }
for (var i=1; <?php echo $count; ?> >= i; i++) { for (var i=1; <?php echo $count; ?> >= i; i++) {
document.getElementById('form')['fields[' + i + '][type]'].onchange(); document.getElementById('form')['fields[' + i + '][type]'].onchange();

View file

@ -191,7 +191,7 @@ function add_row(field) {
foreach ((array) $_GET["where"] as $val) { foreach ((array) $_GET["where"] as $val) {
if (strlen("$val[col]$val[val]") && in_array($val["op"], $operators)) { if (strlen("$val[col]$val[val]") && in_array($val["op"], $operators)) {
echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, $val["col"]) . "</select>"; echo "<div><select name='where[$i][col]'><option></option>" . optionlist($columns, $val["col"]) . "</select>";
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators, $val["op"]) . "</select>"; echo "<select name='where[$i][op]' onchange='where_change(this);'>" . optionlist($operators, $val["op"]) . "</select>";
echo "<input name='where[$i][val]' value=\"" . htmlspecialchars($val["val"]) . "\" /></div>\n"; echo "<input name='where[$i][val]' value=\"" . htmlspecialchars($val["val"]) . "\" /></div>\n";
$i++; $i++;
} }
@ -199,7 +199,12 @@ function add_row(field) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function where_change(op) { function where_change(op) {
op.form[op.name.substr(0, op.name.length - 4) + '[val]'].style.display = (/NULL$/.test(op.value) ? 'none' : ''); for (var i=0; i < op.form.elements.length; i++) {
var el = op.form.elements[i];
if (el.name == op.name.substr(0, op.name.length - 4) + '[val]') {
el.style.display = (/NULL$/.test(op.options[op.selectedIndex].text) ? 'none' : '');
}
}
} }
<?php if ($i) { ?> <?php if ($i) { ?>
for (var i=0; <?php echo $i; ?> > i; i++) { for (var i=0; <?php echo $i; ?> > i; i++) {
@ -209,7 +214,7 @@ for (var i=0; <?php echo $i; ?> > i; i++) {
</script> </script>
<?php <?php
echo "<div><select name='where[$i][col]' onchange='add_row(this);'><option></option>" . optionlist($columns) . "</select>"; echo "<div><select name='where[$i][col]' onchange='add_row(this);'><option></option>" . optionlist($columns) . "</select>";
echo "<select name='where[$i][op]' onchange=\"where_change(this);\">" . optionlist($operators) . "</select>"; echo "<select name='where[$i][op]' onchange='where_change(this);'>" . optionlist($operators) . "</select>";
echo "<input name='where[$i][val]' /></div>\n"; echo "<input name='where[$i][val]' /></div>\n";
echo "</fieldset>\n"; echo "</fieldset>\n";