}
YAHOO.extend(section_class, YAHOO.util.DDProxy);
+
section_class.prototype.debug = true;
+
section_class.prototype.init_section = function(id, group,config,isDraggable) {
if (!id) { return; } // id would be the html id attribute.
- this.is = 'section';
+ this.is = 'section';
this.sectionId = null; // Section number. This is NOT the section id from
// the database.
this.hidden = false;
this.highlighted = false;
this.showOnly = false;
- this.resources_ul = null;
+ this.resources_ul = null;
this.process_section();
this.viewButton = null;
if (this.resources_ul == null) {
this.resources_ul = document.createElement('ul');
this.resources_ul.className='section';
- this.content_td.insertBefore(this.resources_ul,this.content_td.childNodes[1]);
+ this.content_td.insertBefore(this.resources_ul, this.content_td.childNodes[2]);
}
var resource_count = this.resources_ul.getElementsByTagName('li').length;
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=section&field=move',null,'id='+this.sectionId+'&value='+(target.sectionId-this.sectionId));
//move on front end
- for (var i=loopStart;eval(loopCondition);eval(loopInc)) {
+ for (var i=loopStart; eval(loopCondition); eval(loopInc)) {
if ((main.sections[i] == this)&& !found) {
//enounter with original node
if (this.debug)YAHOO.log("Found Original "+main.sections[i].getEl().id);
if (main.sections[i] == this) {
- found = true;
+ found = true;
}
} else if (main.sections[i] == target) {
break;
} else if (found) {
- //encounter with nodes inbetween
+ //encounter with nodes inbetween
main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
- }
- }
+ }
+ }
}
if (this.debug)YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id);
- YAHOO.util.DDM.swapNode(this.getEl(),sectionIn.getEl());
+ YAHOO.util.DDM.swapNode(this.getEl(), sectionIn.getEl());
}
section_class.prototype.toggle_hide = function(e,target,superficial) {
//update model
if (targetel == null) {
this.resources[this.resources.length] = el;
- } else
+ } else {
for (var i=0;i<resourcecount;i++) {
if (found) {
tempStore = this.resources[i];
this.resources[i] = nextStore;
- nextStore = tempStore;
+ nextStore = tempStore;
if (nextStore != null)
nextStore.update_index(i+1);
nextStore.update_index(i+1);
}
}
-
+ }
+
//update on frontend
if (targetel != null) {
this.resources_ul.insertBefore(el.getEl(),targetel.getEl());
- this.resources_ul.insertBefore(document.createTextNode(''),targetel.getEl());
-
+ this.resources_ul.insertBefore(document.createTextNode(''),targetel.getEl());
} else {
this.resources_ul.appendChild(el.getEl());
this.resources_ul.appendChild(document.createTextNode(" "));
if (i != (this.resources.length-1))
listOutput += ',';
}
-
- if (toReturn)
+ if (toReturn) {
return listOutput;
-
+ }
}
}
resource_class.prototype.delete_button = function() {
- if (this.debug)YAHOO.log("Deleteing "+this.getEl().id+"from parent "+this.parentObj.getEl().id);
+ if (this.debug)YAHOO.log("Deleting "+this.getEl().id+"from parent "+this.parentObj.getEl().id);
if (!confirm(main.getString('deletecheck',main.getString(this.is)+" "+this.id))) {
return false;