=== modified file 'modules/block/block-admin-display-form.tpl.php'
--- modules/block/block-admin-display-form.tpl.php 2009-10-05 02:43:01 +0000
+++ modules/block/block-admin-display-form.tpl.php 2010-10-24 04:02:01 +0000
@@ -36,10 +36,10 @@
- |
- |
- |
- |
+
+ |
+
+ |
=== modified file 'modules/block/block.admin.inc'
--- modules/block/block.admin.inc 2010-10-10 20:11:21 +0000
+++ modules/block/block.admin.inc 2010-10-24 05:01:13 +0000
@@ -77,6 +77,14 @@ function block_admin_display_prepare_blo
* @see block_admin_display_form_submit()
*/
function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_regions = NULL) {
+ $form['header'] = array(
+ '#type' => 'value',
+ '#value' => array(
+ 'block' => t('Block'),
+ 'region' => t('Region'),
+ 'weight' => t('Weight'),
+ ),
+ );
drupal_add_css(drupal_get_path('module', 'block') . '/block.css');
@@ -640,6 +648,7 @@ function block_custom_block_delete_submi
* @see theme_block_admin_display()
*/
function template_preprocess_block_admin_display_form(&$variables) {
+ $variables['header'] = $variables['form']['header']['#value'];
$variables['block_regions'] = $variables['form']['block_regions']['#value'];
if (isset($variables['block_regions'][BLOCK_REGION_NONE])) {
$variables['block_regions'][BLOCK_REGION_NONE] = t('Disabled');
=== modified file 'modules/comment/comment.module'
--- modules/comment/comment.module 2010-10-23 15:30:34 +0000
+++ modules/comment/comment.module 2010-10-24 03:40:39 +0000
@@ -402,6 +402,7 @@ function comment_permission() {
*/
function comment_block_info() {
$blocks['recent']['info'] = t('Recent comments');
+ $blocks['recent']['properties']['administrative'] = TRUE;
return $blocks;
}
=== modified file 'modules/dashboard/dashboard.module'
--- modules/dashboard/dashboard.module 2010-10-21 11:55:08 +0000
+++ modules/dashboard/dashboard.module 2010-10-24 05:06:54 +0000
@@ -1,6 +1,8 @@
' . t('Rearrange blocks for display on the dashboard. Disabling a block makes it available on the main blocks administration page.', array('@dashboard-url' => url('admin/dashboard'), '@blocks-url' => url("admin/structure/block/list/{$GLOBALS['theme_key']}"))) . '';
+ $output = '' . t('Rearrange blocks for display on the dashboard.', array('@dashboard-url' => url('admin/dashboard'))) . '
';
return $output;
}
}
@@ -97,7 +99,14 @@ function dashboard_permission() {
* where they will never be displayed.
*/
function dashboard_block_list_alter(&$blocks) {
- if (!dashboard_is_visible()) {
+ if (dashboard_is_visible()) {
+ foreach ($blocks as $key => $block) {
+ if ($block->region == 'dashboard_available') {
+ unset($blocks[$key]);
+ }
+ }
+ }
+ else {
foreach ($blocks as $key => $block) {
if (in_array($block->region, dashboard_regions())) {
unset($blocks[$key]);
@@ -106,6 +115,47 @@ function dashboard_block_list_alter(&$bl
}
}
+function dashboard_block_info_alter(&$blocks, $theme, $code_blocks) {
+ $result = db_query('SELECT * FROM {block} WHERE module = :module AND theme = :theme', array('module' => 'dashboard', 'theme' => $theme));
+ $dashboard_blocks = array();
+ foreach ($result as $block) {
+ list($module, $delta) = explode(':', $block->delta, 2);
+ if (isset($blocks[$module][$delta])) {
+ $dashboard_blocks[$block->delta] = (array) $block;
+ $dashboard_blocks[$block->delta]['info'] = $blocks[$module][$delta]['info'];
+ }
+ }
+ foreach ($blocks as $module => $module_blocks) {
+ if ($module != 'dashboard') {
+ foreach ($module_blocks as $delta => $block) {
+ $dashboard_delta = "$module:$delta";
+ if (isset($dashboard_blocks[$dashboard_delta])) {
+ $dashboard_block = $dashboard_blocks[$dashboard_delta];
+ }
+ else {
+ $dashboard_block = $block;
+ unset($dashboard_block['bid']);
+ $dashboard_block['module'] = 'dashboard';
+ $dashboard_block['delta'] = $dashboard_delta;
+ if (!empty($code_blocks[$module][$delta]['properties']['administrative'])) {
+ $dashboard_block['region'] = 'dashboard_available';
+ $dashboard_block['status'] = 1;
+ }
+ else {
+ $dashboard_block['status'] = 0;
+ }
+ }
+ $blocks['dashboard'][$dashboard_delta] = $dashboard_block;
+ }
+ }
+ }
+}
+
+function dashboard_block_view($dashboard_delta) {
+ list($module, $delta) = explode(':', $dashboard_delta, 2);
+ return module_invoke($module, 'block_view', $delta);
+}
+
/**
* Implements hook_page_build().
*
@@ -121,6 +171,9 @@ function dashboard_page_build(&$page) {
// region into it.
$page['content']['dashboard'] = array('#theme_wrappers' => array('dashboard'));
foreach (dashboard_regions() as $region) {
+ if ($region == 'dashboard_available') {
+ 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();
@@ -307,11 +360,26 @@ function dashboard_form_block_admin_disp
// 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') {
+ if ($form_id == 'dashboard_admin_display_form') {
+ foreach (element_children($form['blocks']) as $i) {
+ if ($form['blocks'][$i]['module']['#value'] != 'dashboard') {
+ unset($form['blocks'][$i]);
+ }
+ else {
+ $form['blocks'][$i]['region']['#empty_option'] = DASHBOARD_DISABLED;
+ }
+ $form['header']['#value']['region'] = t('Dashboard region');
+ }
+ }
+ else {
$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 ($block['module']['#value'] == 'dashboard') {
+ unset($form['blocks'][$i]);
+ continue;
+ }
if (isset($block['region']['#default_value']) && isset($dashboard_regions[$block['region']['#default_value']])) {
$block['#access'] = FALSE;
}
@@ -349,11 +417,18 @@ function dashboard_form_block_admin_conf
// 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);
+ if ($form['module']['#value'] =='dashboard') {
+ $form['regions']['#access'] = FALSE;
+ $form['visibility']['path']['#access'] = FALSE;
+ $form['visibility']['node_type']['#access'] = FALSE;
+ }
+ else {
+ $dashboard_regions = dashboard_region_descriptions();
+ foreach (element_children($form['regions']) as $theme) {
+ $region = &$form['regions'][$theme];
+ if (isset($region['#options'])) {
+ $region['#options'] = array_diff_key($region['#options'], $dashboard_regions);
+ }
}
}
}
@@ -370,6 +445,7 @@ function dashboard_form_block_add_block_
*/
function template_preprocess_dashboard_admin_display_form(&$variables) {
template_preprocess_block_admin_display_form($variables);
+ $variables['block_regions'][BLOCK_REGION_NONE] = t('Not shown for dashboard customization.');
}
/**
@@ -431,8 +507,9 @@ function dashboard_regions() {
*/
function dashboard_dashboard_regions() {
return array(
- 'dashboard_main' => 'Dashboard main',
- 'dashboard_sidebar' => 'Dashboard sidebar',
+ 'dashboard_main' => 'Main',
+ 'dashboard_sidebar' => 'Sidebar',
+ 'dashboard_available' => 'Available for customization',
);
}
@@ -447,7 +524,7 @@ function dashboard_show_disabled() {
// Limit the list to disabled blocks for the current theme.
foreach ($blocks as $key => $block) {
- if ($block['theme'] != $theme_key || (!empty($block['status']) && !empty($block['region']))) {
+ if ($block['module'] != 'dashboard' || $block['theme'] != $theme_key || $block['region'] != 'dashboard_available') {
unset($blocks[$key]);
}
}
@@ -629,4 +706,3 @@ function theme_dashboard_disabled_block(
}
return $output;
}
-
=== modified file 'modules/node/node.module'
--- modules/node/node.module 2010-10-23 15:30:34 +0000
+++ modules/node/node.module 2010-10-24 03:41:10 +0000
@@ -2078,6 +2078,7 @@ function node_block_info() {
$blocks['syndicate']['cache'] = DRUPAL_NO_CACHE;
$blocks['recent']['info'] = t('Recent content');
+ $blocks['recent']['properties']['administrative'] = TRUE;
return $blocks;
}
=== modified file 'modules/search/search.module'
--- modules/search/search.module 2010-10-20 01:31:06 +0000
+++ modules/search/search.module 2010-10-24 03:42:27 +0000
@@ -143,6 +143,8 @@ function search_block_info() {
$blocks['form']['info'] = t('Search form');
// Not worth caching.
$blocks['form']['cache'] = DRUPAL_NO_CACHE;
+ $blocks['form']['properties']['administrative'] = TRUE;
+
return $blocks;
}
=== modified file 'modules/user/user.module'
--- modules/user/user.module 2010-10-23 15:30:34 +0000
+++ modules/user/user.module 2010-10-24 03:41:59 +0000
@@ -1273,10 +1273,13 @@ function user_block_info() {
$blocks['login']['cache'] = DRUPAL_NO_CACHE;
$blocks['new']['info'] = t('Who\'s new');
+ $blocks['new']['properties']['administrative'] = TRUE;
// Too dynamic to cache.
$blocks['online']['info'] = t('Who\'s online');
$blocks['online']['cache'] = DRUPAL_NO_CACHE;
+ $blocks['online']['properties']['administrative'] = TRUE;
+
return $blocks;
}
=== modified file 'profiles/standard/standard.install'
--- profiles/standard/standard.install 2010-10-21 04:22:34 +0000
+++ profiles/standard/standard.install 2010-10-24 05:00:37 +0000
@@ -88,8 +88,8 @@ function standard_install() {
'cache' => -1,
),
array(
- 'module' => 'node',
- 'delta' => 'recent',
+ 'module' => 'dashboard',
+ 'delta' => 'node:recent',
'theme' => $admin_theme,
'status' => 1,
'weight' => 10,
@@ -168,8 +168,8 @@ function standard_install() {
'cache' => -1,
),
array(
- 'module' => 'user',
- 'delta' => 'new',
+ 'module' => 'dashboard',
+ 'delta' => 'user:new',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
@@ -178,8 +178,8 @@ function standard_install() {
'cache' => -1,
),
array(
- 'module' => 'search',
- 'delta' => 'form',
+ 'module' => 'dashboard',
+ 'delta' => 'search:form',
'theme' => $admin_theme,
'status' => 1,
'weight' => -10,