From 64e5a68d9116f1669bf93a3535cd81a7c50a4f0f Mon Sep 17 00:00:00 2001 From: vyshane Date: Fri, 6 Oct 2006 07:56:37 +0000 Subject: [PATCH] Some fixes for MDL-6674. This should fix moving activities (resources). Thanks to Dan Poltawski for suggestions. --- lib/ajax/section_classes.js | 60 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index c147b00937..934ab51451 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -29,7 +29,7 @@ section_class.prototype.init_section = function(id, group,config,isDraggable) { this.handle = null; } - this.createFrame(); + this.createFrame(); this.isTarget = true; this.resources = []; @@ -341,20 +341,20 @@ section_class.prototype.remove_resource = function(el) { } -section_class.prototype.insert_resource = function(el,targetel) { +section_class.prototype.insert_resource = function(el, targetel) { var resourcecount = this.resources.length; var found = false; var tempStore = nextStore = null; //update in backend - targetId=''; - if (targetel !=null) { - targetId=targetel.id; - } - - main.connect('post','class=resource&field=move',null,'id='+el.id+'&beforeId='+targetId+'§ionId='+this.sectionId); - + targetId = ''; + if (targetel != null) { + targetId = targetel.id; + } + main.connect('post', 'class=resource&field=move', null, + 'id='+el.id+'&beforeId='+targetId + +'§ionId='+this.id.replace(/section-/i, '')); //if inserting into a hidden resource hide if (this.hidden) { @@ -572,40 +572,44 @@ resource_class.prototype.startDrag = function(x, y) { resource_class.prototype.onDragDrop = function(e, ids) { // best fit Id var id=[]; - for (var i=0;i