/[drupal]/contributions/modules/logintoboggan/logintoboggan.permissions.js
ViewVC logotype

Contents of /contributions/modules/logintoboggan/logintoboggan.permissions.js

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


Revision 1.1 - (show annotations) (download) (as text)
Tue Oct 20 14:55:44 2009 UTC (5 weeks, 4 days ago) by thehunmonkgroup
Branch: MAIN
CVS Tags: DRUPAL-7--1-0-ALPHA2, DRUPAL-7--1-0-ALPHA1, HEAD
File MIME type: text/javascript
login successful message now contains username.  logged in block now uses theme_username on username.  update theme functions to work for 7.x.  clean up and refactor the access denied/login form functionality.  use a custom user admin permission js file when the pre-auth role is not the auth user -- allows pre-auth role to have lower permissions than auth role.
1 // $Id: $
2
3 /**
4 * This is a custom implementation of user.permissions.js, which is necessary
5 * because LoginToboggan needs it's pre-auth role to not be explicitly tied to
6 * the auth role. The change is minor -- simply exclude the pre-auth role from
7 * all the auto-checking as the anon and auth user roles are.
8 */
9
10 (function ($) {
11
12 /**
13 * Shows checked and disabled checkboxes for inherited permissions.
14 */
15 Drupal.behaviors.permissions = {
16 attach: function (context) {
17 $('table#permissions:not(.permissions-processed)').each(function () {
18 // Create dummy checkboxes. We use dummy checkboxes instead of reusing
19 // the existing checkboxes here because new checkboxes don't alter the
20 // submitted form. If we'd automatically check existing checkboxes, the
21 // permission table would be polluted with redundant entries. This
22 // is deliberate, but desirable when we automatically check them.
23 $(':checkbox', this).not('[name^="2["]').not('[name^="1["]').not('[name^="' + Drupal.settings.LoginToboggan.preAuthID + '["]').each(function () {
24 $(this).addClass('real-checkbox');
25 $('<input type="checkbox" class="dummy-checkbox" disabled="disabled" checked="checked" />')
26 .attr('title', Drupal.t("This permission is inherited from the authenticated user role."))
27 .hide()
28 .insertAfter(this);
29 });
30
31 // Helper function toggles all dummy checkboxes based on the checkboxes'
32 // state. If the "authenticated user" checkbox is checked, the checked
33 // and disabled checkboxes are shown, the real checkboxes otherwise.
34 var toggle = function () {
35 $(this).closest('tr')
36 .find('.real-checkbox')[this.checked ? 'hide' : 'show']().end()
37 .find('.dummy-checkbox')[this.checked ? 'show' : 'hide']();
38 };
39
40 // Initialize the authenticated user checkbox.
41 $(':checkbox[name^="2["]', this)
42 .click(toggle)
43 .each(function () { toggle.call(this); });
44 }).addClass('permissions-processed');
45 }
46 };
47
48 })(jQuery);

  ViewVC Help
Powered by ViewVC 1.1.2