]> git.mjollnir.org Git - moodle.git/commitdiff
There is a new configuration variable called
authormoodler <moodler>
Wed, 26 Jan 2005 14:14:16 +0000 (14:14 +0000)
committermoodler <moodler>
Wed, 26 Jan 2005 14:14:16 +0000 (14:14 +0000)
   $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).

theme/standard/README.html
theme/standard/config.php
theme/standard/styles.php

index 8798cc09020ec5c47cd873e8a09bf040b3bfb75b..08e658bfb05da71fa3df30a246c85aa325f8430e 100644 (file)
@@ -8,15 +8,8 @@
 <p>Programmers working on Moodle should always design for this 
 theme, and add new styles to this theme.</p>
 
-<p>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.</p>
-
-
-<p>The standard stylesheet is:
-<pre>
-   $CFG->wwwroot/theme/standard/styles.php
-</pre>
-</p>
+<p>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.</p>
 
+<p>In this way custom themes are not "left behind" by Moodle upgrades.</p>
index bf97fdd211fa6cc793ab6d9e074dc81ad06d1d13..bbf5dcbedba19c337f2d67311fd5d3df6dbbfd46 100644 (file)
@@ -1,7 +1,38 @@
 <?PHP // $Id$
 
+////////////////////////////////////////////////////////////////////////////////
+/// This file contains a few configuration variables that control 
+/// how Moodle uses this theme.
+////////////////////////////////////////////////////////////////////////////////
+
+$THEME->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.
 ?>
index e0fdd20ed51882f131aac5c16f50e146c028ae9c..0fe3de775da7e59a08433ff9d7a3b91bfff092a1 100644 (file)
@@ -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;
     }
     $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');
     }
 
 ?>