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 () {
31 PMA_getSQLEditor($('#textSqlquery'), {}, 'both');
34 * Ajax handler to check the corresponding 'show' checkbox when column is selected
36 $(document).on('change', 'select[name^=criteriaColumn]', function (event) {
38 var index = (/\d+/).exec($(this).attr('name'));
39 $('input[name=criteriaShow\\[' + index + '\\]]').prop('checked', true);
44 * Ajax event handlers for 'Select saved search'
46 $(document).on('change', '#searchId', function (event) {
47 $('#action').val('load');
48 $('#formQBE').submit();
52 * Ajax event handlers for 'Create bookmark'
54 $(document).on('click', '#saveSearch', function () {
55 $('#action').val('create');
59 * Ajax event handlers for 'Update bookmark'
61 $(document).on('click', '#updateSearch', function (event) {
62 $('#action').val('update');
66 * Ajax event handlers for 'Delete bookmark'
68 $(document).on('click', '#deleteSearch', function (event) {
69 var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text());
70 if (!confirm(question)) {
74 $('#action').val('delete');
77 var windowwidth = $(window).width();
78 $('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');