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
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){
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();