diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-06-15 11:38:46 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-06-15 11:38:46 -0700 |
commit | 00c4cb3f6399319326cd3393ee2f15fc8b111088 (patch) | |
tree | be5c2f1cb5b37319dc3bb5dd55ad740b8962b812 | |
parent | 603d4640141a43350f50da747d747456b28fdd93 (diff) |
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.
-rw-r--r-- | modules/gallery/helpers/item_rest.php | 18 |
1 files changed, 10 insertions, 8 deletions
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); |