mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +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
@ -22,6 +22,12 @@ class CommentAdmin extends LeftAndMain {
|
||||
'EditForm',
|
||||
'unmoderated'
|
||||
);
|
||||
|
||||
/**
|
||||
* the number of comments per page for the {@see CommentTable} in this admin
|
||||
* defaulted 20.
|
||||
*/
|
||||
static $comments_per_page = '20';
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
@ -89,15 +95,13 @@ class CommentAdmin extends LeftAndMain {
|
||||
'Created' => 'SSDatetime->Full',
|
||||
'Comment' => array('HTMLText->LimitCharacters', 150)
|
||||
));
|
||||
|
||||
$table->setPageSize(self::get_comments_per_page());
|
||||
|
||||
$fields = new FieldSet(
|
||||
new TabSet( 'Root',
|
||||
new Tab(_t('CommentAdmin.COMMENTS', 'Comments'),
|
||||
new LiteralField("Title", $title),
|
||||
$idField,
|
||||
$table
|
||||
)
|
||||
)
|
||||
new LiteralField("Title", $title),
|
||||
$idField,
|
||||
$table
|
||||
);
|
||||
|
||||
$actions = new FieldSet();
|
||||
@ -295,6 +299,24 @@ JS;
|
||||
function NumSpam() {
|
||||
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);
|
||||
|
||||
$this->Markable = true;
|
||||
$this->setPageSize(15);
|
||||
|
||||
// search
|
||||
$search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
|
||||
|
Loading…
Reference in New Issue
Block a user