mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 08:06:59 +02:00
Centralize oninput
This commit is contained in:
@@ -266,7 +266,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
echo script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown});");
|
echo script("mixin(qsl('tbody'), {onclick: editingClick, onkeydown: editingKeydown, oninput: editingInput});");
|
||||||
foreach ($fields as $i => $field) {
|
foreach ($fields as $i => $field) {
|
||||||
$i++;
|
$i++;
|
||||||
$orig = $field[($_POST ? "orig" : "field")];
|
$orig = $field[($_POST ? "orig" : "field")];
|
||||||
@@ -280,10 +280,9 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
|||||||
<?php if ($type == "TABLE") { ?>
|
<?php if ($type == "TABLE") { ?>
|
||||||
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
|
<td><?php echo checkbox("fields[$i][null]", 1, $field["null"], "", "", "block", "label-null"); ?>
|
||||||
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td><?php
|
<td><label class="block"><input type="radio" name="auto_increment_col" value="<?php echo $i; ?>"<?php if ($field["auto_increment"]) { ?> checked<?php } ?> aria-labelledby="label-ai"></label><td><?php
|
||||||
echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php echo script("qsl('input').oninput = function () { this.previousSibling.checked = true; }", ""); ?>
|
echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "label-default"); ?><input name="fields[<?php echo $i; ?>][default]" value="<?php echo h($field["default"]); ?>" aria-labelledby="label-default"><?php
|
||||||
<?php echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : ""); ?>
|
echo (support("comment") ? "<td" . ($comments ? "" : " class='hidden'") . "><input name='fields[$i][comment]' value='" . h($field["comment"]) . "' maxlength='" . (min_version(5.5) ? 1024 : 255) . "' aria-labelledby='label-comment'>" : "");
|
||||||
<?php } ?>
|
}
|
||||||
<?php
|
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
echo (support("move_col") ?
|
echo (support("move_col") ?
|
||||||
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'> "
|
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "'> "
|
||||||
|
@@ -224,6 +224,16 @@ function editingClick(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Handle input on fields editing
|
||||||
|
* @param InputEvent
|
||||||
|
*/
|
||||||
|
function editingInput(event) {
|
||||||
|
var el = getTarget(event);
|
||||||
|
if (/\[default\]$/.test(el.name)) {
|
||||||
|
el.previousSibling.checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Detect foreign key
|
/** Detect foreign key
|
||||||
* @this HTMLInputElement
|
* @this HTMLInputElement
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user