Return false from editingMoveRow()

This commit is contained in:
Jakub Vrana 2018-01-12 22:29:11 +01:00
parent 2eaac2e94e
commit af1ad47a64
2 changed files with 8 additions and 8 deletions

View file

@ -279,9 +279,9 @@ echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "
<?php <?php
echo "<td>"; echo "<td>";
echo (support("move_col") ? 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.call(this, 1);'>&nbsp;" "<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return editingAddRow.call(this, 1);'>&nbsp;"
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "' onclick='return !editingMoveRow.call(this, 1);'>&nbsp;" . "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "' onclick='return editingMoveRow.call(this, 1);'>&nbsp;"
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "' onclick='return !editingMoveRow.call(this, 0);'>&nbsp;" . "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "' onclick='return editingMoveRow.call(this, 0);'>&nbsp;"
: ""); : "");
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.call(this, 'fields\$1[field]');\">" : ""); 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.call(this, 'fields\$1[field]');\">" : "");
echo "\n"; echo "\n";

View file

@ -211,7 +211,7 @@ function editingNameChange() {
/** Add table row for next field /** Add table row for next field
* @param boolean * @param boolean
* @return boolean * @return boolean false
* @this HTMLInputElement * @this HTMLInputElement
*/ */
function editingAddRow(focus) { function editingAddRow(focus) {
@ -249,7 +249,7 @@ function editingAddRow(focus) {
} }
added += '0'; added += '0';
rowCount++; rowCount++;
return true; return false;
} }
/** Remove table row for field /** Remove table row for field
@ -266,18 +266,18 @@ function editingRemoveRow(name) {
/** Move table row for field /** Move table row for field
* @param boolean direction to move row, true for up or false for down * @param boolean direction to move row, true for up or false for down
* @return boolean * @return boolean false for success
* @this HTMLInputElement * @this HTMLInputElement
*/ */
function editingMoveRow(dir){ function editingMoveRow(dir){
var row = parentTag(this, 'tr'); var row = parentTag(this, 'tr');
if (!('nextElementSibling' in row)) { if (!('nextElementSibling' in row)) {
return false; return true;
} }
row.parentNode.insertBefore(row, dir row.parentNode.insertBefore(row, dir
? row.previousElementSibling ? row.previousElementSibling
: row.nextElementSibling ? row.nextElementSibling.nextElementSibling : row.parentNode.firstChild); : row.nextElementSibling ? row.nextElementSibling.nextElementSibling : row.parentNode.firstChild);
return true; return false;
} }
var lastType = ''; var lastType = '';