]> git.joonet.de Git - adminer.git/commitdiff
Use <datalist> for altering collations
authorJakub Vrana <jakub@vrana.cz>
Mon, 10 Mar 2025 10:53:34 +0000 (11:53 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 10 Mar 2025 13:13:34 +0000 (14:13 +0100)
adminer/create.inc.php
adminer/include/editing.inc.php
adminer/procedure.inc.php
adminer/static/default.css
changes.txt
designs/paranoiq/adminer.css

index f4baef5b21bef681235f3e414b7f96318662872e..ede508a27b3db977923652327f9e00f48405707d 100644 (file)
@@ -183,7 +183,12 @@ foreach ($engines as $engine) {
 <?php if (support("columns") || $TABLE == "") { ?>
 <?php echo lang('Table name'); ?>: <input name="name"<?php echo ($TABLE == "" && !$_POST ? " autofocus" : ""); ?> data-maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
 <?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") : ""); ?>
- <?php echo ($collations && !preg_match("~sqlite|mssql~", JUSH) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
+ <?php
+       if ($collations) {
+               echo "<datalist id='collations'>" . optionlist($collations) . "</datalist>";
+               echo (preg_match("~sqlite|mssql~", JUSH) ? "" : "<input list='collations' name='Collation' value='" . h($row["Collation"]) . "' placeholder='(" . lang('collation') . ")'>");
+       }
+       ?>
  <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php } ?>
 
index 56629c1419dba222f9f8d725c8b884fd890eb01d..321df2d6bf8cb7db6ecd5c00522dbf174cd29922 100644 (file)
@@ -224,7 +224,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array(), $extra_ty
        size="3"
        <?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); //! type="number" with enabled JavaScript ?>
        aria-labelledby="label-length"><td class="options"><?php
-       echo ($collations ? "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>' : '');
+       echo ($collations ? "<input list='collations' name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . " value='" . h($field["collation"]) . "' placeholder='(" . lang('collation') . ")'>" : '');
        echo ($driver->unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match(number_type(), $type) ? "" : " class='hidden'") . '><option>' . optionlist($driver->unsigned, $field["unsigned"]) . '</select>' : '');
        echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>'
                . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), (preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"]) ? "CURRENT_TIMESTAMP" : $field["on_update"]))
index 6e64860dfe54f6807f247896afa4945c10571c81..3feaffcd6135d6bd8b8bbbc19b7a6e6623710a35 100644 (file)
@@ -34,6 +34,7 @@ if (!$_POST && $PROCEDURE != "") {
 $collations = get_vals("SHOW CHARACTER SET");
 sort($collations);
 $routine_languages = routine_languages();
+echo ($collations ? "<datalist id='collations'>" . optionlist($collations) . "</datalist>" : "");
 ?>
 
 <form action="" method="post" id="form">
index 520e15d10a6521386bb3ed32fa6cd7cbbbd59db1..b3ca0641b4a7e64904c01e065f5e0bba6dfdceb7 100644 (file)
@@ -53,8 +53,8 @@ input.wayoff { left: -1000px; position: absolute; }
 .function { text-align: right; }
 .number { text-align: right; }
 .datetime { text-align: right; }
-.type { width: 15ex; width: auto\9; }
-.options select { width: 20ex; width: auto\9; }
+.type { width: 15ex; }
+.options select, .options input { width: 20ex; }
 .view { font-style: italic; }
 .active { font-weight: bold; }
 .sqlarea { width: 98%; }
index 572110d0f6da83b49913766c2f072e1ffcf61012..41f02edaec33a968e390344b649760b9e4a2d6ca 100644 (file)
@@ -1,5 +1,6 @@
 Adminer dev:
 Fix importing multiple SQL files not terminated by semicolon
+Use <datalist> for altering collations
 
 Adminer 5.0.2 (released 2025-03-10):
 PostgreSQL: Fix setting NULL and original value on enum (bug #884)
index 2317947c0233a54c4a2511bc8a545e384e675a07..7d8681e3ccbfaedf7b8098e0cf279bb4e8f3a08c 100644 (file)
@@ -234,7 +234,7 @@ legend a:hover {
 \r
 select[name^="columns"] optgroup:last-child option:nth-child(3)::before {\r
     content: "count "; }\r
-select[name$="[collation]"] {\r
+input[name$="[collation]"] {\r
     max-width: 120px; }\r
 \r
 .logout a:first-child, p a {\r