From 9e28e05f62e7070bc98b8354ae6d2f9a6780e8cd Mon Sep 17 00:00:00 2001 From: cap2501 Date: Sun, 8 Oct 2006 20:25:10 +0000 Subject: [PATCH] movement of the blocks is now handled completely seperately on the serverside and on the clientside. This was unavoidable. --- lib/ajax/block_classes.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/ajax/block_classes.js b/lib/ajax/block_classes.js index d7a48f1734..a8072d0a42 100644 --- a/lib/ajax/block_classes.js +++ b/lib/ajax/block_classes.js @@ -251,6 +251,11 @@ block_class.prototype.update_index = function(index,columnId){ if(this.debug)YAHOO.log("updating position of "+this.getEl().id+" to index "+index+" on column "+columnId); } +block_class.prototype.updatePosition = function(index,columnId){ + //update the db for the position + main.connectQueue_add('post','class=block&field=position',null,'value='+index+'&column='+columnId+'&instanceId='+this.instanceId); + if(this.debug)YAHOO.log("updating position of "+this.getEl().id+" to index "+index+" on column "+columnId); + } /* * column class, DD targets @@ -300,27 +305,31 @@ column_class.prototype.add_block = function(el){ column_class.prototype.insert_block = function(el,targetel){ var blockcount = this.blocks.length; - var found = false; + var found = -1; var tempStore = nextStore = null; for(var i=0;i 0){ tempStore = this.blocks[i]; this.blocks[i] = nextStore; nextStore = tempStore; }else if(this.blocks[i] == targetel){ - found = true; + found = i; nextStore = this.blocks[i]; this.blocks[i] = el; blockcount++; - } - this.blocks[i].update_index(i,this.ident); + } + //this.blocks[i].update_index(i,this.ident); } - if(!found){//insert at end - el.update_index(this.blocks.length,this.ident); - this.add_block(el); + if(found<0){//insert at end + //el.update_index(this.blocks.length,this.ident); + found = this.blocks.length; + this.add_block(el); + } + + el.updatePosition(found,this.ident); } column_class.prototype.has_block = function(el){ @@ -341,7 +350,7 @@ column_class.prototype.remove_block = function(el){ found = true; if(i < blockcount-1){ - this.blocks[i+1].update_index(i,this.ident); + //this.blocks[i+1].update_index(i,this.ident); this.blocks[i] = this.blocks[i+1]; }else{ this.blocks.pop(); -- 2.39.5