Added an option for tagging items in sub albums.
This commit is contained in:
parent
10231b5718
commit
5052bfd97a
@ -24,11 +24,23 @@ class BatchTag_Controller extends Controller {
|
|||||||
// Prevent Cross Site Request Forgery
|
// Prevent Cross Site Request Forgery
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
|
|
||||||
// Generate an array of all non-album items in the current album.
|
// Figure out if the contents of sub-albums should also be tagged
|
||||||
$children = ORM::factory("item")
|
$str_tag_subitems = Input::instance()->post("tag_subitems");
|
||||||
->where("parent_id", $this->input->post("item_id"))
|
|
||||||
->where("type !=", "album")
|
$children = "";
|
||||||
->find_all();
|
if ($str_tag_subitems == false) {
|
||||||
|
// Generate an array of all non-album items in the current album.
|
||||||
|
$children = ORM::factory("item")
|
||||||
|
->where("parent_id", $this->input->post("item_id"))
|
||||||
|
->where("type !=", "album")
|
||||||
|
->find_all();
|
||||||
|
} else {
|
||||||
|
// Generate an array of all non-album items in the current album
|
||||||
|
// and any sub albums.
|
||||||
|
$children = ORM::factory("item", $this->input->post("item_id"))
|
||||||
|
->where("type !=", "album")
|
||||||
|
->descendants();
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through each item in the album and make sure the user has
|
// Loop through each item in the album and make sure the user has
|
||||||
// access to view and edit it.
|
// access to view and edit it.
|
||||||
|
@ -43,6 +43,11 @@ class batchtag_theme_Core {
|
|||||||
$label = t("Tag everything in this album:");
|
$label = t("Tag everything in this album:");
|
||||||
$group = $form->group("add_tag")->label("Add Tag");
|
$group = $form->group("add_tag")->label("Add Tag");
|
||||||
$group->input("name")->label($label)->rules("required|length[1,64]");
|
$group->input("name")->label($label)->rules("required|length[1,64]");
|
||||||
|
$group->checkbox("tag_subitems")
|
||||||
|
->label(t("Include sub-albums?"))
|
||||||
|
->value(true)
|
||||||
|
->checked(false);
|
||||||
|
|
||||||
$group->hidden("item_id")->value($item->id);
|
$group->hidden("item_id")->value($item->id);
|
||||||
$group->submit("")->value(t("Add Tag"));
|
$group->submit("")->value(t("Add Tag"));
|
||||||
$block->content->form = $form;
|
$block->content->form = $form;
|
||||||
|
Reference in New Issue
Block a user