Merge branch '44217-27' of git://github.com/samhemelryk/moodle
authorDamyon Wiese <damyon@moodle.com>
Mon, 24 Feb 2014 03:13:38 +0000 (11:13 +0800)
committerDamyon Wiese <damyon@moodle.com>
Mon, 24 Feb 2014 03:13:38 +0000 (11:13 +0800)
auth/cas/auth.php
lib/outputlib.php

index 63f005b..ff06a3a 100644 (file)
@@ -422,6 +422,7 @@ class auth_plugin_cas extends auth_plugin_ldap {
 
         // Test for group creator
         if (!empty($this->config->groupecreators)) {
+            $ldapconnection = $this->ldap_connect();
             if ($this->config->memberattribute_isdn) {
                 if(!($userid = $this->ldap_find_userdn($ldapconnection, $extusername))) {
                     return false;
index 04c6988..600714b 100644 (file)
@@ -774,22 +774,33 @@ class theme_config {
                 $plugins = core_component::get_plugin_list($type);
                 foreach ($plugins as $plugin=>$fulldir) {
                     if (!empty($excludes[$type]) and is_array($excludes[$type])
-                        and in_array($plugin, $excludes[$type])) {
+                            and in_array($plugin, $excludes[$type])) {
                         continue;
                     }
 
-                    $plugincontent = '';
+                    // Add main stylesheet.
                     $sheetfile = "$fulldir/styles.css";
                     if (is_readable($sheetfile)) {
                         $cssfiles['plugins'][$type.'_'.$plugin] = $sheetfile;
                     }
-                    $sheetthemefile = "$fulldir/styles_{$this->name}.css";
-                    if (is_readable($sheetthemefile)) {
-                        $cssfiles['plugins'][$type.'_'.$plugin.'_'.$this->name] = $sheetthemefile;
+
+                    // Create a list of candidate sheets from parents (direct parent last) and current theme.
+                    $candidates = array();
+                    foreach (array_reverse($this->parent_configs) as $parent_config) {
+                        $candidates[] = $parent_config->name;
                     }
+                    $candidates[] = $this->name;
+
+                    // Add the sheets found.
+                    foreach ($candidates as $candidate) {
+                        $sheetthemefile = "$fulldir/styles_{$candidate}.css";
+                        if (is_readable($sheetthemefile)) {
+                            $cssfiles['plugins'][$type.'_'.$plugin.'_'.$candidate] = $sheetthemefile;
+                        }
                     }
                 }
             }
+        }
 
         // find out wanted parent sheets
         $excludes = $this->resolve_excludes('parents_exclude_sheets');