Update po files
[phpmyadmin.git] / js / db_qbe.js
blob7c5f50ac3c26296e68fda1a140575a81877a6f1b
1 /* vim: set expandtab sw=4 ts=4 sts=4: */
2 /**
3  * @fileoverview    function used in QBE for DB
4  * @name            Database Operations
5  *
6  * @requires    jQuery
7  * @requires    jQueryUI
8  * @requires    js/functions.js
9  *
10  */
12 /**
13  * Ajax event handlers here for db_qbe.php
14  *
15  * Actions Ajaxified here:
16  * Select saved search
17  */
19 /**
20  * Unbind all event handlers before tearing down a page
21  */
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');
28 });
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);
39     });
41     /**
42      * Ajax handler to check the corresponding 'show' checkbox when column is selected
43      */
44     $(document).on('change', 'select[name^=criteriaColumn]', function (event) {
45         if ($(this).val()) {
46             var index = (/\d+/).exec($(this).attr('name'));
47             $('input[name=criteriaShow\\[' + index + '\\]]').prop('checked', true);
48         }
49     });
51     /**
52      * Ajax event handlers for 'Select saved search'
53      */
54     $(document).on('change', '#searchId', function (event) {
55         $('#action').val('load');
56         $('#formQBE').submit();
57     });
59     /**
60      * Ajax event handlers for 'Create bookmark'
61      */
62     $(document).on('click', '#saveSearch', function () {
63         $('#action').val('create');
64     });
66     /**
67      * Ajax event handlers for 'Update bookmark'
68      */
69     $(document).on('click', '#updateSearch', function (event) {
70         $('#action').val('update');
71     });
73     /**
74      * Ajax event handlers for 'Delete bookmark'
75      */
76     $(document).on('click', '#deleteSearch', function (event) {
77         var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text());
78         if (!confirm(question)) {
79             return false;
80         }
82         $('#action').val('delete');
83     });
85     var windowwidth = $(window).width();
86     $('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
87 });