Use Option key for Safari for moving (bug #1094137), move key handler function to separate file so we have only one, make movement work correctly in vertical display of properties.

This commit is contained in:
Michal Čihař
2005-01-07 11:48:45 +00:00
parent 4de30d4066
commit 479635e791
7 changed files with 88 additions and 107 deletions

View File

@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-01-07 Michal Čihař <michal@cihar.com>
* Documentation.html, tbl_change.php, tbl_properties.inc.php,
libraries/functions.js, libraries/tbl_change.js,
libraries/keyhandler.js: Use Option key for Safari for moving (bug
#1094137), move key handler function to separate file so we have only
one, make movement work correctly in vertical display of properties.
2005-01-06 Marc Delisle <lem9@users.sourceforge.net> 2005-01-06 Marc Delisle <lem9@users.sourceforge.net>
* tbl_change.php: removed old PHP3-workaround that caused problems * tbl_change.php: removed old PHP3-workaround that caused problems
with field names like '000' with field names like '000'
@@ -22,7 +29,7 @@ $Source$
* export.php: Use standardised mime types and use content encoding for * export.php: Use standardised mime types and use content encoding for
gzip/bzip2. I hope this will fix double gzip compression as in bug gzip/bzip2. I hope this will fix double gzip compression as in bug
#1094649. #1094649.
2005-01-01 Michal Čihař <michal@cihar.com> 2005-01-01 Michal Čihař <michal@cihar.com>
* tbl_alter.php: Don't try to set collation for non text fields (bug * tbl_alter.php: Don't try to set collation for non text fields (bug
#1094109). #1094109).

View File

@@ -65,7 +65,7 @@
<b>PHP</b> <b>PHP</b>
<ul> <ul>
<li>You need PHP 4.1.0 or newer (<a href="#faqphp5">*</a>)</li> <li>You need PHP 4.1.0 or newer (<a href="#faqphp5">*</a>)</li>
<li>If you want to display inline thumbnails of JPEGs with the <li>If you want to display inline thumbnails of JPEGs with the
original aspect ratio, you also need GD2 support in PHP</li> original aspect ratio, you also need GD2 support in PHP</li>
<li>Starting with phpMyAdmin 2.6.1, MIME-based transformations <li>Starting with phpMyAdmin 2.6.1, MIME-based transformations
that use an external program need PHP 4.3.0 or newer</li> that use an external program need PHP 4.3.0 or newer</li>
@@ -79,7 +79,7 @@
if you are using if you are using
the &quot;cookie&quot; authentication method, having the <tt>mcrypt</tt> the &quot;cookie&quot; authentication method, having the <tt>mcrypt</tt>
PHP extension on your web server accelerates not only the login PHP extension on your web server accelerates not only the login
phase but every other action that you do in phpMyAdmin. phase but every other action that you do in phpMyAdmin.
</li> </li>
<li> <li>
a web-browser (doh!). a web-browser (doh!).
@@ -241,7 +241,7 @@
in the configuration file.<br /><br /></li> in the configuration file.<br /><br /></li>
<li>HTTP and cookie authentication modes are more secure: the MySQL <li>HTTP and cookie authentication modes are more secure: the MySQL
login information does not need to be set in the phpMyAdmin login information does not need to be set in the phpMyAdmin
configuration file configuration file
(except possibly for the <a href="#controluser">controluser</a>). (except possibly for the <a href="#controluser">controluser</a>).
<br /> <br />
@@ -254,7 +254,7 @@
<li> <li>
<b>Note: starting with phpMyAdmin 2.6.1, configuring the controluser <b>Note: starting with phpMyAdmin 2.6.1, configuring the controluser
to enable HTTP and cookie authentication applies <i>only to enable HTTP and cookie authentication applies <i>only
to MySQL servers older than 4.1.2</i>.</b> to MySQL servers older than 4.1.2</i>.</b>
<br /><br /> <br /><br />
For 'HTTP' and 'cookie' modes, phpMyAdmin needs a controluser that has For 'HTTP' and 'cookie' modes, phpMyAdmin needs a controluser that has
@@ -346,7 +346,7 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON &lt;pma_db&gt;.* TO 'pma'@'localhost';
with the same username.</li> with the same username.</li>
<li>If you want to login to arbitrary server see <li>If you want to login to arbitrary server see
<tt><a href="#AllowArbitraryServer">$cfg['AllowArbitraryServer']</a></tt> directive.</li> <tt><a href="#AllowArbitraryServer">$cfg['AllowArbitraryServer']</a></tt> directive.</li>
<li>See also the <a href="#require">requirements</a> section for a way <li>See also the <a href="#require">requirements</a> section for a way
to improve the interface speed while using this mode.</li> to improve the interface speed while using this mode.</li>
</ul> </ul>
@@ -521,13 +521,13 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON &lt;pma_db&gt;.* TO 'pma'@'localhost';
</dt> </dt>
<dd> <dd>
<i>Note: starting with phpMyAdmin 2.6.1, configuring the controluser <i>Note: starting with phpMyAdmin 2.6.1, configuring the controluser
to enable HTTP and cookie authentication applies only to enable HTTP and cookie authentication applies only
to MySQL servers older than 4.1.2.</i> to MySQL servers older than 4.1.2.</i>
<br /><br /> <br /><br />
This special account is used for 2 distinct purposes: to make possible This special account is used for 2 distinct purposes: to make possible
all relational features all relational features
(see <a href="#pmadb">$cfg['Servers'][$i]['pmadb']</a>) and, for a (see <a href="#pmadb">$cfg['Servers'][$i]['pmadb']</a>) and, for a
MySQL server older than 4.1.2, to enable a multi-user installation MySQL server older than 4.1.2, to enable a multi-user installation
(http or cookie authentication mode). (http or cookie authentication mode).
<br /><br /> <br /><br />
When using HTTP or cookie authentication modes (or 'config' When using HTTP or cookie authentication modes (or 'config'
@@ -1540,7 +1540,7 @@ Defaults to FALSE (drop-down). <br />
<b>$cfg['CtrlArrowsMoving'] </b>boolean<br /> <b>$cfg['CtrlArrowsMoving'] </b>boolean<br />
</dt> </dt>
<dd> <dd>
Enable Ctrl+Arrows moving between fields when editing? Enable Ctrl+Arrows (Option+Arrows in Safari) moving between fields when editing?
<br /><br /> <br /><br />
</dd> </dd>
@@ -2987,8 +2987,8 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
</h4> </h4>
<p> <p>
phpMyAdmin uses a quick method to get the row count, and this method phpMyAdmin uses a quick method to get the row count, and this method
only returns an approximate count in the case of InnoDB tables. See only returns an approximate count in the case of InnoDB tables. See
<tt>$cfg['MaxExactCount']</tt> for a way to modify those results, but <tt>$cfg['MaxExactCount']</tt> for a way to modify those results, but
this could have a serious impact on performance. this could have a serious impact on performance.
</p> </p>
@@ -3572,7 +3572,7 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
[6.16] How can I simply move in page with plenty editing fields? [6.16] How can I simply move in page with plenty editing fields?
</h4> </h4>
<p> <p>
You can use Ctrl+arrows for moving on most pages with plenty editing You can use Ctrl+arrows (Option+Arrows in Safari) for moving on most pages with plenty editing
fields (table structure changes, row editing, etc.) (must be enabled in fields (table structure changes, row editing, etc.) (must be enabled in
configuration - see. <a href="#CtrlArrowsMoving">$cfg['CtrlArrowsMoving']</a>). You can also have a look configuration - see. <a href="#CtrlArrowsMoving">$cfg['CtrlArrowsMoving']</a>). You can also have a look
at the directive <a href="#DefaultPropDisplay">$cfg['DefaultPropDisplay']</a> ('vertical') and see if this at the directive <a href="#DefaultPropDisplay">$cfg['DefaultPropDisplay']</a> ('vertical') and see if this

View File

@@ -745,48 +745,6 @@ 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 != "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;
}
/** /**
* Inserts multiple fields. * Inserts multiple fields.
* *

59
libraries/keyhandler.js Normal file
View File

@@ -0,0 +1,59 @@
/**
* 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 (navigator.userAgent.toLowerCase().indexOf('aplewebkit/') != -1) {
if (e.ctrlKey || e.shiftKey || !e.altKey) return;
} else {
if (!e.ctrlKey || e.shiftKey || e.altKey) 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++)
{
if (switch_movement) {
switch(e.keyCode) {
case 38: x--; break; // up
case 40: x++; break; // down
case 37: y--; break; // left
case 39: y++; break; // right
default: return;
}
} else {
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) {
var id = "field_" + y + "_" + x + "_0";
var nO = document.getElementById(id);
}
if (nO) break;
}
if (!nO) return;
nO.focus();
if (nO.tagName != 'SELECT') {
nO.select();
}
e.returnValue = false;
}

View File

@@ -69,53 +69,6 @@ function unNullify(urlField, multi_edit)
return true; return true;
} // end of the 'unNullify()' function } // 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 || e.shiftKey || e.altKey) 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) {
var id = "field_" + y + "_" + x + "_0";
var nO = document.getElementById(id);
}
if (nO) break;
}
if (!nO) return;
nO.focus();
if (nO.tagName != 'SELECT') {
nO.select();
}
e.returnValue = false;
}
var day; var day;
var month; var month;
var year; var year;

View File

@@ -148,8 +148,10 @@ $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
<?php if ($cfg['CtrlArrowsMoving']) { ?> <?php if ($cfg['CtrlArrowsMoving']) { ?>
<!-- Set on key handler for moving using by Ctrl+arrows --> <!-- Set on key handler for moving using by Ctrl+arrows -->
<script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
var switch_movement = 0;
document.onkeydown = onKeyDownArrowsHandler; document.onkeydown = onKeyDownArrowsHandler;
// --> // -->
</script> </script>
@@ -867,18 +869,18 @@ if (!empty($disp_message)) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $strOr; ?></b><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $strOr; ?></b><br />
<input type="radio" name="after_insert" value="new_insert" id="radio_after_insert_new_insert"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 4); ?>" style="vertical-align: middle" /><label for="radio_after_insert_new_insert"><?php echo $strAfterInsertNewInsert; ?></label><br /> <input type="radio" name="after_insert" value="new_insert" id="radio_after_insert_new_insert"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 4); ?>" style="vertical-align: middle" /><label for="radio_after_insert_new_insert"><?php echo $strAfterInsertNewInsert; ?></label><br />
<?php <?php
if (isset($primary_key)) if (isset($primary_key))
{?> {?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $strOr; ?></b><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $strOr; ?></b><br />
<input type="radio" name="after_insert" value="same_insert" id="radio_after_insert_same_insert"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 5); ?>" style="vertical-align: middle" /><label for="radio_after_insert_same_insert"><?php echo $strAfterInsertSame; ?></label><br /> <input type="radio" name="after_insert" value="same_insert" id="radio_after_insert_same_insert"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 5); ?>" style="vertical-align: middle" /><label for="radio_after_insert_same_insert"><?php echo $strAfterInsertSame; ?></label><br />
<?php <?php
// If we have just numeric primary key, we can also edit next // If we have just numeric primary key, we can also edit next
if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $primary_key)) { if (preg_match('@^[\s]*`[^`]*` = [0-9]+@', $primary_key)) {
?> ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $strOr; ?></b><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $strOr; ?></b><br />
<input type="radio" name="after_insert" value="edit_next" id="radio_after_insert_edit_next"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 5); ?>" style="vertical-align: middle" /><label for="radio_after_insert_edit_next"><?php echo $strAfterInsertNext; ?></label><br /> <input type="radio" name="after_insert" value="edit_next" id="radio_after_insert_edit_next"<?php echo $checked_after_insert_new_insert; ?> tabindex="<?php echo ($tabindex + $tabindex_for_value + 5); ?>" style="vertical-align: middle" /><label for="radio_after_insert_edit_next"><?php echo $strAfterInsertNext; ?></label><br />
<?php <?php
} }
} }
?> ?>

View File

@@ -13,8 +13,10 @@ require_once('./libraries/mysql_charsets.lib.php');
?> ?>
<?php if ($cfg['CtrlArrowsMoving']) { ?> <?php if ($cfg['CtrlArrowsMoving']) { ?>
<!-- Set on key handler for moving using by Ctrl+arrows --> <!-- Set on key handler for moving using by Ctrl+arrows -->
<script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0' : '1'; ?>;
document.onkeydown = onKeyDownArrowsHandler; document.onkeydown = onKeyDownArrowsHandler;
// --> // -->
</script> </script>