1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * @fileoverview function used in QBE for DB
4 * @name Database Operations
8 * @requires js/functions.js
13 * Ajax event handlers here for db_qbe.php
15 * Actions Ajaxified here:
20 * Unbind all event handlers before tearing down a page
22 AJAX.registerTeardown('db_qbe.js', function () {
23 $(document).off('change', 'select[name^=criteriaColumn]');
24 $(document).off('change', "#searchId");
25 $(document).off('click', "#saveSearch");
26 $(document).off('click', "#updateSearch");
27 $(document).off('click', "#deleteSearch");
30 AJAX.registerOnload('db_qbe.js', function () {
32 PMA_getSQLEditor($('#textSqlquery'), {}, 'both');
35 * Ajax handler to check the corresponding 'show' checkbox when column is selected
37 $(document).on('change', 'select[name^=criteriaColumn]', function (event) {
39 var index = (/\d+/).exec($(this).attr('name'));
40 $('input[name=criteriaShow\\[' + index + '\\]]').prop('checked', true);
45 * Ajax event handlers for 'Select saved search'
47 $(document).on('change', "#searchId", function (event) {
48 $('#action').val('load');
49 $('#formQBE').submit();
53 * Ajax event handlers for 'Create bookmark'
55 $(document).on('click', "#saveSearch", function () {
56 $('#action').val('create');
60 * Ajax event handlers for 'Update bookmark'
62 $(document).on('click', "#updateSearch", function (event) {
63 $('#action').val('update');
67 * Ajax event handlers for 'Delete bookmark'
69 $(document).on('click', "#deleteSearch", function (event) {
70 var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $("#searchId").find("option:selected").text());
71 if (!confirm(question)) {
75 $('#action').val('delete');