add ban-reason to bulk actions delete
This commit is contained in:
parent
1ca5366ee2
commit
b158901f53
@ -86,7 +86,7 @@ class BulkActions extends Extension
|
||||
global $user;
|
||||
|
||||
if ($user->can("delete_image")) {
|
||||
$event->add_action("bulk_delete", "(D)elete", "d", "Delete selected images?", "", 10);
|
||||
$event->add_action("bulk_delete", "(D)elete", "d", "Delete selected images?", $this->theme->render_ban_reason_input(), 10);
|
||||
}
|
||||
|
||||
if ($user->can("bulk_edit_image_tag")) {
|
||||
@ -212,6 +212,12 @@ class BulkActions extends Extension
|
||||
continue;
|
||||
}
|
||||
|
||||
if (class_exists("ImageBan") && isset($_POST['bulk_ban_reason'])) {
|
||||
$reason = $_POST['bulk_ban_reason'];
|
||||
if ($reason) {
|
||||
send_event(new AddImageHashBanEvent($image->hash, $reason));
|
||||
}
|
||||
}
|
||||
send_event(new ImageDeletionEvent($image));
|
||||
$total++;
|
||||
} catch (Exception $e) {
|
||||
|
@ -47,6 +47,15 @@ class BulkActionsTheme extends Themelet
|
||||
$page->add_block($block);
|
||||
}
|
||||
|
||||
public function render_ban_reason_input()
|
||||
{
|
||||
if (class_exists("ImageBan")) {
|
||||
return "<input type='text' name='bulk_ban_reason' placeholder='Ban reason (leave blank to not ban)' />";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public function render_tag_input()
|
||||
{
|
||||
return "<label><input type='checkbox' style='width:13px;' name='bulk_tags_replace' value='true'/>Replace tags</label>" .
|
||||
|
Loading…
x
Reference in New Issue
Block a user