diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-04-24 07:12:34 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-04-24 07:12:34 -0700 |
commit | 33d29bb790b04138f3c2d624f32e168595491985 (patch) | |
tree | 02d92c5ceb831b866f187c94a4992c2f5b5e4241 | |
parent | bbb2a3a30c57592b1baed17533bc3a2e7edb2e8a (diff) | |
parent | b57dd202db3c4b007e83aff3df9da7920691d76d (diff) |
Merge branch 'master' of github.com:gallery/gallery3
-rw-r--r-- | .build_number | 2 | ||||
-rw-r--r-- | modules/tag/controllers/admin_tags.php | 25 |
2 files changed, 22 insertions, 5 deletions
diff --git a/.build_number b/.build_number index f5cd72a8..68a5d742 100644 --- a/.build_number +++ b/.build_number @@ -3,4 +3,4 @@ ; process. You don't need to edit it. In fact.. ; ; DO NOT EDIT THIS FILE BY HAND! -build_number=126 +build_number=128 diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index fd82bc92..7a64f7ab 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -85,11 +85,22 @@ class Admin_Tags_Controller extends Admin_Controller { if ($in_place_edit->validate()) { $old_name = $tag->name; - $tag->name = $in_place_edit->value(); + $new_name_or_list = $in_place_edit->value(); + $tag_list = explode(",", $new_name_or_list); + $tag_count = count($tag_list); + + $tag->name = array_shift($tag_list); $tag->save(); - $message = t("Renamed tag <b>%old_name</b> to <b>%new_name</b>", - array("old_name" => $old_name, "new_name" => $tag->name)); + if (!empty($tag_list)) { + $this->_copy_items_for_tags($tag, $tag_list); + $message = t("Split tag <i>%old_name</i> into <i>%tag_list</i>", + array("old_name" => $old_name, "tag_list" => $new_name_or_list)); + } else { + $message = t("Renamed tag <i>%old_name</i> to <i>%new_name</i>", + array("old_name" => $old_name, "new_name" => $tag->name)); + } + message::success($message); log::success("tags", $message); @@ -99,5 +110,11 @@ class Admin_Tags_Controller extends Admin_Controller { } } + private function _copy_items_for_tags($tag, $tag_list) { + foreach ($tag->items() as $item) { + foreach ($tag_list as $new_tag_name) { + tag::add($item, trim($new_tag_name)); + } + } + } } - |