}
YAHOO.extend(section_class, YAHOO.util.DDProxy);
-section_class.prototype.debug = false;
+section_class.prototype.debug = true;
section_class.prototype.init_section = function(id, group,config,isDraggable) {
- if (!id) { return; }
+ if (!id) { return; } // id would be the html id attribute.
this.is = 'section';
- this.sectionId = null;
+ this.sectionId = null; // Section number. This is NOT the section id from
+ // the database.
-
- if (!isDraggable) {
+ if (!isDraggable) {
this.initTarget(id,group,config);
this.removeFromGroup('sections');
} else {
this.isTarget = true;
this.resources = [];
- this.numberDisplay = null;
+ this.numberDisplay = null; // Used to display the section number on the top left
+ // of the section. Not used in all course formats.
this.summary = null;
this.content_td = null;
this.hidden = false;
this.getEl().childNodes[0].innerHTML = '';
this.getEl().childNodes[0].appendChild(this.numberDisplay);
- this.sectionId = this.numberDisplay.innerHTML;
+ this.sectionId = this.id.replace(/section-/i, ''); // Okay, we will have to change this if we
+ // ever change the id attributes format
+ // for the sections.
if (this.debug)YAHOO.log("Creating section "+this.getEl().id+" in position "+this.sectionId);
//find/edit resources
this.move_to_section(target);
//add back to resources group
- this.addToGroup('resources');
+ this.addToGroup('resources');
}
section_class.prototype.endDrag = function() {
//nessicary to defeat default action
var sectionCount = main.sections.length;
var found = null;
+this.debug = true;
+
//determine if original is above or below target and adjust loop
var oIndex=main.get_section_index(this);
var tIndex=main.get_section_index(target);
main.connect('post', 'class=resource&field=move', null,
'id='+el.id+'&beforeId='+targetId
- +'§ionId='+this.id.replace(/section-/i, ''));
+ +'§ionId='+this.sectionId);
//if inserting into a hidden resource hide
if (this.hidden) {
var target = YAHOO.util.DDM.getBestMatch(id);
if (this.debug) {
- YAHOO.log("Dropped on section id="+target.id.replace(/section-/i, '')
+ YAHOO.log("Dropped on section id="+target.sectionId
+", el="+this.getEl().id
+", x="+YAHOO.util.Dom.getXY( this.getDragEl() ));
}