]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from 1.7.
authorvyshane <vyshane>
Thu, 14 Dec 2006 07:48:40 +0000 (07:48 +0000)
committervyshane <vyshane>
Thu, 14 Dec 2006 07:48:40 +0000 (07:48 +0000)
lib/ajax/section_classes.js

index c475e2e2f3050afdd6effb5c18654c354315a34a..6b76cd3f37525f5d87c0ffb33f4ecdbab49c66aa 100755 (executable)
@@ -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");
+       }
 }