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