server_user_groups.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. });
  7. /**
  8. * Bind event handlers
  9. */
  10. AJAX.registerOnload('server_user_groups.js', function () {
  11. // update the checkall checkbox on Edit user group page
  12. $(checkboxes_sel).trigger('change');
  13. $(document).on('click', 'a.deleteUserGroup.ajax', function (event) {
  14. event.preventDefault();
  15. var $link = $(this);
  16. var groupName = $link.parents('tr').find('td:first').text();
  17. var buttonOptions = {};
  18. buttonOptions[PMA_messages.strGo] = function () {
  19. $(this).dialog('close');
  20. $link.removeClass('ajax').trigger('click');
  21. };
  22. buttonOptions[PMA_messages.strClose] = function () {
  23. $(this).dialog('close');
  24. };
  25. $('<div/>')
  26. .attr('id', 'confirmUserGroupDeleteDialog')
  27. .append(PMA_sprintf(PMA_messages.strDropUserGroupWarning, escapeHtml(groupName)))
  28. .dialog({
  29. width: 300,
  30. minWidth: 200,
  31. modal: true,
  32. buttons: buttonOptions,
  33. title: PMA_messages.strConfirm,
  34. close: function () {
  35. $(this).remove();
  36. }
  37. });
  38. });
  39. });