mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Showing 20 comments in tabular view for CommentAdmin (and making the setting configurable via CommentAdmin::set_comments_per_page())
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@105269 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5d5cc70a69
commit
4182cd4709
@ -23,6 +23,12 @@ class CommentAdmin extends LeftAndMain {
|
|||||||
'unmoderated'
|
'unmoderated'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the number of comments per page for the {@see CommentTable} in this admin
|
||||||
|
* defaulted 20.
|
||||||
|
*/
|
||||||
|
static $comments_per_page = '20';
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
@ -90,14 +96,12 @@ class CommentAdmin extends LeftAndMain {
|
|||||||
'Comment' => array('HTMLText->LimitCharacters', 150)
|
'Comment' => array('HTMLText->LimitCharacters', 150)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$table->setPageSize(self::get_comments_per_page());
|
||||||
|
|
||||||
$fields = new FieldSet(
|
$fields = new FieldSet(
|
||||||
new TabSet( 'Root',
|
|
||||||
new Tab(_t('CommentAdmin.COMMENTS', 'Comments'),
|
|
||||||
new LiteralField("Title", $title),
|
new LiteralField("Title", $title),
|
||||||
$idField,
|
$idField,
|
||||||
$table
|
$table
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$actions = new FieldSet();
|
$actions = new FieldSet();
|
||||||
@ -295,6 +299,24 @@ JS;
|
|||||||
function NumSpam() {
|
function NumSpam() {
|
||||||
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"=1")->value();
|
return DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"IsSpam\"=1")->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set CommentAdmin::comments_per_page
|
||||||
|
* @param $num int
|
||||||
|
*/
|
||||||
|
|
||||||
|
function set_comments_per_page($num){
|
||||||
|
self::$comments_per_page = $num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get CommentAdmin::comments_per_page
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
|
||||||
|
function get_comments_per_page(){
|
||||||
|
return self::$comments_per_page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -16,7 +16,6 @@ class CommentTableField extends ComplexTableField {
|
|||||||
parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
|
parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
|
||||||
|
|
||||||
$this->Markable = true;
|
$this->Markable = true;
|
||||||
$this->setPageSize(15);
|
|
||||||
|
|
||||||
// search
|
// search
|
||||||
$search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
|
$search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
|
||||||
|
Loading…
Reference in New Issue
Block a user