diff options
| author | Chad Kieffer <ckieffer@gmail.com> | 2011-04-24 11:56:12 -0400 | 
|---|---|---|
| committer | Chad Kieffer <ckieffer@gmail.com> | 2011-04-24 11:56:12 -0400 | 
| commit | 90458673f41ede656b6e2ad07c8545b2450c8e41 (patch) | |
| tree | 187668d2d7990d9e7d9621f7c5c3bd231165056d /modules/tag/controllers | |
| parent | b4cdd016dc97f2df608bb14d2088cb4ddbd32c35 (diff) | |
| parent | bbd5417fef9c3ad28c6e57cb787e86684f49a71b (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/tag/controllers')
| -rw-r--r-- | modules/tag/controllers/admin_tags.php | 25 | 
1 files changed, 21 insertions, 4 deletions
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)); +      } +    } +  }  } -  | 
