Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
537ea84
)
'add a second parameter to enable YUI loading from header.html in the themes - MDL...
author
urs_hunkler
<urs_hunkler>
Fri, 9 Feb 2007 13:25:48 +0000
(13:25 +0000)
committer
urs_hunkler
<urs_hunkler>
Fri, 9 Feb 2007 13:25:48 +0000
(13:25 +0000)
lib/ajax/ajaxlib.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/ajax/ajaxlib.php
b/lib/ajax/ajaxlib.php
index
e9eb010
..
689f7a7
100644
(file)
--- a/
lib/ajax/ajaxlib.php
+++ b/
lib/ajax/ajaxlib.php
@@
-17,9
+17,11
@@
* @param $lib - string or array of strings
* string(s) should be the shortname for the library or the
* full path to the library file.
* @param $lib - string or array of strings
* string(s) should be the shortname for the library or the
* full path to the library file.
+ * $add - 1 to return the libraries in lib
+ * not already loaded.
* @return string or false or nothing.
*/
* @return string or false or nothing.
*/
-function require_js($lib='') {
+function require_js($lib=''
, $add = 0
) {
global $CFG;
static $loadlibs = array();
global $CFG;
static $loadlibs = array();
@@
-30,20
+32,29
@@
function require_js($lib='') {
if (!empty($lib)) {
// Add the lib to the list of libs to be loaded, if it isn't already
// in the list.
if (!empty($lib)) {
// Add the lib to the list of libs to be loaded, if it isn't already
// in the list.
- if (is_array($lib)) {
- array_map('require_js', $lib);
- } else {
- $libpath = ajax_get_lib($lib);
+ // if (is_array($lib)) {
+ // array_map('require_js', $lib);
+ // } else {
+ foreach ($lib as $lib1) {
+ // $libpath = ajax_get_lib($lib);
+ $libpath = ajax_get_lib($lib1);
if (array_search($libpath, $loadlibs) === false) {
if (array_search($libpath, $loadlibs) === false) {
- array_push($loadlibs, $libpath);
+ // array_push($loadlibs, $libpath);
+ // array_push($addedlibs, $libpath);
+ $loadlibs[] = $libpath;
+ $addedlibs[] = $libpath;
}
}
}
}
- } else {
+ }
+ // } else {
+ if (empty($lib) || ((!empty($addedlibs)) && ($add != 0))) {
// Return the html needed to load the JavaScript files defined in
// our list of libs to be loaded.
$output = '';
// Return the html needed to load the JavaScript files defined in
// our list of libs to be loaded.
$output = '';
- foreach ($loadlibs as $loadlib) {
+ $thelibs = (!empty($addedlibs)) ? $addedlibs : $loadlibs;
+ // foreach ($loadlibs as $loadlib) {
+ foreach ($thelibs as $loadlib) {
$output .= '<script type="text/javascript" ';
$output .= " src=\"$loadlib\"></script>\n";
if ($loadlib == $CFG->wwwroot.'/lib/yui/logger/logger-min.js') {
$output .= '<script type="text/javascript" ';
$output .= " src=\"$loadlib\"></script>\n";
if ($loadlib == $CFG->wwwroot.'/lib/yui/logger/logger-min.js') {
@@
-194,4
+205,4
@@
class jsportal {
}
}
-?>
\ No newline at end of file
+?>