diff --git a/ChangeLog b/ChangeLog index eae43ec0a..0275dee08 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,12 +10,14 @@ $Source$ * lang/spanish: update, thanks to Dr. med. Daniel Hinostroza C. 2003-01-14 Michal Cihar - * tbl_properties_structure.php3,libraries/functions.js: Added (un)check + * tbl_properties_structure.php3, libraries/functions.js: Added (un)check all for fields selection. - * tbl_properties.inc.php3,libraries/functions.js: Merged patch #554439 + * tbl_properties.inc.php3, libraries/functions.js: Merged patch #554439 (Jumping cursor using keyboard). - * tbl_alter.php3: Always include functions.js to allow jumping using - keyboard. + * tbl_alter.php3, tbl_addfield.php3, tbl_create.php3: Always include + functions.js to allow jumping using keyboard. + * tbl_change.php3, libraries/tbl_change.js: Moving cursor with Ctrl+arrows + works also for row editing. 2002-01-13 Robin Johnson * libraries/sqlvalidator.class.php3: diff --git a/libraries/functions.js b/libraries/functions.js index 544b75150..3704cb19a 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -485,10 +485,10 @@ function setSelectOptions(the_form, the_select, do_check) * @param object event data */ function onKeyDownArrowsHandler(e) { - e=e||window.event; + e = e||window.event; var o = (e.srcElement||e.target); if (!o) return; - if (o.tagName != "INPUT" && o.tagName != "SELECT") return; + if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return; if (!e.ctrlKey) return; if (!o.id) return; @@ -496,17 +496,23 @@ function onKeyDownArrowsHandler(e) { if (pos[0] != "field" || typeof pos[2] == "undefined") return; var x = pos[2], y=pos[1]; + + // skip non existent fields + for (i=0; i<10; i++) + { + switch(e.keyCode) { + case 38: y--; break; // up + case 40: y++; break; // down + case 37: x--; break; // left + case 39: x++; break; // right + default: return; + } - switch(e.keyCode) { - case 38: y--; break; // up - case 40: y++; break; // down - case 37: x--; break; // left - case 39: x++; break; // right - default: return; + var id = "field_" + y + "_" + x; + var nO = document.getElementById(id); + if (nO) break; } - - var id = "field_" + y + "_" + x; - var nO = document.getElementById(id); + if (!nO) return; nO.focus(); if (nO.tagName != 'SELECT') { diff --git a/libraries/tbl_change.js b/libraries/tbl_change.js index 959d10bb7..cc4798254 100644 --- a/libraries/tbl_change.js +++ b/libraries/tbl_change.js @@ -58,3 +58,45 @@ function unNullify(urlField) return true; } // end of the 'unNullify()' function + +/** + * Allows moving around inputs/select by Ctrl+arrows + * + * @param object event data + */ +function onKeyDownArrowsHandler(e) { + e = e||window.event; + var o = (e.srcElement||e.target); + if (!o) return; + if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return; + if (!e.ctrlKey) return; + if (!o.id) return; + + var pos = o.id.split("_"); + if (pos[0] != "field" || typeof pos[2] == "undefined") return; + + var x = pos[2], y=pos[1]; + + // skip non existent fields + for (i=0; i<10; i++) + { + switch(e.keyCode) { + case 38: y--; break; // up + case 40: y++; break; // down + case 37: x--; break; // left + case 39: x++; break; // right + default: return; + } + + var id = "field_" + y + "_" + x; + var nO = document.getElementById(id); + if (nO) break; + } + + if (!nO) return; + nO.focus(); + if (nO.tagName != 'SELECT') { + nO.select(); + } + e.returnValue = false; +} diff --git a/tbl_change.php3 b/tbl_change.php3 index 1b3e4e79a..4d99bf5f4 100755 --- a/tbl_change.php3 +++ b/tbl_change.php3 @@ -140,6 +140,13 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5) // some browsers send wrongly this form to the http server. ?> + + +
@@ -317,7 +324,7 @@ for ($i = 0; $i < $fields_cnt; $i++) { } else { ?> - ="return unNullify('')" tabindex="" id="field__1"> 20) { @@ -380,8 +388,8 @@ for ($i = 0; $i < $fields_cnt; $i++) { ?> - - + 20) { echo "\n"; ?> - ="return unNullify('')" tabindex="" id="field__2"> ' . "\n"; echo ' ' . "\n"; } // end for @@ -487,7 +496,7 @@ for ($i = 0; $i < $fields_cnt; $i++) { - ="return unNullify('')" tabindex="" id="field__2"> - - ="return unNullify('')" tabindex="" /> + ="return unNullify('')" tabindex="" id="field__2" /> - - ="return unNullify('')" tabindex="" /> + ="return unNullify('')" tabindex="" id="field__2" />