Merged from 1.7.
This commit is contained in:
+36
-25
@@ -123,36 +123,43 @@
|
||||
// AJAX-capable course format?
|
||||
$useajax = false;
|
||||
$ajaxformatfile = $CFG->dirroot.'/course/format/'.$course->format.'/ajax.php';
|
||||
$meta = '';
|
||||
$bodytags = '';
|
||||
|
||||
if (file_exists($ajaxformatfile)) {
|
||||
require_once($ajaxformatfile);
|
||||
|
||||
if ($USER->editing && !empty($USER->ajax) && $CFG->ajaxcapable) {
|
||||
$useajax = true;
|
||||
}
|
||||
}
|
||||
$meta = '';
|
||||
$bodytags = '';
|
||||
|
||||
if ($useajax) {
|
||||
$meta = require_js(array('yui_yahoo', 'yui_dom', 'yui_event', 'yui_dragdrop', 'yui_connection'));
|
||||
|
||||
if ($meta = require_js(array('yui_yahoo',
|
||||
'yui_dom',
|
||||
'yui_event',
|
||||
'yui_dragdrop',
|
||||
'yui_connection'))) {
|
||||
|
||||
if (debugging('', DEBUG_DEVELOPER)) { // Need to detect whether we're using ajax too.
|
||||
$meta .= require_js(array('yui_logger'));
|
||||
if (debugging('', DEBUG_DEVELOPER)) {
|
||||
$meta .= require_js(array('yui_logger'));
|
||||
|
||||
$bodytags = 'onLoad = "javascript:
|
||||
show_logger = function() {
|
||||
var logreader = new YAHOO.widget.LogReader();
|
||||
logreader.newestOnTop = false;
|
||||
logreader.setTitle(\'Moodle Debug: YUI Log Console\');
|
||||
};
|
||||
show_logger();
|
||||
"';
|
||||
$bodytags = 'onLoad = "javascript:
|
||||
show_logger = function() {
|
||||
var logreader = new YAHOO.widget.LogReader();
|
||||
logreader.newestOnTop = false;
|
||||
logreader.setTitle(\'Moodle Debug: YUI Log Console\');
|
||||
};
|
||||
show_logger();
|
||||
"';
|
||||
}
|
||||
// Okay, global variable alert. VERY UGLY. We need to create
|
||||
// this object here before the <blockname>_print_block()
|
||||
// function is called, since that function needs to set some
|
||||
// stuff in the javascriptportal object.
|
||||
$COURSE->javascriptportal = new jsportal();
|
||||
$useajax = true;
|
||||
|
||||
} else {
|
||||
$useajax = false;
|
||||
}
|
||||
}
|
||||
// Okay, global variable alert. VERY UGLY. We need to create this object
|
||||
// here before the <blockname>_print_block() function is called, since
|
||||
// that function needs to set some stuff in the javascriptportal object.
|
||||
// Like I said... VERY UGLY.
|
||||
$COURSE->javascriptportal = new jsportal();
|
||||
}
|
||||
|
||||
|
||||
@@ -196,8 +203,12 @@
|
||||
if ($useajax) {
|
||||
// At the bottom because we want to process sections and activities
|
||||
// after the relevant html has been generated.
|
||||
echo require_js(array('ajaxcourse_blocks', 'ajaxcourse_sections', 'ajaxcourse'));
|
||||
$COURSE->javascriptportal->print_javascript($course->id);
|
||||
if ($jsincludes = require_js(array('ajaxcourse_blocks',
|
||||
'ajaxcourse_sections',
|
||||
'ajaxcourse'))) {
|
||||
echo $jsincludes;
|
||||
$COURSE->javascriptportal->print_javascript($course->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user