Skip to content
Browse files

Enlarge field for enum and set definition

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1198 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 16ed399 commit 8caf24c533dcac2cf129be2c0fa98aa0a367c645 jakubvrana committed Oct 19, 2009
Showing with 27 additions and 4 deletions.
  1. +2 −2 adminer/include/editing.inc.php
  2. +1 −1 adminer/include/version.inc.php
  3. +21 −0 adminer/static/editing.js
  4. +3 −1 changes.txt
View
4 adminer/include/editing.inc.php
@@ -98,7 +98,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
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><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
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>' : '');
@@ -153,7 +153,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
<thead><tr>
<?php if ($type == "PROCEDURE") { ?><td>&nbsp;<?php } ?>
<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('Options'); ?>
<?php if ($type == "TABLE") { ?>
View
2 adminer/include/version.inc.php
@@ -1,2 +1,2 @@
<?php
-$VERSION = "2.1.1-dev";
+$VERSION = "2.2.0-dev";
View
21 adminer/static/editing.js
@@ -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) {
var trs = document.getElementById('edit-fields').getElementsByTagName('tr');
for (var i=0; i < trs.length; i++) {
View
4 changes.txt
@@ -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
Link URLs in select
Display number of manipulated rows in JS confirm

0 comments on commit 8caf24c

Please sign in to comment.
Something went wrong with that request. Please try again.