mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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:
parent
5d425fa6ed
commit
63ff9536d1
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -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()) {
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user