/[drupal]/drupal/modules/user/user.permissions.js
ViewVC logotype

Contents of /drupal/modules/user/user.permissions.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Tue May 12 08:33:19 2009 UTC (6 months, 2 weeks ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-8, DRUPAL-7-0-UNSTABLE-9, DRUPAL-7-0-UNSTABLE-10, DRUPAL-7-0-UNSTABLE-7, HEAD
File MIME type: text/javascript
- Patch #78941 by kkaefer and ksenzee: added missing file.
1 // $Id$
2 (function ($) {
3
4 /**
5 * Shows checked and disabled checkboxes for inherited permissions.
6 */
7 Drupal.behaviors.permissions = {
8 attach: function (context) {
9 $('table#permissions:not(.permissions-processed)').each(function () {
10 // Create dummy checkboxes. We use dummy checkboxes instead of reusing
11 // the existing checkboxes here because new checkboxes don't alter the
12 // submitted form. If we'd automatically check existing checkboxes, the
13 // permission table would be polluted with redundant entries. This
14 // is deliberate, but desirable when we automatically check them.
15 $(':checkbox', this).not('[name^="2["]').not('[name^="1["]').each(function () {
16 $(this).addClass('real-checkbox');
17 $('<input type="checkbox" class="dummy-checkbox" disabled="disabled" checked="checked" />')
18 .attr('title', Drupal.t("This permission is inherited from the authenticated user role."))
19 .hide()
20 .insertAfter(this);
21 });
22
23 // Helper function toggles all dummy checkboxes based on the checkboxes'
24 // state. If the "authenticated user" checkbox is checked, the checked
25 // and disabled checkboxes are shown, the real checkboxes otherwise.
26 var toggle = function () {
27 $(this).closest('tr')
28 .find('.real-checkbox')[this.checked ? 'hide' : 'show']().end()
29 .find('.dummy-checkbox')[this.checked ? 'show' : 'hide']();
30 };
31
32 // Initialize the authenticated user checkbox.
33 $(':checkbox[name^="2["]', this)
34 .click(toggle)
35 .each(function () { toggle.call(this); });
36 }).addClass('permissions-processed');
37 }
38 };
39
40 })(jQuery);

  ViewVC Help
Powered by ViewVC 1.1.2