|
|
(229 intermediate revisions by 8 users not shown) |
Line 1: |
Line 1: |
| {{Moodle 2.0}} | | {{obsolete}} |
|
| |
|
| * '''PROJECT STATE: Proposal'''
| | The text for this page has been deleted because it was out of date and no longer relevant. See [[Themes]] for information on Themes in Moodle. To view the previous text for this page check the history. |
| * '''MAIN TRACKER ISSUE''': n/a
| |
| * '''DISCUSSION AND COMMENTS''': n/a
| |
| * '''AUTHOR''': [[User:Petr Škoda (škoďák)|Petr Škoda (škoďák)]]
| |
| | |
| ''Please note this is a work in progress, do not edit - use page comments instead if needed, thanks.''
| |
| | |
| =Goals=
| |
| The main goals are: | |
| # general simplification of code
| |
| # easier theme customizations
| |
| # allow themes to be stored in dataroot
| |
| # improved performance
| |
| # solve all caching problems
| |
| # base all themes on YUI CSS foundation
| |
| # easy customisation of theme images (similar to smartpix)
| |
| | |
| =Design overview=
| |
| | |
| All theme files will be served through two files ''/theme/styles.php'' and '/'theme/image.php''. If more advanced themes need extra javascript files we could add optional ''/theme/javascript.php'' file.
| |
| | |
| | |
| All CSS style sheets (including YUI, plugin CSS and parents) would be merged into single large CSS file served via the /theme/styles.php file, it would have several parameters:
| |
| * theme - string, theme name
| |
| * rtl - bool, modified style sheet for RTL languages
| |
| * iehack - 6/7, IE would include special IE6/7 incompatibility fixes (this means IE 6 and 7 loads two styles.php instead of one)
| |
| * rev - int, theme revision number stored in main config table, solves all caching problems
| |
| | |
| | |
| The theme config.php would be significantly simplified, the complete list of available options would be:
| |
| * <code>$THEME->parents = array('standard', 'purple');</code> lists all parents top-down, each theme contains full list of parents, this is non-recursive and more flexible specification without any limits
| |
| * <code>$THEME->sheets = array('styles_layout', 'styles_fonts', 'styles_color');</code> the same as before, lists files from current theme directory
| |
| * <code>$THEME->parents_exclude_sheets('standard'=>array('styles_moz'), 'purple'=>array('styles_fonts.css'));</code> it would be also posssible to use ''true'' instead of array in order to specify ''all'' sheets or all sheets in all parents
| |
| * <code>$THEME->plugins_exclude_sheets('mod_book', 'gradereport_grader');</code> - specify individual components that should be excluded from this theme
| |
| * <code>$THEME->layouts = array(...);</code> - the same as before, cascades through parent themes
| |
| * resource and filter hacks $THEME->resource_mp3player_colors, $THEME->filter_mediaplugin_colors
| |
| | |
| | |
| =Implementation=
| |
| | |
| | |
| ==One huge CSS sheet==
| |
| | |
| Each page would only include only one huge style sheet. The URL would be returned from ''theme_get_url($themename, $rtl, $iehack)'' function. All theme URL would be served by a /theme/styles.php script. Page parameters specifying theme name and RTL flag, rev parameter is used for invalidating of browser caches.
| |
| | |
| The CSS concatenation is done from the YUI CSS, styles.css from all plugins and theme CSS. Algorithm is following:
| |
| # YUI CSS
| |
| ## merge all YUI CSS into one file, respect correct order of files
| |
| ## put image placeholders instead of relative links <nowiki>{{yui|someimage}}</nowiki>
| |
| # Plugins CSS
| |
| ## go through all plugins and search for styles.css - put the list into array, use component names as keys, locations as values
| |
| ## filter out excluded sheets specified in current $THEME->plugins_exluded_sheetes
| |
| # Theme CSS
| |
| ## go through all sheets defined in all parents and store all #THEME->sheets in array
| |
| ## filter out excluded sheets specified in current $THEME->parent_exluded_sheetes
| |
| # Resolve real image locations
| |
| ## regex search for <nowiki>{{component|image}}</nowiki>
| |
| ## priority is: current theme, parent themes, then plugin or YUI fodlers
| |
| ## images in web accessible areas are linked directly, images in dataroot would have to go through /theme/image.php?theme=xxx
| |
| | |
| Please note that the current $PAGE->requires->CSS() does not fit this approach, because we can not put it into correct place.
| |
| | |
| ==YUI==
| |
| | |
| ==Backwards compatibility==
| |
| | |
| Limited, the themes would have to be updated to have new options in config.php. Obsoleted themes can be detected by searching for /theme/oldtheme/styles.php, this file will not be present in new themes any more. Moodle core would simply use parent them if already updated or standard theme.
| |
| | |
| Upgrade steps:
| |
| # delete styles.php
| |
| # redefine all config.php options - in majority of cases change parent value to parents array
| |
| # rename styles_ie6.css and styles_ie7.css to styles_layout_ie6.css and styles_layout_ie7.css - each normal sheet may have an extra sheet with _ieX suffix now, these are loaded automatically, excluding is applied based on $THEME->parents_exclude_sheets() info from the current theme
| |
| # rename rtl.css to styles_layout_rtl.css - again each normal style sheet may have extra sheet with _rtl suffix similar to IE hacks sheets
| |
| # delete header.html, footer.html and meta.php - obsoleted by $THEME->layouts option and new layout files
| |
| | |
| In order to minimize confusion during the upgrade, the old themes will be ignored and will be listed os "Incompatible" on the theme selection page - this page is probably the first place admins go in order to diagnose theme problems.
| |
| | |
| =Removed old features=
| |
| # '''sometheme/meta.php''' - used mostly for IE6/7 hacks, custom layouts may be used instead
| |
| # '''pix/smartpix''' - completely obsoleted by new image location resolution algorithm
| |
| # $CFG->themewww, $CFG->themedir and friends - themes can be stored in dataroot, web hosting companies could use shared dirroot without custom themes, the styles.php URLs would be always constructed via some helper functions
| |
| # '''styles.php''' replaced by styles.css, supported in all plugin types - the PHP is not needed because images are specified using <nowiki>{{component|dir/image}}</nowiki> syntax
| |