',
);
- 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) {
@@ -543,8 +544,7 @@ function user_admin_perm($form_state, $r
}
}
}
- }
-
+ }
// Have to build checkboxes here after checkbox arrays are built
foreach ($role_names as $rid => $name) {
$form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => isset($status[$rid]) ? $status[$rid] : array());
@@ -606,7 +606,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 3 Mar 2008 15:29:41 -0000
@@ -0,0 +1,63 @@
+// $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(
+ $('').keyup(function() {
+ Drupal.userPermissionSearch($(this).val());
+ })
+ );
+};
+
+Drupal.userPermissionSearch = function(term) {
+ if (term) {
+ previousModule = false;
+ zebra = true;
+ isEmpty = true;
+ $('#permissions > tbody > tr').each(function() {
+ td = $(this).find('td:first');
+ if (td.is('.permission')) {
+ if (td.find('.permission-title').text().match(term)) {
+ $(this).show().removeClass('even').removeClass('odd').addClass(zebra == false? 'odd' : 'even');
+ isEmpty = false;
+ previousModule = false;
+ zebra = !zebra;
+ title = td.find('.highlight').removeClass('highlight').end().find('.permission-title');
+ title.html(title.text().replace(term, ''+ term +''));
+ }
+ 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.
');
+ }
+ else {
+ $('#permissions > tbody > tr .user-permissions-empty').remove();
+ }
+ }
+ else {
+ $('#permissions > tbody > tr.user-permissions-empty').remove();
+ $('#permissions > tbody > tr').show().find('.highlight').removeClass('highlight').end().find('.permission-title');;
+ }
+}
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 3 Mar 2008 15:29:41 -0000
@@ -9,6 +9,9 @@
#permissions tr.odd .form-item, tr.even .form-item {
white-space: normal;
}
+#permissions td span.highlight {
+ background-color: #fdf5e6;
+}
#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 3 Mar 2008 15:29:41 -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]]();
- });
-};
-