Permalink
Browse files

Switch back to setting nodes as leaves, but fix the drop zone code to

allow dropping on leaves.
  • Loading branch information...
1 parent 9682b7e commit fc6907dcfe35f2341528620ccedf2db02a30d065 @bharat bharat committed Jan 6, 2011
Showing with 8 additions and 5 deletions.
  1. +1 −5 modules/organize/controllers/organize.php
  2. +7 −0 modules/organize/views/organize_frame.html.php
@@ -169,6 +169,7 @@ private function _get_tree($item, $selected) {
"editable" => false,
"expandable" => false,
"id" => $child->id,
+ "leaf" => $child->children_count(array(array("type", "=", "album"))) == 0,
"text" => $child->title,
"nodeType" => "async");
@@ -177,11 +178,6 @@ private function _get_tree($item, $selected) {
$node["children"] = $this->_get_tree($child, $selected);
$node["expanded"] = true;
}
-
- if ($child->children_count(array(array("type", "=", "album"))) == 0) {
- $node["children"] = array();
- $node["expanded"] = true;
- }
$tree[] = $node;
}
return $tree;
@@ -345,6 +345,13 @@
return returnCls;
}
+ // Override Ext.tree.TreeDropZone.getDropPoint so that it allows dropping
+ // on any node. The standard function won't let you drop on leaves, but
+ // in our model we consider an album without sub-albums a leaf.
+ v.dropZone.getDropPoint = function(e, n, dd) {
+ return "append";
+ }
+
v.dropZone.onNodeDrop = function(target, dd, e, data) {
var nodes = data.nodes;
source_ids = [];

0 comments on commit fc6907d

Please sign in to comment.