From c82061391717a746fb61696ff48152b1e907b49c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 4 Feb 2010 08:19:38 -0800 Subject: Don't change the current album when items are dragged to a different album in the album tree. Fixes ticket #959. --- modules/organize/controllers/organize.php | 8 ++++++-- modules/organize/views/organize_tree.html.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 4a4b9f13..8e2c0cee 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -48,8 +48,12 @@ class Organize_Controller extends Controller { access::required("view", $target_album); access::required("add", $target_album); + $source_album = null; foreach (Input::instance()->post("source_ids") as $source_id) { $source = ORM::factory("item", $source_id); + if (empty($source_album)) { // get the source_album + $source_album = $source->parent(); + } if (!$source->contains($target_album)) { access::required("edit", $source); item::move($source, $target_album); @@ -57,8 +61,8 @@ class Organize_Controller extends Controller { } print json_encode( - array("tree" => (string)self::_expanded_tree(ORM::factory("item", 1), $target_album), - "grid" => (string)self::_get_micro_thumb_grid($target_album, 0))); + array("tree" => (string)self::_expanded_tree(ORM::factory("item", 1), $source_album), + "grid" => (string)self::_get_micro_thumb_grid($source_album, 0))); } function rearrange($target_id, $before_or_after) { diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php index 513c0625..49ed01fc 100644 --- a/modules/organize/views/organize_tree.html.php +++ b/modules/organize/views/organize_tree.html.php @@ -15,7 +15,7 @@
  • " ref="id ?>"> - + " ref="id ?>"> title) ?>
  • -- cgit v1.2.3