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