]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21188 removing support for yui pix folders in themes because it is not compatible...
authorPetr Skoda <skodak@moodle.org>
Fri, 25 Dec 2009 14:14:55 +0000 (14:14 +0000)
committerPetr Skoda <skodak@moodle.org>
Fri, 25 Dec 2009 14:14:55 +0000 (14:14 +0000)
lib/ajax/ajaxlib.php
lib/outputlib.php
lib/outputrenderers.php
theme/styles.php
theme/styles_debug.php

index 763b997a4dc3d4782fb12cbd2e0776f350954a82..966665d7f2b76d71005d338f86148eea82b1ff22 100644 (file)
@@ -133,6 +133,8 @@ class page_requirements_manager {
 
         // This file helps to minimise number of http requests
         //$this->yui3loader->comboBase = $CFG->httpswwwroot . '/theme/yuicomboloader.php?';
+
+        $this->yui3loader->load('cssreset', 'cssbase', 'cssfonts', 'cssgrids');       
     }
 
     /**
@@ -463,7 +465,7 @@ class page_requirements_manager {
      * @return string
      */
     protected function get_yui3lib_code() {
-        return $this->yui3loader->script();
+        return $this->yui3loader->css().$this->yui3loader->script();
     }
 
     /**
index 59a62ba25df925493ec9b8b452326e4fd044d5f1..3c0fcb70bf93f4022e5410a61aa9f4920bafff77 100644 (file)
@@ -591,7 +591,7 @@ class theme_config {
             $css = $this->css_content();
             $url = $CFG->httpswwwroot.'/theme/styles_debug.php';
             $urls = array();
-            $urls[] = new moodle_url($url, array('theme'=>$this->name,'type'=>'yui'));
+            $urls[] = new moodle_url($url, array('theme'=>$this->name,'type'=>'yui2'));
             foreach ($css['plugins'] as $plugin=>$unused) {
                 $urls[] = new moodle_url($url, array('theme'=>$this->name,'type'=>'plugin', 'subtype'=>$plugin));
             }
@@ -614,16 +614,10 @@ class theme_config {
     public function css_content() {
         global $CFG;
 
-        $css = array('yui'=>array(), 'plugins'=>array(), 'parents'=>array(), 'theme'=>array());
+        $css = array('yui2'=>array(), 'plugins'=>array(), 'parents'=>array(), 'theme'=>array());
 
-        //YUI sheets
-        $yui_sheets = "/*** YUI3 reset sheets and grids ***/\n\n";
-        $yui_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui3version/cssreset/reset-min.css");
-        $yui_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui3version/cssbase/base-min.css");
-        $yui_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui3version/cssfonts/fonts-min.css");
-        $yui_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui3version/cssgrids/grids-min.css");
-
-        $yui_sheets .= "\n\n/*** Standard YUI2 sheets ***/\n\n";
+        // legacy YUI2 stylesheets, YUI3 stylesheets are loaded on the fly
+        $yui2_sheets = "\n\n/*** Standard YUI2 sheets ***/\n\n";
         $items = new DirectoryIterator("$CFG->libdir/yui/$CFG->yui2version/assets/skins/sam");
         foreach ($items as $item) {
             if ($item->isDot() or !$item->isFile()) {
@@ -633,28 +627,13 @@ class theme_config {
             if (substr($filename, -4) !== '.css') {
                 continue;
             }
-            $yui_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui2version/assets/skins/sam/$filename");
+            $yui2_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui2version/assets/skins/sam/$filename");
         }
         unset($item);
         unset($items);
 
-        $yui_sheets .= "\n\n/*** Standard YUI3 sheets ***/\n\n";
-        $items = new DirectoryIterator("$CFG->libdir/yui/$CFG->yui3version/assets/skins/sam");
-        foreach ($items as $item) {
-            if ($item->isDot() or !$item->isFile()) {
-                continue;
-            }
-            $filename = $item->getFilename();
-            if (substr($filename, -4) !== '.css') {
-                continue;
-            }
-            $yui_sheets .= file_get_contents("$CFG->libdir/yui/$CFG->yui3version/assets/skins/sam/$filename");
-        }
-        unset($item);
-        unset($items);
-
-        $yui_sheets = preg_replace('/([a-z-]+)\.(png|gif)/', '[[pix:yui|$1]]', $yui_sheets);
-        $css['yui'][] = $this->post_process($yui_sheets);
+        $yui2_sheets = preg_replace('/([a-z-]+)\.(png|gif)/', '[[pix:yui2|$1]]', $yui2_sheets);
+        $css['yui2'][] = $this->post_process($yui2_sheets);
 
         // get all plugin sheets
         $excludes = null;
@@ -898,20 +877,9 @@ class theme_config {
             }
             return null;
 
-        } else if ($component === 'yui') {
-            // yui CSS files are parsed automatically and altered on the fly
-            if ($imagefile = $this->image_exists("$this->dir/pix_yui/$image")) {
-                return $imagefile;
-            }
-            foreach (array_reverse($this->parent_configs) as $parent_config) { // base first, the immediate parent last
-                if ($imagefile = $this->image_exists("$parent_config->dir/pix_yui/$image")) {
-                    return $imagefile;
-                }
-            }
-            if ($imagefile = $this->image_exists("$CFG->libdir/yui/$CFG->yui3version/assets/skins/sam/$image")) {
-                // YUI3 takes precedence
-                return $imagefile;
-            }
+        } else if ($component === 'yui2') {
+            // YUI2 is here for legacy reasons only, YUI3 images are not handled here
+            // yui images need to be overriden with CSS using proper selectors
             if ($imagefile = $this->image_exists("$CFG->libdir/yui/$CFG->yui2version/assets/skins/sam/$image")) {
                 return $imagefile;
             }
index 3426b809dd634ff0334b0563c81fedd04638b7b5..6c971bf32288b674e0a42adb977a67e4e22b0fda 100644 (file)
@@ -362,7 +362,7 @@ class core_renderer extends renderer_base {
         // any other custom CSS can not be overridden via themes and is highly discouraged
         $urls = $this->page->theme->css_urls();
         foreach ($urls as $url) {
-            $output .= '<link rel="stylesheet" type="text/css" href="' . $url->out() . '" />' . "\n";
+            $this->page->requires->css($url->out(), true);
         }
 
         // Get the theme javascript
index a68fc2bf91c0fcbab8f1c2a023f3f74ef5bcbf2a..c4ea5204bd2a1d2c5e49454c989396fa24a55385 100644 (file)
@@ -32,7 +32,7 @@ $themename = min_optional_param('theme', 'standard', 'SAFEDIR');
 $type      = min_optional_param('type', 'all', 'SAFEDIR');
 $rev       = min_optional_param('rev', 0, 'INT');
 
-if (!in_array($type, array('all', 'ie', 'editor', 'yui', 'plugins', 'parents', 'theme'))) {
+if (!in_array($type, array('all', 'ie', 'editor', 'yui2', 'plugins', 'parents', 'theme'))) {
     header('HTTP/1.0 404 not found');
     die('Theme was not found, sorry.');
 }
@@ -116,7 +116,7 @@ function send_ie_css($themename, $rev) {
 
     $css = <<<EOF
 /** Unfortunately IE6/7 does not support more than 4096 selectors in one CSS file, which means we have to use some ugly hacks :-( **/
-@import url(styles.php?theme=$themename&rev=$rev&type=yui);
+@import url(styles.php?theme=$themename&rev=$rev&type=yui2);
 @import url(styles.php?theme=$themename&rev=$rev&type=plugins);
 @import url(styles.php?theme=$themename&rev=$rev&type=parents);
 @import url(styles.php?theme=$themename&rev=$rev&type=theme);
index c35903b7a8198866e62750cb26abf2cef4f68ec3..7fc338f9d0eeb4bd49b2e9ae6f6a9f8d1110c94f 100644 (file)
@@ -56,8 +56,8 @@ if ($type === 'editor') {
 
 $css = $theme->css_content();
 
-if ($type === 'yui') {
-    send_uncached_css(reset($css['yui']));
+if ($type === 'yui2') {
+    send_uncached_css(reset($css['yui2']));
 
 } else if ($type === 'plugin') {
     if (isset($css['plugins'][$subtype])) {