diff --git install.php install.php index be6cd8a..4164557 100644 --- install.php +++ install.php @@ -1426,6 +1426,14 @@ function install_finished(&$install_state) { $output .= '
' . st('For more information on configuring Drupal, refer to the help section.', array('@help' => url('admin/help'))) . '
'; } + // Rebuild the module and theme data, in case any newly-installed modules + // need to modify it via hook_system_info_alter(). We need to clear the + // theme static cache first, to make sure that the theme data is actually + // rebuilt. + drupal_static_reset('_system_get_theme_data'); + system_get_module_data(); + system_get_theme_data(); + // Rebuild menu and registry to get content type links registered by the // profile, and possibly any other menu items created through the tasks. menu_rebuild(); diff --git modules/block/block.module modules/block/block.module index 88f9f25..69d20bf 100644 --- modules/block/block.module +++ modules/block/block.module @@ -243,20 +243,34 @@ function block_page_build(&$page) { * The requested region. */ function block_get_blocks_by_region($region) { - $weight = 0; $build = array(); if ($list = block_list($region)) { - foreach ($list as $key => $block) { - $build[$key] = $block->content; - unset($block->content); - $build[$key] += array( - '#block' => $block, - '#weight' => ++$weight, - ); - $build[$key]['#theme_wrappers'][] ='block'; - } - $build['#sorted'] = TRUE; + $build = _block_get_renderable_array($list); + } + return $build; +} + +/** + * Get an array of blocks suitable for drupal_render(). + * + * @param $list + * A list of blocks such as that returned by block_list(). + * @return + * A renderable array. + */ +function _block_get_renderable_array($list = array()) { + $weight = 0; + $build = array(); + foreach ($list as $key => $block) { + $build[$key] = $block->content; + unset($block->content); + $build[$key] += array( + '#block' => $block, + '#weight' => ++$weight, + ); + $build[$key]['#theme_wrappers'][] ='block'; } + $build['#sorted'] = TRUE; return $build; } diff --git modules/dashboard/dashboard.css modules/dashboard/dashboard.css new file mode 100644 index 0000000..208909e --- /dev/null +++ modules/dashboard/dashboard.css @@ -0,0 +1,115 @@ +/* $Id$ */ + +#dashboard div.dashboard-region { + float: left; + min-height: 1px; +} + +#dashboard div#dashboard_main { + width: 65%; +} + +#dashboard div#dashboard_sidebar { + width: 35%; +} + +#dashboard div.block { + margin-bottom: 20px; +} + +#dashboard .dashboard-region .block { + clear: both; +} + +#dashboard div.block h2 { + background-color:#e2e1dc; + padding: 3px 5px; +} + +#dashboard div.block div.content { + padding: 10px 5px 5px 5px; +} + +#dashboard div.block div.content ul.menu { + margin-left:20px; +} + +#dashboard #disabled-blocks .block, #dashboard .block-placeholder { + background: #e2e1dc; + padding: 6px 4px; + margin: 3px 3px 3px 0; + float: left; + -moz-border-radius: 4px; +} + +#dashboard .ui-sortable { + border: 3px dashed #ccc; + padding: 10px; +} + +#dashboard .canvas-content { + background-color: #4d4d4d; + padding: 10px; + color: #fff; +} + +#dashboard .canvas-content a { + color: #fff; + text-decoration: underline; +} + +#dashboard #disabled-blocks .ui-sortable { + padding: 0; + background-color: #4d4d4d; + border: 0; +} + +#dashboard .canvas-content input { + float: right; + margin: 0 0 0 10px; +} + +#dashboard .region { + margin: 5px; +} + +#dashboard #disabled-blocks .section { + margin: 0 7em 0 0; + height: 100px; + overflow: auto; +} +#dashboard #disabled-blocks { + padding: 5px 0; +} + +#dashboard div.dragging { + width: 30%; +} + +#dashboard #disabled-blocks h2 { + display: inline; + font-weight: normal; + white-space: nowrap; + color: #000; +} + +#dashboard #disabled-blocks .block .content, #dashboard .ui-sortable-helper .content { + display: none; +} + +#dashboard .ui-sortable .block { + cursor: move; +} + +#dashboard .dashboard-region .block-placeholder { + margin: 0 0 20px 0; + padding: 0; + display: block; + height: 1.6em; + width: 100%; +} + +#dashboard #disabled-blocks .block-placeholder { + width: 30px; + height: 1.6em; +} diff --git modules/dashboard/dashboard.info modules/dashboard/dashboard.info new file mode 100644 index 0000000..c49d445 --- /dev/null +++ modules/dashboard/dashboard.info @@ -0,0 +1,8 @@ +; $Id$ +name = Dashboard +description = A module that provides a dashboard interface for organizing and tracking various information within your site. +core = 7.x +package = Core +version = VERSION +files[] = dashboard.module +dependencies[] = block diff --git modules/dashboard/dashboard.js modules/dashboard/dashboard.js new file mode 100644 index 0000000..bfbba1d --- /dev/null +++ modules/dashboard/dashboard.js @@ -0,0 +1,174 @@ +// $Id: toolbar.js,v 1.1 2009/07/04 05:37:30 dries Exp $ +(function ($) { + +/** + * Implementation of Drupal.behaviors for dashboard. + */ +Drupal.behaviors.dashboard = { + attach: function () { + $('#dashboard').prepend(''); + $('#dashboard .customize .action-links a').click(Drupal.behaviors.dashboard.enterCustomizeMode); + if ($('#dashboard .region .block').length == 0) { + Drupal.settings.dashboard.launchCustomize = true; + } + Drupal.behaviors.dashboard.addPlaceholders(); + if (Drupal.settings.dashboard.launchCustomize) { + Drupal.behaviors.dashboard.enterCustomizeMode(); + } + }, + + addPlaceholders: function() { + $('#dashboard .dashboard-region .region').each(function () { + var empty_text = ""; + if ($('.block', this).length == 0) { + // We need a placeholder. + if ($('#dashboard').hasClass('customize_mode')) { + empty_text = Drupal.settings.dashboard.emptyRegionTextActive; + } else { + empty_text = Drupal.settings.dashboard.emptyRegionTextInactive; + } + + if ($('.placeholder', this).length == 0) { + $(this).append(''); + } + $('.placeholder', this).html(empty_text); + } + else { + $('.placeholder', this).remove(); + } + }); + }, + + /** + * Enter "customize" mode by displaying disabled blocks. + */ + enterCustomizeMode: function () { + $('#dashboard').addClass('customize_mode'); + Drupal.behaviors.dashboard.addPlaceholders(); + $('#dashboard .customize .action-links').hide(); + $('div.customize .canvas').load(Drupal.settings.dashboard.drawer, Drupal.behaviors.dashboard.setupDrawer); + }, + + /** + * Exit "customize" mode by simply forcing a page refresh. + */ + exitCustomizeMode: function () { + $('#dashboard').removeClass('customize_mode'); + Drupal.behaviors.dashboard.addPlaceholders(); + location.href = Drupal.settings.dashboard.dashboard; + }, + + /** + * Helper for enterCustomizeMode; sets up drag-and-drop and close button. + */ + setupDrawer: function () { + $('div.customize .canvas-content').prepend(''); + $('div.customize .canvas-content input').click(Drupal.behaviors.dashboard.exitCustomizeMode); + + // 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', + opacity: 0.8, + helper: 'block-dragging', + placeholder: 'block-placeholder clearfix', + start: Drupal.behaviors.dashboard.start, + update: Drupal.behaviors.dashboard.update + }); + }, + + /** + * While dragging, make the block appear as a disabled block + * + * 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) { + 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'}); + } + }, + + /** + * Send block order to the server, and expand 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) { + 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) { + var blockContent = ""; + if (block) { + blockContent = $("div.content", $(block)); + } + + if (!blockContent) { + blockContent = $('' . t('Drag and drop dashboard blocks to their place. Changes are automatically saved. You can also add a custom block.', array('@add-block' => url('admin/structure/block/add', array('query' => array('destination' => 'admin/dashboard/customize'))))) . '
'; + $output .= '