#845742 by Damien Tournoud: Make Bartik the default core theme.

merge-requests/26/head
Angie Byron 2010-07-08 03:41:27 +00:00
parent 893fba439b
commit 8f5c296cc0
15 changed files with 87 additions and 73 deletions

View File

@ -81,7 +81,7 @@ function drupal_theme_initialize() {
// Only select the user selected theme if it is available in the
// list of themes that can be accessed.
$theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'garland');
$theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'bartik');
// Allow modules to override the theme. Validation has already been performed
// inside menu_get_custom_theme(), so we do not need to check it again here.
@ -1260,7 +1260,7 @@ function theme_enable($theme_list) {
*/
function theme_disable($theme_list) {
// Don't disable the default theme.
if ($pos = array_search(variable_get('theme_default', 'garland'), $theme_list) !== FALSE) {
if ($pos = array_search(variable_get('theme_default', 'bartik'), $theme_list) !== FALSE) {
unset($theme_list[$pos]);
if (empty($theme_list)) {
return;

View File

@ -46,7 +46,7 @@ function _drupal_maintenance_theme() {
// We use the default theme as the maintenance theme. If a default theme
// isn't specified in the database or in settings.php, we use Garland.
$custom_theme = variable_get('maintenance_theme', variable_get('theme_default', 'garland'));
$custom_theme = variable_get('maintenance_theme', variable_get('theme_default', 'bartik'));
}
// Ensure that system.module is loaded.

View File

@ -228,7 +228,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) {
'#tree' => TRUE,
);
$theme_default = variable_get('theme_default', 'garland');
$theme_default = variable_get('theme_default', 'bartik');
foreach (list_themes() as $key => $theme) {
// Only display enabled themes
if ($theme->status) {

View File

@ -64,7 +64,7 @@ function block_help($path, $arg) {
return '<p>' . t('Use this page to create a new custom block.') . '</p>';
}
if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list')) {
$demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'garland');
$demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'bartik');
$themes = list_themes();
$output = '<p>' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the <em>Save blocks</em> button at the bottom of the page. Click the <em>configure</em> link next to each block to configure its specific title and visibility settings.') . '</p>';
$output .= '<p>' . l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '</p>';
@ -104,7 +104,7 @@ function block_permission() {
* Implements hook_menu().
*/
function block_menu() {
$default_theme = variable_get('theme_default', 'garland');
$default_theme = variable_get('theme_default', 'bartik');
$items['admin/structure/block'] = array(
'title' => 'Blocks',
'description' => 'Configure what block content appears in your site\'s sidebars and other regions.',
@ -592,7 +592,7 @@ function block_theme_initialize($theme) {
// Initialize theme's blocks if none already registered.
$has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', 0, 1, array(':theme' => $theme))->fetchField();
if (!$has_blocks) {
$default_theme = variable_get('theme_default', 'garland');
$default_theme = variable_get('theme_default', 'bartik');
$regions = system_region_list($theme);
$result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $block) {

View File

@ -33,11 +33,11 @@ class BlockTestCase extends DrupalWebTestCase {
// Define the existing regions
$this->regions = array();
$this->regions[] = array('name' => 'header', 'class' => 'region region-header clearfix');
$this->regions[] = array('name' => 'sidebar_first');
$this->regions[] = array('name' => 'content');
$this->regions[] = array('name' => 'sidebar_second');
$this->regions[] = array('name' => 'footer');
$this->regions[] = 'header';
$this->regions[] = 'sidebar_first';
$this->regions[] = 'content';
$this->regions[] = 'sidebar_second';
$this->regions[] = 'footer';
}
/**
@ -120,7 +120,7 @@ class BlockTestCase extends DrupalWebTestCase {
// Set the created custom block to a specific region.
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
$edit = array();
$edit['block_' . $bid . '[region]'] = $this->regions[1]['name'];
$edit['block_' . $bid . '[region]'] = $this->regions[1];
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// Confirm that the custom block is being displayed using configured text format.
@ -228,7 +228,7 @@ class BlockTestCase extends DrupalWebTestCase {
// For convenience of developers, put the navigation block back.
$edit = array();
$edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $this->regions[1]['name'];
$edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $this->regions[1];
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'), t('Block successfully move to first sidebar region.'));
@ -237,18 +237,13 @@ class BlockTestCase extends DrupalWebTestCase {
}
function moveBlockToRegion($block, $region) {
// If an id for an region hasn't been specified, we assume it's the same as the name.
if (!(isset($region['class']))) {
$region['class'] = 'region region-' . str_replace('_', '-', $region['name']);
}
// Set the created block to a specific region.
$edit = array();
$edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region['name'];
$edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region;
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// Confirm that the block was moved to the proper region.
$this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region['name'])));
$this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
// Confirm that the block is being displayed.
$this->drupalGet('node');
@ -256,10 +251,10 @@ class BlockTestCase extends DrupalWebTestCase {
// Confirm that the custom block was found at the proper region.
$xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array(
':region-class' => $region['class'],
':region-class' => 'region region-' . str_replace('_', '-', $region),
':block-id' => 'block-' . $block['module'] . '-' . $block['delta'],
));
$this->assertFieldByXPath($xpath, FALSE, t('Custom block found in %region_name region.', array('%region_name' => $region['name'])));
$this->assertFieldByXPath($xpath, FALSE, t('Custom block found in %region_name region.', array('%region_name' => $region)));
}
/**
@ -327,12 +322,17 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
// Ensure no other theme's blocks are in the block table yet.
$count = db_query_range("SELECT 1 FROM {block} WHERE theme NOT IN ('garland', 'seven')", 0, 1)->fetchField();
$this->assertFalse($count, t('Only Garland and Seven have blocks.'));
$themes = array();
$themes['default'] = variable_get('theme_default', 'bartik');
if ($admin_theme = variable_get('admin_theme')) {
$themes['admin'] = $admin_theme;
}
$count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField();
$this->assertFalse($count, t('Only the default theme and the admin theme have blocks.'));
// Populate list of all blocks for matching against new theme.
$blocks = array();
$result = db_query("SELECT * FROM {block} WHERE theme = 'garland'");
$result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => $themes['default']));
foreach ($result as $block) {
// $block->theme and $block->bid will not match, so remove them.
unset($block->theme, $block->bid);
@ -340,10 +340,10 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
}
// Turn on the Stark theme and ensure that it contains all of the blocks
// that Garland did.
// the default theme had.
theme_enable(array('stark'));
variable_set('theme_default', 'stark');
$result = db_query("SELECT * FROM {block} WHERE theme='stark'");
$result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => 'stark'));
foreach ($result as $block) {
unset($block->theme, $block->bid);
$this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));

View File

@ -122,9 +122,6 @@ class BlogTestCase extends DrupalWebTestCase {
* HTTP response code.
*/
private function verifyBlogs($node_user, $node, $admin, $response = 200) {
$crumb = '';
$quote = '&#039;';
$response2 = ($admin) ? 200 : 403;
// View blog help node.
@ -144,7 +141,12 @@ class BlogTestCase extends DrupalWebTestCase {
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
$this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => format_username($node_user))), t('Breadcrumbs were displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Blogs'), 'blog'),
l(t("!name's blog", array('!name' => format_username($node_user))), 'blog/' . $node_user->uid),
);
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
// View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
@ -176,8 +178,6 @@ class BlogTestCase extends DrupalWebTestCase {
* The logged in user.
*/
private function verifyBlogLinks($user) {
$crumb = '';
// Confirm blog entries link exists on the user page.
$this->drupalGet('user/' . $user->uid);
$this->assertResponse(200);

View File

@ -22,8 +22,13 @@ class ColorTestCase extends DrupalWebTestCase {
function setUp() {
parent::setUp('color');
// Create users.
$this->big_user = $this->drupalCreateUser(array('administer themes'));
// This test relies on Garland, the mother of all the colorable themes.
theme_enable(array('garland'));
variable_set('theme_default', 'garland');
}
/**
@ -55,7 +60,6 @@ class ColorTestCase extends DrupalWebTestCase {
$stylesheet_content = join("\n", file($stylesheets[0]));
$matched = preg_match('/(.*color: #0c7a00.*)/i', $stylesheet_content, $matches);
$this->assertTrue($matched == 1, 'Make sure the color we changed is in the color stylesheet.');
}
}

View File

@ -353,9 +353,6 @@ class ForumTestCase extends DrupalWebTestCase {
* The exptected HTTP response code.
*/
private function verifyForums($node_user, $node, $admin, $response = 200) {
$crumb = '';
$quote = '&#039;';
$response2 = ($admin) ? 200 : 403;
// View forum help node.
@ -382,7 +379,13 @@ class ForumTestCase extends DrupalWebTestCase {
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
$this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @container ' . $crumb . ' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Forums'), 'forum'),
l($this->container['name'], 'forum/' . $this->container['tid']),
l($this->forum['name'], 'forum/' . $this->forum['tid']),
);
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
// View forum edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
@ -424,18 +427,20 @@ class ForumTestCase extends DrupalWebTestCase {
* A row from taxonomy_term_data table in array.
*/
private function verifyForumView($forum, $parent = NULL) {
$crumb = '';
// View forum page.
$this->drupalGet('forum/' . $forum['tid']);
$this->assertResponse(200);
$this->assertTitle($forum['name'] . ' | Drupal', t('Forum name was displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Forums'), 'forum'),
);
if (isset($parent)) {
$this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @name', array('@name' => $parent['name'])), t('Breadcrumbs were displayed'));
}
else {
$this->assertText(t('Home ' . $crumb . ' Forums'), t('Breadcrumbs were displayed'));
$breadcrumb[] = l($parent['name'], 'forum/' . $parent['tid']);
}
$this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
}
/**
@ -462,8 +467,6 @@ class ForumTestCase extends DrupalWebTestCase {
* An array of forum node IDs.
*/
private function viewForumTopics($nids) {
$crumb = '';
for ($i = 0; $i < 2; $i++) {
foreach ($nids as $nid) {
$this->drupalGet('node/' . $nid);

View File

@ -678,7 +678,8 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$this->assertRaw('<span class="submitted">', t('Post information is displayed.'));
$elements = $this->xpath('//div[contains(@class,:class)]', array(':class' => 'submitted'));
$this->assertEqual(count($elements), 1, t('Post information is displayed.'));
}
/**
@ -1474,8 +1475,10 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
$custom_block['title'] = $this->randomName();
$custom_block['types[article]'] = TRUE;
$custom_block['body[value]'] = $this->randomName(32);
$custom_block['regions[garland]'] = 'content';
$custom_block['regions[seven]'] = 'content';
$custom_block['regions[' . variable_get('theme_default', 'bartik') . ']'] = 'content';
if ($admin_theme = variable_get('admin_theme')) {
$custom_block['regions[' . $admin_theme . ']'] = 'content';
}
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();

View File

@ -20,6 +20,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
parent::setUp('menu_test');
// Make the tests below more robust by explicitly setting the default theme
// and administrative theme that they expect.
theme_enable(array('garland'));
variable_set('theme_default', 'garland');
variable_set('admin_theme', 'seven');
}

View File

@ -165,7 +165,7 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
// Configure and save the block.
$block = block_load('statistics', 'popular');
$block->theme = 'garland';
$block->theme = variable_get('theme_default', 'bartik');
$block->status = 1;
$block->pages = '';
$block->region = 'sidebar_first';

View File

@ -203,7 +203,7 @@ function system_themes_page() {
$themes = system_rebuild_theme_data();
uasort($themes, 'system_sort_modules_by_info_name');
$theme_default = variable_get('theme_default', 'garland');
$theme_default = variable_get('theme_default', 'bartik');
$theme_groups = array();
foreach ($themes as &$theme) {
@ -389,7 +389,7 @@ function system_theme_disable() {
// Check if the specified theme is one recognized by the system.
if (!empty($themes[$theme])) {
if ($theme == variable_get('theme_default', 'garland')) {
if ($theme == variable_get('theme_default', 'bartik')) {
// Don't disable the default theme.
drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error');
}

View File

@ -480,11 +480,11 @@ function system_install() {
system_rebuild_theme_data();
// Enable the default theme.
variable_set('theme_default', 'garland');
variable_set('theme_default', 'bartik');
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'garland')
->condition('name', 'bartik')
->execute();
// Populate the cron key variable.

View File

@ -8,11 +8,12 @@
*/
function minimal_install() {
// Enable some standard blocks.
$default_theme = variable_get('theme_default', 'bartik');
$values = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
@ -22,7 +23,7 @@ function minimal_install() {
array(
'module' => 'user',
'delta' => 'login',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
@ -32,7 +33,7 @@ function minimal_install() {
array(
'module' => 'system',
'delta' => 'navigation',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
@ -42,7 +43,7 @@ function minimal_install() {
array(
'module' => 'system',
'delta' => 'management',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 1,
'region' => 'sidebar_first',
@ -52,7 +53,7 @@ function minimal_install() {
array(
'module' => 'system',
'delta' => 'help',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',

View File

@ -62,11 +62,13 @@ function standard_install() {
filter_format_save($full_html_format);
// Enable some standard blocks.
$default_theme = variable_get('theme_default', 'bartik');
$admin_theme = 'seven';
$values = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
@ -76,7 +78,7 @@ function standard_install() {
array(
'module' => 'search',
'delta' => 'form',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => -1,
'region' => 'sidebar_first',
@ -86,7 +88,7 @@ function standard_install() {
array(
'module' => 'node',
'delta' => 'recent',
'theme' => 'seven',
'theme' => $admin_theme,
'status' => 1,
'weight' => 10,
'region' => 'dashboard_main',
@ -96,7 +98,7 @@ function standard_install() {
array(
'module' => 'user',
'delta' => 'login',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
@ -106,7 +108,7 @@ function standard_install() {
array(
'module' => 'system',
'delta' => 'navigation',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'sidebar_first',
@ -116,7 +118,7 @@ function standard_install() {
array(
'module' => 'system',
'delta' => 'management',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 1,
'region' => 'sidebar_first',
@ -126,7 +128,7 @@ function standard_install() {
array(
'module' => 'system',
'delta' => 'powered-by',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 10,
'region' => 'footer',
@ -136,7 +138,7 @@ function standard_install() {
array(
'module' => 'system',
'delta' => 'help',
'theme' => 'garland',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
@ -146,7 +148,7 @@ function standard_install() {
array(
'module' => 'system',
'delta' => 'main',
'theme' => 'seven',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
@ -156,7 +158,7 @@ function standard_install() {
array(
'module' => 'system',
'delta' => 'help',
'theme' => 'seven',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
@ -166,7 +168,7 @@ function standard_install() {
array(
'module' => 'user',
'delta' => 'login',
'theme' => 'seven',
'theme' => $admin_theme,
'status' => 1,
'weight' => 10,
'region' => 'content',
@ -176,7 +178,7 @@ function standard_install() {
array(
'module' => 'user',
'delta' => 'new',
'theme' => 'seven',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'dashboard_sidebar',
@ -186,7 +188,7 @@ function standard_install() {
array(
'module' => 'search',
'delta' => 'form',
'theme' => 'seven',
'theme' => $admin_theme,
'status' => 1,
'weight' => -10,
'region' => 'dashboard_sidebar',