Edit select SQL query on Ctrl+click

This commit is contained in:
Jakub Vrana 2013-04-04 18:15:18 -07:00
parent e4d5835dab
commit 1a1b800b40
4 changed files with 8 additions and 8 deletions

View file

@ -165,9 +165,9 @@ username.form['auth[driver]'].onchange();
*/
function selectQuery($query) {
global $jush, $token;
return "<form action='" . h(ME) . "sql=' method='post'><p><span>"
return "<form action='" . h(ME) . "sql=' method='post'><p><span onclick=\"return !selectEditSql(event, this, '" . lang('Execute') . "');\">"
. "<code class='jush-$jush'>" . h(str_replace("\n", " ", $query)) . "</code>"
. " <a href='" . h(ME) . "sql=" . urlencode($query) . "' onclick=\"return !selectEditSql(event, this.parentNode, '" . lang('Execute') . "');\">" . lang('Edit') . "</a>"
. " <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>"
. "</span><input type='hidden' name='token' value='$token'></p></form>\n"; // </p> - required for IE9 inline edit
}

View file

@ -203,11 +203,11 @@ function selectFieldChange(form) {
* @param MouseEvent
* @param HTMLSpanElement
* @param string
* @return boolean
*/
function selectEditSql(event, el, label) {
if (isCtrl(event) || event.altKey) {
return false;
var a = parentTag(event.target || event.srcElement, 'a');
if (!isCtrl(event) || (a && a.href)) {
return;
}
var sql = el.firstChild;
var input = document.createElement('input');

View file

@ -40,12 +40,12 @@ function selectValue(select) {
/** Get parent node with specified tag name.
* @param HTMLElement
* @param string
* @param string regular expression
* @return HTMLElement
*/
function parentTag(el, tag) {
var re = new RegExp('^' + tag + '$', 'i');
while (!re.test(el.tagName)) {
while (el && !re.test(el.tagName)) {
el = el.parentNode;
}
return el;

View file

@ -1,6 +1,6 @@
Adminer 3.6.4-dev:
Display pagination on a fixed position
Display select SQL edit form inline
Display SQL edit form on Ctrl+click on the select query
Recover original view, trigger, routine if creating fails
Allow loading more data with inline edit (bug #3605531)
Stay on the same page after deleting rows (bug #3605845)