]> git.joonet.de Git - adminer.git/commitdiff
HTML5 input fields
authorJakub Vrana <jakub@vrana.cz>
Wed, 5 Dec 2012 21:11:36 +0000 (13:11 -0800)
committerJakub Vrana <jakub@vrana.cz>
Wed, 5 Dec 2012 21:17:42 +0000 (13:17 -0800)
adminer/create.inc.php
adminer/db.inc.php
adminer/event.inc.php
adminer/include/adminer.inc.php
adminer/include/design.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/indexes.inc.php
adminer/static/default.css
changes.txt
editor/include/adminer.inc.php

index 619ce2abb744dec179df64662c2fb3c1e1c4cb1e..b698a8ec59fd9b95cf64338925e3a915c43ca636 100644 (file)
@@ -198,7 +198,7 @@ if (support("partitioning")) {
 <p>
 <?php echo html_select("partition_by", array(-1 => "") + $partition_by, $row["partition_by"], "partitionByChange(this);"); ?>
 (<input name="partition" value="<?php echo h($row["partition"]); ?>">)
-<?php echo lang('Partitions'); ?>: <input name="partitions" size="2" value="<?php echo h($row["partitions"]); ?>"<?php echo ($partition_table || !$row["partition_by"] ? " class='hidden'" : ""); ?>>
+<?php echo lang('Partitions'); ?>: <input type="number" name="partitions" class="size" value="<?php echo h($row["partitions"]); ?>"<?php echo ($partition_table || !$row["partition_by"] ? " class='hidden'" : ""); ?>>
 <table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
 <thead><tr><th><?php echo lang('Partition name'); ?><th><?php echo lang('Values'); ?></thead>
 <?php
index 29a2bab7e45219cdadce592841517af54fb7fa9f..9ad10c61f1ef27a4bc07bdc4897812e70d3b684b 100644 (file)
@@ -50,7 +50,7 @@ if ($adminer->homepage()) {
                        echo "<p class='message'>" . lang('No tables.') . "\n";
                } else {
                        echo "<form action='' method='post'>\n";
-                       echo "<p>" . lang('Search data in tables') . ": <input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' name='search' value='" . lang('Search') . "'>\n";
+                       echo "<p>" . lang('Search data in tables') . ": <input type='search' name='query' value='" . h($_POST["query"]) . "'> <input type='submit' name='search' value='" . lang('Search') . "'>\n";
                        if ($_POST["search"] && $_POST["query"] != "") {
                                search_tables();
                        }
index f7e876786d5f2e7ddc3bf410cf4f99154393732b..c1926a9b9c0dbed75d545ae6cf2bef182092c08e 100644 (file)
@@ -38,7 +38,7 @@ if (!$row && $EVENT != "") {
 <tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64">
 <tr><th><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
 <tr><th><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
-<tr><th><?php echo lang('Every'); ?><td><input name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" size="6"> <?php echo html_select("INTERVAL_FIELD", $intervals, $row["INTERVAL_FIELD"]); ?>
+<tr><th><?php echo lang('Every'); ?><td><input type="number" name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" class="size"> <?php echo html_select("INTERVAL_FIELD", $intervals, $row["INTERVAL_FIELD"]); ?>
 <tr><th><?php echo lang('Status'); ?><td><?php echo html_select("STATUS", $statuses, $row["STATUS"]); ?>
 <tr><th><?php echo lang('Comment'); ?><td><input name="EVENT_COMMENT" value="<?php echo h($row["EVENT_COMMENT"]); ?>" maxlength="64">
 <tr><th>&nbsp;<td><?php echo checkbox("ON_COMPLETION", "PRESERVE", $row["ON_COMPLETION"] == "PRESERVE", lang('On completion preserve')); ?>
index 96d3301a136c664e5414a5ff2001aa36ddcb456e..0445d8a54e2a32d4a50dccbe64835e065e3a9b00 100644 (file)
@@ -240,7 +240,7 @@ username.form['auth[driver]'].onchange();
                foreach ($indexes as $i => $index) {
                        if ($index["type"] == "FULLTEXT") {
                                echo "(<i>" . implode("</i>, <i>", array_map('h', $index["columns"])) . "</i>) AGAINST";
-                               echo " <input name='fulltext[$i]' value='" . h($_GET["fulltext"][$i]) . "' onchange='selectFieldChange(this.form);'>";
+                               echo " <input type='search' name='fulltext[$i]' value='" . h($_GET["fulltext"][$i]) . "' onchange='selectFieldChange(this.form);'>";
                                echo checkbox("boolean[$i]", 1, isset($_GET["boolean"][$i]), "BOOL");
                                echo "<br>\n";
                        }
@@ -253,7 +253,7 @@ username.form['auth[driver]'].onchange();
                        if (!$val || ("$val[col]$val[val]" != "" && in_array($val["op"], $this->operators))) {
                                echo "<div><select name='where[$i][col]' onchange='$change_next'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, $val["col"], true) . "</select>";
                                echo html_select("where[$i][op]", $this->operators, $val["op"], $change_next);
-                               echo "<input name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";'></div>\n";
+                               echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";'></div>\n";
                        }
                }
                echo "</div></fieldset>\n";
@@ -286,7 +286,7 @@ username.form['auth[driver]'].onchange();
        */
        function selectLimitPrint($limit) {
                echo "<fieldset><legend>" . lang('Limit') . "</legend><div>"; // <div> for easy styling
-               echo "<input name='limit' size='3' value='" . h($limit) . "' onchange='selectFieldChange(this.form);'>";
+               echo "<input type='number' name='limit' class='size' value='" . h($limit) . "' onchange='selectFieldChange(this.form);'>";
                echo "</div></fieldset>\n";
        }
        
@@ -297,7 +297,7 @@ username.form['auth[driver]'].onchange();
        function selectLengthPrint($text_length) {
                if ($text_length !== null) {
                        echo "<fieldset><legend>" . lang('Text length') . "</legend><div>";
-                       echo '<input name="text_length" size="3" value="' . h($text_length) . '">';
+                       echo "<input type='number' name='text_length' class='size' value='" . h($text_length) . "'>";
                        echo "</div></fieldset>\n";
                }
        }
index fb13af2dc329b03b97c34fa2f0788b23cde0ed56..c2a331fdcbee187d2a05f8124504556d2ddd11f9 100644 (file)
@@ -16,7 +16,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
        $title_all = $title . ($title2 != "" ? ": " . h($title2) : "");
        $title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
        ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<!DOCTYPE html>
 <html lang="<?php echo $LANG; ?>" dir="<?php echo lang('ltr'); ?>">
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta http-equiv="Content-Script-Type" content="text/javascript">
index ca7ebd28ddd945e864a4ba8299b1f7c362875383..8a7da38dddf5992eec6497f08ff0f0ffd3c8657d 100644 (file)
@@ -147,7 +147,7 @@ function edit_type($key, $field, $collations, $foreign_keys = array()) {
        global $structured_types, $types, $unsigned, $on_actions;
        ?>
 <td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"><?php echo optionlist((!$field["type"] || isset($types[$field["type"]]) ? array() : array($field["type"])) + $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" onfocus="editingLengthFocus(this);"><td class="options"><?php
+<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"><td class="options"><?php //! type="number" with enabled JavaScript
        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 ($foreign_keys ? "<select name='$key" . "[on_delete]'" . (ereg("`", $field["type"]) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
index b047726e6c0e578f8680b9bbdacc33cb3447081f..01b2fa43f360906afca899ad1bc5730ef94e3a36 100644 (file)
@@ -740,7 +740,8 @@ function input($field, $value, $function) {
                } else {
                        // int(3) is only a display hint
                        $maxlength = (!ereg('int', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? ((ereg("binary", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
-                       echo "<input value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
+                       // type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator
+                       echo "<input" . (ereg('int|float|double|decimal', $field["type"]) ? " type='number'" : "") . " value='" . h($value) . "'" . ($maxlength ? " maxlength='$maxlength'" : "") . (ereg('char|binary', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "$attrs>";
                }
        }
 }
index 7eb4874d508dc80c546f6463888edd5e1bbe5156..67787f60b341026843c3a30c29a3eead3f47e82a 100644 (file)
@@ -89,7 +89,7 @@ foreach ($row["indexes"] as $index) {
        $i = 1;
        foreach ($index["columns"] as $key => $column) {
                echo "<span>" . html_select("indexes[$j][columns][$i]", array(-1 => "") + $fields, $column, ($i == count($index["columns"]) ? "indexesAddColumn" : "indexesChangeColumn") . "(this, '" . js_escape($jush == "sql" ? "" : $_GET["indexes"] . "_") . "');");
-               echo "<input name='indexes[$j][lengths][$i]' size='2' value='" . h($index["lengths"][$key]) . "'> </span>"; //! hide for non-MySQL drivers, add ASC|DESC
+               echo "<input type='number' name='indexes[$j][lengths][$i]' class='size' value='" . h($index["lengths"][$key]) . "'> </span>"; //! hide for non-MySQL drivers, add ASC|DESC
                $i++;
        }
        echo "<td><input name='indexes[$j][name]' value='" . h($index["name"]) . "'>\n";
index 6a4bb98ceeaa178da96b40625abbef9145f516b5..603bbe7ef3b89fc25cf79bf25471aad4269192fa 100644 (file)
@@ -45,6 +45,7 @@ input[type=image] { vertical-align: middle; }
 .active { font-weight: bold; }
 .sqlarea { width: 98%; }
 .icon { width: 18px; height: 18px; }
+.size { width: 6ex; }
 #menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; }
 #menu p { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; }
 #dbs { overflow: hidden; }
index 12807f5fe71574cd0cbf815149efd4081068975e..300095a789b47b0501032a3fa4d93bbf76f7cfa5 100644 (file)
@@ -4,6 +4,7 @@ Don't select row on double click
 Shorten printed values in varchar fields
 Display table default values on wide screens
 Display date in SQL history
+HTML5 input fields
 Fix switching language on first load
 Support enabled mbstring.func_overload
 MySQL: Prolong comment length since MySQL 5.5
index ea7dc697d12fdb4c53aaeb9bb3a1c5022250498d..7c29e5e58c1f5573daebc7b06672498f71e3e72f 100644 (file)
@@ -231,13 +231,13 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
                        if (($val["col"] == "" || $columns[$val["col"]]) && "$val[col]$val[val]" != "") {
                                echo "<div><select name='where[$i][col]'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, $val["col"], true) . "</select>";
                                echo html_select("where[$i][op]", array(-1 => "") + $this->operators, $val["op"]);
-                               echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
+                               echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
                                $i++;
                        }
                }
                echo "<div><select name='where[$i][col]' onchange='this.nextSibling.nextSibling.onchange();'><option value=''>(" . lang('anywhere') . ")" . optionlist($columns, null, true) . "</select>";
                echo html_select("where[$i][op]", array(-1 => "") + $this->operators);
-               echo "<input name='where[$i][val]' onchange='selectAddRow(this);'></div>\n";
+               echo "<input type='search' name='where[$i][val]' onchange='selectAddRow(this);'></div>\n";
                echo "</div></fieldset>\n";
        }