From 61c1b4b57327d60540f54d40b0b55269811b14e6 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 1 Mar 2007 02:42:16 +0000 Subject: [PATCH] Merged changes to use new ajaxenabled for MDL-8417 --- course/format/topics/ajax.php | 3 ++- course/format/weeks/ajax.php | 3 ++- course/view.php | 15 ++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/course/format/topics/ajax.php b/course/format/topics/ajax.php index bea639597d..2280eddd81 100644 --- a/course/format/topics/ajax.php +++ b/course/format/topics/ajax.php @@ -5,5 +5,6 @@ $CFG->ajaxcapable = true; +$CFG->ajaxtestedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111); -?> \ No newline at end of file +?> diff --git a/course/format/weeks/ajax.php b/course/format/weeks/ajax.php index bea639597d..2280eddd81 100644 --- a/course/format/weeks/ajax.php +++ b/course/format/weeks/ajax.php @@ -5,5 +5,6 @@ $CFG->ajaxcapable = true; +$CFG->ajaxtestedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111); -?> \ No newline at end of file +?> diff --git a/course/view.php b/course/view.php index a59e264348..8aa8663c5d 100644 --- a/course/view.php +++ b/course/view.php @@ -121,16 +121,21 @@ // AJAX-capable course format? - $CFG->useajax = false; + $CFG->useajax = false; $ajaxformatfile = $CFG->dirroot.'/course/format/'.$course->format.'/ajax.php'; $bodytags = ''; - if (file_exists($ajaxformatfile)) { + if (file_exists($ajaxformatfile)) { // Needs to exist otherwise no AJAX by default + + $CFG->ajaxcapable = false; // May be overridden later by ajaxformatfile + $CFG->ajaxtestedbrowsers = array(); // May be overridden later by ajaxformatfile + require_once($ajaxformatfile); - if ($USER->editing && !empty($USER->ajax) && !empty($CFG->enableajax) && $CFG->ajaxcapable) { + if (!empty($USER->editing) && $CFG->ajaxcapable && has_capability('moodle/course:manageactivities', $context)) { + // Course-based switches - if (ajaxenabled() && has_capability('moodle/course:manageactivities', $context)) { + if (ajaxenabled($CFG->ajaxtestedbrowsers)) { // Browser, user and site-based switches require_js(array('yui_yahoo', 'yui_dom', @@ -216,4 +221,4 @@ print_footer(NULL, $course); -?> \ No newline at end of file +?> -- 2.39.5