$temp = new admin_settingpage('ajax', get_string('ajaxuse'));
$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 1));
+ $temp->add(new admin_setting_configcheckbox('useexternalyui', get_string('useexternalyui', 'admin'), get_string('configuseexternalyui', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('disablecourseajax', get_string('disablecourseajax', 'admin'), get_string('configdisablecourseajax', 'admin'),
isset($CFG->disablecourseajax) ? 1 : empty($CFG->enableajax)));
$ADMIN->add('appearance', $temp);
For example: standard,orangewhite.';
$string['configtimezone'] = 'You can set the default timezone here. This is the only the DEFAULT timezone for displaying dates - each user can override this by setting their own in their profile. \"Server time\" here will make Moodle default to the server\'s operating system setting, but \"Server time\" in the user profile will make the user default to this timezone setting. Cronjobs that depend on a time of day to run will use this timezone.';
$string['configunzip'] = 'Indicate the location of your unzip program (Unix only, optional). If specified, this will be used to unpack zip archives on the server. If you leave this blank, then Moodle will use internal routines.';
+$string['configuseexternalyui'] = 'Instead of using local files, use online files available on Yahoo‘s servers.';
$string['configusetags'] = 'Should tags functionality across the site be enabled?';
$string['configvariables'] = 'Variables';
$string['configwarning'] = 'Be careful modifying these settings - strange values could cause problems.';
$string['uploaduserspreview'] = 'Upload users preview';
$string['uploadusersresult'] = 'Upload users results';
$string['upwards'] = 'upwards';
+$string['useexternalyui'] = 'Use online YUI libraries';
$string['usehtmleditor'] = 'Use HTML editor';
$string['useraccountupdated'] = 'User updated';
$string['userbulk'] = 'Bulk user actions';
global $CFG;
$libpath = '';
+ $external_yui = false;
$translatelist = array(
'yui_yahoo' => '/lib/yui/yahoo/yahoo-min.js',
);
if (array_key_exists($libname, $translatelist)) {
- $libpath = $CFG->wwwroot . $translatelist[$libname];
+ // If this is a YUI file and we are using external libraries
+ if (substr($libname, 0, 3) == 'yui' && $CFG->useexternalyui) {
+ $external_yui = true;
+ // Get current version
+ include($CFG->libdir.'/yui/version.php');
+ $libpath = 'http://yui.yahooapis.com/'.$yuiversion.'/build/'.substr($translatelist[$libname], 9);
+ } else {
+ $libpath = $CFG->wwwroot . $translatelist[$libname];
+ }
+
} else {
$libpath = $libname;
}
- $testpath = str_replace($CFG->wwwroot, $CFG->dirroot, $libpath);
- if (!file_exists($testpath)) {
- print_error('require_js: '.$libpath.' - file not found.');
+ // Make sure the file exists if it is local.
+ if ($external_yui === false) {
+ $testpath = str_replace($CFG->wwwroot, $CFG->dirroot, $libpath);
+ if (!file_exists($testpath)) {
+ error('require_js: '.$libpath.' - file not found.');
+ }
}
return $libpath;
--- /dev/null
+<?php
+$yuiversion = '2.5.0';
+?>
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2008072401; // YYYYMMDD = date of the last version bump
+ $version = 2008072402; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20080724)'; // Human-friendly version name