Translated using Weblate (Dutch)
[phpmyadmin.git] / js / db_qbe.js
blobf2b9307c39524554be7b80e89d40ff81bbe22994
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'), {}, 'both');
33     /**
34      * Ajax handler to check the corresponding 'show' checkbox when column is selected
35      */
36     $(document).on('change', 'select[name^=criteriaColumn]', function (event) {
37         if ($(this).val()) {
38             var index = (/\d+/).exec($(this).attr('name'));
39             $('input[name=criteriaShow\\[' + index + '\\]]').prop('checked', true);
40         }
41     });
43     /**
44      * Ajax event handlers for 'Select saved search'
45      */
46     $(document).on('change', '#searchId', function (event) {
47         $('#action').val('load');
48         $('#formQBE').submit();
49     });
51     /**
52      * Ajax event handlers for 'Create bookmark'
53      */
54     $(document).on('click', '#saveSearch', function () {
55         $('#action').val('create');
56     });
58     /**
59      * Ajax event handlers for 'Update bookmark'
60      */
61     $(document).on('click', '#updateSearch', function (event) {
62         $('#action').val('update');
63     });
65     /**
66      * Ajax event handlers for 'Delete bookmark'
67      */
68     $(document).on('click', '#deleteSearch', function (event) {
69         var question = PMA_sprintf(PMA_messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text());
70         if (!confirm(question)) {
71             return false;
72         }
74         $('#action').val('delete');
75     });
77     var windowwidth = $(window).width();
78     $('.jsresponsive').css('max-width', (windowwidth - 35) + 'px');
79 });