mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +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,14 +12,14 @@ function section_class(id,group,config,isDraggable) {
|
||||||
}
|
}
|
||||||
YAHOO.extend(section_class, YAHOO.util.DDProxy);
|
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) {
|
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.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.initTarget(id,group,config);
|
||||||
|
@ -33,7 +33,8 @@ section_class.prototype.init_section = function(id, group,config,isDraggable) {
|
||||||
this.isTarget = true;
|
this.isTarget = true;
|
||||||
|
|
||||||
this.resources = [];
|
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.summary = null;
|
||||||
this.content_td = null;
|
this.content_td = null;
|
||||||
this.hidden = false;
|
this.hidden = false;
|
||||||
|
@ -105,7 +106,9 @@ section_class.prototype.process_section = function() {
|
||||||
this.getEl().childNodes[0].innerHTML = '';
|
this.getEl().childNodes[0].innerHTML = '';
|
||||||
this.getEl().childNodes[0].appendChild(this.numberDisplay);
|
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);
|
if (this.debug)YAHOO.log("Creating section "+this.getEl().id+" in position "+this.sectionId);
|
||||||
//find/edit resources
|
//find/edit resources
|
||||||
|
@ -170,6 +173,8 @@ section_class.prototype.move_to_section = function(target) {
|
||||||
var sectionCount = main.sections.length;
|
var sectionCount = main.sections.length;
|
||||||
var found = null;
|
var found = null;
|
||||||
|
|
||||||
|
this.debug = true;
|
||||||
|
|
||||||
//determine if original is above or below target and adjust loop
|
//determine if original is above or below target and adjust loop
|
||||||
var oIndex=main.get_section_index(this);
|
var oIndex=main.get_section_index(this);
|
||||||
var tIndex=main.get_section_index(target);
|
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,
|
main.connect('post', 'class=resource&field=move', null,
|
||||||
'id='+el.id+'&beforeId='+targetId
|
'id='+el.id+'&beforeId='+targetId
|
||||||
+'§ionId='+this.id.replace(/section-/i, ''));
|
+'§ionId='+this.sectionId);
|
||||||
|
|
||||||
//if inserting into a hidden resource hide
|
//if inserting into a hidden resource hide
|
||||||
if (this.hidden) {
|
if (this.hidden) {
|
||||||
|
@ -586,7 +591,7 @@ resource_class.prototype.onDragDrop = function(e, ids) {
|
||||||
var target = YAHOO.util.DDM.getBestMatch(id);
|
var target = YAHOO.util.DDM.getBestMatch(id);
|
||||||
|
|
||||||
if (this.debug) {
|
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
|
+", el="+this.getEl().id
|
||||||
+", x="+YAHOO.util.Dom.getXY( this.getDragEl() ));
|
+", x="+YAHOO.util.Dom.getXY( this.getDragEl() ));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue