From 0f0faced955bee693c52048137aaf06e98540508 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Tue, 13 Oct 2009 03:19:42 +0800 Subject: [PATCH] Updated for new sidebar code. --- modules/batchtag/helpers/batchtag_block.php | 61 +++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 modules/batchtag/helpers/batchtag_block.php diff --git a/modules/batchtag/helpers/batchtag_block.php b/modules/batchtag/helpers/batchtag_block.php new file mode 100644 index 00000000..8bc3afc6 --- /dev/null +++ b/modules/batchtag/helpers/batchtag_block.php @@ -0,0 +1,61 @@ + t("Batch Tag")); + } + + static function get($block_id, $theme) { + $block = ""; + + // Only display on album pages that the user can edit. + $item = $theme->item(); + if (!$item->is_album() || !access::can("edit", $item)) { + return; + } + + switch ($block_id) { + case "batch_tag": + // Make a new sidebar block. + $block = new Block(); + $block->css_id = "g-batch-tag"; + $block->title = t("Batch Tag"); + $block->content = new View("batchtag_block.html"); + + // Make a new form to place in the sidebar block. + $form = new Forge("batchtag/tagitems", "", "post", + array("id" => "g-batch-tag-form")); + $label = t("Tag everything in this album:"); + $group = $form->group("add_tag")->label("Add Tag"); + $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->submit("")->value(t("Add Tag")); + $block->content->batch_tag_form = $form; + + break; + } + return $block; + } +}