From: Petr Skoda Date: Wed, 16 Dec 2009 18:00:58 +0000 (+0000) Subject: MDL-20204 first batch of major theme changes, some regressions are still there, expec... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=78946b9bdb1299a21f00b88d81c73ad8700c951e;p=moodle.git MDL-20204 first batch of major theme changes, some regressions are still there, expect more changes and improvements soon; see tracker for details and list of subtasks --- diff --git a/admin/bloglevelupgrade.php b/admin/bloglevelupgrade.php index 7d2c9e4864..5b38998936 100644 --- a/admin/bloglevelupgrade.php +++ b/admin/bloglevelupgrade.php @@ -8,7 +8,7 @@ require_once($CFG->dirroot.'/mod/forum/lib.php'); require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('bloglevelupgrade'); -$PAGE->set_generaltype('maintenance'); +$PAGE->set_pagelayout('maintenance'); $go = optional_param('go', 0, PARAM_BOOL); diff --git a/admin/cli/install.php b/admin/cli/install.php index c4b8e5eb7e..eb04b8b596 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -110,7 +110,6 @@ $CFG->dirroot = str_replace('\\', '/', dirname(dirname(dirname(__FI $CFG->libdir = "$CFG->dirroot/lib"; $CFG->wwwroot = "http://localhost"; $CFG->httpswwwroot = $CFG->wwwroot; -$CFG->httpsthemewww = $CFG->wwwroot; $CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(__FILE__))).'/moodledata'); $CFG->docroot = 'http://docs.moodle.org'; $CFG->directorypermissions = 00777; @@ -262,7 +261,6 @@ if ($interactive) { } $CFG->wwwroot = $wwwroot; $CFG->httpswwwroot = $CFG->wwwroot; -$CFG->httpsthemewww = $CFG->wwwroot; //We need dataroot before lang download diff --git a/admin/generator.php b/admin/generator.php index d743cd295e..63f48c5b6f 100755 --- a/admin/generator.php +++ b/admin/generator.php @@ -1334,7 +1334,7 @@ if (isset($argv) && isset($argc)) { require_capability('moodle/site:config', $systemcontext); $PAGE->set_url($CFG->wwwroot.'/admin/generator.php'); - $PAGE->set_generaltype('form'); + $PAGE->set_pagelayout('form'); $generator = new generator_web(); $generator->setup(); $generator->display(); diff --git a/admin/index.php b/admin/index.php index 909bfe3d69..46c4bd4ab7 100644 --- a/admin/index.php +++ b/admin/index.php @@ -107,7 +107,7 @@ $origxmlstrictheaders = !empty($CFG->xmlstrictheaders); $CFG->xmlstrictheaders = false; if (!core_tables_exist()) { - $PAGE->set_generaltype('maintenance'); + $PAGE->set_pagelayout('maintenance'); // fake some settings $CFG->docroot = 'http://docs.moodle.org'; @@ -188,7 +188,7 @@ if (empty($CFG->version)) { } if ($version > $CFG->version) { // upgrade - $PAGE->set_generaltype('maintenance'); + $PAGE->set_pagelayout('maintenance'); $a->oldversion = "$CFG->release ($CFG->version)"; $a->newversion = "$release ($version)"; diff --git a/admin/roles/assign.php b/admin/roles/assign.php index c9fbbc1a22..744cee1860 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -310,7 +310,6 @@ } /// Print the form. - check_theme_arrows(); ?>
diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 9675963461..180c98dc02 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -8,6 +8,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page // "themesettings" settingpage $temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin')); $temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS)); + $setting = new admin_setting_configcheckbox('themedesignermode', get_string('themedesignermode', 'admin'), get_string('configthemedesignermode', 'admin'), 0); + $setting->set_updatedcallback('theme_reset_all_caches'); + $temp->add($setting); $temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0)); @@ -23,6 +26,14 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $ADMIN->add('themes', $temp); $ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php')); + // settings for each theme + foreach (get_plugin_list('theme') as $theme => $themedir) { + $settings_path = "$themedir/settings.php"; + if (file_exists($settings_path)) { + include($settings_path); + } + } + // calendar $temp = new admin_settingpage('calendar', get_string('calendarsettings','admin')); $temp->add(new admin_setting_special_adminseesall()); @@ -132,3 +143,4 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php")); } // end of speedup + diff --git a/admin/settings/development.php b/admin/settings/development.php index 6fb46f29f3..70ad9c9ec3 100644 --- a/admin/settings/development.php +++ b/admin/settings/development.php @@ -9,7 +9,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin')); $temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0)); $item = new admin_setting_configcheckbox('enablehtmlpurifier', get_string('enablehtmlpurifier', 'admin'), get_string('configenablehtmlpurifier', 'admin'), 0); $item->set_updatedcallback('reset_text_filters_cache'); $temp->add($item); diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 852f80aaab..f5d6f09a60 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -4,10 +4,7 @@ * Please note that is file is always loaded last - it means that you can inject entries into other categories too. */ -if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { - - require_once($CFG->libdir. '/portfoliolib.php'); - +if ($hassiteconfig) { $ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules'))); $ADMIN->add('modsettings', new admin_page_managemods()); if ($modules = $DB->get_records('modules')) { @@ -136,6 +133,9 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) } } + + //== Portfolio settings == + require_once($CFG->libdir. '/portfoliolib.php'); $catname = get_string('portfolios', 'portfolio'); $manage = get_string('manageportfolios', 'portfolio'); $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; @@ -222,9 +222,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true), '', $url); - foreach (repository::get_types() - as $repositorytype) - { + foreach (repository::get_types() as $repositorytype) { //display setup page for plugins with: general options or multiple instances (e.g. has instance config) $typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names'); $instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names'); @@ -236,6 +234,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) 'moodle/site:config'); } } +} // Web services $ADMIN->add('modules', new admin_category('webservicesettings', get_string('webservices', 'webservice'))); @@ -264,6 +263,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) } } +if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { // Question type settings. $ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin'))); $ADMIN->add('qtypesettings', new admin_page_manageqtypes()); diff --git a/admin/upgradesettings.php b/admin/upgradesettings.php index 4a800a4851..da9b3bf2b9 100644 --- a/admin/upgradesettings.php +++ b/admin/upgradesettings.php @@ -13,7 +13,7 @@ require_login(0, false); $adminroot = admin_get_root(); // need all settings admin_externalpage_setup('upgradesettings'); // now hidden page -$PAGE->set_generaltype('maintenance'); +$PAGE->set_pagelayout('maintenance'); // now we'll deal with the case that the admin has submitted the form with new settings if ($data = data_submitted() and confirm_sesskey()) { diff --git a/admin/webservice/service_users.php b/admin/webservice/service_users.php index 4e79e3b1db..0b022d858e 100644 --- a/admin/webservice/service_users.php +++ b/admin/webservice/service_users.php @@ -73,8 +73,6 @@ $alloweduserselector = new service_user_selector('removeselect', array('servicei } } /// Print the form. - check_theme_arrows(); - /// display the UI ?>
diff --git a/auth/shibboleth/login.php b/auth/shibboleth/login.php index 58c7882873..b37d1f9558 100644 --- a/auth/shibboleth/login.php +++ b/auth/shibboleth/login.php @@ -29,7 +29,7 @@ httpsrequired(); $select = html_select::make_popup_form("$CFG->httpswwwroot/login/index.php", 'lang', $langs, 'chooselang', $currlang); $select->nothinglabel = false; $select->set_label(get_accesshide(get_string('language'))); - $langmenu = $OUTPUT->select($select); + $langmenu = '
'.$OUTPUT->select($select).'
'; } $loginsite = get_string("loginsite"); @@ -82,7 +82,7 @@ httpsrequired(); $PAGE->set_title("$site->fullname: $loginsite"); $PAGE->set_heading($site->fullname); $PAGE->set_focuscontrol('idp'); - $PAGE->set_headingmenu('
'.$langmenu.'
'); + $PAGE->set_headingmenu($langmenu); echo $OUTPUT->header(); include("index_form.html"); diff --git a/backup/restorelib.php b/backup/restorelib.php index 585b88b529..2f29bb9b8b 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -9288,9 +9288,10 @@ WHERE $restorelog_file = fopen("$dest_dir/restorelog.html","a"); //Add the stylesheet $stylesheetshtml = ''; - foreach ($CFG->stylesheets as $stylesheet) { +/* foreach ($CFG->stylesheets as $stylesheet) { + //TODO: MDL-21120 $stylesheetshtml .= ''."\n"; - } + }*/ ///Accessibility: added the 'lang' attribute to $direction, used in theme tag. $languagehtml = get_html_lang($dir=true); @@ -9299,7 +9300,7 @@ WHERE fwrite ($restorelog_file," \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> "); fwrite ($restorelog_file,""); - fwrite ($restorelog_file,$stylesheetshtml); +// fwrite ($restorelog_file,$stylesheetshtml); fwrite ($restorelog_file,"".$course_header->course_shortname." Restored "); fwrite ($restorelog_file,"

The following changes were made during the Restoration of this Course.



"); fwrite ($restorelog_file,"The Course ShortName is now - ".$course_header->course_shortname." The FullName is now - ".$course_header->course_fullname."

"); diff --git a/blocks/global_navigation_tree/block_global_navigation_tree.php b/blocks/global_navigation_tree/block_global_navigation_tree.php index e4a0d2b5a3..9586b8e1cd 100644 --- a/blocks/global_navigation_tree/block_global_navigation_tree.php +++ b/blocks/global_navigation_tree/block_global_navigation_tree.php @@ -88,6 +88,7 @@ class block_global_navigation_tree extends block_tree { if ($this->contentgenerated === true) { return true; } + $this->page->requires->yui_lib('dom'); $this->page->requires->js('lib/javascript-navigation.js'); // Navcount is used to allow us to have multiple trees although I dont' know why // you would want to trees the same diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index b43f7c1b07..03db833cd2 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -815,7 +815,7 @@ class block_tree extends block_list { * * Also adds the required javascript call to the page output. * - * @param moodle_core_renderer $output + * @param core_renderer $output * @return string HTML */ protected function formatted_contents($output) { diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php index a67da8965e..e451e3509c 100644 --- a/blocks/rss_client/editfeed.php +++ b/blocks/rss_client/editfeed.php @@ -175,7 +175,7 @@ if ($returnurl) { $managefeeds = new moodle_url($CFG->wwwroot . '/blocks/rss_client/managefeeds.php', $urlparams); $PAGE->set_url('blocks/rss_client/editfeed.php', $urlparams); -$PAGE->set_generaltype('form'); +$PAGE->set_pagelayout('form'); if ($rssid) { $isadding = false; diff --git a/blocks/rss_client/managefeeds.php b/blocks/rss_client/managefeeds.php index 66482e35aa..8181c9b9e6 100644 --- a/blocks/rss_client/managefeeds.php +++ b/blocks/rss_client/managefeeds.php @@ -78,7 +78,7 @@ $feeds = $DB->get_records_select('block_rss_client', $select, null, $DB->sql_ord $strmanage = get_string('managefeeds', 'block_rss_client'); -$PAGE->set_generaltype('form'); +$PAGE->set_pagelayout('form'); $PAGE->set_title($strmanage); $PAGE->set_heading($strmanage); diff --git a/blocks/rss_client/viewfeed.php b/blocks/rss_client/viewfeed.php index 5da40c8fd9..fa7ce070fb 100644 --- a/blocks/rss_client/viewfeed.php +++ b/blocks/rss_client/viewfeed.php @@ -55,7 +55,7 @@ if ($returnurl) { $urlparams['returnurl'] = $returnurl; } $PAGE->set_url('blocks/rss_client/viewfeed.php', $urlparams); -$PAGE->set_generaltype('popup'); +$PAGE->set_pagelayout('popup'); $rssrecord = $DB->get_record('block_rss_client', array('id' => $rssid), '*', MUST_EXIST); diff --git a/blocks/settings_navigation_tree/block_settings_navigation_tree.php b/blocks/settings_navigation_tree/block_settings_navigation_tree.php index 704eeb37f6..881f54ed49 100644 --- a/blocks/settings_navigation_tree/block_settings_navigation_tree.php +++ b/blocks/settings_navigation_tree/block_settings_navigation_tree.php @@ -87,6 +87,7 @@ class block_settings_navigation_tree extends block_tree { if ($this->contentgenerated === true) { return true; } + $this->page->requires->yui_lib('dom'); $this->page->requires->js('lib/javascript-navigation.js'); block_settings_navigation_tree::$navcount++; diff --git a/blocks/upgrade.txt b/blocks/upgrade.txt index 256cc2532a..f7239e1c06 100644 --- a/blocks/upgrade.txt +++ b/blocks/upgrade.txt @@ -11,6 +11,9 @@ required changes in code: * move post instalation code from install() method into db/install.php * completely rewrite file handling * rewrite backup/restore +* theme changes: move plugin styles into blocks/xxx/styles.css and use new css markers for images, + move all images into new blocks/xxx/pix/ directory and use new outputlib api + optional - no changes needed in older code: * diff --git a/calendar/lib.php b/calendar/lib.php index 5ca172f525..e40a87b58a 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -719,7 +719,7 @@ function calendar_get_events($tstart, $tend, $users, $groups, $courses, $withdur } function calendar_top_controls($type, $data) { - global $CFG, $CALENDARDAYS, $THEME; + global $CFG, $CALENDARDAYS; $content = ''; if(!isset($data['d'])) { $data['d'] = 1; diff --git a/course/edit.php b/course/edit.php index c02dcde6df..be7f4f603c 100644 --- a/course/edit.php +++ b/course/edit.php @@ -9,7 +9,7 @@ $id = optional_param('id', 0, PARAM_INT); // course id $categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form - $PAGE->set_generaltype('form'); + $PAGE->set_pagelayout('form'); /// basic access control checks if ($id) { // editing course diff --git a/course/importstudents.html b/course/importstudents.html index 403c344746..2828982e2e 100644 --- a/course/importstudents.html +++ b/course/importstudents.html @@ -19,7 +19,6 @@ ?> -


diff --git a/course/lib.php b/course/lib.php index dbf7f90e49..cd0a31411e 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1383,12 +1383,12 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false, if (!empty($customicon)) { if (substr($customicon, 0, 4) === 'mod/') { list($modname, $iconname) = explode('/', substr($customicon, 4), 2); - $icon = $OUTPUT->mod_icon_url(str_replace(array('.gif', '.png'), '', $customicon), $modname); + $icon = $OUTPUT->old_icon_url(str_replace(array('.gif', '.png'), '', $customicon), $modname); } else { $icon = $OUTPUT->old_icon_url(str_replace(array('.gif', '.png'), '', $customicon)); } } else { - $icon = $OUTPUT->mod_icon_url('icon', $mod->modname); + $icon = $OUTPUT->old_icon_url('icon', $mod->modname); } //Accessibility: for files get description via icon, this is very ugly hack! @@ -2924,12 +2924,12 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=- $leftright = ''; if (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $mod->course))) { - if (right_to_left()) { // Exchange arrows on RTL - $rightarrow = 't/left'; - $leftarrow = 't/right'; - } else { - $rightarrow = 't/right'; - $leftarrow = 't/left'; + if (right_to_left()) { // Exchange arrows on RTL + $rightarrow = 't/left'; + $leftarrow = 't/right'; + } else { + $rightarrow = 't/right'; + $leftarrow = 't/left'; } if ($indent > 0) { diff --git a/course/modedit.php b/course/modedit.php index d6d898f083..b464229c2b 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -35,7 +35,7 @@ $return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true $type = optional_param('type', '', PARAM_ALPHANUM); //TODO: hopefully will be removed in 2.0 - $PAGE->set_generaltype('form'); + $PAGE->set_pagelayout('form'); $url = new moodle_url($CFG->wwwroot.'/course/modedit.php'); if (!empty($add)) { diff --git a/course/report/log/live.php b/course/report/log/live.php index f59b1a69b3..828c8aeb4e 100644 --- a/course/report/log/live.php +++ b/course/report/log/live.php @@ -30,7 +30,7 @@ $strupdatesevery = get_string("updatesevery", "moodle", COURSE_LIVELOG_REFRESH); $PAGE->set_url('/course/report/log/live.php', Array('id'=>$course->id)); - $PAGE->set_generaltype('popup'); + $PAGE->set_pagelayout('popup'); $PAGE->set_title("$strlivelogs ($strupdatesevery)"); $PAGE->set_periodic_refresh_delay(COURSE_LIVELOG_REFRESH); $PAGE->set_heading($strlivelogs); diff --git a/course/resources.php b/course/resources.php index b740707fde..6ed85aec7d 100644 --- a/course/resources.php +++ b/course/resources.php @@ -127,7 +127,7 @@ foreach ($cms as $cm) { if (!empty($cm->icon)) { $icon = ' '; } else { - $icon = ' '; + $icon = ' '; } $class = $cm->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed diff --git a/course/view.php b/course/view.php index 7855be202e..6bae6db916 100644 --- a/course/view.php +++ b/course/view.php @@ -90,6 +90,7 @@ } $PAGE->set_url('course/view.php', array('id' => $course->id)); + $PAGE->set_pagelayout('course'); $PAGE->set_pagetype('course-view-' . $course->format); $PAGE->set_other_editing_capability('moodle/course:manageactivities'); @@ -197,7 +198,8 @@ $PAGE->set_title(get_string('course') . ': ' . $course->fullname); $PAGE->set_heading($course->fullname); $PAGE->set_button($buttons); - $PAGE->set_headingmenu(user_login_string($course, $USER)); + //TODO: MDL-21123 this should be done in course page layout, not here with this ugly hack! + //$PAGE->set_headingmenu(user_login_string($course, $USER)); echo $OUTPUT->header(); if ($completion->is_enabled() && ajaxenabled()) { diff --git a/enrol/manual/enrol.php b/enrol/manual/enrol.php index 4f665e1a41..a41cfe123e 100644 --- a/enrol/manual/enrol.php +++ b/enrol/manual/enrol.php @@ -48,7 +48,7 @@ var $errormsg; * @param course current course object */ function print_entry($course) { - global $CFG, $USER, $SESSION, $THEME, $OUTPUT, $PAGE; + global $CFG, $USER, $SESSION, $OUTPUT, $PAGE; $strloginto = get_string('loginto', '', $course->shortname); $strcourses = get_string('courses'); @@ -134,7 +134,7 @@ function print_entry($course) { * @param course the current course, as an object */ function check_entry($form, $course) { - global $CFG, $USER, $SESSION, $THEME; + global $CFG, $USER, $SESSION; if (empty($form->password)) { $form->password = ''; diff --git a/grade/edit/outcome/course.php b/grade/edit/outcome/course.php index a4a625160f..baf1ede4ed 100644 --- a/grade/edit/outcome/course.php +++ b/grade/edit/outcome/course.php @@ -129,7 +129,6 @@ if ($data = data_submitted() and confirm_sesskey()) { /// Print header print_grade_page_head($COURSE->id, 'outcome', 'course'); -check_theme_arrows(); require('course_form.html'); echo $OUTPUT->footer(); diff --git a/grade/edit/tree/index.php b/grade/edit/tree/index.php index 53fbd9d2ff..b85059638a 100644 --- a/grade/edit/tree/index.php +++ b/grade/edit/tree/index.php @@ -36,7 +36,6 @@ $PAGE->requires->yui_lib('element'); $PAGE->requires->yui_lib('container'); $PAGE->requires->yui_lib('animation'); $PAGE->requires->js('grade/edit/tree/functions.js'); -$PAGE->requires->css('/grade/edit/tree/tree.css'); $courseid = required_param('id', PARAM_INT); $action = optional_param('action', 0, PARAM_ALPHA); diff --git a/grade/lib.php b/grade/lib.php index 41f91128f8..45077255c7 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -803,13 +803,12 @@ class grade_plugin_info { * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function * @param string $bodytags Additional attributes that will be added to the tag * @param string $buttons Additional buttons to display on the page - * @param array $extracss An array of additional stylesheets to load (relative paths) * * @return string HTML code or nothing if $return == false */ function print_grade_page_head($courseid, $active_type, $active_plugin=null, $heading = false, $return=false, - $buttons=false, $extracss=array()) { + $buttons=false) { global $CFG, $COURSE, $OUTPUT, $PAGE; $strgrades = get_string('grades'); $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin); @@ -826,13 +825,6 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null, $first_link = $CFG->wwwroot.'/grade/index.php?id='.$COURSE->id; } - if ($active_type == 'preferences') { - $CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css'; - } - - foreach ($extracss as $css_url) { - $CFG->stylesheets[] = $css_url; - } $PAGE->navbar->add($strgrades, $first_link); diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index 6ad521dd7c..3a4213e6a7 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -35,7 +35,6 @@ $toggle = optional_param('toggle', NULL, PARAM_INT); $toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM); $PAGE->set_url('grade/report/grader/index.php', compact('courseid', 'page', 'perpageurl', 'edit', 'sortitemid')); -$PAGE->requires->css('lib/yui/container/assets/skins/sam/container.css'); /// basic access checks if (!$course = $DB->get_record('course', array('id' => $courseid))) { diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 80d7c07c73..4919e84462 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -217,8 +217,8 @@ class grade_report_grader extends grade_report { if ($bounded > $finalgrade) { $errorstr = 'lessthanmin'; } else if ($bounded < $finalgrade) { - $errorstr = 'morethanmax'; - } + $errorstr = 'morethanmax'; + } } if ($errorstr) { $user = $DB->get_record('user', array('id' => $userid), 'id, firstname, lastname'); diff --git a/grade/report/styles.css b/grade/report/styles.css deleted file mode 100644 index d179694d5b..0000000000 --- a/grade/report/styles.css +++ /dev/null @@ -1,4 +0,0 @@ -#content #siteconfiglink { - text-align: right; -} - diff --git a/group/assign.php b/group/assign.php index f2a3d0247e..32381ea2fb 100644 --- a/group/assign.php +++ b/group/assign.php @@ -147,7 +147,6 @@ echo $OUTPUT->header(); -


diff --git a/group/members.php b/group/members.php index 476acc3166..1564460aab 100644 --- a/group/members.php +++ b/group/members.php @@ -87,7 +87,6 @@ $PAGE->set_title("$course->shortname: $strgroups"); $PAGE->set_heading($course->fullname); $PAGE->set_headingmenu(user_login_string($course, $USER)); echo $OUTPUT->header(); -check_theme_arrows(); ?>

diff --git a/help.php b/help.php index bc0b6b3967..cc4eba7f1c 100644 --- a/help.php +++ b/help.php @@ -113,7 +113,7 @@ if(preg_match('~(##emoticons_html##)~', $output, $matches)) { } // Do the main output. -$PAGE->set_generaltype('popup'); +$PAGE->set_pagelayout('popup'); $PAGE->set_title($title); echo $OUTPUT->header(); echo $OUTPUT->box_start(); diff --git a/index.php b/index.php index 1caf8bef33..68a167c12d 100644 --- a/index.php +++ b/index.php @@ -78,17 +78,18 @@ $select = html_select::make_popup_form($CFG->wwwroot .'/index.php', 'lang', $langs, 'chooselang', $currlang); $select->nothinglabel = false; $select->set_label(get_accesshide(get_string('language'))); - $langmenu = $OUTPUT->select($select); + //TODO: MDL-21123 + $langmenu = '
'.$OUTPUT->select($select).'
'; } $PAGE->set_other_editing_capability('moodle/course:manageactivities'); $PAGE->set_url(''); $PAGE->set_docs_path(''); - $PAGE->set_generaltype('home'); + $PAGE->set_pagelayout('home'); $editing = $PAGE->user_is_editing(); $PAGE->set_title($SITE->fullname); $PAGE->set_heading($SITE->fullname); - $PAGE->set_headingmenu(user_login_string($SITE) . $langmenu); - echo $OUTPUT->header(); + $PAGE->set_headingmenu($langmenu); + echo $OUTPUT->header($langmenu); /// Print Section if ($SITE->numsections > 0) { diff --git a/install.php b/install.php index ea5c18f4a2..86882c45d3 100644 --- a/install.php +++ b/install.php @@ -139,10 +139,7 @@ $CFG->lang = $config->lang; $CFG->dirroot = str_replace('\\', '/', dirname(__FILE__)); // Fix for win32 $CFG->libdir = "$CFG->dirroot/lib"; $CFG->wwwroot = install_guess_wwwroot(); // can not be changed - ppl must use the real address when installing -$CFG->themedir = $CFG->dirroot.'/theme'; -$CFG->themewww = $CFG->wwwroot.'/theme'; $CFG->httpswwwroot = $CFG->wwwroot; -$CFG->httpsthemewww = $CFG->wwwroot; $CFG->dataroot = $config->dataroot; $CFG->admin = $config->admin; $CFG->docroot = 'http://docs.moodle.org'; diff --git a/iplookup/index.php b/iplookup/index.php index 1cc15aed11..5db39aed51 100644 --- a/iplookup/index.php +++ b/iplookup/index.php @@ -39,7 +39,7 @@ if (isset($CFG->iplookup)) { } $PAGE->set_url('iplookup/index.php', array('id'=>$ip, 'user'=>$user)); -$PAGE->set_generaltype('popup'); +$PAGE->set_pagelayout('popup'); $info = array($ip); $note = array(); diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 40e7d6521a..a31d5e3a8a 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -304,6 +304,8 @@ $string['configsupportemail'] = 'This email address will be published to users o $string['configsupportname'] = 'This is the name of a person or other entity offering general help via the support email or web address.'; $string['configsupportpage'] = 'This web address will be published to users of this site as the one to go to when they need general help (for example, when new users create their own accounts). If this address is left blank then no link will be supplied.'; $string['configteacherassignteachers'] = 'Should ordinary teachers be allowed to assign other teachers within courses they teach? If \'No\', then only course creators and admins can assign teachers.'; +$string['configthemedesignermode'] = 'All theme images and CSS are cached in browsers and in server for a very long time. Turn on this setting if you are developing or tweaking themes. This setting is also suitable for developers. +You can invalidate all theme caches manually from the theme selection page too. WARNING: enabling of theme designer mode affects the server performance severly!'; $string['configthemelist'] = 'Leave this blank to allow any valid theme to be used. If you want to shorten the theme menu, you can specify a comma-separated list of names here (Don\'t use spaces!). For example: standard,orangewhite.'; $string['configtimezone'] = 'You can set the default timezone here. This is the only the DEFAULT timezone for displaying dates - each user can override this by setting their own in their profile. \"Server time\" here will make Moodle default to the server\'s operating system setting, but \"Server time\" in the user profile will make the user default to this timezone setting. Cronjobs that depend on a time of day to run will use this timezone.'; @@ -851,7 +853,9 @@ $string['tablenosave'] = 'Changes in table above are saved automatically.'; $string['tablesnosave'] = 'Changes in tables above are saved automatically.'; $string['tabselectedtofront'] = 'On tables with tabs, should the row with the currently selected tab be placed at the front'; $string['tabselectedtofronttext'] = 'Bring selected tab row to front'; +$string['themedesignermode'] = 'Theme designer mode'; $string['themelist'] = 'Theme list'; +$string['themeresetcaches'] = 'Invalidate theme caches'; $string['themeselector'] = 'Theme Selector'; $string['themesettings'] = 'Theme settings'; $string['therewereerrors'] = 'There were errors in your data'; diff --git a/lang/en_utf8/theme_standard.php b/lang/en_utf8/theme_standard.php index 5ffdae2bf9..cfaf9c980d 100644 --- a/lang/en_utf8/theme_standard.php +++ b/lang/en_utf8/theme_standard.php @@ -1,5 +1,5 @@ -locate($section); + if ($section === 'upgradesettings') { + $PAGE->set_pagelayout('maintenance'); + } else { + $PAGE->set_pagelayout('admin'); + } + $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); // $PAGE->set_extra_button($extrabutton); TODO @@ -5222,7 +5228,7 @@ function admin_externalpage_setup($section, $extrabutton = '', * @param string $focus focus element */ function admin_externalpage_print_header($focus='') { - global $CFG, $PAGE, $SITE, $THEME, $OUTPUT; + global $CFG, $PAGE, $SITE, $OUTPUT; if (!is_string($focus)) { $focus = ''; // BC compatibility, there used to be adminroot parameter diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php index b4fe79c5ec..86bf646ace 100644 --- a/lib/ajax/ajaxlib.php +++ b/lib/ajax/ajaxlib.php @@ -32,7 +32,7 @@ * @param page_requirements_manager $requires The page_requirements_manager to initialise. */ function setup_core_javascript(page_requirements_manager $requires) { - global $CFG, $OUTPUT; + global $CFG, $OUTPUT, $PAGE; // JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot. // Otherwise, in some situations, users will get warnings about insecure content @@ -41,7 +41,9 @@ function setup_core_javascript(page_requirements_manager $requires) { $config = array( 'wwwroot' => $CFG->httpswwwroot, // Yes, really. See above. 'sesskey' => sesskey(), - 'loadingicon' => $OUTPUT->old_icon_url('i/loading_small') + 'loadingicon' => $OUTPUT->old_icon_url('i/loading_small', 'moodle', false), + 'themerev' => theme_get_revision(), + 'theme' => $PAGE->theme->name, ); if (debugging('', DEBUG_DEVELOPER)) { $config['developerdebug'] = true; @@ -74,7 +76,7 @@ function setup_core_javascript(page_requirements_manager $requires) { * * Typical useage would be *
- *     $PAGE->requires->css('mod/mymod/styles.css');
+ *     $PAGE->requires->css('mod/mymod/userstyles.php?id='.$id); // not overriddable via themes!
  *     $PAGE->requires->js('mod/mymod/script.js');
  *     $PAGE->requires->js('mod/mymod/small_but_urgent.js')->in_head();
  *     $PAGE->requires->js_function_call('init_mymod', array($data))->on_dom_ready();
@@ -148,11 +150,6 @@ class page_requirements_manager {
      * performance. Optional dependencies are not loaded automatically - if you want
      * them you will need to load them first with other calls to this method.
      *
-     * If the YUI library you ask for requires one or more CSS files, and if
-     *  has already been printed, then an exception will be thrown.
-     * Therefore, you are strongly advised to request all the YUI libraries you
-     * will need before output is started.
-     *
      * Even if a particular library is requested more than once (perhaps as a dependancy
      * of other libraries) it will only be linked to once.
      *
@@ -696,10 +693,7 @@ class required_js extends linked_requirement {
  *
  * This class (with the help of {@link ajax_resolve_yui_lib()}) knows about the
  * dependancies between the different YUI libraries, and will include all the
- * other libraries required by the one you ask for. It also knows which YUI
- * libraries require css files. If the library you ask for requires CSS files,
- * then you should ask for it before  is output, or an exception will
- * be thrown.
+ * other libraries required by the one you ask for.
  *
  * By default JavaScript files are included at the end of the HTML.
  * This is recommended practice because it means that the web browser will only
@@ -726,15 +720,10 @@ class required_yui_lib extends linked_requirement {
         parent::__construct($manager, '');
         $this->when = page_requirements_manager::WHEN_AT_END;
 
-        list($jsurls, $cssurls) = ajax_resolve_yui_lib($libname);
+        $jsurls = ajax_resolve_yui_lib($libname);
         foreach ($jsurls as $jsurl) {
             $this->jss[] = $manager->js($jsurl, true);
         }
-        foreach ($cssurls as $cssurl) {
-            // this might be a bit problematic because it requires yui to be
-            // requested before print_header() - this was not required in 1.9.x
-            $manager->css($cssurl, true);
-        }
     }
 
     public function get_html() {
@@ -1150,8 +1139,7 @@ function ajax_generate_script_tag($js) {
 
 
 /**
- * Given the name of a YUI library, return a list of the .js and .css files that
- * it requries.
+ * Given the name of a YUI library, return a list of the .js that it requries.
  *
  * This method takes note of the $CFG->useexternalyui setting.
  *
@@ -1159,10 +1147,8 @@ function ajax_generate_script_tag($js) {
  * the -debug version of the YUI files, otherwise it will return links to the -min versions.
  *
  * @param string $libname the name of a YUI library, for example 'autocomplete'.
- * @return array with two elementes. The first is an array of the JavaScript URLs
- *      that must be loaded to make this library work, in the order they should be
- *      loaded. The second element is a (possibly empty) list of CSS files that
- *      need to be loaded.
+ * @return an array of the JavaScript URLs that must be loaded to make this library work,
+ *      in the order they should be loaded.
  */
 function ajax_resolve_yui_lib($libname) {
     global $CFG;
@@ -1171,99 +1157,53 @@ function ajax_resolve_yui_lib($libname) {
     // because another part of the code may later ask for other bits. It is easier, and
     // not very inefficient, just to always use (and get browsers to cache) the combined file.
     static $translatelist = array(
-        'yahoo' => 'yahoo-dom-event',
-        'animation' => array('yahoo-dom-event', 'animation'),
-        'autocomplete' => array(
-                'js' => array('yahoo-dom-event', 'datasource', 'autocomplete'),
-                'css' => array('autocomplete/assets/skins/sam/autocomplete.css')),
-        'button' => array(
-                'js' => array('yahoo-dom-event', 'element', 'button'),
-                'css' => array('button/assets/skins/sam/button.css')),
-        'calendar' => array(
-                'js' => array('yahoo-dom-event', 'calendar'),
-                'css' => array('calendar/assets/skins/sam/calendar.css')),
-        'carousel' => array(
-                'js' => array('yahoo-dom-event', 'element', 'carousel'),
-                'css' => array('carousel/assets/skins/sam/carousel.css')),
-        'charts' => array('yahoo-dom-event', 'element', 'datasource', 'json', 'charts'),
-        'colorpicker' => array(
-                'js' => array('utilities', 'slider', 'colorpicker'),
-                'css' => array('colorpicker/assets/skins/sam/colorpicker.css')),
-        'connection' => array('yahoo-dom-event', 'connection'),
-        'container' => array(
-                'js' => array('yahoo-dom-event', 'container'),
-                'css' => array('container/assets/skins/sam/container.css')),
-        'cookie' => array('yahoo-dom-event', 'cookie'),
-        'datasource' => array('yahoo-dom-event', 'datasource'),
-        'datatable' => array(
-                'js' => array('yahoo-dom-event', 'element', 'datasource', 'datatable'),
-                'css' => array('datatable/assets/skins/sam/datatable.css')),
-        'dom' => 'yahoo-dom-event',
-        'dom-event' => 'yahoo-dom-event',
-        'dragdrop' => array('yahoo-dom-event', 'dragdrop'),
-        'editor' => array(
-                'js' => array('yahoo-dom-event', 'element', 'container', 'menu', 'button', 'editor'),
-                'css' => array('assets/skins/sam/skin.css')),
-        'element' => array('yahoo-dom-event', 'element'),
-        'event' => 'yahoo-dom-event',
-        'get' => array('yahoo-dom-event', 'get'),
-        'history' => array('yahoo-dom-event', 'history'),
-        'imagecropper' => array(
-                'js' => array('yahoo-dom-event', 'dragdrop', 'element', 'resize', 'imagecropper'),
-                'css' => array('assets/skins/sam/resize.css', 'assets/skins/sam/imagecropper.css')),
-        'imageloader' => array('yahoo-dom-event', 'imageloader'),
-        'json' => array('yahoo-dom-event', 'json'),
-        'layout' => array(
-                'js' => array('yahoo-dom-event', 'dragdrop', 'element', 'layout'),
-                'css' => array('reset-fonts-grids/reset-fonts-grids.css', 'assets/skins/sam/layout.css')),
-        'logger' => array(
-                'js' => array('yahoo-dom-event', 'logger'),
-                'css' => array('logger/assets/skins/sam/logger.css')),
-        'menu' => array(
-                'js' => array('yahoo-dom-event', 'container', 'menu'),
-                'css' => array('menu/assets/skins/sam/menu.css')),
-        'paginator' => array(
-                'js' => array('yahoo-dom-event', 'element', 'paginator'),
-                'css' => array('paginator/assets/skins/sam/paginator.css')),
-        'profiler' => array('yahoo-dom-event', 'profiler'),
+        'yahoo'          => array('yahoo-dom-event'),
+        'animation'      => array('yahoo-dom-event', 'animation'),
+        'autocomplete'   => array('yahoo-dom-event', 'datasource', 'autocomplete'),
+        'button'         => array('yahoo-dom-event', 'element', 'button'),
+        'calendar'       => array('yahoo-dom-event', 'calendar'),
+        'carousel'       => array('yahoo-dom-event', 'element', 'carousel'),
+        'charts'         => array('yahoo-dom-event', 'element', 'datasource', 'json', 'charts'),
+        'colorpicker'    => array('utilities', 'slider', 'colorpicker'),
+        'connection'     => array('yahoo-dom-event', 'connection'),
+        'container'      => array('yahoo-dom-event', 'container'),
+        'cookie'         => array('yahoo-dom-event', 'cookie'),
+        'datasource'     => array('yahoo-dom-event', 'datasource'),
+        'datatable'      => array('yahoo-dom-event', 'element', 'datasource', 'datatable'),
+        'dom'            => array('yahoo-dom-event'),
+        'dom-event'      => array('yahoo-dom-event'),
+        'dragdrop'       => array('yahoo-dom-event', 'dragdrop'),
+        'editor'         => array('yahoo-dom-event', 'element', 'container', 'menu', 'button', 'editor'),
+        'element'        => array('yahoo-dom-event', 'element'),
+        'event'          => array('yahoo-dom-event'),
+        'get'            => array('yahoo-dom-event', 'get'),
+        'history'        => array('yahoo-dom-event', 'history'),
+        'imagecropper'   => array('yahoo-dom-event', 'dragdrop', 'element', 'resize', 'imagecropper'),
+        'imageloader'    => array('yahoo-dom-event', 'imageloader'),
+        'json'           => array('yahoo-dom-event', 'json'),
+        'layout'         => array('yahoo-dom-event', 'dragdrop', 'element', 'layout'),
+        'logger'         => array('yahoo-dom-event', 'logger'),
+        'menu'           => array('yahoo-dom-event', 'container', 'menu'),
+        'paginator'      => array('yahoo-dom-event', 'element', 'paginator'),
+        'profiler'       => array('yahoo-dom-event', 'profiler'),
         'profilerviewer' => array('yuiloader-dom-event', 'element', 'profiler', 'profilerviewer'),
-        'resize' => array(
-                'js' => array('yahoo-dom-event', 'dragdrop', 'element', 'resize'),
-                'css' => array('assets/skins/sam/resize.css')),
-        'selector' => array('yahoo-dom-event', 'selector'),
-        'simpleeditor' => array(
-                'js' => array('yahoo-dom-event', 'element', 'container', 'simpleeditor'),
-                'css' => array('assets/skins/sam/skin.css')),
-        'slider' => array('yahoo-dom-event', 'gragdrop', 'slider'),
-        'stylesheet' => array('yahoo-dom-event', 'stylesheet'),
-        'tabview' => array(
-                'js' => array('yahoo-dom-event', 'element', 'tabview'),
-                'css' => array('assets/skins/sam/skin.css')),
-        'treeview' => array(
-                'js' => array('yahoo-dom-event', 'treeview'),
-                'css' => array('treeview/assets/skins/sam/treeview.css')),
-        'uploader' => array('yahoo-dom-event', 'element', 'uploader'),
-        'utilities' => array('yahoo-dom-event', 'connection', 'animation', 'dragdrop', 'element', 'get'),
-        'yuiloader' => 'yuiloader',
-        'yuitest' => array(
-                'js' => array('yahoo-dom-event', 'logger', 'yuitest'),
-                'css' => array('logger/assets/logger.css', 'yuitest/assets/testlogger.css')),
+        'resize'         => array('yahoo-dom-event', 'dragdrop', 'element', 'resize'),
+        'selector'       => array('yahoo-dom-event', 'selector'),
+        'simpleeditor'   => array('yahoo-dom-event', 'element', 'container', 'simpleeditor'),
+        'slider'         => array('yahoo-dom-event', 'gragdrop', 'slider'),
+        'stylesheet'     => array('yahoo-dom-event', 'stylesheet'),
+        'tabview'        => array('yahoo-dom-event', 'element', 'tabview'),
+        'treeview'       => array('yahoo-dom-event', 'treeview'),
+        'uploader'       => array('yahoo-dom-event', 'element', 'uploader'),
+        'utilities'      => array('yahoo-dom-event', 'connection', 'animation', 'dragdrop', 'element', 'get'),
+        'yuiloader'      => array('yuiloader'),
+        'yuitest'        => array('yahoo-dom-event', 'logger', 'yuitest'),
     );
     if (!isset($translatelist[$libname])) {
         throw new coding_exception('Unknown YUI library ' . $libname);
     }
 
-    $data = $translatelist[$libname];
-    if (!is_array($data)) {
-        $jsnames = array($data);
-        $cssfiles = array();
-    } else if (isset($data['js']) && isset($data['css'])) {
-        $jsnames = $data['js'];
-        $cssfiles = $data['css'];
-    } else {
-        $jsnames = $data;
-        $cssfiles = array();
-    }
+    $jsnames = $translatelist[$libname];
 
     $debugging = debugging('', DEBUG_DEVELOPER);
     if ($debugging) {
@@ -1294,12 +1234,7 @@ function ajax_resolve_yui_lib($libname) {
         }
     }
 
-    $cssurls = array();
-    foreach ($cssfiles as $css) {
-        $cssurls[] = $libpath . $css;
-    }
-
-    return array($jsurls, $cssurls);
+    return $jsurls;
 }
 
 /**
diff --git a/lib/ajax/simpletest/testajaxlib.php b/lib/ajax/simpletest/testajaxlib.php
index d235f5a5c3..0d7d8dc50d 100644
--- a/lib/ajax/simpletest/testajaxlib.php
+++ b/lib/ajax/simpletest/testajaxlib.php
@@ -296,22 +296,6 @@ class page_requirements_manager_test extends ajaxlib_unit_test_base {
         $this->assertTrue($this->requires->is_top_of_body_done());
     }
 
-    public function test_requiring_css() {
-        global $CFG;
-        $cssfile = 'theme/standard/styles_layout.css'; // Just needs to be a CSS file that exists.
-        $this->requires->css($cssfile);
-
-        $html = $this->requires->get_head_code();
-        $this->assertContains($html, $CFG->httpswwwroot . '/' . $cssfile);
-    }
-
-    public function test_nonexistant_css_throws_exception() {
-        $cssfile = 'css/file/that/does/not/exist.css';
-
-        $this->expectException();
-        $this->requires->css($cssfile);
-    }
-
     public function test_requiring_js() {
         global $CFG;
         $jsfile = 'lib/javascript-static.js'; // Just needs to be a JS file that exists.
@@ -331,10 +315,10 @@ class page_requirements_manager_test extends ajaxlib_unit_test_base {
     }
 
     public function test_nonexistant_js_throws_exception() {
-        $cssfile = 'js/file/that/does/not/exist.js';
+        $jsfile = 'js/file/that/does/not/exist.js';
 
         $this->expectException();
-        $this->requires->js($cssfile);
+        $this->requires->js($jsfile);
     }
 
     public function test_requiring_skip_link() {
diff --git a/lib/blocklib.php b/lib/blocklib.php
index b6e6489aa5..7bb4d615ea 100644
--- a/lib/blocklib.php
+++ b/lib/blocklib.php
@@ -167,9 +167,9 @@ class block_manager {
      * @return array the internal names of the regions on this page where block may appear.
      */
     public function get_regions() {
-    	if (is_null($this->defaultregion)) {
+        if (is_null($this->defaultregion)) {
             $this->page->initialise_theme_and_output();
-    	}
+        }
         return array_keys($this->regions);
     }
 
@@ -303,7 +303,7 @@ class block_manager {
      * output the blocks anyway, so we are not doing wasted effort.)
      *
      * @param string $region a block region that exists on this page.
-     * @param object $output a moodle_core_renderer. normally the global $OUTPUT.
+     * @param object $output a core_renderer. normally the global $OUTPUT.
      * @return boolean Whether there is anything in this region.
      */
     public function region_has_content($region, $output) {
@@ -781,7 +781,7 @@ class block_manager {
      * Return an array of content objects from a set of block instances
      *
      * @param array $instances An array of block instances
-     * @param moodle_renderer_base The renderer to use.
+     * @param renderer_base The renderer to use.
      * @param string $region the region name.
      * @return array An array of block_content (and possibly block_move_target) objects.
      */
@@ -1056,7 +1056,7 @@ class block_manager {
         }
 
         $editpage = new moodle_page();
-        $editpage->set_generaltype('form');
+        $editpage->set_pagelayout('form');
         $editpage->set_course($this->page->course);
         $editpage->set_context($block->context);
         $editurlbase = str_replace($CFG->wwwroot . '/', '', $this->page->url->out(true));
@@ -1455,11 +1455,11 @@ function blocks_remove_inappropriate($course) {
     return;
     $blockmanager = blocks_get_by_page($page);
 
-    if(empty($blockmanager)) {
+    if (empty($blockmanager)) {
         return;
     }
 
-    if(($pageformat = $page->pagetype) == NULL) {
+    if (($pageformat = $page->pagetype) == NULL) {
         return;
     }
 
diff --git a/lib/configonlylib.php b/lib/configonlylib.php
new file mode 100644
index 0000000000..39132321ad
--- /dev/null
+++ b/lib/configonlylib.php
@@ -0,0 +1,55 @@
+.
+
+/**
+ * Minimalistic library, usable even when no other moodle libs are loaded.
+ *
+ * The only library that gets loaded if you define ABORT_AFTER_CONFIG
+ * before including main config.php. You can resume normal script operation
+ * if you define ABORT_AFTER_CONFIG_CANCEL and require the setup.php
+ *
+ * @package   moodlecore
+ * @copyright 2009 petr Skoda (skodak)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Minimalistic parameter validation function.
+ * Can not use optional param because moodlelib.php is not loaded yet
+ * @param string $name
+ * @param mixed $default
+ * @param string $type
+ * @return mixed
+ */
+function min_optional_param($name, $default, $type) {
+    $value = $default;
+    if (isset($_GET[$name])) {
+        $value = $_GET[$name];
+
+    } else if (isset($_GET['amp;'.$name])) {
+        // very, very, very ugly hack, unforunately $OUTPUT->old_icon_url() is not used properly in javascript code :-(
+        $value = $_GET['amp;'.$name];
+    }
+    switch($type) {
+        case 'INT':      $value = (int)$value; break;
+        case 'SAFEDIR':  $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); break;
+        case 'SAFEPATH': $value = preg_replace('/[^a-zA-Z0-9\/_-]/', '', $value); break;
+        default:         die("Coding error: incorrent parameter type specified ($type).");
+    }
+    return $value;
+}
+
diff --git a/lib/db/install.php b/lib/db/install.php
index 2f210f0c9d..f0e2a73e5d 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'                 => 'standardwhite',
+        'theme'                 => 'standard', //TODO: MDL-20204 replace with some new default theme when implemented
         'filter_multilang_converted' => 1,
         'siteidentifier'        => random_string(32).get_host_from_url($CFG->wwwroot),
         'backup_version'        => 2008111700,
@@ -216,4 +216,6 @@ function xmldb_main_install() {
     set_role_contextlevels($guestrole,          get_default_contextlevels('guest'));
     set_role_contextlevels($userrole,           get_default_contextlevels('user'));
 
+    // init themes
+    set_config('themerev', 1);
 }
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index 9e4d532cc6..6e013c4929 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -20,7 +20,7 @@
 // before any action that may take longer time to finish.
 
 function xmldb_main_upgrade($oldversion) {
-    global $CFG, $THEME, $USER, $DB, $OUTPUT;
+    global $CFG, $USER, $DB, $OUTPUT;
 
     require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
 
diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php
index 05bd527da6..3be437d27a 100644
--- a/lib/deprecatedlib.php
+++ b/lib/deprecatedlib.php
@@ -585,7 +585,7 @@ function get_current_group($courseid, $full = false) {
  * @return void, always throws moodle_exception
  */
 function error($message, $link='') {
-	throw new moodle_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a deprecated function, please call print_error() instead of error()');
+    throw new moodle_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a deprecated function, please call print_error() instead of error()');
 }
 
 
@@ -1720,33 +1720,6 @@ function make_mod_upload_directory($courseid) {
     return make_upload_directory($courseid .'/'. $CFG->moddata);
 }
 
-
-/**
- * This is a slight variatoin on the standard_renderer_factory that uses
- * custom_corners_core_renderer instead of moodle_core_renderer.
- *
- * This generates the slightly different HTML that the custom_corners theme expects.
- *
- * @copyright 2009 Tim Hunt
- * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- * @deprecated Required to make the old $THEME->customcorners setting work.
- */
-class custom_corners_renderer_factory extends standard_renderer_factory {
-    public function __construct($theme) {
-        parent::__construct($theme);
-        global $CFG;
-        require_once($CFG->themedir . '/custom_corners/renderers.php');
-    }
-    /* Implement the subclass method. */
-    public function get_renderer($module, $page, $subtype=null) {
-        if ($module == 'core') {
-            return new custom_corners_core_renderer($page);
-        }
-        return parent::get_renderer($module, $page, $subtype);
-    }
-}
-
-
 /**
  * Used to be used for setting up the theme. No longer used by core code, and
  * should not have been used elsewhere.
@@ -1777,25 +1750,6 @@ function current_theme() {
     return $PAGE->theme->name;
 }
 
-/**
- * This used to be the thing that theme styles.php files used to do all the work.
- * This is now handled differently. You should copy theme/standard/styes.php
- * into your theme.
- *
- * @deprecated
- * @param int $lastmodified Always gets set to now
- * @param int $lifetime The max-age header setting (seconds) defaults to 300
- * @param string $themename The name of the theme to use (optional) defaults to current theme
- * @param string $forceconfig Force a particular theme config (optional)
- * @param string $lang Load styles for the specified language (optional)
- */
-function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $forceconfig='', $lang='') {
-    global $CFG, $PAGE, $THEME, $showdeprecatedstylesheetsetupwarning;
-    $showdeprecatedstylesheetsetupwarning = true;
-    include($CFG->dirroot . '/theme/styles.php');
-    exit;
-}
-
 /**
  * @todo Remove this deprecated function when no longer used
  * @deprecated since Moodle 2.0 - use $PAGE->pagetype instead of the .
@@ -1895,7 +1849,7 @@ function print_heading($text, $deprecated = '', $size = 2, $class = 'main', $ret
 function print_heading_block($heading, $class='', $return=false) {
     global $OUTPUT;
     debugging('print_heading_with_block() has been deprecated. Please change your code to use $OUTPUT->heading().');
-    $output = $OUTPUT->heading($heading, 2, 'headingblock header ' . moodle_renderer_base::prepare_classes($class));
+    $output = $OUTPUT->heading($heading, 2, 'headingblock header ' . renderer_base::prepare_classes($class));
     if ($return) {
         return $output;
     } else {
@@ -2012,6 +1966,13 @@ function print_container_start($clearfix=false, $classes='', $idbase='', $return
     }
 }
 
+/**
+ * Deprecated, now handled automatically in themes
+ */
+function check_theme_arrows() {
+    debugging('check_theme_arrows() has been deprecated, do not use it anymore, it is now automatic.');
+}
+
 /**
  * Simple function to end a container (see above)
  *
@@ -2193,7 +2154,7 @@ function print_footer($course = NULL, $usercourse = NULL, $return = false) {
     // TODO check arguments.
     if (is_string($course)) {
         debugging("Magic values like 'home', 'empty' passed to print_footer no longer have any effect. " .
-                'To achieve a similar effect, call $PAGE->set_generaltype before you call print_header.', DEBUG_DEVELOPER);
+                'To achieve a similar effect, call $PAGE->set_pagelayout before you call print_header.', DEBUG_DEVELOPER);
     } else if (!empty($course->id) && $course->id != $PAGE->course->id) {
         throw new coding_exception('The $course object you passed to print_footer does not match $PAGE->course.');
     }
@@ -3702,8 +3663,6 @@ function build_navigation($extranavlinks, $cm = null) {
  * @return string
  */
 function navmenu($course, $cm=NULL, $targetwindow='self') {
-    global $CFG, $THEME, $USER, $DB, $OUTPUT;
-
     // This function has been deprecated with the creation of the global nav in
     // moodle 2.0
 
@@ -3776,7 +3735,7 @@ function delete_event($id) {
 /**
  * Call this function to hide an event in the calendar table
  * the event will be identified by the id field of the $event object.
- * 
+ *
  * @param object $event An object representing an event from the calendar table. The event will be identified by the id field.
  * @return true
  */
diff --git a/lib/editor/tinymce/editor_styles.css b/lib/editor/tinymce/editor_styles.css
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/lib/editor/tinymce/lib.php b/lib/editor/tinymce/lib.php
index a55ec42ec3..0b93e7996c 100644
--- a/lib/editor/tinymce/lib.php
+++ b/lib/editor/tinymce/lib.php
@@ -74,8 +74,8 @@ class tinymce_texteditor extends texteditor {
         $directionality = get_string('thisdirection');
         $strtime        = get_string('strftimetime');
         $strdate        = get_string('strftimedaydate');
-        $lang           = str_replace('_utf8', '', current_language());     // use more standard language codes
-        $contentcss     = $CFG->themewww.'/'.current_theme().'/styles.php'; // should be customizable
+        $lang           = str_replace('_utf8', '', current_language()); // use more standard language codes
+        $contentcss     = $PAGE->theme->editor_css_url()->out(false, array(), false);
 
         $context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context'];
         if (!empty($options['legacy'])) {
diff --git a/lib/filelib.php b/lib/filelib.php
index f650b69265..3e699678bd 100644
--- a/lib/filelib.php
+++ b/lib/filelib.php
@@ -2068,9 +2068,10 @@ function file_modify_html_header($text) {
     global $CFG;
 
     $stylesheetshtml = '';
-    foreach ($CFG->stylesheets as $stylesheet) {
+/*    foreach ($CFG->stylesheets as $stylesheet) {
+        //TODO: MDL-21120
         $stylesheetshtml .= ''."\n";
-    }
+    }*/
 
     $ufo = '';
     if (filter_is_enabled('filter/mediaplugin')) {
diff --git a/lib/installlib.php b/lib/installlib.php
index 5af8c22bc9..bd4f3b6378 100644
--- a/lib/installlib.php
+++ b/lib/installlib.php
@@ -233,7 +233,7 @@ function install_print_help_page($help) {
     echo '';
     echo '
           
-          
+          
           
           '.get_string('installation','install').'
           
@@ -279,7 +279,7 @@ function install_print_header($config, $stagename, $heading, $stagetext) {
     echo '';
     echo '
           
-          ';
+          ';
 
     $sheets = array('styles_layout', 'styles_fonts', 'styles_color', 'styles_moz');
     $csss = array();
diff --git a/lib/javascript-navigation.js b/lib/javascript-navigation.js
index 1328185c20..be4183b20d 100644
--- a/lib/javascript-navigation.js
+++ b/lib/javascript-navigation.js
@@ -321,7 +321,7 @@ navigation_tree.prototype.move_to_sidebar_popout = function(e) {
             var moveicon = moveto[i].getElementsByTagName('img');
             if (moveicon.length>0) {
                 for (var j=0;j0) {
                 for (var j=0;jlibdir : 'lib');
     } else {
-        list($type, $plugin) = explode('_', $component, 2);
+        if (strpos($component, '_') === false) {
+            $type   = 'mod';
+            $plugin = $component;
+        } else {
+            list($type, $plugin) = explode('_', $component, 2);
+        }
         $path = get_plugin_directory($type, $plugin, $fullpaths);
     }
 
@@ -6747,7 +6745,8 @@ function get_plugin_types($fullpaths=true) {
                       'repository'    => 'repository',
                       'portfolio'     => 'portfolio',
                       'qtype'         => 'question/type',
-                      'qformat'       => 'question/format');
+                      'qformat'       => 'question/format',
+                      'theme'         => 'theme'); // this is a bit hacky, themes may be in dataroot too
 
         $mods = get_plugin_list('mod');
         foreach ($mods as $mod => $moddir) {
@@ -6759,19 +6758,13 @@ function get_plugin_types($fullpaths=true) {
             }
         }
 
-        // do not include themes if in non-standard location
-        if (empty($CFG->themedir) or $CFG->themedir === $CFG->dirroot.'/theme') {
-            $info['theme'] = 'theme';
-        }
-
-        // local is always last
+        // local is always last!
         $info['local'] = 'local';
 
         $fullinfo = array();
         foreach ($info as $type => $dir) {
             $fullinfo[$type] = $CFG->dirroot.'/'.$dir;
         }
-        $fullinfo['theme'] = $CFG->themedir;
     }
 
     return ($fullpaths ? $fullinfo : $info);
@@ -6780,10 +6773,9 @@ function get_plugin_types($fullpaths=true) {
 /**
  * Simplified version of get_list_of_plugins()
  * @param string $plugintype type of plugin
- * @param bool $fullpaths false means relative paths from dirroot
  * @return array name=>fulllocation pairs of plugins of given type
  */
-function get_plugin_list($plugintype, $fullpaths=true) {
+function get_plugin_list($plugintype) {
     global $CFG;
 
     $ignored = array('CVS', '_vti_cnf', 'simpletest', 'db');
@@ -6799,40 +6791,53 @@ function get_plugin_list($plugintype, $fullpaths=true) {
         $plugintype = 'mod';
     }
 
+    $fulldirs = array();
+
     if ($plugintype === 'mod') {
         // mod is an exception because we have to call this function from get_plugin_types()
-        $fulldir = $CFG->dirroot.'/mod';
-        $dir = $fullpaths ? $fulldir : 'mod';
+        $fulldirs[] = $CFG->dirroot.'/mod';
+
+    } else if ($plugintype === 'theme') {
+        // themes are an exception because they may be stored also in dataroot
+        $fulldirs[] = $CFG->dirroot.'/theme';
 
     } else {
-        $fulltypes = get_plugin_types(true);
-        $types     = get_plugin_types($fullpaths);
+        $types = get_plugin_types(true);
         if (!array_key_exists($plugintype, $types)) {
             return array();
         }
-        $fulldir = $fulltypes[$plugintype];
-        $dir     = $types[$plugintype];
+        $fulldir = $types[$plugintype];
         if (!file_exists($fulldir)) {
             return array();
         }
+        $fulldirs[] = $fulldir;
     }
 
     $result = array();
 
-    $items = new DirectoryIterator($fulldir);
-    foreach ($items as $item) {
-        if ($item->isDot() or !$item->isDir()) {
-            continue;
-        }
-        $pluginname = $item->getFilename();
-        if (in_array($pluginname, $ignored)) {
+    //TODO: MDL-20799 add themedir support
+
+    foreach ($fulldirs as $fulldir) {
+        if (!is_dir($fulldir)) {
             continue;
         }
-        if ($pluginname !== clean_param($pluginname, PARAM_SAFEDIR)) {
-            // better ignore plugins with problematic names here
-            continue;
+        $items = new DirectoryIterator($fulldir);
+        foreach ($items as $item) {
+            if ($item->isDot() or !$item->isDir()) {
+                continue;
+            }
+            $pluginname = $item->getFilename();
+            if (in_array($pluginname, $ignored)) {
+                continue;
+            }
+            if ($pluginname !== clean_param($pluginname, PARAM_SAFEDIR)) {
+                // better ignore plugins with problematic names here
+                continue;
+            }
+            $result[$pluginname] = $fulldir.'/'.$pluginname;
+            unset($item);
         }
-        $result[$pluginname] = $dir.'/'.$pluginname;
+        unset($items);
     }
 
     ksort($result);
@@ -6858,14 +6863,8 @@ function get_list_of_plugins($directory='mod', $exclude='', $basedir='') {
     $plugins = array();
 
     if (empty($basedir)) {
-        // This switch allows us to use the appropiate theme directory - and potentialy alternatives for other plugins
-        switch ($directory) {
-            case "theme":
-                $basedir = $CFG->themedir;
-                break;
-            default:
-                $basedir = $CFG->dirroot .'/'. $directory;
-        }
+        // TODO: MDL-20799 megre theme with themedir if defined
+        $basedir = $CFG->dirroot .'/'. $directory;
 
     } else {
         $basedir = $basedir .'/'. $directory;
@@ -6966,37 +6965,37 @@ function plugin_supports($type, $name, $feature, $default=null) {
     $name = clean_param($name, PARAM_SAFEDIR); //bit of extra security
 
     if ($type === 'mod') {
-    	// we need this special case because we support subplugins in modules,
-    	// otherwise it would end up in infinite loop
-    	if ($name === 'NEWMODULE') {
-    		//somebody forgot to rename the module template
-    		return false;
-    	}
-    	include_once("$CFG->dirroot/mod/$name/lib.php");
-    	
+        // we need this special case because we support subplugins in modules,
+        // otherwise it would end up in infinite loop
+        if ($name === 'NEWMODULE') {
+            //somebody forgot to rename the module template
+            return false;
+        }
+        include_once("$CFG->dirroot/mod/$name/lib.php");
+        
         $function = $name.'_supports';
 
     } else {
-    	if ($feature == FEATURE_MOD_SUBPLUGINS) {
-    		//sorry only modules
-    		return false;
-    	}
-	    if (!$dir = get_plugin_directory($type, $name)) {
-	        throw new coding_exception("Unsupported plugin type or name ($type/$name)");
-	    }
-	
-	    $libfile = $dir.'/lib.php';
-	    if (file_exists($libfile)) {
-	    	include_once($libfile);
-	    }
-	
-	    $function = $type.'_'.$name.'_supports';
+        if ($feature == FEATURE_MOD_SUBPLUGINS) {
+            //sorry only modules
+            return false;
+        }
+        if (!$dir = get_plugin_directory($type, $name)) {
+            throw new coding_exception("Unsupported plugin type or name ($type/$name)");
+        }
+    
+        $libfile = $dir.'/lib.php';
+        if (file_exists($libfile)) {
+            include_once($libfile);
+        }
+    
+        $function = $type.'_'.$name.'_supports';
     }
 
     if (function_exists($function)) {
         $supports = $function($feature);
         if (is_null($supports)) {
-        	// plugin does not know - use default
+            // plugin does not know - use default
             return $default;
         } else {
             return $supports;
diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index a803792b3e..38473f7f92 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -433,7 +433,7 @@ class navigation_node {
                 $link->add_class('dimmed');
             }
 
-            if (!empty($CFG->framename) && ($PAGE->generaltype=='topframe' || $CFG->framename!='_top')) {
+            if (!empty($CFG->framename) && ($PAGE->pagelayout=='topframe' || $CFG->framename!='_top')) {
                 $breakoutaction = new breakout_of_frame_action();
                 $link->add_action($breakoutaction);
             }
diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index f9faada944..0ea7661795 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -283,7 +283,7 @@ class html_label extends moodle_html_component {
 
 /**
  * This class hold all the information required to describe a