merge Agasa's mass tagger work (replace tags mode, as opposed to the default of adding)

This commit is contained in:
Shish 2012-09-22 22:58:56 +01:00
parent 01aacdb19c
commit 5c30eab6ad
2 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* /*
* Name: Mass Tagger * Name: Mass Tagger
* Author: Christian Walde <walde.christian@googlemail.com> * Author: Christian Walde <walde.christian@googlemail.com>, contributions by Shish and Agasa
* License: WTFPL * License: WTFPL
* Description: Tag a bunch of images at once * Description: Tag a bunch of images at once
* Documentation: * Documentation:
@ -38,9 +38,19 @@ class MassTagger extends Extension {
$images = array_map( "Image::by_id", $ids ); $images = array_map( "Image::by_id", $ids );
if(isset($_POST['setadd']) &&
$_POST['setadd'] == 'set')
{
foreach($images as $image) {
$image->set_tags($tag);
}
}
else
{
foreach($images as $image) { foreach($images as $image) {
$image->set_tags($tag . " " . $image->get_tag_list()); $image->set_tags($tag . " " . $image->get_tag_list());
} }
}
$page->set_mode("redirect"); $page->set_mode("redirect");
$page->set_redirect(make_link("post/list")); $page->set_redirect(make_link("post/list"));

View File

@ -13,6 +13,7 @@ class MassTaggerTheme extends Themelet {
Click on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images. Click on images to mark them. Use the 'Index Options' in the Board Config to increase the amount of shown images.
<br /> <br />
<input type='hidden' name='ids' id='mass_tagger_ids' /> <input type='hidden' name='ids' id='mass_tagger_ids' />
Set instead of add? <input type='checkbox' name='setadd' value='set' />
<label>Tags: <input type='text' name='tag' /></label> <label>Tags: <input type='text' name='tag' /></label>
<input type='submit' value='Tag Marked Images' /> <input type='submit' value='Tag Marked Images' />