Merge pull request #14825 from williamdes/issue-14478-export-stream
[phpmyadmin.git] / js / server_user_groups.js
blob513777a97fa3b797319c5b5a601e603c53784298
1 /**
2  * Unbind all event handlers before tearing down a page
3  */
4 AJAX.registerTeardown('server_user_groups.js', function () {
5     $(document).off('click', 'a.deleteUserGroup.ajax');
6 });
8 /**
9  * Bind event handlers
10  */
11 AJAX.registerOnload('server_user_groups.js', function () {
12     // update the checkall checkbox on Edit user group page
13     $(checkboxes_sel).trigger('change');
15     $(document).on('click', 'a.deleteUserGroup.ajax', function (event) {
16         event.preventDefault();
17         var $link = $(this);
18         var groupName = $link.parents('tr').find('td:first').text();
19         var buttonOptions = {};
20         buttonOptions[PMA_messages.strGo] = function () {
21             $(this).dialog('close');
22             $link.removeClass('ajax').trigger('click');
23         };
24         buttonOptions[PMA_messages.strClose] = function () {
25             $(this).dialog('close');
26         };
27         $('<div/>')
28             .attr('id', 'confirmUserGroupDeleteDialog')
29             .append(PMA_sprintf(PMA_messages.strDropUserGroupWarning, escapeHtml(groupName)))
30             .dialog({
31                 width: 300,
32                 minWidth: 200,
33                 modal: true,
34                 buttons: buttonOptions,
35                 title: PMA_messages.strConfirm,
36                 close: function () {
37                     $(this).remove();
38                 }
39             });
40     });
41 });