Index: modules/toolbar/toolbar.module =================================================================== RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.module,v retrieving revision 1.13 diff -u -r1.13 toolbar.module --- modules/toolbar/toolbar.module 15 Sep 2009 20:50:48 -0000 1.13 +++ modules/toolbar/toolbar.module 25 Sep 2009 08:26:55 -0000 @@ -36,12 +36,30 @@ * Add admin toolbar to the page_top region automatically. */ function toolbar_page_build(&$page) { - if (user_access('access toolbar')) { + if (user_access('access toolbar') && toolbar_enabled()) { $page['page_top']['toolbar'] = toolbar_build(); } } /** + * Enable or disable the toolbar, or find out the current status of the + * toolbar (enabled or disabled). + * + * @param $enabled + * If given, will change the display mode of the toolbar to the given + * boolean. + * @return + * The current status of the toolbar, TRUE for enabled, FALSE for disabled. + */ +function toolbar_enabled($enabled = NULL) { + $setting = &drupal_static(__FUNCTION__, TRUE); + if (isset($enabled)) { + $setting = $enabled; + } + return $setting; +} + +/** * Implement hook_preprocess_page(). * * Add some page classes, so global page theming can adjust to the toolbar. Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.67 diff -u -r1.67 node.admin.inc --- modules/node/node.admin.inc 18 Sep 2009 00:12:47 -0000 1.67 +++ modules/node/node.admin.inc 25 Sep 2009 08:26:55 -0000 @@ -447,6 +447,9 @@ foreach ($result as $node) { $nodes[$node->nid] = ''; $options = empty($node->language) ? array() : array('language' => $languages[$node->language]); + // Set a class to flag to the overlay, if present, not to open the link in + // the overlay. + $options['attributes']['class'] = 'overlay-escape'; $form['title'][$node->nid] = array('#markup' => l($node->title, 'node/' . $node->nid, $options) . ' ' . theme('mark', node_mark($node->nid, $node->changed))); $form['name'][$node->nid] = array('#markup' => check_plain(node_type_get_name($node))); $form['username'][$node->nid] = array('#markup' => theme('username', $node)); Index: profiles/default/default.install =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.install,v retrieving revision 1.6 diff -u -r1.6 default.install --- profiles/default/default.install 22 Sep 2009 07:44:58 -0000 1.6 +++ profiles/default/default.install 25 Sep 2009 08:26:55 -0000 @@ -216,5 +216,4 @@ ->condition('name', 'seven') ->execute(); variable_set('admin_theme', 'seven'); - variable_set('node_admin_theme', '1'); } Index: profiles/default/default.info =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.info,v retrieving revision 1.4 diff -u -r1.4 default.info --- profiles/default/default.info 30 Aug 2009 06:02:08 -0000 1.4 +++ profiles/default/default.info 25 Sep 2009 08:26:55 -0000 @@ -14,6 +14,7 @@ dependencies[] = dblog dependencies[] = search dependencies[] = toolbar +dependencies[] = overlay dependencies[] = field_ui dependencies[] = file files[] = default.profile Index: themes/garland/style.css =================================================================== RCS file: /cvs/drupal/drupal/themes/garland/style.css,v retrieving revision 1.64 diff -u -r1.64 style.css --- themes/garland/style.css 31 Aug 2009 17:40:03 -0000 1.64 +++ themes/garland/style.css 25 Sep 2009 08:26:55 -0000 @@ -355,6 +355,15 @@ position: absolute; } +/* Don't display any header elements when within the overlay, and adjust the page height accordingly. */ +body.overlay #header * { + display: none; +} + +body.overlay { + margin-top: -80px; +} + #wrapper #container #header h1, #wrapper #container #header h1 a:link, #wrapper #container #header h1 a:visited { line-height: 120px; position: relative; Index: modules/overlay/overlay.info =================================================================== RCS file: /cvs/drupal/drupal/modules/overlay/overlay.info,v retrieving revision 1.1 diff -u -r1.1 overlay.info --- modules/overlay/overlay.info 16 Sep 2009 23:55:40 -0000 1.1 +++ modules/overlay/overlay.info 25 Sep 2009 08:26:55 -0000 @@ -0,0 +1,7 @@ +; $Id$ +name = Overlay +description = Displays the Drupal administration interface in an overlay. +package = Core +version = VERSION +core = 7.x +files[] = overlay.module Index: themes/seven/style.css =================================================================== RCS file: /cvs/drupal/drupal/themes/seven/style.css,v retrieving revision 1.18 diff -u -r1.18 style.css --- themes/seven/style.css 11 Sep 2009 13:48:44 -0000 1.18 +++ themes/seven/style.css 25 Sep 2009 08:26:55 -0000 @@ -55,7 +55,7 @@ */ #branding { overflow: hidden; - padding: 20px 40px 0 40px; + padding: 20px 20px 0 20px; position: relative; background-color: #e0e0d8; } @@ -158,7 +158,7 @@ /** * Console. */ -#page .console { +#console { border-top: 1px solid #ccc; padding: 9px 0 10px; } @@ -618,9 +618,14 @@ ul.action-links { margin: 1em 0; + padding: 0 20px 0 20px; overflow: hidden; } +#block-system-main ul.action-links { + padding: 0; +} + ul.action-links li { float: left; margin: 0 1em 0 0; @@ -720,18 +725,31 @@ background: #fff; } -body.overlay #branding, -body.overlay #page-title, +body.overlay .primary, +body.overlay .page-title, body.overlay #page #left, body.overlay #page #footer { display: none; } +/* Branding needs a white background to look good in the overlay. */ +body.overlay #branding { + background-color: #ffffff; +} + +body.overlay #branding { + padding-top: 15px; +} + body.overlay #page { margin: 0; padding: 0; } -body.overlay #block-system-main { +body.overlay #content { padding: 20px; } + +body.overlay #block-system-main { + padding: 0; +} Index: modules/overlay/overlay-parent.css =================================================================== RCS file: modules/overlay/overlay-parent.css diff -N modules/overlay/overlay-parent.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/overlay/overlay-parent.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,148 @@ +/* $Id$ */ + +/** + * jQuery UI Dialog classes. + */ +.overlay { + color: #000; + padding-right: 42px; +} + +.overlay.ui-widget-content { + background: none; + border: none; +} + +.overlay .ui-widget-header { + background: none; + border: none; +} + +.overlay .ui-dialog-titlebar { + position: relative; + height: 35px; + white-space: nowrap; + z-index: 2; + padding: 0 20px; +} + +.overlay .ui-dialog-title { + display: block; + font-family: Verdana,sans-serif; + position: absolute; + top: 0; + left: 20px; + margin: 0.3em 0; + padding: 0; + color: #fff; + font-size: 20px; +} + +.overlay .ui-dialog-title:active, +.overlay .ui-dialog-title:focus { + outline: 0; +} + +.overlay .ui-dialog-titlebar-close { + display: block; + position: absolute; + right: -31px; + top: 35px; + margin: 0; + padding: 0; + width: 32px; + height: 36px; + background: transparent url(images/close.png) no-repeat; +} + +.overlay .ui-dialog-titlebar-close span { + display: none; +} + +.overlay .ui-dialog-content { + color: #292929; + background-color: #f8f8f8; +} + +/** + * ui-dialog overlay. + */ +.ui-widget-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: #000; + opacity: 0.7; + filter: alpha(opacity=80); +} + +/** + * Overlay content and shadows. + */ +#overlay-container { + margin: 0; + padding: 0; + background: #fff url(images/loading.gif) no-repeat 50% 50%; + -webkit-box-shadow: 8px 8px 8px rgba(0,0,0,.5); + -moz-box-shadow: 8px 8px 8px rgba(0,0,0,.5); + box-shadow: 8px 8px 8px rgba(0,0,0,.5); +} + +#overlay-element { + margin: 0; + padding: 0; + border: none; + overflow: hidden; +} + +/** + * Tabs on the overlay. + */ +.ui-dialog-titlebar ul { + float: right; + margin: 0 0 -10px 0; + padding: 3px 0 0 8px; + line-height: 40px; + text-transform: uppercase; + font-size: 12px; +} + +.ui-dialog-titlebar ul li { + display: inline; + list-style: none; + margin: 0 0 0 -3px; + padding-bottom: 0; +} + +.ui-dialog-titlebar ul li a, +.ui-dialog-titlebar ul li a:active, +.ui-dialog-titlebar ul li a:visited, +.ui-dialog-titlebar ul li a:hover { + background-color: #a6a7a2; + -moz-border-radius: 8px 8px 0 0; + -webkit-border-top-left-radius: 8px; + -webkit-border-top-right-radius: 8px; + border-radius: 8px 8px 0 0; + color: #000; + font-weight: bold; + padding: 8px 20px 4px 20px; + text-decoration: none; +} + +.ui-dialog-titlebar ul li.active a, +.ui-dialog-titlebar ul li.active a.active, +.ui-dialog-titlebar ul li.active a:active, +.ui-dialog-titlebar ul li.active a:visited { + background-color: #fff; + padding: 8px 20px 5px 20px; +} + +.ui-dialog-titlebar ul li a:hover { + color: #fff; +} + +.ui-dialog-titlebar ul li.active a:hover { + color: #000; +} Index: modules/overlay/overlay-parent.js =================================================================== RCS file: modules/overlay/overlay-parent.js diff -N modules/overlay/overlay-parent.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/overlay/overlay-parent.js 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,645 @@ +// $Id: parent.js,v 1.1.4.4 2009/06/19 15:32:57 markuspetrux Exp $ + +(function ($) { + +/** + * Open or modify overlay based on clicks of links marked with .to-overlay. + */ +Drupal.behaviors.overlayParent = { + attach: function(context, settings) { + + // Attach on the .to-overlay class. + $('a.to-overlay:not(.overlay-exclude)').once('overlay').click(function() { + + // Remove the active class from where it was, and add the active class to + // this link, so the button keeps highlighting where we are. Only + // highlight active items in the shortcuts bar. + $('#toolbar a').each(function() { + $(this).removeClass('active'); + }); + if ($(this).parents('div.toolbar-shortcuts').length) { + $(this).addClass('active'); + } + + // Append render variable, so the server side can choose the right + // rendering and add child modal frame code to the page if needed. + var linkURL = $(this).attr('href'); + linkURL += (linkURL.indexOf('?') > -1 ? '&' : '?') + 'render=overlay'; + + // If the modal frame is already open, replace the loaded document with + // this new one. Keeps browser history. + if (Drupal.overlay.isOpen) { + Drupal.overlay.load(linkURL); + return false; + } + + // There is overlay opened yet, we should open a new one. + var toolbarHeight = $('#toolbar').height(); + var overlayOptions = { + url: linkURL, + width: $(window).width() - 40, + height: $(window).height() - 40 - toolbarHeight, + // Remove active class from all header buttons. + onOverlayClose: function() { $('#toolbar a').each(function() { $(this).removeClass('active'); }); }, + draggable: false + }; + Drupal.overlay.open(overlayOptions); + + // Set position and styling to let the admin toolbar work. + $('.overlay').css('top', toolbarHeight + 20); + $('#toolbar').css('z-index', 2000); + + // Prevent default action of the link click event. + return false; + }); + } +}; + +/** + * Overlay object for parent windows. + */ +Drupal.overlay = Drupal.overlay || { + options: {}, + iframe: { $container: null, $element: null }, + isOpen: false +}; + +/** + * Open an overlay. + * + * Ensure that only one overlay is opened ever. Use Drupal.overlay.load() if + * the overlay is already open but a new page needs to be opened. + * + * @param options + * Properties of the overlay to open: + * - url: the URL of the page to open in the overlay. + * - width: width of the overlay in pixels. + * - height: height of the overlay in pixels. + * - autoFit: boolean indicating whether the overlay should be resized to + * fit the contents of the document loaded. + * - onOverlayOpen: callback to invoke when the overlay is opened. + * - onOverlayCanClose: callback to allow external scripts decide if the + * overlay can be closed. + * - onOverlayClose: callback to invoke when the overlay is closed. + * - customDialogOptions: an object with custom jQuery UI Dialog options. + * @return + * If the overlay was opened true, otherwise false. + */ +Drupal.overlay.open = function(options) { + var self = this; + + // Just one overlay is allowed. + if (self.isOpen || $('#overlay-container').size()) { + return false; + } + + var defaultOptions = { + url: options.url, + width: options.width, + height: options.height, + autoFit: (options.autoFit == undefined || options.autoFit), + onOverlayOpen: options.onOverlayOpen, + onOverlayCanClose: options.onOverlayCanClose, + onOverlayClose: options.onOverlayClose, + customDialogOptions: options.customDialogOptions || {} + } + + self.options = $.extend(defaultOptions, options); + + // Create the dialog and related DOM elements. + self.create(); + + // Open the dialog offscreen where we can set its size, etc. + self.iframe.$container.dialog('option', { position: ['-999em', '-999em'] }).dialog('open'); + + return true; +}; + +/** + * Create the underlying markup and behaviors for the overlay. + * + * Reuses jQuery UI's dialog component to construct the overlay markup and + * behaviors, sanitizing the options previously set in self.options. + */ +Drupal.overlay.create = function() { + var self = this; + + // Note: We use scrolling="yes" for IE as a workaround to yet another IE bug + // where the horizontal scrollbar is always rendered no matter how wide the + // iframe element is defined. + self.iframe.$element = $('