- Patch #240873 by Gábor Hojtsy, sun: block system clean-ups. Thanks for the review sun.

merge-requests/26/head
Dries Buytaert 2009-04-30 21:44:20 +00:00
parent 3e81a14a49
commit 5f08579bfe
7 changed files with 25 additions and 30 deletions

View File

@ -107,6 +107,8 @@ Drupal 7.0, xxxx-xx-xx (development version)
and allow custom data fields to be attached to itself.
* Provides a subset of the features of the Content Construction
Kit (CCK) module.
- Page organization
* Made the help text area a full featured region with blocks.
- Upgraded the core JavaScript library to jQuery version 1.3.2.
- Upgraded the jQuery Forms library to 2.21.

View File

@ -80,7 +80,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$this->setPermission('anonymous user', array('access site-wide contact form' => TRUE));
$this->drupalLogout();
$this->drupalGet('contact');
$this->assertText(t('Contact'), t('Contact form is shown when there is one category.'));
$this->assertText(t('Your e-mail address'), t('Contact form is shown when there is one category.'));
$this->assertNoText(t('Category'), t('When there is only one category, the category selection element is hidden.'));
$this->drupalLogin($admin_user);

View File

@ -3266,7 +3266,7 @@ function system_update_7021() {
foreach ($result as $theme) {
$themes_with_blocks[] = $theme->name;
// Add new system generated help block.
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('system', 'help', '". $theme->name ."', 1, 0, 'help', '', 1)");
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('system', 'help', '" . $theme->name . "', 1, 0, 'help', '', 1)");
}
// Migrate contact form information and user register help to blocks.
@ -3275,17 +3275,17 @@ function system_update_7021() {
db_insert('box')->fields(array('body' => $contact_help, 'info' => 'Contact page help', 'format' => FILTER_FORMAT_DEFAULT))->execute();
foreach ($themes_with_blocks as $theme) {
// Add contact help block for themes, which had blocks.
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '". ($bid_max + 1) ."', '". $theme ."', 1, 5, 'help', 1, 'contact', -1)");
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . ($bid_max + 1) . "', '" . $theme . "', 1, 5, 'help', 1, 'contact', -1)");
}
drupal_set_message('The contact form information setting was migrated to <a href="'. url('admin/build/block/configure/block/' . ($bid_max + 1)) . '">a custom block</a> and set up to only show on the site-wide contact page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.');
drupal_set_message('The contact form information setting was migrated to <a href="' . url('admin/build/block/configure/block/' . ($bid_max + 1)) . '">a custom block</a> and set up to only show on the site-wide contact page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.');
}
if ($user_help = variable_get('user_registration_help', '')) {
db_insert('box')->fields(array('body' => $user_help, 'info' => 'User registration guidelines', 'format' => FILTER_FORMAT_DEFAULT))->execute();
foreach ($themes_with_blocks as $theme) {
// Add user registration help block for themes, which had blocks.
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '". ($bid_max + 2) ."', '". $theme ."', 1, 5, 'help', 1, 'user/register', -1)");
$ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, visibility, pages, cache) VALUES ('block', '" . ($bid_max + 2) . "', '" . $theme . "', 1, 5, 'help', 1, 'user/register', -1)");
}
drupal_set_message('The user registration guidelines were migrated to <a href="'. url('admin/build/block/configure/block/' . ($bid_max + 2)) . '">a custom block</a> and set up to only show on the user registration page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.');
drupal_set_message('The user registration guidelines were migrated to <a href="' . url('admin/build/block/configure/block/' . ($bid_max + 2)) . '">a custom block</a> and set up to only show on the user registration page. The block was set to use the default text format, which might differ from the HTML based format used before. Please check the block and ensure that the output is right.');
}
// Remove the two variables (even if they were saved empty on the admin interface),
// to avoid keeping clutter in the variables table.
@ -3293,7 +3293,7 @@ function system_update_7021() {
variable_del('user_registration_help');
// Rebuild theme data, so the new 'help' region is identified.
system_theme_data();
_system_theme_data();
return $ret;
}

View File

@ -892,12 +892,11 @@ function system_block_list() {
$blocks['powered-by'] = array(
'info' => t('Powered by Drupal'),
'weight' => '10',
// Not worth caching.
'cache' => BLOCK_NO_CACHE,
);
$blocks['help'] = array(
'info' => t('System help'),
'weight' => '5',
'info' => t('System help'),
'weight' => '5',
);
// System-defined menu blocks.
foreach (menu_list_system_menus() as $menu_name => $title) {
@ -960,17 +959,13 @@ function system_block_view($delta = '') {
switch ($delta) {
case 'powered-by':
$image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png';
// Don't display a title.
$block['subject'] = NULL;
$block['content'] = theme('system_powered_by', $image_path);
return $block;
case 'help':
return array(
// Don't display a title.
'subject' => NULL,
'content' => menu_get_active_help(),
);
break;
$block['subject'] = NULL;
$block['content'] = menu_get_active_help();
return $block;
default:
// All system menu blocks.
$system_menus = menu_list_system_menus();

View File

@ -2851,10 +2851,8 @@ function user_register() {
drupal_goto('user/' . $user->uid);
}
$form = array();
// Merge in the default user edit fields.
$form = array_merge($form, user_edit_form($form_state, NULL, NULL, TRUE));
// Start with the default user edit fields.
$form = user_edit_form($form_state, NULL, NULL, TRUE);
if ($admin) {
$form['account']['notify'] = array(
'#type' => 'checkbox',

View File

@ -101,7 +101,7 @@ function default_profile_tasks(&$task, $url) {
'weight' => 0,
'region' => 'left',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -111,7 +111,7 @@ function default_profile_tasks(&$task, $url) {
'weight' => 0,
'region' => 'left',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -121,7 +121,7 @@ function default_profile_tasks(&$task, $url) {
'weight' => 1,
'region' => 'left',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -131,7 +131,7 @@ function default_profile_tasks(&$task, $url) {
'weight' => 10,
'region' => 'footer',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -141,7 +141,7 @@ function default_profile_tasks(&$task, $url) {
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1
'cache' => -1,
),
);
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));

View File

@ -52,7 +52,7 @@ function expert_profile_tasks(&$task, $url) {
'weight' => 0,
'region' => 'left',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -62,7 +62,7 @@ function expert_profile_tasks(&$task, $url) {
'weight' => 0,
'region' => 'left',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -72,7 +72,7 @@ function expert_profile_tasks(&$task, $url) {
'weight' => 1,
'region' => 'left',
'pages' => '',
'cache' => -1
'cache' => -1,
),
array(
'module' => 'system',
@ -82,7 +82,7 @@ function expert_profile_tasks(&$task, $url) {
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1
'cache' => -1,
),
);
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));