From 2492280cc0ec9eb64a8daeccc7b5698ece7fea66 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 15 Jun 2010 12:52:28 -0700 Subject: Change the item rest update processing to call the item::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. Changed the item::move method so it returns a message to be displayed if the caller chooses. And changed the move controller to display the message returned by the move if the item name was renamed as part of the move. --- modules/gallery/helpers/item.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'modules/gallery/helpers/item.php') diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 15bbe977..6a740de4 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -47,27 +47,28 @@ class item_Core { $orig_name_filename = pathinfo($source->name, PATHINFO_FILENAME); $orig_name_extension = pathinfo($source->name, PATHINFO_EXTENSION); $orig_slug = $source->slug; + $message = ""; for ($i = 0; $i < 5; $i++) { try { $source->save(); if ($orig_name != $source->name) { switch ($source->type) { case "album": - message::info( + $message = t("Album %old_name renamed to %new_name to avoid a conflict", - array("old_name" => $orig_name, "new_name" => $source->name))); + array("old_name" => $orig_name, "new_name" => $source->name)); break; case "photo": - message::info( + $message = t("Photo %old_name renamed to %new_name to avoid a conflict", - array("old_name" => $orig_name, "new_name" => $source->name))); + array("old_name" => $orig_name, "new_name" => $source->name)); break; case "movie": - message::info( + $message = t("Movie %old_name renamed to %new_name to avoid a conflict", - array("old_name" => $orig_name, "new_name" => $source->name))); + array("old_name" => $orig_name, "new_name" => $source->name)); break; } } @@ -95,6 +96,8 @@ class item_Core { if ($target->album_cover_item_id == null) { item::make_album_cover($source); } + + return $message; } static function make_album_cover($item) { -- cgit v1.2.3