jumping cursor using Keyboard
This commit is contained in:
@@ -5,7 +5,7 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$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
|
||||
all for fields selection.
|
||||
|
||||
|
@@ -478,3 +478,39 @@ function setSelectOptions(the_form, the_select, do_check)
|
||||
|
||||
return true;
|
||||
} // 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;
|
||||
}
|
||||
|
@@ -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; ?>">
|
||||
<?php
|
||||
echo PMA_generate_common_hidden_inputs($db, $table);
|
||||
@@ -64,10 +71,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<input type="text" name="field_name[]" size="10" maxlength="64" value="<?php if (isset($row) && isset($row['Field'])) echo str_replace('"', '"', $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('"', '"', $row['Field']); ?>" class="textfield" />
|
||||
</td>
|
||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||
<select name="field_type[]">
|
||||
<select name="field_type[]" id="field_<?php echo $i; ?>_2">
|
||||
<?php
|
||||
echo "\n";
|
||||
if (empty($row['Type'])) {
|
||||
@@ -119,10 +126,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<input type="text" name="field_length[]" size="8" value="<?php echo str_replace('"', '"', $length); ?>" class="textfield" />
|
||||
<input id="field_<?php echo $i; ?>_3" type="text" name="field_length[]" size="8" value="<?php echo str_replace('"', '"', $length); ?>" class="textfield" />
|
||||
</td>
|
||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||
<select name="field_attribute[]">
|
||||
<select name="field_attribute[]" id="field_<?php echo $i; ?>_4">
|
||||
<?php
|
||||
echo "\n";
|
||||
$binary = eregi('BINARY', $row['Type'], $test_attribute1);
|
||||
@@ -149,7 +156,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
|
||||
</select>
|
||||
</td>
|
||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||
<select name="field_null[]">
|
||||
<select name="field_null[]" id="field_<?php echo $i; ?>_5">
|
||||
<?php
|
||||
if (!isset($row) || empty($row['Null'])) {
|
||||
echo "\n";
|
||||
@@ -185,10 +192,10 @@ for ($i = 0 ; $i < $num_fields; $i++) {
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
<input type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '"', $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('"', '"', $row['Default']); ?>" class="textfield" />
|
||||
</td>
|
||||
<td bgcolor="<?php echo $bgcolor; ?>">
|
||||
<select name="field_extra[]">
|
||||
<select name="field_extra[]" id="field_<?php echo $i; ?>_7">
|
||||
<?php
|
||||
if(!isset($row) || empty($row['Extra'])) {
|
||||
echo "\n";
|
||||
|
Reference in New Issue
Block a user