Skip to content
Browse files

movement of the blocks is now handled completely seperately on the se…

…rverside and on the clientside. This was unavoidable.
  • Loading branch information...
1 parent bb781a7 commit 9e28e05f62e7070bc98b8354ae6d2f9a6780e8cd cap2501 committed
Showing with 18 additions and 9 deletions.
  1. +18 −9 lib/ajax/block_classes.js
View
27 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<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();

0 comments on commit 9e28e05

Please sign in to comment.
Something went wrong with that request. Please try again.