mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FEATURE: added ability to display comments even when comments have been disabled. #2081
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@77806 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0e4cccb979
commit
bf7b7d09e7
@ -43,6 +43,17 @@ class PageCommentInterface extends RequestHandler {
|
||||
*/
|
||||
static $use_ajax_commenting = true;
|
||||
|
||||
/**
|
||||
* If this is true then we should show the existing comments on
|
||||
* the page even when we have disabled the comment form.
|
||||
*
|
||||
* If this is false the form + existing comments will be hidden
|
||||
*
|
||||
* @var bool
|
||||
* @since 2.4 - Always show them by default
|
||||
*/
|
||||
static $show_comments_when_disabled = true;
|
||||
|
||||
/**
|
||||
* Create a new page comment interface
|
||||
* @param controller The controller that the interface is used on
|
||||
@ -61,7 +72,8 @@ class PageCommentInterface extends RequestHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* See @link PageCommentInterface::$comments_require_login
|
||||
* See {@link PageCommentInterface::$comments_require_login}
|
||||
*
|
||||
* @param boolean state The new state of this static field
|
||||
*/
|
||||
static function set_comments_require_login($state) {
|
||||
@ -69,13 +81,22 @@ class PageCommentInterface extends RequestHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* See @link PageCommentInterface::$comments_require_permission
|
||||
* See {@link PageCommentInterface::$comments_require_permission}
|
||||
*
|
||||
* @param string permission The permission to check against.
|
||||
*/
|
||||
static function set_comments_require_permission($permission) {
|
||||
self::$comments_require_permission = $permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@link PageCommentInterface::$show_comments_when_disabled}
|
||||
*
|
||||
* @param bool - show / hide the existing comments when disabled
|
||||
*/
|
||||
static function set_show_comments_when_disabled($state) {
|
||||
self::$show_comments_when_disabled = $state;
|
||||
}
|
||||
/**
|
||||
* See {@link PageCommentInterface::$use_ajax_commenting}
|
||||
* @param bool
|
||||
@ -124,6 +145,9 @@ class PageCommentInterface extends RequestHandler {
|
||||
}
|
||||
|
||||
function PostCommentForm() {
|
||||
if(!$this->page->ProvideComments){
|
||||
return false;
|
||||
}
|
||||
$fields = new FieldSet(
|
||||
new HiddenField("ParentID", "ParentID", $this->page->ID)
|
||||
);
|
||||
|
@ -1,11 +1,15 @@
|
||||
<div id="PageComments_holder" class="typography">
|
||||
<% if CanPostComment %>
|
||||
<h4><% _t('POSTCOM','Post your comment') %></h4>
|
||||
|
||||
<h4><% _t('POSTCOM','Post your comment') %></h4>
|
||||
<% if PostCommentForm %>
|
||||
<% if CanPostComment %>
|
||||
$PostCommentForm
|
||||
<% else %>
|
||||
<p>You can't post comments until you have logged in<% if PostingRequiresPermission %>, and that you have an appropriate permission level<% end_if %>. Please <a href="Security/login?BackURL={$Page.URLSegment}/" title="Login to post a comment">login by clicking here</a>.</p>
|
||||
<% end_if %>
|
||||
<% else %>
|
||||
<p><% _t('COMMENTSDISABLED', 'Posting Comments has been Disabled') %>.</p>
|
||||
<% end_if %>
|
||||
|
||||
<h4><% _t('COMMENTS','Comments') %></h4>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user