mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Added a delete all button in the spam folder
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39906 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3d5d9200ca
commit
3c4b53030b
@ -78,6 +78,10 @@ class CommentAdmin extends LeftAndMain {
|
||||
|
||||
$actions->push(new FormAction('deletemarked', 'Delete'));
|
||||
|
||||
if($section == 'spam') {
|
||||
$actions->push(new FormAction('deleteall', 'Delete All'));
|
||||
}
|
||||
|
||||
$form = new Form($this, "EditForm", $fields, $actions);
|
||||
|
||||
return $form;
|
||||
@ -107,6 +111,25 @@ class CommentAdmin extends LeftAndMain {
|
||||
JS;
|
||||
}
|
||||
|
||||
function deleteall() {
|
||||
$numComments = 0;
|
||||
$spam = DataObject::get('PageComment', "PageComment.IsSpam=1");
|
||||
|
||||
if($spam) {
|
||||
$numComments = $spam->Count();
|
||||
|
||||
foreach($spam as $comment) {
|
||||
$comment->delete();
|
||||
}
|
||||
}
|
||||
|
||||
echo <<<JS
|
||||
$('Form_EditForm').getPageFromServer($('Form_EditForm_ID').value);
|
||||
statusMessage("Deleted $numComments comments.");
|
||||
JS;
|
||||
|
||||
}
|
||||
|
||||
function spammarked() {
|
||||
$numComments = 0;
|
||||
$folderID = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user