movement of the blocks is now handled completely seperately on the serverside and on the clientside. This was unavoidable.

This commit is contained in:
cap2501
2006-10-08 20:25:10 +00:00
parent bb781a70c5
commit 9e28e05f62
+18 -9
View File
@@ -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<blockcount;i++){
if(found){
if(found > 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();