From 03e36e70775681b0f8cf41e767fa90876ffc760c Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 19 Sep 2013 00:19:46 +0100 Subject: [PATCH] MDL-41878 JavaScript: Add an alias for Moodle in the YUI loader --- lib/outputrequirementslib.php | 4 ++-- theme/yui_combo.php | 3 +++ theme/yui_image.php | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 0dbe7bbb985..3c6228203b7 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -219,11 +219,11 @@ class page_requirements_manager { $configname = $this->YUI_config->set_config_source('lib/yui/config/moodle.js'); $this->YUI_config->add_group('moodle', array( 'name' => 'moodle', - 'base' => $CFG->httpswwwroot . '/theme/yui_combo.php'.$sep.'moodle/'.$jsrev.'/', + 'base' => $CFG->httpswwwroot . '/theme/yui_combo.php' . $sep . 'm/' . $jsrev . '/', 'combine' => $this->yui3loader->combine, 'comboBase' => $CFG->httpswwwroot . '/theme/yui_combo.php'.$sep, 'ext' => false, - 'root' => 'moodle/'.$jsrev.'/', // Add the rev to the root path so that we can control caching. + 'root' => 'm/'.$jsrev.'/', // Add the rev to the root path so that we can control caching. 'patterns' => array( 'moodle-' => array( 'group' => 'moodle', diff --git a/theme/yui_combo.php b/theme/yui_combo.php index 47e5e90d97b..26a0edf37c1 100644 --- a/theme/yui_combo.php +++ b/theme/yui_combo.php @@ -81,6 +81,9 @@ foreach ($parts as $part) { } //debug($bits); $version = array_shift($bits); + if ($version === 'm') { + $version = 'moodle'; + } if ($version === 'moodle') { if (count($bits) <= 3) { // This is an invalid module load attempt. diff --git a/theme/yui_image.php b/theme/yui_image.php index 8d2e97a131c..2bb712c23d8 100644 --- a/theme/yui_image.php +++ b/theme/yui_image.php @@ -40,6 +40,9 @@ if ($slashargument = min_get_slash_argument()) { $etag = sha1($path); $parts = explode('/', $path); $version = array_shift($parts); +if ($version === 'm') { + $version = 'moodle'; +} if ($version == 'moodle' && count($parts) >= 3) { $frankenstyle = array_shift($parts); $module = array_shift($parts); -- 2.43.0