]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21242 towards removing og yui2 skin sheet from the huge theme css file
authorPetr Skoda <skodak@moodle.org>
Tue, 5 Jan 2010 00:33:15 +0000 (00:33 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 5 Jan 2010 00:33:15 +0000 (00:33 +0000)
lib/outputlib.php
lib/outputrenderers.php

index 983354cfcb51c255fd0afc96a3a7e4e4f76cc44f..8b58ee610cecfacef0bfcbbe1a67c42790f6c180 100644 (file)
@@ -574,17 +574,20 @@ class theme_config {
      * @param bool $encoded false means use & and true use &amp; in URLs
      * @return array of moodle_url
      */
-    public function css_urls() {
+    public function css_urls(moodle_page $page) {
         global $CFG;
 
         $rev = theme_get_revision();
 
+        $urls = array();
+        //TODO: MDL-21242 add here link to full YUI2 skin.css - get the url from the $page->requires instance
+
         if ($rev > -1) {
             $params = array('theme'=>$this->name,'rev'=>$rev);
             if (check_browser_version('MSIE', 5) and !check_browser_version('MSIE', 8)) {
                 $params['type'] = 'ie';
             }
-            return array(new moodle_url($CFG->httpswwwroot.'/theme/styles.php', $params));
+            $urls[] = new moodle_url($CFG->httpswwwroot.'/theme/styles.php', $params);
 
         } else {
             // find out the current CSS and cache it now for 5 seconds
@@ -627,8 +630,9 @@ class theme_config {
             foreach ($css['theme'] as $sheet=>$unused) {
                 $urls[] = new moodle_url($url, array('sheet'=>$sheet, 'theme'=>$this->name, 'type'=>'theme')); // sheet first in order to make long urls easier to read
             }
-            return $urls;
         }
+
+        return $urls;
     }
 
     /**
@@ -643,6 +647,7 @@ class theme_config {
         // legacy YUI2 stylesheets, YUI3 stylesheets are loaded on the fly
         $yui2_sheets = "\n\n/*** Standard YUI2 sheets ***/\n\n";
         $yui2_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui2version/build/assets/skins/sam/skin.css");
+        //TODO: MDL-21242 move this YUI2 CSS hack to css_urls(), the page requirements manager should return the correct yui_combo.php?2.x.x/build/skinks/sam/skin.css
 
         // search for all images in yui2 CSS and serve them through the yui_image.php script
         $css['yui2'][] = preg_replace('/([a-z-]+)\.(png|gif)/', 'yui_image.php?file='.$CFG->yui2version.'/$1.$2', $yui2_sheets);
index 7f9e2606d24dbb0b836c7abb83d874591996ec73..92c98da7afde3e78e078910a0b3b6cec0871f890 100644 (file)
@@ -390,7 +390,7 @@ class core_renderer extends renderer_base {
 
         // Get the theme stylesheet - this has to be always first CSS, this loads also styles.css from all plugins;
         // any other custom CSS can not be overridden via themes and is highly discouraged
-        $urls = $this->page->theme->css_urls();
+        $urls = $this->page->theme->css_urls($this->page);
         foreach ($urls as $url) {
             $this->page->requires->css($url->out(), true);
         }