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 3 Jan 2010 19:12:52 -0000 @@ -0,0 +1,22 @@ + 'checkbox', + '#title' => t('Allow users to disable the overlay for their account'), + '#default_value' => variable_get('overlay_user_config', 1), + ); + return system_settings_form($form); +} \ No newline at end of file Index: modules/overlay/overlay.module =================================================================== RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v retrieving revision 1.4 diff -u -p -r1.4 overlay.module --- modules/overlay/overlay.module 14 Dec 2009 16:36:56 -0000 1.4 +++ modules/overlay/overlay.module 3 Jan 2010 19:12:52 -0000 @@ -30,6 +30,14 @@ function overlay_menu() { 'access arguments' => array('access overlay'), 'type' => MENU_CALLBACK, ); + $items['admin/config/system/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 @@ function overlay_permission() { } /** + * 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', 1)) { + $account = $form['#user']; + if (user_access('access overlay', $account)) { + $form['account']['overlay'] = array( + '#type' => 'checkbox', + '#title' => t('Use overlays'), + '#default_value' => isset($account->overlay) ? $account->overlay : 1, + '#description' => t('Display content creation and administration in overlays.'), + '#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_permission() { 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', 1) && isset($user->overlay)) ? $user->overlay : TRUE; + if (user_access('access overlay') && $user_overlay) { if (isset($_GET['render']) && $_GET['render'] == 'overlay') { // If this page shouldn't be rendered here, redirect to the parent. if (!path_is_admin($_GET['q'])) {