jumping cursor using Keyboard

This commit is contained in:
Michal Čihař
2003-01-14 13:01:02 +00:00
parent 99f08d6111
commit d2ed8f4eaa
3 changed files with 51 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2003-01-14444chal Cihar <nijel@users.sourceforge.net> 2003-01-14 Michal Cihar <nijel@users.sourceforge.net>
* tbl_properties_structure.php3,libraries/functions.js: Added (un)check * tbl_properties_structure.php3,libraries/functions.js: Added (un)check
all for fields selection. all for fields selection.

View File

@@ -478,3 +478,39 @@ function setSelectOptions(the_form, the_select, do_check)
return true; return true;
} // end of the 'setSelectOptions()' function } // end of the 'setSelectOptions()' 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 != "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];
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) return;
nO.focus();
if (nO.tagName != 'SELECT') {
nO.select();
}
e.returnValue = false;
}

View File

@@ -4,6 +4,13 @@
?> ?>
<!-- Set on key handler for moving using by Ctrl+arrows -->
<script type="text/javascript" language="javascript">
<!--
document.onkeydown = onKeyDownArrowsHandler;
// -->
</script>
<form method="post" action="<?php echo $action; ?>"> <form method="post" action="<?php echo $action; ?>">
<?php <?php
echo PMA_generate_common_hidden_inputs($db, $table); echo PMA_generate_common_hidden_inputs($db, $table);
@@ -64,10 +71,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
} }
echo "\n"; echo "\n";
?> ?>
<input type="text" name="field_name[]" size="10" maxlength="64" value="<?php if (isset($row) && isset($row['Field'])) echo str_replace('"', '&quot;', $row['Field']); ?>" class="textfield" /> <input id="field_<?php echo $i; ?>_1" type="text" name="field_name[]" size="10" maxlength="64" value="<?php if (isset($row) && isset($row['Field'])) echo str_replace('"', '&quot;', $row['Field']); ?>" class="textfield" />
</td> </td>
<td bgcolor="<?php echo $bgcolor; ?>"> <td bgcolor="<?php echo $bgcolor; ?>">
<select name="field_type[]"> <select name="field_type[]" id="field_<?php echo $i; ?>_2">
<?php <?php
echo "\n"; echo "\n";
if (empty($row['Type'])) { if (empty($row['Type'])) {
@@ -119,10 +126,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
} }
echo "\n"; echo "\n";
?> ?>
<input type="text" name="field_length[]" size="8" value="<?php echo str_replace('"', '&quot;', $length); ?>" class="textfield" /> <input id="field_<?php echo $i; ?>_3" type="text" name="field_length[]" size="8" value="<?php echo str_replace('"', '&quot;', $length); ?>" class="textfield" />
</td> </td>
<td bgcolor="<?php echo $bgcolor; ?>"> <td bgcolor="<?php echo $bgcolor; ?>">
<select name="field_attribute[]"> <select name="field_attribute[]" id="field_<?php echo $i; ?>_4">
<?php <?php
echo "\n"; echo "\n";
$binary = eregi('BINARY', $row['Type'], $test_attribute1); $binary = eregi('BINARY', $row['Type'], $test_attribute1);
@@ -149,7 +156,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
</select> </select>
</td> </td>
<td bgcolor="<?php echo $bgcolor; ?>"> <td bgcolor="<?php echo $bgcolor; ?>">
<select name="field_null[]"> <select name="field_null[]" id="field_<?php echo $i; ?>_5">
<?php <?php
if (!isset($row) || empty($row['Null'])) { if (!isset($row) || empty($row['Null'])) {
echo "\n"; echo "\n";
@@ -185,10 +192,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
} }
echo "\n"; echo "\n";
?> ?>
<input type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '&quot;', $row['Default']); ?>" class="textfield" /> <input id="field_<?php echo $i; ?>_6" type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '&quot;', $row['Default']); ?>" class="textfield" />
</td> </td>
<td bgcolor="<?php echo $bgcolor; ?>"> <td bgcolor="<?php echo $bgcolor; ?>">
<select name="field_extra[]"> <select name="field_extra[]" id="field_<?php echo $i; ?>_7">
<?php <?php
if(!isset($row) || empty($row['Extra'])) { if(!isset($row) || empty($row['Extra'])) {
echo "\n"; echo "\n";