Created the option of having bbcode in comments.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42885 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Jeremy Shipman 2007-10-02 02:47:02 +00:00
parent 5d425fa6ed
commit 63ff9536d1
3 changed files with 21 additions and 3 deletions

View File

@ -21,6 +21,8 @@ class PageComment extends DataObject {
static $moderate = false;
static $bbcode = false;
/**
* Return a link to this comment
* @return string link to this comment.
@ -29,6 +31,10 @@ class PageComment extends DataObject {
return $this->Parent()->Link() . '#PageComment_'. $this->ID;
}
function ParsedBBCode(){
$parser = new BBCodeParser($this->Comment);
return $parser->parse();
}
function DeleteLink() {
if(Permission::check('CMS_ACCESS_CMSMain')) {
@ -185,6 +191,15 @@ class PageComment extends DataObject {
static function moderationEnabled() {
return self::$moderate;
}
static function enableBBCode() {
self::$bbcode = true;
}
static function bbCodeEnabled() {
return self::$bbcode;
}
}
?>

View File

@ -127,7 +127,6 @@ class PageCommentInterface_Form extends Form {
$this->saveInto($comment);
$comment->IsSpam = false;
$comment->NeedsModeration = PageComment::moderationEnabled();
$comment->write();
if(Director::is_ajax()) {

View File

@ -1,5 +1,9 @@
<p class="comment" id="PageComment_$ID">
<% if bbCodeEnabled %>
$ParsedBBCode
<% else %>
$Comment.XML
<% end_if %>
</p>
<p class="info">
<span><% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)</span>