]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7574 Applying Matthew Davidson's patch.
authornicolasconnault <nicolasconnault>
Mon, 27 Aug 2007 16:59:04 +0000 (16:59 +0000)
committernicolasconnault <nicolasconnault>
Mon, 27 Aug 2007 16:59:04 +0000 (16:59 +0000)
course/format/weeks/format.php
lib/ajax/section_classes.js

index d551508198958caade14275334cc0d08baa091ba..f3c35b34f5d56827f8b61f1a765420e9576af5a7 100644 (file)
             echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
             echo '<td class="left side">&nbsp;</td>';
 
-
-            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
-                // around. For now, just hide all the dates to avoid confusion.
-                $weekperiod = '';
-            } else {
-                $weekperiod = $weekday.' - '.$endweekday;
-            }
-
+            $weekperiod = $weekday.' - '.$endweekday;
+            
 
             echo '<td class="content">';
             if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) {   // Hidden for students
index 64b2f107968cf3f0126fb80b210c739e7ed0be10..9c0add90776c56c9280f2d9ac3de4b1bd8aceaae 100755 (executable)
@@ -237,13 +237,15 @@ section_class.prototype.move_to_section = function(target) {
         } else if (main.sections[i] == target) {
             //encounter with target node
             if (this.debug) {
-                YAHOO.log("Found target "+main.sections[i].getEl().id);
-            }
+                               YAHOO.log("Found target "+main.sections[i].getEl().id);
+                       }
+            main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);
             main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
             found = false;
             break;
         } else if (found) {
             //encounter with nodes inbetween
+            main.sections[i].swap_dates(main.sections[eval(loopmodifier)]);
             main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
         }
     }
@@ -878,3 +880,28 @@ resource_class.prototype.onDragDrop = function(e, ids) {
 resource_class.prototype.endDrag = function() {
     // Eliminates default action
 }
+
+section_class.prototype.swap_dates = function(el){
+    var i=0;
+    while(this.getEl().getElementsByTagName("div")[i]) {
+        if (this.getEl().getElementsByTagName("div")[i].className == "weekdates") {
+            var tempdate = this.getEl().getElementsByTagName("div")[i].innerHTML;
+            var permi = i;
+        }
+        i++;
+    }
+
+    var j=0;
+    while(el.getEl().getElementsByTagName("div")[j]) {
+        if (el.getEl().getElementsByTagName("div")[j].className == "weekdates") {
+            var permj = j;
+        }
+        j++;
+    }
+
+    if(tempdate) {
+        this.getEl().getElementsByTagName("div")[permi].innerHTML = el.getEl().getElementsByTagName("div")[permj].innerHTML;
+        el.getEl().getElementsByTagName("div")[permj].innerHTML = tempdate;
+    }
+}
+