From 0f103b1c069063a2e6109a0ba7e566104f4ba8fa Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 4 Dec 2008 20:05:58 +0000 Subject: Moving albums around with a drag and drop interface seems to work and preserve the left right pointers. * changed _lock and _unlock to protected methods lock and lock respectively * added a moveTo method on the Item_Model * Corrected the hole closure on delete. * added moveTo on the ORM_MTPP class * Changed the rearrange javascript to do moves with ajax --- modules/rearrange/js/jquery.gallery.rearrange.tree.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'modules/rearrange/js') diff --git a/modules/rearrange/js/jquery.gallery.rearrange.tree.js b/modules/rearrange/js/jquery.gallery.rearrange.tree.js index 09284a25..c423becd 100644 --- a/modules/rearrange/js/jquery.gallery.rearrange.tree.js +++ b/modules/rearrange/js/jquery.gallery.rearrange.tree.js @@ -70,9 +70,19 @@ if(jQuery) (function($){ hoverClass: "droppable-hover", drop: function(ev, ui) { source_element = ui.draggable; - source_parent = source_element.parent(); + source_parent = getParent(source_element); target = ui.element; - alert(source_element.attr("id") + "\n" + target.attr("id")); + + $.ajax({ + url: "rearrange/move/" + source_element.attr("id") + "/" + target.attr("id"), + success: function(data, textStatus) { + collapse(source_parent); + showTree(source_parent, source_parent.attr("id")); + }, + error: function(xhr, textStatus, errorThrown) { + alert("Http Error Code: " + xhr.status + "Text Status: " + textStatus); + } + }); } }); bindTree(c); @@ -168,9 +178,7 @@ if(jQuery) (function($){ showTree(parent, parent.attr("id")); }, error: function(xhr, textStatus, errorThrown) { - alert(xhr.status); - alert(textStatus); - alert(errorThrown); + alert("Http Error Code: " + xhr.status + "Text Status: " + textStatus); }, type: "DELETE" }); -- cgit v1.2.3