Index: role_weights.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/role_weights/role_weights.module,v
retrieving revision 1.23.2.2
diff -u -r1.23.2.2 role_weights.module
--- role_weights.module	8 Jun 2009 12:36:17 -0000	1.23.2.2
+++ role_weights.module	8 Jun 2009 16:05:05 -0000
@@ -7,6 +7,37 @@
  */
 
 /**
+ * Implementation of hook_help().
+ */
+function role_weights_help($path, $arg) {
+  switch ($path) {
+    case 'admin/help#role_weights':
+      $output = '<p>'. t('Role Weights is a small utility module to allow site admins to specify weights for user roles. Once installed, users with <em>administer users</em> permission can set weights for roles on the <a href="@roles">Roles configuration page</a>.', array('@roles' => url('admin/user/roles'))) .'</p>';
+      $output .= '<p>'. t('Admins can optionally enable sorting roles by weight on the <a href="@roles">Roles</a> and <a href="@permissions">Permissions</a> configuration pages on the <a href="@roleweights">Role Weights configuration page</a>.', array('@roles' => url('admin/user/roles'), '@permissions' => url('admin/user/permissions'), '@roleweights' => url('admin/settings/role_weights'))) .'</p>';
+      $output .= '<p>'. t('For more information visit <a href="http://drupal.org/project/role_weights">Role Weights module page on drupal.org</a>.') .'</p>';
+      return $output;
+
+    case 'admin/settings/role_weights':
+      return t('<p>Configure how Role Weights affects the sorting of various core configuration pages. To set role weights, edit the relevant role on the <a href="@roles">Roles configuration page</a>.</p>', array('@roles' => url('admin/user/roles')));
+  }
+}
+
+/**
+ * Implementation of hook_menu().
+ */
+function role_weights_menu() {
+  $items['admin/settings/role_weights'] = array(
+    'title' => 'Role Weights',
+    'description' => "Enable sorting roles by weight on the Roles and Permissions configuration pages.",
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('role_weights_settings_form'),
+    'access arguments' => array('administer users'),
+    'type' => MENU_NORMAL_ITEM, 
+  );
+  return $items;
+}
+
+/**
  * Implementation of hook_theme().
  */
 function role_weights_theme($existing, $type, $theme, $path) {
@@ -18,6 +49,23 @@
 }
 
 /**
+ * Form callback for the admin settings form.
+ */
+function role_weights_settings_form() {
+  $form = array();
+
+  $form['role_weights_reorder_forms'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable sort by role weights'),
+    '#default_value' => variable_get('role_weights_reorder_forms', FALSE),
+    '#description' => t('Enable sorting roles by weight on the Roles (admin/user/roles) and Permissions (admin/user/permissions) pages. <em>Please note that this setting will override Drupal\'s default alphabetical sorting: if enabled and role weights are <strong>not</strong> set (or are equal), sorting will be less than satisfactory. There is an <a href="http://drupal.org/node/368088">issue open for this on drupal.org</a></em>'),
+  );
+
+  return system_settings_form($form);
+}
+
+
+/**
  * Implementation of hook_form_alter().
  *
  * User.module's role handling is not fully Forms API
