From: vyshane Date: Thu, 14 Dec 2006 07:48:40 +0000 (+0000) Subject: Merged from 1.7. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=53a4443bae8b306f8a0c7243a4c22dd53477cc36;p=moodle.git Merged from 1.7. --- diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index c475e2e2f3..6b76cd3f37 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -264,7 +264,20 @@ section_class.prototype.swap_with_section = function(sectionIn) { if (this.debug) { YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id); } + // Swap the sections. YAHOO.util.DDM.swapNode(this.getEl(), sectionIn.getEl()); + + // Sections contain forms to add new resources/activities. These forms + // have not been updated to reflect the new positions of the sections that + // we have swapped. Let's swap the two sections' forms around. + if (this.getEl().getElementsByTagName('form')[0].parentNode + && sectionIn.getEl().getElementsByTagName('form')[0].parentNode) { + + YAHOO.util.DDM.swapNode(this.getEl().getElementsByTagName('form')[0].parentNode, + sectionIn.getEl().getElementsByTagName('form')[0].parentNode); + } else { + YAHOO.log("Swapping sections: form not present in one or both sections", "warn"); + } }