Index: modules/overlay/overlay.module =================================================================== RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v retrieving revision 1.11 diff -u -r1.11 overlay.module --- modules/overlay/overlay.module 7 Mar 2010 06:31:48 -0000 1.11 +++ modules/overlay/overlay.module 9 Mar 2010 08:58:19 -0000 @@ -30,6 +30,14 @@ 'access arguments' => array('access overlay'), 'type' => MENU_CALLBACK, ); + $items['admin/config/user-interface/overlay'] = array( + 'title' => 'Overlay', + 'description' => 'Settings for the administrative overlay.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('overlay_settings_form'), + 'access arguments' => array('administer site configuration'), + 'file' => 'overlay.admin.inc', + ); return $items; } @@ -46,6 +54,28 @@ } /** + * Implements hook_form_FORM_ID_alter(). + */ +function overlay_form_user_profile_form_alter(&$form, &$form_state) { + if ($form['#user_category'] == 'account') { + if (variable_get('overlay_user_config', 0)) { + $account = $form['#user']; + if (user_access('access overlay', $account)) { + $form['account']['overlay'] = array( + '#type' => 'checkbox', + '#title' => t('Use overlay'), + '#default_value' => isset($account->overlay) ? $account->overlay : 1, + '#description' => t('Open content creation and administrative pages in an overlay.'), + '#weight' => 10, + ); + } + } + return $form; + } +} + + +/** * Implements hook_init(). * * Determine whether the current page request is destined to appear in the @@ -56,9 +86,11 @@ function overlay_init() { // @todo: custom_theme does not exist anymore. global $custom_theme; + global $user; // Only act if the user has access to administration pages. Other modules can // also enable the overlay directly for other uses of the JavaScript. - if (user_access('access overlay')) { + $user_overlay = (variable_get('overlay_user_config', 0) && isset($user->overlay)) ? $user->overlay : TRUE; + if ($user_overlay && user_access('access overlay')) { // After overlay is enabled on the modules page, redirect to // #overlay=admin/modules to actually enable the overlay. if (isset($_SESSION['overlay_enable_redirect']) && $_SESSION['overlay_enable_redirect']) { Index: modules/overlay/overlay.admin.inc =================================================================== RCS file: modules/overlay/overlay.admin.inc diff -N modules/overlay/overlay.admin.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/overlay/overlay.admin.inc 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ + 'checkbox', + '#title' => t('Allow users to disable the overlay for their account.'), + '#default_value' => variable_get('overlay_user_config', 0), + ); + return system_settings_form($form); +}