3.1 compat

This commit is contained in:
Ingo Schommer 2013-04-11 14:23:03 +02:00
parent 3b251c5627
commit ea3fc6ad2b
5 changed files with 20 additions and 24 deletions

View File

@ -7,13 +7,13 @@
*/
class CommentAdmin extends LeftAndMain {
public static $url_segment = 'comments';
private static $url_segment = 'comments';
public static $url_rule = '/$Action';
private static $url_rule = '/$Action';
public static $menu_title = 'Comments';
private static $menu_title = 'Comments';
public static $allowed_actions = array(
private static $allowed_actions = array(
'approvedmarked',
'deleteall',
'deletemarked',

View File

@ -6,7 +6,7 @@
class CommentingController extends Controller {
public static $allowed_actions = array(
private static $allowed_actions = array(
'delete',
'spam',
'ham',

View File

@ -7,7 +7,7 @@
*/
class Comment extends DataObject {
public static $db = array(
private static $db = array(
"Name" => "Varchar(200)",
"Comment" => "Text",
"Email" => "Varchar(200)",
@ -19,27 +19,27 @@ class Comment extends DataObject {
'AllowHtml' => "Boolean"
);
public static $has_one = array(
private static $has_one = array(
"Author" => "Member"
);
public static $default_sort = '"Created" DESC';
private static $default_sort = '"Created" DESC';
public static $has_many = array();
private static $has_many = array();
public static $many_many = array();
private static $many_many = array();
public static $defaults = array(
private static $defaults = array(
"Moderated" => 1,
"IsSpam" => 0
);
public static $casting = array(
private static $casting = array(
'AuthorName' => 'Varchar',
'RSSName' => 'Varchar'
);
public static $searchable_fields = array(
private static $searchable_fields = array(
'Name',
'Email',
'Comment',
@ -47,7 +47,7 @@ class Comment extends DataObject {
'BaseClass',
);
public static $summary_fields = array(
private static $summary_fields = array(
'Name' => 'Submitted By',
'Email' => 'Email',
'Comment' => 'Comment',

View File

@ -13,19 +13,15 @@ class CommentsExtension extends DataExtension {
* {@link Comment} objects. If the owner class is a sitetree class
* it also enables a checkbox allowing comments to be turned off and off
*/
public static function add_to_class($class, $extensionClass, $args = null) {
Config::inst()->update($class, 'has_many', array(
'Comments' => 'Comment'
));
public static function get_extra_config($class, $extension, $args = null) {
$config = array('has_many' => array('Comments' => 'Comment'));
// if it is attached to the SiteTree then we need to add ProvideComments
if(is_subclass_of($class, 'SiteTree') || $class == 'SiteTree') {
Config::inst()->update($class, 'db', array(
'ProvideComments' => 'Boolean'
));
$config['db'] = array('ProvideComments' => 'Boolean');
}
parent::add_to_class($class, $extensionClass, $args);
return $config;
}

View File

@ -231,7 +231,7 @@ class CommentsTest extends FunctionalTest {
*/
class CommentableItem extends DataObject implements TestOnly {
public static $db = array(
private static $db = array(
'ProvideComments' => 'Boolean',
'Title' => 'Varchar'
);