From: Petr Skoda Date: Tue, 12 Jan 2010 17:21:52 +0000 (+0000) Subject: MDL-21149 preparation for renaming of old standard to standardold X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5f0baa43a548a5d4ed775598bdcfa04cf44fb5ba;p=moodle.git MDL-21149 preparation for renaming of old standard to standardold --- diff --git a/lib/db/install.php b/lib/db/install.php index 954b674142..fdd92deda1 100644 --- a/lib/db/install.php +++ b/lib/db/install.php @@ -49,7 +49,7 @@ function xmldb_main_install() { 'enrol_plugins_enabled' => 'manual', 'style' => 'default', 'template' => 'default', - 'theme' => 'standard', //TODO: MDL-21149 replace with some new default theme when implemented + 'theme' => theme_config::DEFAULT_THEME, 'filter_multilang_converted' => 1, 'siteidentifier' => random_string(32).get_host_from_url($CFG->wwwroot), 'backup_version' => 2008111700, diff --git a/lib/outputlib.php b/lib/outputlib.php index c6a45266d9..cbded86407 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -101,6 +101,12 @@ function theme_get_revision() { * @since Moodle 2.0 */ class theme_config { + /** + * @var string default theme, used when requested theme not found + * TODO: MDL-21149 replace with some new default theme when implemented + */ + const DEFAULT_THEME = 'standard'; + /** * You can base your theme on other themes by linking to the other theme as * parents. This lets you use the CSS and layouts from the other themes @@ -351,9 +357,13 @@ class theme_config { if ($config = theme_config::find_theme_config($themename, $settings)) { return new theme_config($config); + + } else if ($themename == theme_config::DEFAULT_THEME) { + throw new coding_exception('Default theme '.theme_config::DEFAULT_THEME.' not available or broken!'); + } else { // bad luck, the requested theme has some problems - admin see details in theme config - return new theme_config(theme_config::find_theme_config('standard', $settings)); // TODO: use some other default MDL-21149 + return new theme_config(theme_config::find_theme_config(theme_config::DEFAULT_THEME, $settings)); } } diff --git a/lib/simpletest/testpagelib_moodlepage.php b/lib/simpletest/testpagelib_moodlepage.php index d6f18124cd..ab57b0b3eb 100644 --- a/lib/simpletest/testpagelib_moodlepage.php +++ b/lib/simpletest/testpagelib_moodlepage.php @@ -137,7 +137,7 @@ class moodle_page_test extends UnitTestCase { public function test_cannot_set_course_once_theme_set() { // Setup fixture - $this->testpage->force_theme('standard'); + $this->testpage->force_theme(theme_config::DEFAULT_THEME); $course = $this->create_a_course(); // Set expectation. $this->expectException(); @@ -147,7 +147,7 @@ class moodle_page_test extends UnitTestCase { public function test_cannot_set_category_once_theme_set() { // Setup fixture - $this->testpage->force_theme('standard'); + $this->testpage->force_theme(theme_config::DEFAULT_THEME); // Set expectation. $this->expectException(); // Exercise SUT