Merged changes to use new ajaxenabled for MDL-8417
authormoodler <moodler>
Thu, 1 Mar 2007 02:42:16 +0000 (02:42 +0000)
committermoodler <moodler>
Thu, 1 Mar 2007 02:42:16 +0000 (02:42 +0000)
course/format/topics/ajax.php
course/format/weeks/ajax.php
course/view.php

index bea639597d77aeae4999f041975c6b60ac3c5edb..2280eddd8154b13e0fae503de5335e1b812bc498 100644 (file)
@@ -5,5 +5,6 @@
 
 
 $CFG->ajaxcapable = true;
+$CFG->ajaxtestedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111);
 
-?>
\ No newline at end of file
+?>
index bea639597d77aeae4999f041975c6b60ac3c5edb..2280eddd8154b13e0fae503de5335e1b812bc498 100644 (file)
@@ -5,5 +5,6 @@
 
 
 $CFG->ajaxcapable = true;
+$CFG->ajaxtestedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111);
 
-?>
\ No newline at end of file
+?>
index a59e2643482caa60185def8d9d163c6d3635952d..8aa8663c5d3d4831a2b1ffcc2d7f5385334037d7 100644 (file)
 
 
     // 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',
 
     print_footer(NULL, $course);
 
-?>
\ No newline at end of file
+?>