diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-03-23 12:45:28 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-03-23 12:45:28 +0300 |
commit | b48f1ea52fe11f9c6d9231ee04a3483054db941c (patch) | |
tree | 8ac50c41fe46ca11b858eec428df2b7a08c2e0d6 /js/sql.js | |
parent | 856b984aecd06d93b0196e73442c13c6bc9d8f21 (diff) |
rfe #933 Manage multiple variable in bookmarked query
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/sql.js')
-rw-r--r-- | js/sql.js | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -91,6 +91,7 @@ AJAX.registerTeardown('sql.js', function () { $(document).off('stickycolumns', ".sqlqueryresults"); $("#togglequerybox").unbind('click'); $(document).off('click', "#button_submit_query"); + $(document).off('change', '#id_bookmark') $("input[name=bookmark_variable]").unbind("keypress"); $(document).off('submit', "#sqlqueryform.ajax"); $(document).off('click', "input[name=navig].ajax"); @@ -268,6 +269,31 @@ AJAX.registerOnload('sql.js', function () { }); /** + * Event handler to show appropiate number of variable boxes + * based on the bookmarked query + */ + $(document).on('change', '#id_bookmark', function (event) { + + var varCount = $(this).find('option:selected').data('varcount'); + if (typeof varCount == 'undefined') { + varCount = 0; + } + + var $varDiv = $('#bookmark_variables'); + $varDiv.empty(); + for (var i = 1; i <= varCount; i++) { + $varDiv.append($('<label for="bookmark_variable_' + i + '">' + PMA_sprintf(PMA_messages.strBookmarkVariable, i) + '</label>')); + $varDiv.append($('<input type="text" size="10" name="bookmark_variable[' + i + ']" id="bookmark_variable_' + i + '"></input>')); + } + + if (varCount == 0) { + $varDiv.parent('.formelement').hide(); + } else { + $varDiv.parent('.formelement').show(); + } + }); + + /** * Event handler for hitting enter on sqlqueryform bookmark_variable * (the Variable textfield in Bookmarked SQL query section) * |