echo "<td>";
echo (support("move_col") ?
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow(this, 1);'> "
- . "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "'> "
- . "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "'> "
+ . "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "' onclick='return !editingMoveRow(this, 1);'> "
+ . "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "' onclick='return !editingMoveRow(this, 0);'> "
: "");
echo ($orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'fields\$1[field]');\">" : "");
echo "\n";
* @return bool
*/
function process_fields(&$fields) {
- ksort($fields);
$offset = 0;
if ($_POST["up"]) {
$last = 0;
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