diff --git a/adminer/create.inc.php b/adminer/create.inc.php index 7af80dd8..19ae3f53 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -35,7 +35,6 @@ if ($_POST && !process_fields($row["fields"]) && !$error) { $all_fields = array(); $use_all_fields = false; $foreign = array(); - ksort($row["fields"]); $orig_field = reset($orig_fields); $after = " FIRST"; diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index e7b5cc5e..51569303 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -277,8 +277,8 @@ echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", " echo ""; echo (support("move_col") ? " " - . " " - . " " + . " " + . " " : ""); echo ($orig == "" || support("drop_col") ? "" : ""); echo "\n"; @@ -290,7 +290,6 @@ echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", " * @return bool */ function process_fields(&$fields) { - ksort($fields); $offset = 0; if ($_POST["up"]) { $last = 0; diff --git a/adminer/static/editing.js b/adminer/static/editing.js index f0ce0e34..ceea6b1d 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -271,6 +271,22 @@ function editingRemoveRow(button, name) { return true; } +/** Move table row for field +* @param HTMLInputElement +* @param boolean direction to move row, true for up or false for down +* @return boolean +*/ +function editingMoveRow(button, dir){ + var row = parentTag(button, 'tr'); + if (!('nextElementSibling' in row)) { + return false; + } + row.parentNode.insertBefore(row, dir + ? row.previousElementSibling + : row.nextElementSibling ? row.nextElementSibling.nextElementSibling : row.parentNode.firstChild); + return true; +} + var lastType = ''; /** Clear length and hide collation or unsigned