Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauricio@fauth.dev>2022-06-19 07:31:31 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2022-06-19 22:48:10 +0300
commitf5d738db59a7430c96b3824458d89e01c331450a (patch)
tree472f2b0d22bd77feabb5b4134d9840b0417ba3af
parentb9fa83ce705fb4116516b69b9b8451e6e2557b70 (diff)
Move `input.sqlbutton` event listener to sql.js file
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
-rw-r--r--js/src/functions.js8
-rw-r--r--js/src/sql.js9
-rw-r--r--libraries/classes/Controllers/Table/TrackingController.php1
-rw-r--r--libraries/classes/Controllers/View/CreateController.php2
4 files changed, 11 insertions, 9 deletions
diff --git a/js/src/functions.js b/js/src/functions.js
index e66a6a9428..92a5f08a94 100644
--- a/js/src/functions.js
+++ b/js/src/functions.js
@@ -1395,14 +1395,12 @@ AJAX.registerTeardown('functions.js', function () {
$(document).off('click', 'a.inline_edit_sql');
$(document).off('click', 'input#sql_query_edit_save');
$(document).off('click', 'input#sql_query_edit_discard');
- $('input.sqlbutton').off('click');
if (codeMirrorEditor) {
codeMirrorEditor.off('blur');
} else {
$(document).off('blur', '#sqlquery');
}
$(document).off('change', '#parameterized');
- $(document).off('click', 'input.sqlbutton');
$('#sqlquery').off('keydown');
$('#sql_query_edit').off('keydown');
@@ -1484,12 +1482,6 @@ AJAX.registerOnload('functions.js', function () {
$divEditor.remove();
});
- $(document).on('click', 'input.sqlbutton', function (evt) {
- Functions.insertQuery(evt.target.id);
- Functions.handleSimulateQueryButton();
- return false;
- });
-
$(document).on('change', '#parameterized', Functions.updateQueryParameters);
var $inputUsername = $('#input_username');
diff --git a/js/src/sql.js b/js/src/sql.js
index cf99236455..0d5326bb08 100644
--- a/js/src/sql.js
+++ b/js/src/sql.js
@@ -214,6 +214,7 @@ AJAX.registerTeardown('sql.js', function () {
$(document).off('submit', '.maxRowsForm');
$(document).off('click', '#view_as');
$(document).off('click', '#sqlquery');
+ $(document).off('click', 'input.sqlbutton');
});
/**
@@ -851,7 +852,13 @@ AJAX.registerOnload('sql.js', function () {
Functions.selectContent(this);
}
});
-}); // end $()
+
+ $(document).on('click', 'input.sqlbutton', function (evt) {
+ Functions.insertQuery(evt.target.id);
+ Functions.handleSimulateQueryButton();
+ return false;
+ });
+});
/**
* Starting from some th, change the class of all td under it.
diff --git a/libraries/classes/Controllers/Table/TrackingController.php b/libraries/classes/Controllers/Table/TrackingController.php
index 23615ab057..61cdfb0c94 100644
--- a/libraries/classes/Controllers/Table/TrackingController.php
+++ b/libraries/classes/Controllers/Table/TrackingController.php
@@ -194,6 +194,7 @@ final class TrackingController extends AbstractController
$sqlDump = '';
if (isset($_POST['report_export']) && $_POST['export_type'] === 'sqldump') {
+ $this->addScriptFiles(['sql.js']);
$sqlDump = $this->tracking->exportAsSqlDump($GLOBALS['db'], $GLOBALS['table'], $GLOBALS['entries']);
}
diff --git a/libraries/classes/Controllers/View/CreateController.php b/libraries/classes/Controllers/View/CreateController.php
index 12a5a732ab..29160c747f 100644
--- a/libraries/classes/Controllers/View/CreateController.php
+++ b/libraries/classes/Controllers/View/CreateController.php
@@ -281,6 +281,8 @@ class CreateController extends AbstractController
$GLOBALS['urlParams']['db'] = $GLOBALS['db'];
$GLOBALS['urlParams']['reload'] = 1;
+ $this->addScriptFiles(['sql.js']);
+
echo $this->template->render('view_create', [
'ajax_dialog' => isset($_POST['ajax_dialog']),
'text_dir' => $GLOBALS['text_dir'],