diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 1c4a1542..7d47e127 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -809,8 +809,9 @@ function input($field, $value, $function) { } $onchange = ($first ? " onchange=\"var f = this.form['function[" . h(js_escape(bracket_escape($field["field"]))) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\" onkeyup='keyupChange.call(this);'" : ""); $attrs .= $onchange; + $has_function = (in_array($function, $functions) || isset($functions[$function])); echo (count($functions) > 1 - ? "" + ? "" : nbsp(reset($functions)) ) . ''; $input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table @@ -842,7 +843,12 @@ function input($field, $value, $function) { $maxlength += 7; // microtime } // type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator - echo " 20 ? " size='40'" : "") . "$attrs>"; + echo " 20 ? " size='40'" : "") + . "$attrs>" + ; } } } diff --git a/adminer/static/functions.js b/adminer/static/functions.js index 304952e5..69094b0f 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -453,12 +453,17 @@ function editingKeydown(event) { function functionChange(select) { var input = select.form[select.name.replace(/^function/, 'fields')]; if (selectValue(select)) { - if (input.origMaxLength === undefined) { + if (input.origType === undefined) { + input.origType = input.type; input.origMaxLength = input.maxLength; } input.removeAttribute('maxlength'); - } else if (input.origMaxLength >= 0) { - input.maxLength = input.origMaxLength; + input.type = 'text'; + } else if (input.origType) { + input.type = input.origType; + if (input.origMaxLength >= 0) { + input.maxLength = input.origMaxLength; + } } helpClose(); } diff --git a/changes.txt b/changes.txt index 1c25b100..ab609320 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ Adminer 4.0.1-dev: Fix compiled version of Elasticsearch +Don't use type=number if a SQL function is used Adminer 4.0.0 (released 2014-01-08): Driver for SimpleDB, MongoDB and Elasticsearch