Hi,
I think this is because the select boxes that do the add resource/activity stuff contain things like the section number. The values in these forms relate to the sections as they are when the page is loaded. They don't get updated as the sections are dragged around the page. Hence if you dragged section 1 to section 10 and then tried to add a resource to it the form - which is now in section 10 - still thinks it's in section 1 (so when you create your resource that's where it gets put)
I think the easiest way to solve this (well certainly the way that uses least code
) may be to get the parent div of the select boxes in the two sections being swapped and swap these over too.
This could be done by modifying section_class.prototype.swap_with_section in lib/ajax/section_classes.js as follows
section_class.prototype.swap_with_section = function(sectionIn) {
var tmpStore = null;
thisIndex = main.get_section_index(this);
targetIndex = main.get_section_index(sectionIn);
main.sections[targetIndex] = this;
main.sections[thisIndex] = sectionIn;
this.changeId(targetIndex);
sectionIn.changeId(thisIndex);
if (this.debug) {
YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id);
}
YAHOO.util.DDM.swapNode(this.getEl(), sectionIn.getEl());
// swap the forms around so adding a resource/activity into a section that has moved still works
// question: are we always sure we'll have a form in the section or is it worth testing whether whatever.getEl().getElementsByTagName('form')[0] actually matches an element?
YAHOO.util.DDM.swapNode(this.getEl().getElementsByTagName('form')[0].parentNode, sectionIn.getEl().getElementsByTagName('form')[0].parentNode);
}
I'm not sure if there would be any performance issues with the extra DOM mangling this does? It seems to make things react fractionally slower here. Though my machine isn't massively powerful and even then the difference I'm seeing isn't really that noticable.
Comments?
I should add that the server is using apache with mod_expires commands added to make it cache everything except text and html, so javascript is cached too. Not wise enough to know if this is relevant or not