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

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.
<br />
<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>
<input type='submit' value='Tag Marked Images' />