diff --git a/code/CommentAdmin.php b/code/CommentAdmin.php index 81f14d20..77799efc 100644 --- a/code/CommentAdmin.php +++ b/code/CommentAdmin.php @@ -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; + } } ?> diff --git a/code/CommentTableField.php b/code/CommentTableField.php index f9bf395e..cf0d6c56 100644 --- a/code/CommentTableField.php +++ b/code/CommentTableField.php @@ -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;