MDL-7574 Applying Matthew Davidson's patch.
This commit is contained in:
@@ -191,17 +191,8 @@
|
||||
echo '<tr id="section-'.$section.'" class="section main'.$sectionstyle.'">';
|
||||
echo '<td class="left side"> </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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user