Permalink
Browse files

MDL-7574 Applying Matthew Davidson's patch.

  • Loading branch information...
1 parent ea6f1fd commit 03648520cc854d2f1e2a68a14671bb36a5439569 nicolasconnault committed Aug 27, 2007
Showing with 29 additions and 11 deletions.
  1. +2 −11 course/format/weeks/format.php
  2. +27 −0 lib/ajax/section_classes.js
@@ -198,17 +198,8 @@
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
@@ -239,11 +239,13 @@ section_class.prototype.move_to_section = function(target) {
if (this.debug) {
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)]);
}
}
@@ -877,3 +879,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;
+ }
+}
+

0 comments on commit 0364852

Please sign in to comment.