From: moodler Date: Wed, 26 Jan 2005 14:14:16 +0000 (+0000) Subject: There is a new configuration variable called X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b3f748f655af26177989f9a25580e2649b94f476;p=moodle.git There is a new configuration variable called $THEME->standardsheets that a theme can use to control how much of the standard theme is included before the actual current theme sheets. When true, use all subsheets from "standard" When not existent, use all subsheets from "standard" (this is to help old themes work better out of the box) When false, don't use standard at all When an array of filenames, only use those (in that order). --- diff --git a/theme/standard/README.html b/theme/standard/README.html index 8798cc0902..08e658bfb0 100644 --- a/theme/standard/README.html +++ b/theme/standard/README.html @@ -8,15 +8,8 @@

Programmers working on Moodle should always design for this theme, and add new styles to this theme.

-

Other themes should always reference the style sheet from -this theme before defining their own styles to augment or -replace the standard styles. In this way custom themes -are not as affected by Moodle upgrades.

- - -

The standard stylesheet is: -

-   $CFG->wwwroot/theme/standard/styles.php
-
-

+

By default, these styles are automatically loaded before any other +themes, so that all custom themes need to do is to define their +own styles to augment or overwrite particular standard styles.

+

In this way custom themes are not "left behind" by Moodle upgrades.

diff --git a/theme/standard/config.php b/theme/standard/config.php index bf97fdd211..bbf5dcbedb 100644 --- a/theme/standard/config.php +++ b/theme/standard/config.php @@ -1,7 +1,38 @@ custompix = false; + +/// If true, then this theme must have a "pix" +/// subdirectory that contains copies of all +/// files from the moodle/pix directory, plus a +/// "pix/mod" directory containing all the icons +/// for all the activity modules. +//////////////////////////////////////////////////////////////////////////////// + +$THEME->standardsheets = true; + +/// This variable can be set to an array containing +/// filenames from the *STANDARD* theme. If the +/// array exists, it will be used to choose the +/// files to include in the standard style sheet. +/// When false or non-existent, then no files are used. +/// When true, then ALL standard files are used. +/// This parameter can be used, for example, to prevent +/// having to override too many classes. +/// Note that the trailing .css should not be included +/// eg $THEME->standardsheets = array('styles_layout', 'styles_fonts', +/// 'styles_color', 'styles_moz'); +//////////////////////////////////////////////////////////////////////////////// + + // These colours are not used anymore, so I've set them to -// bright red to help identify where they should be removed +// bright green to help identify where they should be removed +// These lines will be deleted soon $THEME->body = "#22FF22"; // Main page color $THEME->cellheading = "#22FF22"; // Standard headings of big tables @@ -13,8 +44,4 @@ $THEME->highlight = "#22FF22"; // Highlighted text (eg after a search) $THEME->hidden = "#22FF22"; // To color things that are hidden $THEME->autolink = "#22FF22"; // To color auto-generated links (eg glossary) -$THEME->custompix = false; // If true, then this theme must have a "pix" - // subdirectory that contains copies of all - // files from the moodle/pix directory - // See "cordoroyblue" for an up-to-date example. ?> diff --git a/theme/standard/styles.php b/theme/standard/styles.php index e0fdd20ed5..0fe3de775d 100644 --- a/theme/standard/styles.php +++ b/theme/standard/styles.php @@ -4,13 +4,6 @@ /// up any necessary variables, and lets us include raw CSS files. /// The output of this script should be a completely standard CSS file. - -/// These are the stylesheets this theme uses - $subsheets = array('styles_layout.css', 'styles_fonts.css', 'styles_color.css', 'styles_moz.css'); - - -/// There should be no need to touch the following - if (!isset($themename)) { $themename = NULL; } @@ -18,10 +11,24 @@ $nomoodlecookie = true; require_once("../../config.php"); +/// Following lines are just for standard theme/styles.php + if (!isset($THEME->standardsheets) or $THEME->standardsheets === true) { // Use all the sheets we have + $subsheets = array('styles_layout', 'styles_fonts', 'styles_color', 'styles_moz'); + } else if ($THEME->standardsheets === false) { // We can stop right now! + exit; + } else { // Use the provided subset only + $subsheets = $THEME->standardsheets; + } + +/// Normal themes will just use a line like this instead of the above. +/// $subsheets = array('styles_layout', 'styles_fonts', 'styles_color', 'styles_moz'); + +/// There should be no need to touch the following + $lastmodified = filemtime('styles.php'); foreach ($subsheets as $subsheet) { - $lastmodifiedsub = filemtime($subsheet); + $lastmodifiedsub = filemtime($subsheet.'.css'); if ($lastmodifiedsub > $lastmodified) { $lastmodified = $lastmodifiedsub; } @@ -30,7 +37,7 @@ $themeurl = style_sheet_setup($lastmodifiedsub, 600, $themename); foreach ($subsheets as $subsheet) { - include_once($subsheet); + include_once($subsheet.'.css'); } ?>