diff --git a/lib/ajax/ajaxlib.php b/lib/ajax/ajaxlib.php
index e910176f24c..e9eb01055cc 100644
--- a/lib/ajax/ajaxlib.php
+++ b/lib/ajax/ajaxlib.php
@@ -1,19 +1,72 @@
-\n";
+ if ($loadlib == $CFG->wwwroot.'/lib/yui/logger/logger-min.js') {
+ // Special case, we need the CSS too.
+ $output .= 'wwwroot}/lib/yui/logger/assets/logger.css\" />\n";
+ }
+ }
+ return $output;
+ }
+}
+
+
+/**
+ * Get the path to a JavaScript library.
+ * @param $libname - the name of the library whose path we need.
+ * @return string
+ */
+function ajax_get_lib($libname) {
+
+ global $CFG;
+ $libpath = '';
+
$translatelist = array(
'yui_yahoo' => '/lib/yui/yahoo/yahoo-min.js',
'yui_animation' => '/lib/yui/animation/animation-min.js',
@@ -36,18 +89,18 @@ function require_js($list) {
'ajaxcourse' => '/lib/ajax/ajaxcourse.js'
);
- for ($i=0; $iwwwroot.''.$translatelist[$list[$i]]."'>\n";
- if ($translatelist[$list[$i]] == '/lib/yui/logger/logger-min.js') {
- // Special case. We need the css.
- $output .= "";
- }
- } else {
- $output .= "\n";
- }
+ if (array_key_exists($libname, $translatelist)) {
+ $libpath = $CFG->wwwroot . $translatelist[$libname];
+ } else {
+ $libpath = $libname;
}
- return $output;
+
+ $testpath = str_replace($CFG->wwwroot, $CFG->dirroot, $libpath);
+ if (!file_exists($testpath)) {
+ error('require_js: '.$libpath.' - file not found.');
+ }
+
+ return $libpath;
}