Enlarge field for enum and set definition

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1198 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-10-19 05:11:45 +00:00
parent 16ed399209
commit 8caf24c533
4 changed files with 27 additions and 4 deletions

View file

@ -98,7 +98,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
global $structured_types, $unsigned, $inout; global $structured_types, $unsigned, $inout;
?> ?>
<td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select> <td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3"> <td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editing_length_focus(this);">
<td><?php <td><?php
echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>'; echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
echo ($unsigned ? " <select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : ''); echo ($unsigned ? " <select name='$key" . "[unsigned]'" . (!$field["type"] || ereg('(int|float|double|decimal)$', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
@ -153,7 +153,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
<thead><tr> <thead><tr>
<?php if ($type == "PROCEDURE") { ?><td>&nbsp;<?php } ?> <?php if ($type == "PROCEDURE") { ?><td>&nbsp;<?php } ?>
<th><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?> <th><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
<td><?php echo lang('Type'); ?> <td><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="10" style="display: none;" onblur="editing_length_blur(this);"></textarea>
<td><?php echo lang('Length'); ?> <td><?php echo lang('Length'); ?>
<td><?php echo lang('Options'); ?> <td><?php echo lang('Options'); ?>
<?php if ($type == "TABLE") { ?> <?php if ($type == "TABLE") { ?>

View file

@ -1,2 +1,2 @@
<?php <?php
$VERSION = "2.1.1-dev"; $VERSION = "2.2.0-dev";

View file

@ -157,6 +157,27 @@ function editing_type_change(type) {
} }
} }
function editing_length_focus(field) {
var td = field.parentNode;
if (/enum|set/.test(select_value(td.previousSibling.firstChild))) {
var edit = document.getElementById('enum-edit');
var val = field.value;
edit.value = (/^'.+','.+'$/.test(val) ? val.substr(1, val.length - 2).replace(/','/g, "\n").replace(/''/g, "'") : val);
td.appendChild(edit);
field.style.display = 'none';
edit.style.display = 'inline';
edit.focus();
}
}
function editing_length_blur(edit) {
var field = edit.parentNode.firstChild;
var val = edit.value;
field.value = (/\n/.test(val) ? "'" + val.replace(/\n+$/, '').replace(/'/g, "''").replace(/\n/g, "','") + "'" : val);
field.style.display = 'inline';
edit.style.display = 'none';
}
function column_show(checked, column) { function column_show(checked, column) {
var trs = document.getElementById('edit-fields').getElementsByTagName('tr'); var trs = document.getElementById('edit-fields').getElementsByTagName('tr');
for (var i=0; i < trs.length; i++) { for (var i=0; i < trs.length; i++) {

View file

@ -1,4 +1,6 @@
Adminer 2.1.1-dev: Adminer 2.2.0-dev:
Database list - bulk drop, number of tables
Enlarge field for enum and set definition
Display table links above table structure Display table links above table structure
Link URLs in select Link URLs in select
Display number of manipulated rows in JS confirm Display number of manipulated rows in JS confirm