Index: database/database.mysql =================================================================== RCS file: /cvs/drupal/drupal/database/database.mysql,v retrieving revision 1.191 diff -u -r1.191 database.mysql --- database/database.mysql 29 Jul 2005 07:26:49 -0000 1.191 +++ database/database.mysql 31 Jul 2005 07:08:03 -0000 @@ -121,9 +121,10 @@ CREATE TABLE blocks ( module varchar(64) DEFAULT '' NOT NULL, delta varchar(32) NOT NULL default '0', + theme varchar(255) NOT NULL default '', status tinyint(2) DEFAULT '0' NOT NULL, weight tinyint(1) DEFAULT '0' NOT NULL, - region tinyint(1) DEFAULT '0' NOT NULL, + region varchar(64) DEFAULT 'left' NOT NULL, custom tinyint(2) DEFAULT '0' NOT NULL, throttle tinyint(1) DEFAULT '0' NOT NULL, visibility tinyint(1) DEFAULT '0' NOT NULL, @@ -804,8 +805,8 @@ REPLACE variable SET name='theme_default', value='s:10:"bluemarine";'; -REPLACE blocks SET module = 'user', delta = '0', status = '1'; -REPLACE blocks SET module = 'user', delta = '1', status = '1'; +REPLACE blocks SET module = 'user', delta = '0', theme = 'bluemarine', status = '1'; +REPLACE blocks SET module = 'user', delta = '1', theme = 'bluemarine', status = '1'; INSERT INTO sequences (name, id) VALUES ('menu_mid', 1); Index: database/database.pgsql =================================================================== RCS file: /cvs/drupal/drupal/database/database.pgsql,v retrieving revision 1.130 diff -u -r1.130 database.pgsql --- database/database.pgsql 29 Jul 2005 07:26:49 -0000 1.130 +++ database/database.pgsql 31 Jul 2005 07:08:06 -0000 @@ -116,9 +116,10 @@ CREATE TABLE blocks ( module varchar(64) NOT NULL default '', delta varchar(32) NOT NULL default '0', + theme varchar(255) NOT NULL default '', status smallint NOT NULL default '0', weight smallint NOT NULL default '0', - region smallint NOT NULL default '0', + region varchar(64) DEFAULT 'left' NOT NULL, custom smallint NOT NULL default '0', throttle smallint NOT NULL default '0', visibility smallint NOT NULL default '0', @@ -797,8 +798,8 @@ INSERT INTO role (name) VALUES ('authenticated user'); INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0); -INSERT INTO blocks(module,delta,status) VALUES('user', 0, 1); -INSERT INTO blocks(module,delta,status) VALUES('user', 1, 1); +INSERT INTO blocks(module,delta,theme,status) VALUES('user', 0, 'bluemarine', 1); +INSERT INTO blocks(module,delta,theme,status) VALUES('user', 1, 'bluemarine', 1); INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0); Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.122 diff -u -r1.122 updates.inc --- database/updates.inc 29 Jul 2005 20:31:04 -0000 1.122 +++ database/updates.inc 31 Jul 2005 07:11:58 -0000 @@ -118,7 +118,8 @@ "2005-05-11" => "update_139", "2005-05-12" => "update_140", "2005-05-22" => "update_141", - "2005-07-29" => "update_142" + "2005-07-29" => "update_142", + "2005-07-28" => "update_143" ); function update_32() { @@ -2518,6 +2519,28 @@ return $ret; } +function update_143() { + $default_theme = variable_get('theme_default', 'bluemarine'); + $ret = array(); + $ret[] = update_sql("ALTER TABLE {blocks} CHANGE region region varchar(64) default 'left' NOT NULL"); + $ret[] = update_sql("ALTER TABLE {blocks} ADD theme varchar(255) NOT NULL default ''"); + + // Intialize block data for default theme + $ret[] = update_sql("UPDATE {blocks} SET region = 'left' WHERE region = '0'"); + $ret[] = update_sql("UPDATE {blocks} SET region = 'right' WHERE region = '1'"); + db_query("UPDATE {blocks} SET theme = '%s'", $default_theme); + + // Initialze block data for other enabled themes. + $themes = list_themes(); + foreach (array_keys($themes) as $theme) { + if (($theme != $default_theme) && $themes[$theme]->status == 1) { + system_initialize_theme_blocks($theme); + } + } + + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.464 diff -u -r1.464 common.inc --- includes/common.inc 30 Jul 2005 12:52:54 -0000 1.464 +++ includes/common.inc 31 Jul 2005 07:08:27 -0000 @@ -25,6 +25,48 @@ define('SAVED_DELETED', 3); /** + * Set content for a specified region. + * + * @param $region + * Page region the content is assigned to. + * + * @param $data + * Content to be set. + */ +function drupal_set_content($region = null, $data = null) { + static $content = array(); + + if (!is_null($region) && !is_null($data)) { + $content[$region][] = $data; + } + return $content; +} + +/** + * Get assigned content. + * + * @param $region + * A specified region to fetch content for. If null, all regions will be returned. + * + * @param $delimiter + * Content to be inserted between exploded array elements. + */ +function drupal_get_content($region = null, $delimiter = ' ') { + $content = drupal_set_content(); + if (isset($region) && is_array($content[$region])) { + return implode ($delimiter, $content[$region]); + } + else { + foreach (array_keys($content) as $region) { + if (is_array($content[$region])) { + $content[$region] = implode ($delimiter, $content[$region]); + } + } + return $content; + } +} + +/** * Set the breadcrumb trail for the current page. * * @param $breadcrumb Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.249 diff -u -r1.249 theme.inc --- includes/theme.inc 30 Jul 2005 12:52:54 -0000 1.249 +++ includes/theme.inc 31 Jul 2005 07:08:32 -0000 @@ -795,7 +795,7 @@ * * @param $block * An object populated with fields from the "blocks" database table - * ($block->module, $block->delta, $block->region, ...) and fields returned by + * ($block->module, $block->delta ...) and fields returned by * module_block('view') ($block->subject, $block->content, ...). * @return * A string containing the block output. @@ -934,7 +934,10 @@ * A string containing the themed blocks for this region. */ function theme_blocks($region) { + global $theme; + $output = ''; + $content = drupal_get_content(); if ($list = module_invoke('block', 'list', $region)) { foreach ($list as $key => $block) { @@ -942,6 +945,24 @@ $output .= theme('block', $block); } } + + $regions = system_region_list($theme); + $module_regions = system_region_list(null, false, 'module'); + + // If this is the default region, load any content assigned to regions not available in the current theme. + if ($region == system_default_region()) { + foreach (system_region_list() as $key => $value) { + // Set content if it is not in one of the regions in the current theme, and is not a module-defined region. + if (!array_key_exists($key, $regions) && !array_key_exists($key, $module_regions)) { + // Because this is a recursive call, it will include any drupal_set_content() assigned data. + $output .= theme('blocks', $key); + } + } + } + // Add any content assigned to this region through drupal_set_content() calls. + if (array_key_exists($region, $content)) { + $output .= $content[$region]; + } return $output; } Index: misc/drupal.css =================================================================== RCS file: /cvs/drupal/drupal/misc/drupal.css,v retrieving revision 1.111 diff -u -r1.111 drupal.css --- misc/drupal.css 29 Jul 2005 06:59:29 -0000 1.111 +++ misc/drupal.css 31 Jul 2005 07:34:53 -0000 @@ -618,3 +618,12 @@ html.js fieldset.collapsed legend a { background-image: url('menu-collapsed.png'); } +/* +** blocks admin +*/ +.regionhighlight { + background-color: #ffff66; + margin-top: 4px; + margin-bottom: 4px; + padding: 3px; +} \ No newline at end of file Index: modules/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block.module,v retrieving revision 1.175 diff -u -r1.175 block.module --- modules/block.module 29 Jul 2005 21:06:33 -0000 1.175 +++ modules/block.module 31 Jul 2005 07:08:36 -0000 @@ -13,8 +13,8 @@ switch ($section) { case 'admin/help#block': return t(' -

Blocks are the boxes visible in the sidebar(s) of your web site. These are usually generated automatically by modules (e.g. recent forum topics), but you can also create your own blocks.

-

The sidebar each block appears in depends on both which theme you are using (some are left-only, some right, some both), and on the settings in block management.

+

Blocks are the boxes visible in the sidebar(s) of your web site and other regions. These are usually generated automatically by modules (e.g. recent forum topics), but you can also create your own blocks.

+

The region each block appears in depends on both which theme you are using (some are left-only, some right, some both, and some may offer other regions), and on the settings in block management.

The block management screen lets you specify the vertical sort-order of the blocks within a sidebar. You do this by assigning a weight to each block. Lighter blocks (smaller weight) "float up" towards the top of the sidebar. Heavier ones "sink down" towards the bottom of it.

A block\'s visibility depends on: