mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Fix for MDL-6889. See bug report for description.
This commit is contained in:
parent
230a910a0b
commit
3203f10402
1 changed files with 15 additions and 10 deletions
|
@ -12,16 +12,16 @@ function section_class(id,group,config,isDraggable) {
|
|||
}
|
||||
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 {
|
||||
|
@ -33,7 +33,8 @@ section_class.prototype.init_section = function(id, group,config,isDraggable) {
|
|||
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;
|
||||
|
@ -105,7 +106,9 @@ section_class.prototype.process_section = function() {
|
|||
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
|
||||
|
@ -155,7 +158,7 @@ section_class.prototype.onDragDrop = function(e, id) {
|
|||
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
|
||||
|
@ -170,6 +173,8 @@ section_class.prototype.move_to_section = function(target) {
|
|||
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);
|
||||
|
@ -354,7 +359,7 @@ section_class.prototype.insert_resource = function(el, targetel) {
|
|||
|
||||
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) {
|
||||
|
@ -586,7 +591,7 @@ resource_class.prototype.onDragDrop = function(e, ids) {
|
|||
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() ));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue