From 00c4cb3f6399319326cd3393ee2f15fc8b111088 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 15 Jun 2010 11:38:46 -0700 Subject: Revert "Change the item rest update processing to call the itemm::move(source, target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Also, only change the weights of the album children if the item sort_column is set to weight." This reverts commit 603d4640141a43350f50da747d747456b28fdd93. --- modules/gallery/helpers/item_rest.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index 27542dea..763e586f 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -99,7 +99,7 @@ class item_rest_Core { if ($entity = $request->params->entity) { // Only change fields from a whitelist. foreach (array("album_cover", "captured", "description", - "height", "mime_type", "name", "rand_key", "resize_dirty", + "height", "mime_type", "name", "parent", "rand_key", "resize_dirty", "resize_height", "resize_width", "slug", "sort_column", "sort_order", "thumb_dirty", "thumb_height", "thumb_width", "title", "view_count", "width") as $key) { @@ -112,21 +112,23 @@ class item_rest_Core { } break; + case "parent": + if (property_exists($entity, "parent")) { + $parent = rest::resolve($entity->parent); + access::required("edit", $parent); + $item->parent_id = $parent->id; + } + break; default: if (property_exists($entity, $key)) { $item->$key = $entity->$key; } } } - - $item->save(); - if (property_exists($entity, "parent")) { - $parent = rest::resolve($entity->parent); - item::move($item, $parent); - } } + $item->save(); - if (isset($request->params->members) && $item->sort_column == "weight") { + if (isset($request->params->members)) { $weight = 0; foreach ($request->params->members as $url) { $child = rest::resolve($url); -- cgit v1.2.3