',
);
- drupal_add_js(drupal_get_path('module', 'user') .'/user.js');
+ drupal_add_js(drupal_get_path('module', 'user') .'/user.admin.js');
// If JS is enabled, and the radio is defaulting to off, hide all
// the settings on page load via .css using the js-hide class so
// that there's no flicker.
@@ -493,6 +493,7 @@ function user_admin_settings() {
* @see theme_user_admin_perm()
*/
function user_admin_perm($form_state, $rid = NULL) {
+ drupal_add_js(drupal_get_path('module', 'user') .'/user.admin.js');
if (is_numeric($rid)) {
$result = db_query('SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid WHERE r.rid = %d', $rid);
}
@@ -532,7 +533,7 @@ function user_admin_perm($form_state, $r
$options[$perm] = '';
$form['permission'][$perm] = array(
'#type' => 'item',
- '#value' => t($perm),
+ '#value' => '
'. t($perm) .'
',
'#description' => $hide_descriptions ? $description : NULL,
);
foreach ($role_names as $rid => $name) {
@@ -606,7 +607,7 @@ function theme_user_admin_perm($form) {
$rows[] = $row;
}
}
- $header[] = (t('Permission'));
+ $header[] = array('data' => t('Permission'), 'class' => 'permission-header');
foreach (element_children($form['role_names']) as $rid) {
if (is_array($form['role_names'][$rid])) {
$header[] = array('data' => drupal_render($form['role_names'][$rid]), 'class' => 'checkbox');
Index: modules/user/user.admin.js
===================================================================
RCS file: modules/user/user.admin.js
diff -N modules/user/user.admin.js
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/user/user.admin.js 18 Mar 2008 19:50:15 -0000
@@ -0,0 +1,76 @@
+// $Id: user.js,v 1.6 2007/09/12 18:29:32 goba Exp $
+
+/**
+ * On the admin/user/settings page, conditionally show all of the
+ * picture-related form elements depending on the current value of the
+ * "Picture support" radio buttons.
+ */
+Drupal.behaviors.userSettings = function(context) {
+ $('div.user-admin-picture-radios input[type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function () {
+ $('div.user-admin-picture-settings', context)[['hide', 'show'][this.value]]();
+ });
+};
+
+Drupal.behaviors.userPermissions = function(context) {
+ $('.permission-header:not(.userPermissions-processed)', context).addClass('.userPermissions-processed').append(' ').append(
+ $('').bind('keyup mouseup', function() {
+ $('.permission-header > input.form-text').val($(this).val());
+ Drupal.userPermissionSearch($(this).val());
+ })
+ );
+};
+
+Drupal.userPermissionSearch = function(term) {
+ if (term) {
+ filter = new RegExp(term, "i"); // Case insensitivity flag
+ previousModule = false;
+ zebra = true;
+ isEmpty = true;
+ $('#permissions > tbody > tr').each(function() {
+ td = $(this).find('td:first');
+ if (td.is('.permission')) {
+ match_title = td.find('.permission-title').text().match(filter);
+ match_description = td.find('.description').text().match(filter);
+ if (match_title || match_description) {
+ $(this).show().removeClass('even').removeClass('odd').addClass(zebra == false? 'odd' : 'even');
+ isEmpty = false;
+ previousModule = false;
+ zebra = !zebra;
+ if (match_title) {
+ title = td.find('.permission-title').find('.highlight').removeClass('highlight').end();
+ title.html(title.text().replace(match_title, ''+ match_title +''));
+ }
+ if (match_description) {
+ description = td.find('.description');
+ description.html(description.text().replace(match_description, ''+ match_description +''));
+ }
+ }
+ else {
+ $(this).hide();
+ }
+ }
+ else {
+ if (previousModule != false) {
+ previousModule.hide();
+ }
+ previousModule = $(this);
+ }
+ });
+ if (previousModule != false) {
+ previousModule.hide();
+ }
+ if (isEmpty) {
+ $('#permissions > tbody > tr').hide().parent().append('
No permissions were found.
');
+ $('#user-admin-perm > div > input#edit-submit').hide();
+ }
+ else {
+ $('#permissions > tbody > tr .user-permissions-empty').remove();
+ $('#user-admin-perm > div > input#edit-submit').show();
+ }
+ }
+ else {
+ $('#permissions > tbody > tr.user-permissions-empty').remove();
+ $('#user-admin-perm > div > input#edit-submit').show();
+ $('#permissions > tbody > tr').show().find('.highlight').removeClass('highlight').end().find('.permission-title, .description');;
+ }
+}
Index: modules/user/user.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.css,v
retrieving revision 1.8
diff -u -p -r1.8 user.css
--- modules/user/user.css 20 Feb 2008 13:46:43 -0000 1.8
+++ modules/user/user.css 18 Mar 2008 19:50:15 -0000
@@ -9,6 +9,9 @@
#permissions tr.odd .form-item, tr.even .form-item {
white-space: normal;
}
+#permissions td span.highlight {
+ background-color: #ff6;
+}
#access-rules .access-type, #access-rules .rule-type {
margin-right: 1em; /* LTR */
float: left; /* LTR */
Index: modules/user/user.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.js,v
retrieving revision 1.6
diff -u -p -r1.6 user.js
--- modules/user/user.js 12 Sep 2007 18:29:32 -0000 1.6
+++ modules/user/user.js 18 Mar 2008 19:50:15 -0000
@@ -174,15 +174,3 @@ Drupal.setDefaultTimezone = function() {
var offset = new Date().getTimezoneOffset() * -60;
$("#edit-date-default-timezone, #edit-user-register-timezone").val(offset);
};
-
-/**
- * On the admin/user/settings page, conditionally show all of the
- * picture-related form elements depending on the current value of the
- * "Picture support" radio buttons.
- */
-Drupal.behaviors.userSettings = function (context) {
- $('div.user-admin-picture-radios input[type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function () {
- $('div.user-admin-picture-settings', context)[['hide', 'show'][this.value]]();
- });
-};
-