Merge branch 'MDL-35230-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Dan Poltawski
2013-01-07 13:41:16 +08:00
2 changed files with 15 additions and 5 deletions
+9 -1
View File
@@ -846,8 +846,11 @@ class theme_config {
/**
* Generate a URL to the file that serves theme JavaScript files.
*
* If we determine that the theme has no relevant files, then we return
* early with a null value.
*
* @param bool $inhead true means head url, false means footer
* @return moodle_url
* @return moodle_url|null
*/
public function javascript_url($inhead) {
global $CFG;
@@ -856,6 +859,11 @@ class theme_config {
$params = array('theme'=>$this->name,'rev'=>$rev);
$params['type'] = $inhead ? 'head' : 'footer';
// Return early if there are no files to serve
if (count($this->javascript_files($params['type'])) === 0) {
return null;
}
if (!empty($CFG->slasharguments) and $rev > 0) {
$url = new moodle_url("$CFG->httpswwwroot/theme/javascript.php");
$url->set_slashargument('/'.$this->name.'/'.$rev.'/'.$params['type'], 'noparam', true);
+6 -4
View File
@@ -393,10 +393,12 @@ class core_renderer extends renderer_base {
}
// Get the theme javascript head and footer
$jsurl = $this->page->theme->javascript_url(true);
$this->page->requires->js($jsurl, true);
$jsurl = $this->page->theme->javascript_url(false);
$this->page->requires->js($jsurl);
if ($jsurl = $this->page->theme->javascript_url(true)) {
$this->page->requires->js($jsurl, true);
}
if ($jsurl = $this->page->theme->javascript_url(false)) {
$this->page->requires->js($jsurl);
}
// Get any HTML from the page_requirements_manager.
$output .= $this->page->requires->get_head_code($this->page, $this);