]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from 1.7.
authorvyshane <vyshane>
Fri, 17 Nov 2006 05:54:21 +0000 (05:54 +0000)
committervyshane <vyshane>
Fri, 17 Nov 2006 05:54:21 +0000 (05:54 +0000)
course/format/weeks/format.php
lib/ajax/ajaxlib.php
lib/ajax/section_classes.js

index bf8922403285ece09cc7fcbde11b8c07f79fd37d..beab3a5469dc813b3e07e2c32e1686fd9f305452 100644 (file)
             echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
             echo '<td class="left side">&nbsp;</td>';
 
-            if (!empty($USER->ajax) && $editing) {
+
+            if (ajaxenabled() && $editing) {
                 // Temporarily hide the dates for the weeks. We do it this way
                 // for now. Eventually, we'll have to modify the javascript code
                 // to handle re-calculation of dates when sections are moved
                 $weekperiod = $weekday.' '.$endweekday;
             }
 
+
             echo '<td class="content">';
             if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) {   // Hidden for students
                 echo '<div class="weekdates">'.$weekperiod.' ('.get_string('notavailable').')</div>';
index 19812cadce026a3ac5f563f9a04932832f118b31..b261f38dddf260ab0506ba51a088e6292e3e12a5 100644 (file)
@@ -9,10 +9,7 @@ function require_js($list) {
     global $CFG;
     $output = '';
 
-    if (!check_browser_version('MSIE', 6.0)
-                && !check_browser_version('Firefox', 1.5)
-                && !check_browser_version('Camino', '1.0.2')) {
-        // We still have issues with AJAX in other browsers.
+    if (!ajaxenabled()) {
         return;
     }
 
@@ -45,6 +42,28 @@ function require_js($list) {
 }
 
 
+/**
+ * Returns whether ajax is enabled/allowed or not.
+ */
+function ajaxenabled() {
+
+    global $CFG, $USER;
+
+    if (!check_browser_version('MSIE', 6.0)
+                && !check_browser_version('Firefox', 1.5)
+                && !check_browser_version('Camino', '1.0.2')) {
+        // We still have issues with AJAX in other browsers.
+        return false;
+    }
+
+    if (!empty($CFG->enableajax) && !empty($USER->ajax)) {
+        return true;
+    } else {
+        return false;
+    }
+}
+
+
 /**
  * Used to create view of document to be passed to JavaScript on pageload.
  * We use this class to pass data from PHP to JavaScript.
index 18f8e3630f1328a539208e03c0a18ecd3117ce88..f4b64df50420e39e212b7530f23ed029d482e8b8 100755 (executable)
@@ -306,16 +306,16 @@ section_class.prototype.mk_marker = function() {
         main.connect('POST', 'class=course&field=marker', null, 'value=0');
         this.toggle_highlight();
     }
-}    
+}
 
 section_class.prototype.changeId = function(newId) {                       
     this.sectionId = newId;       
-    this.numberDisplay.firstChild.data = newId;                      
+    this.numberDisplay.firstChild.data = newId;
 
     //main.connectQueue_add('POST','class=section&field=all',null,'id='+newId+"&summary="+main.mk_safe_for_transport(this.summary)+"&sequence="+this.write_sequence_list(true)+'&visible='+(this.hidden?0:1))           
 
     if (main.marker == this) {
-        main.update_marker(this);                   
+        main.update_marker(this);
     }
 }     
 
@@ -392,7 +392,7 @@ section_class.prototype.insert_resource = function(el, targetel) {
     } else {
         if (el.hiddenStored != null) {
             el.toggle_hide(null, null, true, el.hiddenStored);
-            el.hiddenStored = null;                
+            el.hiddenStored = null;
         }
     }
     //update model