From: vyshane Date: Fri, 2 Feb 2007 06:35:59 +0000 (+0000) Subject: Changed to work with new require_js(). X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f47e1c17519292335463a670d88b90febc97e566;p=moodle.git Changed to work with new require_js(). Related to MDL-7682 and MDL-8374. --- diff --git a/course/view.php b/course/view.php index 434ddda601..f342fb3345 100644 --- a/course/view.php +++ b/course/view.php @@ -123,7 +123,6 @@ // AJAX-capable course format? $CFG->useajax = false; $ajaxformatfile = $CFG->dirroot.'/course/format/'.$course->format.'/ajax.php'; - $meta = ''; $bodytags = ''; if (file_exists($ajaxformatfile)) { @@ -131,14 +130,18 @@ if ($USER->editing && !empty($USER->ajax) && !empty($CFG->enableajax) && $CFG->ajaxcapable) { - if ($meta = require_js(array('yui_yahoo', - 'yui_dom', - 'yui_event', - 'yui_dragdrop', - 'yui_connection'))) { - + if (ajaxenabled()) { + + require_js(array('yui_yahoo', + 'yui_dom', + 'yui_event', + 'yui_dragdrop', + 'yui_connection', + 'ajaxcourse_blocks', + 'ajaxcourse_sections')); + if (debugging('', DEBUG_DEVELOPER)) { - $meta .= require_js(array('yui_logger')); + require_js(array('yui_logger')); $bodytags = 'onload = "javascript: show_logger = function() { @@ -149,6 +152,7 @@ show_logger(); "'; } + // Okay, global variable alert. VERY UGLY. We need to create // this object here before the _print_block() // function is called, since that function needs to set some @@ -162,7 +166,7 @@ $CFG->blocksdrag = $CFG->useajax; // this will add a new class to the header so we can style differently - $PAGE->print_header(get_string('course').': %fullname%', NULL, $meta, $bodytags); + $PAGE->print_header(get_string('course').': %fullname%', NULL, '', $bodytags); // Course wrapper start. echo '
'; @@ -195,22 +199,21 @@ // Include the actual course format. require($CFG->dirroot .'/course/format/'. $course->format .'/format.php'); // Content wrapper end. - echo '
'; + echo "\n\n"; // Use AJAX? if ($CFG->useajax) { // At the bottom because we want to process sections and activities - // after the relevant html has been generated. - if ($jsincludes = require_js(array('ajaxcourse_blocks', - 'ajaxcourse_sections', - 'ajaxcourse'))) { - echo $jsincludes; - $COURSE->javascriptportal->print_javascript($course->id); - } + // after the relevant html has been generated. We're forced to do this + // because of the way in which lib/ajax/ajaxcourse.js is written. + echo '\n"; + + $COURSE->javascriptportal->print_javascript($course->id); } print_footer(NULL, $course); -?> +?> \ No newline at end of file