mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
Change moderation labels
This commit is contained in:
parent
1410702fce
commit
086dd03b5c
@ -52,7 +52,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
|
|
||||||
$newGrid = new GridField(
|
$newGrid = new GridField(
|
||||||
'NewComments',
|
'NewComments',
|
||||||
_t('CommentsAdmin.NewComments', 'Unmoderated'),
|
_t('CommentsAdmin.NewComments', 'New'),
|
||||||
$newComments,
|
$newComments,
|
||||||
$commentsConfig
|
$commentsConfig
|
||||||
);
|
);
|
||||||
@ -61,7 +61,7 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
|
|
||||||
$approvedGrid = new GridField(
|
$approvedGrid = new GridField(
|
||||||
'ApprovedComments',
|
'ApprovedComments',
|
||||||
_t('CommentsAdmin.ApprovedComments', 'Displayed'),
|
_t('CommentsAdmin.ApprovedComments', 'Approved'),
|
||||||
$approvedComments,
|
$approvedComments,
|
||||||
$commentsConfig
|
$commentsConfig
|
||||||
);
|
);
|
||||||
@ -82,10 +82,10 @@ class CommentAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
$root = new TabSet(
|
$root = new TabSet(
|
||||||
'Root',
|
'Root',
|
||||||
new Tab('NewComments', _t('CommentAdmin.NewComments', 'Unmoderated') . ' ' . $newCount,
|
new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount,
|
||||||
$newGrid
|
$newGrid
|
||||||
),
|
),
|
||||||
new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Displayed') . ' ' . $approvedCount,
|
new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount,
|
||||||
$approvedGrid
|
$approvedGrid
|
||||||
),
|
),
|
||||||
new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
|
new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
|
||||||
|
@ -44,7 +44,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
|||||||
$field .= GridField_FormAction::create(
|
$field .= GridField_FormAction::create(
|
||||||
$gridField,
|
$gridField,
|
||||||
'CustomAction' . $record->ID,
|
'CustomAction' . $record->ID,
|
||||||
'Mark As Spam',
|
'Spam',
|
||||||
'spam',
|
'spam',
|
||||||
array('RecordID' => $record->ID)
|
array('RecordID' => $record->ID)
|
||||||
)->Field();
|
)->Field();
|
||||||
@ -52,8 +52,8 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
|||||||
$field .= GridField_FormAction::create(
|
$field .= GridField_FormAction::create(
|
||||||
$gridField,
|
$gridField,
|
||||||
'CustomAction' . $record->ID,
|
'CustomAction' . $record->ID,
|
||||||
'Mark As Not Spam',
|
'Approve',
|
||||||
'not_spam',
|
'approve',
|
||||||
array('RecordID' => $record->ID)
|
array('RecordID' => $record->ID)
|
||||||
)->Field();
|
)->Field();
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getActions($gridField) {
|
public function getActions($gridField) {
|
||||||
return array('spam', 'not_spam');
|
return array('spam', 'approve');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +85,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($actionName == 'not_spam') {
|
if($actionName == 'approve') {
|
||||||
$comment = Comment::get()->byID($arguments["RecordID"]);
|
$comment = Comment::get()->byID($arguments["RecordID"]);
|
||||||
|
|
||||||
$comment->Moderated = true;
|
$comment->Moderated = true;
|
||||||
@ -95,7 +95,7 @@ class CommentsGridFieldAction implements GridField_ColumnProvider, GridField_Act
|
|||||||
// output a success message to the user
|
// output a success message to the user
|
||||||
Controller::curr()->getResponse()->setStatusCode(
|
Controller::curr()->getResponse()->setStatusCode(
|
||||||
200,
|
200,
|
||||||
'Comment marked as not spam.'
|
'Comment approved.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @package comments
|
* @package comments
|
||||||
*/
|
*/
|
||||||
class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler {
|
class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,22 +13,22 @@ class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler {
|
|||||||
* @package comments
|
* @package comments
|
||||||
*/
|
*/
|
||||||
class CommentsGridFieldBulkAction_Handlers extends CommentsGridFieldBulkAction {
|
class CommentsGridFieldBulkAction_Handlers extends CommentsGridFieldBulkAction {
|
||||||
|
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'markAsSpam',
|
'spam',
|
||||||
'markAsNotSpam',
|
'approve',
|
||||||
);
|
);
|
||||||
|
|
||||||
private static $url_handlers = array(
|
private static $url_handlers = array(
|
||||||
'markAsSpam' => 'markAsSpam',
|
'spam' => 'spam',
|
||||||
'markAsNotSpam' => 'markAsNotSpam',
|
'approve' => 'approve',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
public function markAsSpam(SS_HTTPRequest $request) {
|
public function spam(SS_HTTPRequest $request) {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
||||||
foreach($this->getRecords() as $record) {
|
foreach($this->getRecords() as $record) {
|
||||||
array_push($ids, $record->ID);
|
array_push($ids, $record->ID);
|
||||||
|
|
||||||
$record->Moderated = 1;
|
$record->Moderated = 1;
|
||||||
@ -43,11 +43,11 @@ class CommentsGridFieldBulkAction_Handlers extends CommentsGridFieldBulkAction {
|
|||||||
|
|
||||||
$response->addHeader('Content-Type', 'text/json');
|
$response->addHeader('Content-Type', 'text/json');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function markAsNotSpam(SS_HTTPRequest $request) {
|
public function approve(SS_HTTPRequest $request) {
|
||||||
$ids = array();
|
$ids = array();
|
||||||
|
|
||||||
foreach($this->getRecords() as $record) {
|
foreach($this->getRecords() as $record) {
|
||||||
|
@ -24,7 +24,7 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor {
|
|||||||
$manager = new GridFieldBulkManager();
|
$manager = new GridFieldBulkManager();
|
||||||
|
|
||||||
$manager->addBulkAction(
|
$manager->addBulkAction(
|
||||||
'markAsSpam', 'Mark as spam', 'CommentsGridFieldBulkAction_Handlers',
|
'spam', 'Spam', 'CommentsGridFieldBulkAction_Handlers',
|
||||||
array(
|
array(
|
||||||
'isAjax' => true,
|
'isAjax' => true,
|
||||||
'icon' => 'cross',
|
'icon' => 'cross',
|
||||||
@ -33,7 +33,7 @@ class CommentsGridFieldConfig extends GridFieldConfig_RecordEditor {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$manager->addBulkAction(
|
$manager->addBulkAction(
|
||||||
'markAsNotSpam', 'Mark as not spam', 'CommentsGridFieldBulkAction_Handlers',
|
'approve', 'Approve', 'CommentsGridFieldBulkAction_Handlers',
|
||||||
array(
|
array(
|
||||||
'isAjax' => true,
|
'isAjax' => true,
|
||||||
'icon' => 'cross',
|
'icon' => 'cross',
|
||||||
|
@ -463,7 +463,7 @@ class CommentsExtension extends DataExtension {
|
|||||||
|
|
||||||
$newGrid = new GridField(
|
$newGrid = new GridField(
|
||||||
'NewComments',
|
'NewComments',
|
||||||
_t('CommentsAdmin.NewComments', 'Unmoderated'),
|
_t('CommentsAdmin.NewComments', 'New'),
|
||||||
$newComments,
|
$newComments,
|
||||||
$commentsConfig
|
$commentsConfig
|
||||||
);
|
);
|
||||||
@ -472,7 +472,7 @@ class CommentsExtension extends DataExtension {
|
|||||||
|
|
||||||
$approvedGrid = new GridField(
|
$approvedGrid = new GridField(
|
||||||
'ApprovedComments',
|
'ApprovedComments',
|
||||||
_t('CommentsAdmin.Comments', 'Displayed'),
|
_t('CommentsAdmin.Comments', 'Approved'),
|
||||||
$approvedComments,
|
$approvedComments,
|
||||||
$commentsConfig
|
$commentsConfig
|
||||||
);
|
);
|
||||||
@ -493,10 +493,10 @@ class CommentsExtension extends DataExtension {
|
|||||||
if($fields->hasTabSet()) {
|
if($fields->hasTabSet()) {
|
||||||
$tabs = new TabSet(
|
$tabs = new TabSet(
|
||||||
'Comments',
|
'Comments',
|
||||||
new Tab('CommentsNewCommentsTab', _t('CommentAdmin.NewComments', 'Unmoderated') . ' ' . $newCount,
|
new Tab('CommentsNewCommentsTab', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount,
|
||||||
$newGrid
|
$newGrid
|
||||||
),
|
),
|
||||||
new Tab('CommentsCommentsTab', _t('CommentAdmin.Comments', 'Displayed') . ' ' . $approvedCount,
|
new Tab('CommentsCommentsTab', _t('CommentAdmin.Comments', 'Approved') . ' ' . $approvedCount,
|
||||||
$approvedGrid
|
$approvedGrid
|
||||||
),
|
),
|
||||||
new Tab('CommentsSpamCommentsTab', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
|
new Tab('CommentsSpamCommentsTab', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount,
|
||||||
|
Loading…
Reference in New Issue
Block a user