From 353eb10cc29eacdafafea3dbdbcdc2fc0136250e Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Sat, 21 Jul 2012 21:23:27 -0700 Subject: [PATCH] Issue #950956 by tim.plunkett, aspilicious, jenlampton, chx, Rob Loach: Remove Dashboard module until/unless such time as it's more useful. --- core/CHANGELOG.txt | 1 + core/MAINTAINERS.txt | 3 - core/modules/block/block.module | 2 +- core/modules/dashboard/dashboard-rtl.css | 30 - core/modules/dashboard/dashboard.api.php | 42 -- core/modules/dashboard/dashboard.css | 108 --- core/modules/dashboard/dashboard.info | 7 - core/modules/dashboard/dashboard.install | 78 -- core/modules/dashboard/dashboard.js | 226 ------ core/modules/dashboard/dashboard.module | 687 ------------------ .../Tests/DashboardBlockAvailabilityTest.php | 65 -- .../dashboard/Tests/DashboardBlocksTest.php | 111 --- core/modules/system/system.admin.inc | 2 +- core/themes/seven/style-rtl.css | 8 - core/themes/seven/style.css | 22 - profiles/standard/standard.info | 1 - profiles/standard/standard.install | 30 - 17 files changed, 3 insertions(+), 1420 deletions(-) delete mode 100644 core/modules/dashboard/dashboard-rtl.css delete mode 100644 core/modules/dashboard/dashboard.api.php delete mode 100644 core/modules/dashboard/dashboard.css delete mode 100644 core/modules/dashboard/dashboard.info delete mode 100644 core/modules/dashboard/dashboard.install delete mode 100644 core/modules/dashboard/dashboard.js delete mode 100644 core/modules/dashboard/dashboard.module delete mode 100644 core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlockAvailabilityTest.php delete mode 100644 core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlocksTest.php diff --git a/core/CHANGELOG.txt b/core/CHANGELOG.txt index 27c28f8a72ed..4618d7ff0151 100644 --- a/core/CHANGELOG.txt +++ b/core/CHANGELOG.txt @@ -23,6 +23,7 @@ Drupal 8.0, xxxx-xx-xx (development version) * The following modules have been removed from core, because contributed modules with similar functionality are available: * Blog + * Dashboard * Profile * Trigger - Removed the Garland theme from core. diff --git a/core/MAINTAINERS.txt b/core/MAINTAINERS.txt index 53e6bc75ef23..674dcb78e34d 100644 --- a/core/MAINTAINERS.txt +++ b/core/MAINTAINERS.txt @@ -174,9 +174,6 @@ Contact module Contextual module - Daniel F. Kudwien 'sun' <http://drupal.org/user/54136> -Dashboard module -- ? - Database Logging module - Khalid Baheyeldin 'kbahey' <http://drupal.org/user/4063> diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 50bae7644fcc..455f98f27c5a 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -48,7 +48,7 @@ function block_help($path, $arg) { case 'admin/help#block': $output = ''; $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Block module allows you to create boxes of content, which are rendered into an area, or region, of one or more pages of a website. The core Seven administration theme, for example, implements the regions "Content", "Help", "Dashboard main", and "Dashboard sidebar", and a block may appear in any one of these regions. The <a href="@blocks">Blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. For more information, see the online handbook entry for <a href="@block">Block module</a>.', array('@block' => 'http://drupal.org/documentation/modules/block', '@blocks' => url('admin/structure/block'))) . '</p>'; + $output .= '<p>' . t('The Block module allows you to create boxes of content, which are rendered into an area, or region, of one or more pages of a website. The core Seven administration theme, for example, implements the regions "Content" and "Help", and a block may appear in either of these regions. The <a href="@blocks">Blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. For more information, see the online handbook entry for <a href="@block">Block module</a>.', array('@block' => 'http://drupal.org/documentation/modules/block', '@blocks' => url('admin/structure/block'))) . '</p>'; $output .= '<h3>' . t('Uses') . '</h3>'; $output .= '<dl>'; $output .= '<dt>' . t('Positioning content') . '</dt>'; diff --git a/core/modules/dashboard/dashboard-rtl.css b/core/modules/dashboard/dashboard-rtl.css deleted file mode 100644 index 8d3d0edd05cb..000000000000 --- a/core/modules/dashboard/dashboard-rtl.css +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file - * Right-to-left specific stylesheet for the Dashboard module. - */ - -#dashboard div.dashboard-region { - float: right; -} -#dashboard #disabled-blocks .block, #dashboard .block-placeholder { - float: right; - margin: 3px 0 3px 3px; - padding: 6px 8px 6px 4px; -} -#dashboard .canvas-content a.button { - margin: 0 10px 0 0; -} -#dashboard .ui-sortable .block h2 { - background-position: right -39px; - padding: 0 19px; -} -#dashboard.customize-inactive #disabled-blocks .block:hover h2 { - background-position: right -39px; -} -#dashboard.customize-inactive .dashboard-region .ui-sortable .block:hover h2 { - background-position: right -36px; -} -#dashboard div#dashboard_main { - margin-left: 1%; - margin-right: 0; -} diff --git a/core/modules/dashboard/dashboard.api.php b/core/modules/dashboard/dashboard.api.php deleted file mode 100644 index 623dd30abe3c..000000000000 --- a/core/modules/dashboard/dashboard.api.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php - -/** - * @file - * Hooks provided by the Dashboard module. - */ - -/** - * @addtogroup hooks - * @{ - */ - -/** - * Add regions to the dashboard. - * - * @return - * An array whose keys are the names of the dashboard regions and whose - * values are the titles that will be displayed in the blocks administration - * interface. The keys are also used as theme wrapper functions. - */ -function hook_dashboard_regions() { - // Define a new dashboard region. Your module can also then define - // theme_mymodule_dashboard_region() as a theme wrapper function to control - // the region's appearance. - return array('mymodule_dashboard_region' => "My module's dashboard region"); -} - -/** - * Alter dashboard regions provided by modules. - * - * @param $regions - * An array containing all dashboard regions, in the format provided by - * hook_dashboard_regions(). - */ -function hook_dashboard_regions_alter($regions) { - // Remove the sidebar region defined by the core dashboard module. - unset($regions['dashboard_sidebar']); -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/core/modules/dashboard/dashboard.css b/core/modules/dashboard/dashboard.css deleted file mode 100644 index f68b372da9ff..000000000000 --- a/core/modules/dashboard/dashboard.css +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @file - * Stylesheet for the Dashboard module. - */ - -#dashboard div.dashboard-region { - float: left; - min-height: 1px; -} -#dashboard div#dashboard_main { - margin-right: 1%; /* LTR */ - width: 65%; -} -#dashboard div#dashboard_sidebar { - width: 33%; -} -#dashboard div.block { - margin-bottom: 20px; -} -#dashboard .dashboard-region .block { - clear: both; -} -#dashboard .dashboard-region .block-placeholder { - display: block; - height: 1.6em; - margin: 0 0 20px 0; - padding: 0; - width: 100%; -} -#dashboard div.block h2 { - float: none; -} -#dashboard #disabled-blocks .block, -#dashboard .block-placeholder { - background: #e2e1dc; - -moz-border-radius: 4px; - border-radius: 4px; - float: left; /* LTR */ - margin: 3px 3px 3px 0; /* LTR */ - padding: 6px 4px 6px 8px; /* LTR */ -} -#dashboard .dashboard-add-other-blocks { - margin: 10px 0 0 0; -} -#dashboard .ui-sortable { - border: 2px dashed #ccc; - padding: 10px; -} -#dashboard .canvas-content { - padding: 10px; -} -#dashboard .canvas-content a.button { - color: #5a5a5a; - margin: 0 0 0 10px; /* LTR */ - text-decoration: none; -} -#dashboard .region { - margin: 5px; -} -#dashboard #disabled-blocks { - padding: 5px 0; -} -#dashboard #disabled-blocks .ui-sortable { - background-color: #777; - border: 0; - padding: 0; -} -#dashboard #disabled-blocks .region { - background-color: #e0e0d8; - border: #ccc 1px solid; - padding: 10px; -} -#dashboard #disabled-blocks h2 { - display: inline; - font-weight: normal; - white-space: nowrap; -} -#dashboard #disabled-blocks .block { - background: #444; - color: #fff; -} -#dashboard.customize-inactive #disabled-blocks .block:hover { - background: #0074bd; -} -#dashboard #disabled-blocks .block-placeholder { - height: 1.6em; - width: 30px; -} -#dashboard #disabled-blocks .block .content, -#dashboard .ui-sortable-helper .content { - display: none; -} -#dashboard .ui-sortable .block { - cursor: move; - min-height: 1px; -} -#dashboard .ui-sortable .block h2 { - background: transparent url(../../misc/draggable.png) no-repeat 0px -39px; - padding: 0 17px; -} -#dashboard.customize-inactive #disabled-blocks .block:hover h2 { - background: #0074bd url(../../misc/draggable.png) no-repeat 0px -39px; - color: #fff; -} -#dashboard.customize-inactive .dashboard-region .ui-sortable .block:hover h2 { - background: #0074bd url(../../misc/draggable.png) no-repeat 3px -36px; - color: #fff; -} diff --git a/core/modules/dashboard/dashboard.info b/core/modules/dashboard/dashboard.info deleted file mode 100644 index 17c0b1df0fff..000000000000 --- a/core/modules/dashboard/dashboard.info +++ /dev/null @@ -1,7 +0,0 @@ -name = Dashboard -description = Provides a dashboard page in the administrative interface for organizing administrative tasks and tracking information within your site. -core = 8.x -package = Core -version = VERSION -dependencies[] = block -configure = admin/dashboard/customize diff --git a/core/modules/dashboard/dashboard.install b/core/modules/dashboard/dashboard.install deleted file mode 100644 index 502182625232..000000000000 --- a/core/modules/dashboard/dashboard.install +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -/** - * @file - * Install, update and uninstall functions for the dashboard module. - */ - -/** - * Implements hook_disable(). - * - * Stash a list of blocks enabled on the dashboard, so they can be re-enabled - * if the dashboard is re-enabled. Then disable those blocks, since the - * dashboard regions will no longer be defined. - */ -function dashboard_disable() { - // Stash a list of currently enabled blocks. - $stashed_blocks = array(); - - $result = db_select('block', 'b') - ->fields('b', array('module', 'delta', 'region')) - ->condition('b.region', dashboard_regions(), 'IN') - ->execute(); - - foreach ($result as $block) { - $stashed_blocks[] = array( - 'module' => $block->module, - 'delta' => $block->delta, - 'region' => $block->region, - ); - } - variable_set('dashboard_stashed_blocks', $stashed_blocks); - - // Disable the dashboard blocks. - db_update('block') - ->fields(array( - 'status' => 0, - 'region' => BLOCK_REGION_NONE, - )) - ->condition('region', dashboard_regions(), 'IN') - ->execute(); -} - -/** - * Implements hook_enable(). - * - * Restores blocks to the dashboard that were there when the dashboard module - * was disabled. - */ -function dashboard_enable() { - global $theme_key; - if (!$stashed_blocks = variable_get('dashboard_stashed_blocks')) { - return; - } - if (!$admin_theme = variable_get('admin_theme')) { - drupal_theme_initialize(); - $admin_theme = $theme_key; - } - foreach ($stashed_blocks as $block) { - db_update('block') - ->fields(array( - 'status' => 1, - 'region' => $block['region'] - )) - ->condition('module', $block['module']) - ->condition('delta', $block['delta']) - ->condition('theme', $admin_theme) - ->condition('status', 0) - ->execute(); - } - variable_del('dashboard_stashed_blocks'); -} - -/** - * Implements hook_uninstall(). - */ -function dashboard_uninstall() { - variable_del('dashboard_stashed_blocks'); -} diff --git a/core/modules/dashboard/dashboard.js b/core/modules/dashboard/dashboard.js deleted file mode 100644 index a82fa074d40c..000000000000 --- a/core/modules/dashboard/dashboard.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * @file - * Attaches behaviors for the Dashboard module. - */ - -(function ($) { - -"use strict"; - -/** - * Implements Drupal.behaviors for the Dashboard module. - */ -Drupal.behaviors.dashboard = { - attach: function (context, settings) { - $(context).find('#dashboard').once(function () { - $(this).prepend('<div class="customize clearfix"><ul class="action-links"><li><a href="#">' + Drupal.t('Customize dashboard') + '</a></li></ul><div class="canvas"></div></div>'); - $('.customize .action-links a', this).click(Drupal.behaviors.dashboard.enterCustomizeMode); - }); - Drupal.behaviors.dashboard.addPlaceholders(); - if (Drupal.settings.dashboard.launchCustomize) { - Drupal.behaviors.dashboard.enterCustomizeMode(); - } - }, - - addPlaceholders: function() { - $('#dashboard .dashboard-region .region').each(function () { - var $this = $(this); - var empty_text = ""; - // If the region is empty - if ($this.find('.block').length === 0) { - // Check if we are in customize mode and grab the correct empty text - if ($('#dashboard').hasClass('customize-mode')) { - empty_text = Drupal.settings.dashboard.emptyRegionTextActive; - } else { - empty_text = Drupal.settings.dashboard.emptyRegionTextInactive; - } - // We need a placeholder. - if ($this.find('.placeholder').length === 0) { - $this.append('<div class="placeholder"></div>'); - } - $this.find('.placeholder').html(empty_text); - } - else { - $this.find('.placeholder').remove(); - } - }); - }, - - /** - * Enters "customize" mode by displaying disabled blocks. - */ - enterCustomizeMode: function () { - $('#dashboard').addClass('customize-mode customize-inactive'); - Drupal.behaviors.dashboard.addPlaceholders(); - // Hide the customize link - $('#dashboard .customize .action-links').hide(); - // Load up the disabled blocks - $('div.customize .canvas').load(Drupal.settings.dashboard.drawer, Drupal.behaviors.dashboard.setupDrawer); - }, - - /** - * Exits "customize" mode by simply forcing a page refresh. - */ - exitCustomizeMode: function () { - $('#dashboard').removeClass('customize-mode customize-inactive'); - Drupal.behaviors.dashboard.addPlaceholders(); - location.href = Drupal.settings.dashboard.dashboard; - }, - - /** - * Sets up the drag-and-drop behavior and the 'close' button. - */ - setupDrawer: function () { - $('div.customize .canvas-content input').click(Drupal.behaviors.dashboard.exitCustomizeMode); - $('div.customize .canvas-content').append('<a class="button" href="' + Drupal.settings.dashboard.dashboard + '">' + Drupal.t('Done') + '</a>'); - - // Initialize drag-and-drop. - var regions = $('#dashboard div.region'); - regions.sortable({ - connectWith: regions, - cursor: 'move', - cursorAt: {top:0}, - dropOnEmpty: true, - items: '> div.block, > div.disabled-block', - placeholder: 'block-placeholder clearfix', - tolerance: 'pointer', - start: Drupal.behaviors.dashboard.start, - over: Drupal.behaviors.dashboard.over, - sort: Drupal.behaviors.dashboard.sort, - update: Drupal.behaviors.dashboard.update - }); - }, - - /** - * Makes the block appear as a disabled block while dragging. - * - * This function is called on the jQuery UI Sortable "start" event. - * - * @param event - * The event that triggered this callback. - * @param ui - * An object containing information about the item that is being dragged. - */ - start: function (event, ui) { - $('#dashboard').removeClass('customize-inactive'); - var item = $(ui.item); - - // If the block is already in disabled state, don't do anything. - if (!item.hasClass('disabled-block')) { - item.css({height: 'auto'}); - } - }, - - /** - * Adapts block's width to the region it is moved into while dragging. - * - * This function is called on the jQuery UI Sortable "over" event. - * - * @param event - * The event that triggered this callback. - * @param ui - * An object containing information about the item that is being dragged. - */ - over: function (event, ui) { - var item = $(ui.item); - - // If the block is in disabled state, remove width. - if ($(this).closest('#disabled-blocks').length) { - item.css('width', ''); - } - else { - item.css('width', $(this).width()); - } - }, - - /** - * Adapts a block's position to stay connected with the mouse pointer. - * - * This function is called on the jQuery UI Sortable "sort" event. - * - * @param event - * The event that triggered this callback. - * @param ui - * An object containing information about the item that is being dragged. - */ - sort: function (event, ui) { - var item = $(ui.item); - - if (event.pageX > ui.offset.left + item.width()) { - item.css('left', event.pageX); - } - }, - - /** - * Sends block order to the server, and expands previously disabled blocks. - * - * This function is called on the jQuery UI Sortable "update" event. - * - * @param event - * The event that triggered this callback. - * @param ui - * An object containing information about the item that was just dropped. - */ - update: function (event, ui) { - $('#dashboard').addClass('customize-inactive'); - var item = $(ui.item); - - // If the user dragged a disabled block, load the block contents. - if (item.hasClass('disabled-block')) { - var module, delta, itemClass; - itemClass = item.attr('class'); - // Determine the block module and delta. - module = itemClass.match(/\bmodule-(\S+)\b/)[1]; - delta = itemClass.match(/\bdelta-(\S+)\b/)[1]; - - // Load the newly enabled block's content. - $.get(Drupal.settings.dashboard.blockContent + '/' + module + '/' + delta, {}, - function (block) { - if (block) { - item.html(block); - } - - if (item.find('div.content').is(':empty')) { - item.find('div.content').html(Drupal.settings.dashboard.emptyBlockText); - } - - Drupal.attachBehaviors(item); - }, - 'html' - ); - // Remove the "disabled-block" class, so we don't reload its content the - // next time it's dragged. - item.removeClass("disabled-block"); - } - - Drupal.behaviors.dashboard.addPlaceholders(); - - // Let the server know what the new block order is. - $.post(Drupal.settings.dashboard.updatePath, { - 'form_token': Drupal.settings.dashboard.formToken, - 'regions': Drupal.behaviors.dashboard.getOrder - } - ); - }, - - /** - * Returns the current order of the blocks in each of the sortable regions. - * - * @return - * The current order of the blocks, in query string format. - */ - getOrder: function () { - var order = []; - $('#dashboard div.region').each(function () { - var region = $(this).parent().attr('id').replace(/-/g, '_'); - var blocks = $(this).sortable('toArray'); - for (var i = 0, il = blocks.length; i < il; i += 1) { - order.push(region + '[]=' + blocks[i]); - } - }); - order = order.join('&'); - return order; - } -}; - -})(jQuery); diff --git a/core/modules/dashboard/dashboard.module b/core/modules/dashboard/dashboard.module deleted file mode 100644 index 14645768886e..000000000000 --- a/core/modules/dashboard/dashboard.module +++ /dev/null @@ -1,687 +0,0 @@ -<?php - -/** - * @file - * Provides a dashboard page in the administrative interface. - */ - -/** - * Implements hook_help(). - */ -function dashboard_help($path, $arg) { - switch ($path) { - case 'admin/help#dashboard': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Dashboard module provides a <a href="@dashboard">Dashboard page</a> in the administrative interface for organizing administrative tasks and navigation, and tracking information within your site. The Dashboard page contains blocks, which you can add to and arrange using the drag-and-drop interface that appears when you click on the <em>Customize dashboard</em> link. Within this interface, blocks that are not primarily used for site administration do not appear by default, but can be added via the <em>Add other blocks</em> link. For more information, see the online handbook entry for <a href="@handbook">Dashboard module</a>.', array('@handbook' => 'http://drupal.org/documentation/modules/dashboard', '@dashboard' => url('admin/dashboard'))) . '</p>'; - $output .= '<h3>' . t('Uses') . '</h3>'; - $output .= '<dl>'; - $output .= '<dt>' . t('Tracking user activity') . '</dt>'; - $output .= '<dd>' . t("By enabling blocks such as <em>Who's online</em> and <em>Who's new</em>, site users can track who is logged in and new user signups at a centralized location.") . '</dd>'; - $output .= '<dt>' . t('Tracking content activity') . '</dt>'; - $output .= '<dd>' . t('By enabling blocks such as <em>New forum topics</em> and <em>Recent comments</em>, site users can view newly added site content at a glance.') . '</dd>'; - $output .= '</dl>'; - return $output; - - case 'admin/dashboard/configure': - // @todo This assumes the current page is being displayed using the same - // theme that the dashboard is displayed in. - $output = '<p>' . t('Rearrange blocks for display on the <a href="@dashboard-url">Dashboard page</a>. Blocks placed in the <em>Dashboard (inactive)</em> region are not displayed when viewing the Dashboard page, but are available within its <em>Customize dashboard</em> interface. Removing a block from active dashboard display makes it available on the main <a href="@blocks-url">blocks administration page</a>.', array('@dashboard-url' => url('admin/dashboard'), '@blocks-url' => url("admin/structure/block/list/{$GLOBALS['theme_key']}"))) . '</p>'; - return $output; - } -} - -/** - * Implements hook_menu(). - */ -function dashboard_menu() { - $items['admin/dashboard'] = array( - 'title' => 'Dashboard', - 'description' => 'View and customize your dashboard.', - 'page callback' => 'dashboard_admin', - 'access arguments' => array('access dashboard'), - // Make this appear first, so for example, in admin menus, it shows up on - // the top corner of the window as a convenient "home link". - 'weight' => -15, - ); - $items['admin/dashboard/configure'] = array( - 'title' => 'Configure available dashboard blocks', - 'description' => 'Configure which blocks can be shown on the dashboard.', - 'page callback' => 'dashboard_admin_blocks', - 'access arguments' => array('administer blocks'), - 'type' => MENU_VISIBLE_IN_BREADCRUMB, - ); - $items['admin/dashboard/customize'] = array( - 'title' => 'Customize dashboard', - 'description' => 'Customize your dashboard.', - 'page callback' => 'dashboard_admin', - 'page arguments' => array(TRUE), - 'access arguments' => array('access dashboard'), - 'type' => MENU_VISIBLE_IN_BREADCRUMB, - ); - $items['admin/dashboard/drawer'] = array( - 'page callback' => 'dashboard_show_disabled', - 'access arguments' => array('administer blocks'), - 'type' => MENU_CALLBACK, - ); - $items['admin/dashboard/block-content/%/%'] = array( - 'page callback' => 'dashboard_show_block_content', - 'page arguments' => array(3, 4), - 'access arguments' => array('administer blocks'), - 'type' => MENU_CALLBACK, - ); - $items['admin/dashboard/update'] = array( - 'page callback' => 'dashboard_update', - 'access arguments' => array('administer blocks'), - 'type' => MENU_CALLBACK, - ); - - return $items; -} - -/** - * Implements hook_permission(). - */ -function dashboard_permission() { - return array( - 'access dashboard' => array( - 'title' => t('View the administrative dashboard'), - // Note: We translate the 'Administer blocks' permission string here with - // a separate t() call, to make sure it gets the same translation as when - // it's in block_permission(). - 'description' => t('Customizing the dashboard requires the !permission-name permission.', array( - '!permission-name' => l(t('Administer blocks'), 'admin/people/permissions', array('fragment' => 'module-block')), - )), - ), - ); -} - -/** - * Implements hook_block_info_alter(). - */ -function dashboard_block_info_alter(&$blocks, $theme, $code_blocks) { - $admin_theme = variable_get('admin_theme'); - if (($admin_theme && $theme == $admin_theme) || (!$admin_theme && $theme == variable_get('theme_default', 'stark'))) { - foreach ($blocks as $module => &$module_blocks) { - foreach ($module_blocks as $delta => &$block) { - // Make administrative blocks that are not already in use elsewhere - // available for the dashboard. - if (empty($block['status']) && (empty($block['region']) || $block['region'] == BLOCK_REGION_NONE) && !empty($code_blocks[$module][$delta]['properties']['administrative'])) { - $block['status'] = 1; - $block['region'] = 'dashboard_inactive'; - } - } - } - } -} - -/** - * Implements hook_block_list_alter(). - * - * Skip rendering dashboard blocks when not on the dashboard page itself. This - * prevents expensive dashboard blocks from causing performance issues on pages - * where they will never be displayed. - */ -function dashboard_block_list_alter(&$blocks) { - if (!dashboard_is_visible()) { - foreach ($blocks as $key => $block) { - if (in_array($block->region, dashboard_regions())) { - unset($blocks[$key]); - } - } - } -} - -/** - * Implements hook_page_build(). - * - * Display dashboard blocks in the main content region. - */ -function dashboard_page_build(&$page) { - global $theme_key; - - if (dashboard_is_visible()) { - $block_info = array(); - - // Create a wrapper for the dashboard itself, then insert each dashboard - // region into it. - $page['content']['dashboard'] = array('#theme_wrappers' => array('dashboard')); - foreach (dashboard_regions() as $region) { - // Do not show dashboard blocks that are disabled. - if ($region == 'dashboard_inactive') { - continue; - } - // Insert regions even when they are empty, so that they will be - // displayed when the dashboard is being configured. - $page['content']['dashboard'][$region] = !empty($page[$region]) ? $page[$region] : array(); - $page['content']['dashboard'][$region]['#dashboard_region'] = $region; - // Allow each dashboard region to be themed differently, or fall back on - // the generic theme wrapper function for dashboard regions. - $page['content']['dashboard'][$region]['#theme_wrappers'][] = array($region, 'dashboard_region'); - unset($page[$region]); - $blocks_found = array(); - foreach ($page['content']['dashboard'][$region] as $item) { - if (isset($item['#theme_wrappers']) && is_array($item['#theme_wrappers']) && in_array('block', $item['#theme_wrappers'])) { - // If this item is a block, ensure it has a subject. - if (empty($item['#block']->subject)) { - // Locally cache info data for the object for all blocks, in case - // we find a block similarly missing title from the same module. - if (!isset($block_info[$item['#block']->module])) { - $block_info[$item['#block']->module] = module_invoke($item['#block']->module, 'block_info'); - } - $item['#block']->subject = $block_info[$item['#block']->module][$item['#block']->delta]['info']; - } - $blocks_found[$item['#block']->module . '_' . $item['#block']->delta] = TRUE; - } - } - - // Find blocks which were not yet displayed on the page (were empty), and - // add placeholder items in their place for rendering. - $block_list = db_select('block') - ->condition('theme', $theme_key) - ->condition('status', 1) - ->condition('region', $region) - ->fields('block') - ->execute(); - foreach ($block_list as $block) { - if (!isset($blocks_found[$block->module . '_' . $block->delta])) { - $block->enabled = $block->page_match = TRUE; - $block->content = array('#markup' => '<div class="dashboard-block-empty">(empty)</div>'); - if (!isset($block_info[$block->module])) { - $block_info[$block->module] = module_invoke($block->module, 'block_info'); - } - $block->subject = t('@title', array('@title' => $block_info[$block->module][$block->delta]['info'])); - $block_render = array($block->module . '_' . $block->delta => $block); - $build = _block_get_renderable_region($block_render); - $page['content']['dashboard'][$block->region][] = $build; - } - } - } - } -} - -/** - * Implements hook_system_info_alter(). - * - * Add regions to each theme to store the dashboard blocks. - */ -function dashboard_system_info_alter(&$info, $file, $type) { - if ($type == 'theme') { - // Add the dashboard regions (the "inactive" region should always appear - // last in the list, for usability reasons). - $dashboard_regions = dashboard_region_descriptions(); - if (isset($dashboard_regions['dashboard_inactive'])) { - $inactive_region = $dashboard_regions['dashboard_inactive']; - unset($dashboard_regions['dashboard_inactive']); - $dashboard_regions['dashboard_inactive'] = $inactive_region; - } - $info['regions'] += $dashboard_regions; - // Indicate that these regions are intended to be displayed whenever the - // dashboard is displayed in an overlay. This information is provided for - // any module that might need to use it, not just the core Overlay module. - $info['overlay_regions'] = !empty($info['overlay_regions']) ? array_merge($info['overlay_regions'], dashboard_regions()) : dashboard_regions(); - } -} - -/** - * Implements hook_theme(). - */ -function dashboard_theme() { - return array( - 'dashboard' => array( - 'render element' => 'element', - ), - 'dashboard_admin' => array( - 'render element' => 'element', - ), - 'dashboard_region' => array( - 'render element' => 'element', - ), - 'dashboard_disabled_blocks' => array( - 'variables' => array('blocks' => NULL), - ), - 'dashboard_disabled_block' => array( - 'variables' => array('block' => NULL), - ), - 'dashboard_admin_display_form' => array( - // When building the form for configuring dashboard blocks, reuse the - // Block module's template for the main block configuration form. - 'template' => 'block-admin-display-form', - 'path' => drupal_get_path('module', 'block'), - 'file' => 'block.admin.inc', - 'render element' => 'form', - ), - ); -} - -/** - * Implements hook_forms(). - */ -function dashboard_forms() { - // Reroute the dashboard configuration form to the main blocks administration - // form. This allows us to distinguish them by form ID in hook_form_alter(). - $forms['dashboard_admin_display_form'] = array( - 'callback' => 'block_admin_display_form', - ); - - return $forms; -} - -/** - * Page callback: Displays the dashboard. - * - * @param $launch_customize - * Whether to launch in customization mode right away. TRUE or FALSE. - * - * @see dashboard_menu() - */ -function dashboard_admin($launch_customize = FALSE) { - $js_settings = array( - 'dashboard' => array( - 'drawer' => url('admin/dashboard/drawer'), - 'blockContent' => url('admin/dashboard/block-content'), - 'updatePath' => url('admin/dashboard/update'), - 'formToken' => drupal_get_token('dashboard-update'), - 'launchCustomize' => $launch_customize, - 'dashboard' => url('admin/dashboard'), - 'emptyBlockText' => t('(empty)'), - 'emptyRegionTextInactive' => t('This dashboard region is empty. Click <em>Customize dashboard</em> to add blocks to it.'), - 'emptyRegionTextActive' => t('DRAG HERE'), - ), - ); - $build = array( - '#theme' => 'dashboard_admin', - '#message' => t('To customize the dashboard page, move blocks to the dashboard regions on the <a href="@dashboard">Dashboard administration page</a>, or enable JavaScript on this page to use the drag-and-drop interface.', array('@dashboard' => url('admin/dashboard/configure'))), - '#access' => user_access('administer blocks'), - '#attached' => array( - 'js' => array( - drupal_get_path('module', 'dashboard') . '/dashboard.js', - array('data' => $js_settings, 'type' => 'setting'), - ), - 'library' => array(array('system', 'jquery.ui.sortable')), - ), - ); - return $build; -} - -/** - * Page callback: Builds the page for administering dashboard blocks. - * - * This page reuses the Block module's administration form but limits editing - * to blocks that are available to appear on the dashboard. - * - * @see dashboard_menu() - * @see block_admin_display() - * @see block_admin_display_form() - * @see dashboard_form_dashboard_admin_display_form_alter() - * @see template_preprocess_dashboard_admin_display_form() - */ -function dashboard_admin_blocks() { - global $theme_key; - drupal_theme_initialize(); - module_load_include('inc', 'block', 'block.admin'); - - // Prepare the blocks for the current theme, and remove those that are - // currently displayed in non-dashboard regions. - // @todo This assumes the current page is being displayed using the same - // theme that the dashboard is displayed in. - $blocks = block_admin_display_prepare_blocks($theme_key); - $dashboard_regions = dashboard_region_descriptions(); - $regions_to_remove = array_diff_key(system_region_list($theme_key, REGIONS_VISIBLE), $dashboard_regions); - foreach ($blocks as $id => $block) { - if (isset($regions_to_remove[$block['region']])) { - unset($blocks[$id]); - } - } - - // Pass in the above blocks and dashboard regions to the form, so that only - // dashboard-related regions will be displayed. - return drupal_get_form('dashboard_admin_display_form', $blocks, $theme_key, $dashboard_regions); -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function dashboard_form_block_admin_display_form_alter(&$form, &$form_state, $form_id) { - // Hide dashboard regions (and any blocks placed within them) from the block - // administration form and from the options list on that form. This - // function is called for both the dashboard block configuration form and the - // standard block configuration form so that both forms can share the same - // constructor. As a result the form_id must be checked. - if ($form_id != 'dashboard_admin_display_form') { - $dashboard_regions = dashboard_region_descriptions(); - $form['block_regions']['#value'] = array_diff_key($form['block_regions']['#value'], $dashboard_regions); - foreach (element_children($form['blocks']) as $i) { - $block = &$form['blocks'][$i]; - if (isset($block['region']['#default_value']) && isset($dashboard_regions[$block['region']['#default_value']]) && $block['region']['#default_value'] != 'dashboard_inactive') { - $block['#access'] = FALSE; - } - elseif (isset($block['region']['#options'])) { - $block['region']['#options'] = array_diff_key($block['region']['#options'], $dashboard_regions); - } - // Show inactive dashboard blocks as disabled on the main block - // administration form, so that they are available to place in other - // regions of the theme. Note that when the form is submitted, any such - // blocks which still remain disabled will immediately be put back in the - // 'dashboard_inactive' region, because dashboard_block_info_alter() is - // called when the blocks are rehashed. Fortunately, this is the exact - // behavior we want. - if ($block['region']['#default_value'] == 'dashboard_inactive') { - // @todo These do not wind up in correct alphabetical order. - $block['region']['#default_value'] = NULL; - } - } - } -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function dashboard_form_dashboard_admin_display_form_alter(&$form, &$form_state) { - // Redirect the 'configure' and 'delete' links on each block back to the - // dashboard blocks administration page. - foreach ($form['blocks'] as &$block) { - if (isset($block['configure']['#href'])) { - $block['configure']['#options']['query']['destination'] = 'admin/dashboard/configure'; - } - if (isset($block['delete']['#href'])) { - $block['delete']['#options']['query']['destination'] = 'admin/dashboard/configure'; - } - } -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function dashboard_form_block_admin_configure_alter(&$form, &$form_state) { - global $theme_key; - drupal_theme_initialize(); - // Hide the dashboard regions from the region select list on the block - // configuration form, for all themes except the current theme (since the - // other themes do not display the dashboard). - // @todo This assumes the current page is being displayed using the same - // theme that the dashboard is displayed in. - $dashboard_regions = dashboard_region_descriptions(); - foreach (element_children($form['regions']) as $region_name) { - $region = &$form['regions'][$region_name]; - if ($region_name != $theme_key && isset($region['#options'])) { - $region['#options'] = array_diff_key($region['#options'], $dashboard_regions); - } - } -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function dashboard_form_block_add_block_form_alter(&$form, &$form_state) { - dashboard_form_block_admin_configure_alter($form, $form_state); -} - -/** - * Preprocesses variables for block-admin-display-form.tpl.php. - */ -function template_preprocess_dashboard_admin_display_form(&$variables) { - template_preprocess_block_admin_display_form($variables); - if (isset($variables['block_regions'][BLOCK_REGION_NONE])) { - $variables['block_regions'][BLOCK_REGION_NONE] = t('Other blocks'); - } -} - -/** - * Determines if the dashboard should be displayed on the current page. - * - * This function checks if the user is currently viewing the dashboard and has - * access to see it. It is used by other functions in the dashboard module to - * decide whether or not the dashboard content should be displayed to the - * current user. - * - * Although the menu system normally handles the above tasks, it only does so - * for the main page content. However, the dashboard is not part of the main - * page content, but rather is displayed in special regions of the page (so it - * can interface with the Block module's method of managing page regions). We - * therefore need to maintain this separate function to check the menu item for - * us. - * - * @return - * TRUE if the dashboard should be visible on the current page, FALSE - * otherwise. - * - * @see dashboard_block_list_alter() - * @see dashboard_page_build() - */ -function dashboard_is_visible() { - static $is_visible; - if (!isset($is_visible)) { - // If the current menu item represents the page on which we want to display - // the dashboard, and if the current user has access to see it, return - // TRUE. - $menu_item = menu_get_item(); - $is_visible = isset($menu_item['page_callback']) && $menu_item['page_callback'] == 'dashboard_admin' && !empty($menu_item['access']); - } - return $is_visible; -} - -/** - * Returns an array of dashboard region descriptions, keyed by region name. - */ -function dashboard_region_descriptions() { - $regions = module_invoke_all('dashboard_regions'); - drupal_alter('dashboard_regions', $regions); - return $regions; -} - -/** - * Returns an array of dashboard region names. - */ -function dashboard_regions() { - $regions = &drupal_static(__FUNCTION__); - if (!isset($regions)) { - $regions = array_keys(dashboard_region_descriptions()); - } - return $regions; -} - -/** - * Implements hook_dashboard_regions(). - */ -function dashboard_dashboard_regions() { - return array( - 'dashboard_main' => 'Dashboard (main)', - 'dashboard_sidebar' => 'Dashboard (sidebar)', - 'dashboard_inactive' => 'Dashboard (inactive)', - ); -} - -/** - * Ajax callback: Shows disabled blocks in the dashboard customization mode. - * - * @see dashboard_menu() - */ -function dashboard_show_disabled() { - global $theme_key; - - // Blocks are not necessarily initialized at this point. - $blocks = _block_rehash(); - - // Limit the list to blocks that are marked as disabled for the dashboard. - foreach ($blocks as $key => $block) { - if ($block['theme'] != $theme_key || $block['region'] != 'dashboard_inactive') { - unset($blocks[$key]); - } - } - - // Theme the output and end the page request. - print theme('dashboard_disabled_blocks', array('blocks' => $blocks)); - drupal_exit(); -} - -/** - * Ajax callback: Displays the rendered contents of a specific block. - * - * @param $module - * The block's module name. - * @param $delta - * The block's delta. - * - * @see dashboard_menu() - */ -function dashboard_show_block_content($module, $delta) { - drupal_theme_initialize(); - global $theme_key; - - $blocks = array(); - $block_object = db_query("SELECT * FROM {block} WHERE theme = :theme AND module = :module AND delta = :delta", array( - ":theme" => $theme_key, - ":module" => $module, - ":delta" => $delta, - )) - ->fetchObject(); - $block_object->enabled = $block_object->page_match = TRUE; - $blocks[$module . "_" . $delta] = $block_object; - $build = _block_get_renderable_region($blocks); - $rendered_block = drupal_render($build); - print $rendered_block; - drupal_exit(); -} - -/** - * Sets the new weight of each region according to the drag-and-drop order. - */ -function dashboard_update() { - drupal_theme_initialize(); - global $theme_key; - // Check the form token to make sure we have a valid request. - if (!empty($_REQUEST['form_token']) && drupal_valid_token($_REQUEST['form_token'], 'dashboard-update')) { - parse_str($_REQUEST['regions'], $regions); - foreach ($regions as $region_name => $blocks) { - if ($region_name == 'disabled_blocks') { - $region_name = 'dashboard_inactive'; - } - foreach ($blocks as $weight => $block_string) { - // Parse the query string to determine the block's module and delta. - preg_match('/block-([^-]+)-(.+)/', $block_string, $matches); - $block = new stdClass(); - $block->module = $matches[1]; - $block->delta = $matches[2]; - - $block->region = $region_name; - $block->weight = $weight; - $block->status = 1; - - db_merge('block') - ->key(array( - 'module' => $block->module, - 'delta' => $block->delta, - 'theme' => $theme_key, - )) - ->fields(array( - 'status' => $block->status, - 'weight' => $block->weight, - 'region' => $block->region, - 'pages' => '', - )) - ->execute(); - } - } - drupal_set_message(t('The configuration options have been saved.'), 'status', FALSE); - } - drupal_exit(); -} - -/** - * Returns HTML for the entire dashboard. - * - * @param $variables - * An associative array containing: - * - element: A render element containing the properties of the dashboard - * region element, #dashboard_region and #children. - * - * @ingroup themeable - */ -function theme_dashboard($variables) { - extract($variables); - drupal_add_css(drupal_get_path('module', 'dashboard') . '/dashboard.css'); - return '<div id="dashboard" class="clearfix">' . $element['#children'] . '</div>'; -} - -/** - * Returns HTML for the non-customizable part of the dashboard page. - * - * @param $variables - * An associative array containing: - * - element: A render element containing a #message. - * - * @ingroup themeable - */ -function theme_dashboard_admin($variables) { - // We only return a simple help message, since the actual content of the page - // will be populated via the dashboard regions in dashboard_page_build(). - return '<div class="customize-dashboard js-hide">' . $variables['element']['#message'] . '</div>'; -} - -/** - * Returns HTML for a generic dashboard region. - * - * @param $variables - * An associative array containing: - * - element: A render element containing the properties of the dashboard - * region element, #dashboard_region and #children. - * - * @ingroup themeable - */ -function theme_dashboard_region($variables) { - extract($variables); - $output = '<div id="' . $element['#dashboard_region'] . '" class="dashboard-region">'; - $output .= '<div class="region clearfix">'; - $output .= $element['#children']; - // Closing div.region - $output .= '</div>'; - // Closing div.dashboard-region - $output .= '</div>'; - return $output; -} - -/** - * Returns HTML for disabled blocks, for use in dashboard customization mode. - * - * @param $variables - * An associative array containing: - * - blocks: An array of block objects from _block_rehash(). - * - * @ingroup themeable - */ -function theme_dashboard_disabled_blocks($variables) { - extract($variables); - $output = '<div class="canvas-content"><p>' . t('Drag and drop these blocks to the columns below. Changes are automatically saved. More options are available on the <a href="@dashboard-url">configuration page</a>.', array('@dashboard-url' => url('admin/dashboard/configure'))) . '</p>'; - $output .= '<div id="disabled-blocks"><div class="region disabled-blocks clearfix">'; - foreach ($blocks as $block) { - $output .= theme('dashboard_disabled_block', array('block' => $block)); - } - $output .= '<div class="clearfix"></div>'; - $output .= '<p class="dashboard-add-other-blocks">' . l(t('Add other blocks'), 'admin/dashboard/configure') . '</p>'; - $output .= '</div></div></div>'; - return $output; -} - -/** - * Returns HTML for a disabled block, for use in dashboard customization mode. - * - * @param $variables - * An associative array containing: - * - block: A block object from _block_rehash(). - * - * @ingroup themeable - */ -function theme_dashboard_disabled_block($variables) { - extract($variables); - $output = ""; - if (isset($block)) { - $output .= '<div id="block-' . $block['module'] . '-' . $block['delta'] - . '" class="disabled-block block block-' . $block['module'] . '-' . $block['delta'] - . ' module-' . $block['module'] . ' delta-' . $block['delta'] . '">' - . '<h2>' . (!empty($block['title']) && $block['title'] != '<none>' ? check_plain($block['title']) : check_plain($block['info'])) . '</h2>' - . '<div class="content"></div>' - . '</div>'; - } - return $output; -} diff --git a/core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlockAvailabilityTest.php b/core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlockAvailabilityTest.php deleted file mode 100644 index 41aed6f9e89a..000000000000 --- a/core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlockAvailabilityTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -/** - * @file - * Definition of Drupal\dashboard\Tests\DashboardBlockAvailabilityTest. - */ - -namespace Drupal\dashboard\Tests; - -use Drupal\simpletest\WebTestBase; - -class DashboardBlockAvailabilityTest extends WebTestBase { - protected $profile = 'standard'; - - public static function getInfo() { - return array( - 'name' => 'Block availability', - 'description' => 'Test blocks as used by the dashboard.', - 'group' => 'Dashboard', - ); - } - - function setUp() { - parent::setUp(); - - // Create and log in an administrative user having access to the dashboard. - $admin_user = $this->drupalCreateUser(array('access dashboard', 'administer blocks', 'access administration pages', 'administer modules')); - $this->drupalLogin($admin_user); - - // Make sure that the dashboard is using the same theme as the rest of the - // site (and in particular, the same theme used on 403 pages). This forces - // the dashboard blocks to be the same for an administrator as for a - // regular user, and therefore lets us test that the dashboard blocks - // themselves are specifically removed for a user who does not have access - // to the dashboard page. - theme_enable(array('stark')); - variable_set('theme_default', 'stark'); - variable_set('admin_theme', 'stark'); - } - - /** - * Tests that administrative blocks are available for the dashboard. - */ - function testBlockAvailability() { - // Test "Recent comments", which should be available (defined as - // "administrative") but not enabled. - $this->drupalGet('admin/dashboard'); - $this->assertNoText(t('Recent comments'), t('"Recent comments" not on dashboard.')); - $this->drupalGet('admin/dashboard/drawer'); - $this->assertText(t('Recent comments'), t('Drawer of disabled blocks includes a block defined as "administrative".')); - $this->assertNoText(t('Syndicate'), t('Drawer of disabled blocks excludes a block not defined as "administrative".')); - $this->drupalGet('admin/dashboard/configure'); - $elements = $this->xpath('//select[@id=:id]//option[@selected="selected"]', array(':id' => 'edit-blocks-comment-recent-region')); - $this->assertTrue($elements[0]['value'] == 'dashboard_inactive', t('A block defined as "administrative" defaults to dashboard_inactive.')); - - // Now enable the block on the dashboard. - $values = array(); - $values['blocks[comment_recent][region]'] = 'dashboard_main'; - $this->drupalPost('admin/dashboard/configure', $values, t('Save blocks')); - $this->drupalGet('admin/dashboard'); - $this->assertText(t('Recent comments'), t('"Recent comments" was placed on dashboard.')); - $this->drupalGet('admin/dashboard/drawer'); - $this->assertNoText(t('Recent comments'), t('Drawer of disabled blocks excludes enabled blocks.')); - } -} diff --git a/core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlocksTest.php b/core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlocksTest.php deleted file mode 100644 index 2e719bd661e2..000000000000 --- a/core/modules/dashboard/lib/Drupal/dashboard/Tests/DashboardBlocksTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -/** - * @file - * Definition of Drupal\dashboard\Tests\DashboardBlocksTest. - */ - -namespace Drupal\dashboard\Tests; - -use Drupal\simpletest\WebTestBase; - -/** - * Tests the Dashboard module blocks. - */ -class DashboardBlocksTest extends WebTestBase { - public static function getInfo() { - return array( - 'name' => 'Dashboard blocks', - 'description' => 'Test blocks as used by the dashboard.', - 'group' => 'Dashboard', - ); - } - - function setUp() { - parent::setUp(array('block', 'dashboard')); - - // Create and log in an administrative user having access to the dashboard. - $admin_user = $this->drupalCreateUser(array('access dashboard', 'administer blocks', 'access administration pages', 'administer modules')); - $this->drupalLogin($admin_user); - } - - /** - * Tests adding a block to the dashboard and checking access to it. - */ - function testDashboardAccess() { - // Add a new custom block to a dashboard region. - $custom_block = array(); - $custom_block['info'] = $this->randomName(8); - $custom_block['title'] = $this->randomName(8); - $custom_block['body[value]'] = $this->randomName(32); - $custom_block['regions[stark]'] = 'dashboard_main'; - $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block')); - - // Ensure admin access. - $this->drupalGet('admin/dashboard'); - $this->assertResponse(200, t('Admin has access to the dashboard.')); - $this->assertRaw($custom_block['title'], t('Admin has access to a dashboard block.')); - - // Ensure non-admin access is denied. - $normal_user = $this->drupalCreateUser(); - $this->drupalLogin($normal_user); - $this->drupalGet('admin/dashboard'); - $this->assertResponse(403, t('Non-admin has no access to the dashboard.')); - $this->assertNoText($custom_block['title'], t('Non-admin has no access to a dashboard block.')); - } - - /** - * Tests that dashboard regions are displayed or hidden properly. - */ - function testDashboardRegions() { - $dashboard_regions = dashboard_region_descriptions(); - $this->assertTrue(!empty($dashboard_regions), 'One or more dashboard regions found.'); - - // Ensure blocks can be placed in dashboard regions. - $this->drupalGet('admin/dashboard/configure'); - foreach ($dashboard_regions as $region => $description) { - $elements = $this->xpath('//option[@value=:region]', array(':region' => $region)); - $this->assertTrue(!empty($elements), t('%region is an available choice on the dashboard block configuration page.', array('%region' => $region))); - } - - // Ensure blocks cannot be placed in dashboard regions on the standard - // blocks configuration page. - $this->drupalGet('admin/structure/block'); - foreach ($dashboard_regions as $region => $description) { - $elements = $this->xpath('//option[@value=:region]', array(':region' => $region)); - $this->assertTrue(empty($elements), t('%region is not an available choice on the block configuration page.', array('%region' => $region))); - } - } - - /** - * Tests that the dashboard module can be re-enabled, retaining its blocks. - */ - function testDisableEnable() { - // Add a new custom block to a dashboard region. - $custom_block = array(); - $custom_block['info'] = $this->randomName(8); - $custom_block['title'] = $this->randomName(8); - $custom_block['body[value]'] = $this->randomName(32); - $custom_block['regions[stark]'] = 'dashboard_main'; - $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block')); - $this->drupalGet('admin/dashboard'); - $this->assertRaw($custom_block['title'], t('Block appears on the dashboard.')); - - $edit = array(); - $edit['modules[Core][dashboard][enable]'] = FALSE; - $this->drupalPost('admin/modules', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); - $this->assertNoRaw('assigned to the invalid region', t('Dashboard blocks gracefully disabled.')); - system_list_reset(); - $this->assertFalse(module_exists('dashboard'), t('Dashboard disabled.')); - - $edit['modules[Core][dashboard][enable]'] = 'dashboard'; - $this->drupalPost('admin/modules', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); - system_list_reset(); - $this->assertTrue(module_exists('dashboard'), t('Dashboard enabled.')); - - $this->drupalGet('admin/dashboard'); - $this->assertRaw($custom_block['title'], t('Block still appears on the dashboard.')); - } -} diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 7dbd85a96872..dcd261cf584a 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -2429,7 +2429,7 @@ function theme_admin_page($variables) { } /** - * Returns HTML for the output of the dashboard page. + * Returns HTML for the output of the admin index page. * * @param $variables * An associative array containing: diff --git a/core/themes/seven/style-rtl.css b/core/themes/seven/style-rtl.css index a41d32547807..11ee2dc71663 100644 --- a/core/themes/seven/style-rtl.css +++ b/core/themes/seven/style-rtl.css @@ -219,14 +219,6 @@ div.add-or-remove-shortcuts { padding-right: 6px; } -/* Dashboard */ -#dashboard div.block div.content { - padding: 10px 5px 5px 5px; -} -#dashboard div.block div.content ul.menu { - margin-right: 20px; -} - /* Recent content block */ #block-node-recent .more-link { padding: 0 0 5px 5px; diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index ae443a449c0e..09e6b3521ff0 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -934,25 +934,6 @@ div.add-or-remove-shortcuts { padding-left: 6px; /* LTR */ } -/* Dashboard */ -#dashboard .dashboard-region div.block h2 { - background: #E0E0D8; -} -#dashboard div.block h2 { - margin: 0; - font-size: 1em; - padding: 3px 10px; -} -#dashboard div.block div.content { - padding: 10px 5px 5px 5px; /* LTR */ -} -#dashboard div.block div.content ul.menu { - margin-left: 20px; /* LTR */ -} -#dashboard .dashboard-region .block { - border: #ccc 1px solid; -} - /* Field UI */ #field-display-overview input.field-formatter-settings-edit { @@ -976,9 +957,6 @@ div.add-or-remove-shortcuts { } /* Recent content block */ -#dashboard div#block-node-recent div.content { - padding: 0; -} #block-node-recent table, #block-node-recent tr { border: none; diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info index efb9a6d48a75..8b8a33be4fc8 100644 --- a/profiles/standard/standard.info +++ b/profiles/standard/standard.info @@ -7,7 +7,6 @@ dependencies[] = block dependencies[] = color dependencies[] = comment dependencies[] = contextual -dependencies[] = dashboard dependencies[] = help dependencies[] = image dependencies[] = menu diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index ff3d1d62d3e1..27faf10dd3aa 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -98,16 +98,6 @@ function standard_install() { 'pages' => '', 'cache' => -1, ), - array( - 'module' => 'node', - 'delta' => 'recent', - 'theme' => $admin_theme, - 'status' => 1, - 'weight' => 10, - 'region' => 'dashboard_main', - 'pages' => '', - 'cache' => -1, - ), array( 'module' => 'user', 'delta' => 'login', @@ -178,26 +168,6 @@ function standard_install() { 'pages' => '', 'cache' => -1, ), - array( - 'module' => 'user', - 'delta' => 'new', - 'theme' => $admin_theme, - 'status' => 1, - 'weight' => 0, - 'region' => 'dashboard_sidebar', - 'pages' => '', - 'cache' => -1, - ), - array( - 'module' => 'search', - 'delta' => 'form', - 'theme' => $admin_theme, - 'status' => 1, - 'weight' => -10, - 'region' => 'dashboard_sidebar', - 'pages' => '', - 'cache' => -1, - ), ); $query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); foreach ($blocks as $block) { -- GitLab