Fix #664 make comment placeholders available to all board skins

This commit is contained in:
Kijin Sung 2016-12-20 14:11:50 +09:00
parent f9c26e19fc
commit 92b73a1149
3 changed files with 57 additions and 29 deletions

View file

@ -25,16 +25,7 @@
<input type="hidden" name="comment_srl" value="{$comment->get('comment_srl')}" />
</form>
<!--@else-->
<div class="xe_content">
<!--@if($comment->status == 7)-->
{$lang->msg_deleted_comment}
<!--@elseif($comment->status == 8)-->
{$lang->msg_admin_deleted_comment}
<!--@end-->
</div>
<block cond="$comment->status < 7">
{$comment->getContent(false)}
</block>
{$comment->getContent(false)}
<!--@end-->
<div cond="$comment->hasUploadedFiles()" class="fileList">
<button type="button" class="toggleFile" onclick="jQuery(this).next('ul.files').toggle();"><i class="xi-diskette"></i> {$lang->uploaded_file} [<strong>{$comment->get('uploaded_count')}</strong>]</button>
@ -42,7 +33,7 @@
<li loop="$comment->getUploadedFiles()=>$key,$file"><a href="{getUrl('')}{$file->download_url}">{$file->source_filename} <span class="fileSize">[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]</span></a></li>
</ul>
</div>
<p class="action" cond="$comment->status < 7">
<p class="action" cond="!$comment->isDeleted()">
<a cond="$comment->getVote() === false || $comment->getVote() < 0" href="#" onclick="doCallModuleAction('comment','procCommentVoteUp','{$comment->comment_srl}');return false;"|cond="$is_logged" class="voted"><i class="xi-thumbs-up"></i>{$lang->cmd_vote}{$comment->get('voted_count')}</a>
<a cond="$comment->getVote() > 0" href="#" onclick="doCallModuleAction('comment','procCommentVoteUpCancel','{$comment->comment_srl}');return false;"|cond="$is_logged" class="voted"><i class="xi-thumbs-up"></i>{$lang->cmd_vote}{$comment->get('voted_count')}</a>
<a cond="$comment->getVote() === false || $comment->getVote() > 0" href="#" onclick="doCallModuleAction('comment','procCommentVoteDown','{$comment->comment_srl}');return false;"|cond="$is_logged" class="voted"><i class="xi-thumbs-up"></i>{$lang->cmd_vote_down}{$comment->get('blamed_count')}</a>
@ -52,7 +43,7 @@
<a cond="$comment->isGranted()||!$comment->get('member_srl')" href="{getUrl('act','dispBoardDeleteComment','comment_srl',$comment->comment_srl)}" class="delete"><i class="xi-trash"></i> {$lang->cmd_delete}</a>
<a cond="$is_logged" class="comment_{$comment->comment_srl} this" href="#popup_menu_area" onclick="return false">{$lang->cmd_comment_do}</a>
</p>
<p class="action" cond="$comment->status >= 7">
<p class="action" cond="$comment->isDeleted()">
<a cond="$grant->manager" href="{getUrl('act','dispBoardDeleteComment','comment_srl',$comment->comment_srl)}" class="delete"><i class="xi-trash"></i> {$lang->delete_placeholder}</a>
</p>
</li>

View file

@ -737,6 +737,10 @@
.feedback .xe_content *:first-child {
margin-top: 0;
}
.feedback .xe_content.is_deleted,
.feedback .xe_content.is_secret {
color: #999;
}
#trackback .xe_content {
color: #888;
}

View file

@ -151,6 +151,16 @@ class commentItem extends Object
return $this->get('is_secret') == 'Y' ? TRUE : FALSE;
}
function isDeleted()
{
return $this->get('status') == RX_STATUS_DELETED || $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
}
function isDeletedByAdmin()
{
return $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
}
function isAccessible()
{
if($_SESSION['accessibled_comment'][$this->comment_srl])
@ -311,12 +321,22 @@ class commentItem extends Object
*/
function getContentText($strlen = 0)
{
if($this->isSecret() && !$this->isAccessible())
if($this->isDeletedByAdmin())
{
return lang('msg_is_secret');
$content = lang('msg_admin_deleted_comment');
}
elseif($this->isDeleted())
{
$content = lang('msg_deleted_comment');
}
elseif($this->isSecret() && !$this->isAccessible())
{
$content = lang('msg_is_secret');
}
else
{
$content = $this->get('content');
}
$content = $this->get('content');
if($strlen)
{
@ -332,13 +352,27 @@ class commentItem extends Object
*/
function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE)
{
if($this->isSecret() && !$this->isAccessible())
if($this->isDeletedByAdmin())
{
return lang('msg_is_secret');
$content = lang('msg_admin_deleted_comment');
$additional_class = ' is_deleted is_deleted_by_admin';
}
elseif($this->isDeleted())
{
$content = lang('msg_deleted_comment');
$additional_class = ' is_deleted';
}
elseif($this->isSecret() && !$this->isAccessible())
{
$content = lang('msg_is_secret');
$additional_class = ' is_secret';
}
else
{
$content = $this->get('content');
$additional_class = '';
stripEmbedTagForAdmin($content, $this->get('member_srl'));
}
$content = $this->get('content');
stripEmbedTagForAdmin($content, $this->get('member_srl'));
// when displaying the comment on the pop-up menu
if($add_popup_menu && Context::get('is_logged'))
@ -351,21 +385,20 @@ class commentItem extends Object
// if additional information which can access contents is set
if($add_content_info)
{
$memberSrl = $this->get('member_srl');
if($memberSrl < 0)
$member_srl = $this->get('member_srl');
if($member_srl < 0)
{
$memberSrl = 0;
$member_srl = 0;
}
$content = sprintf(
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl
);
// xe_content class name should be specified although content access is not necessary.
$content = vsprintf('<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content%s">%s</div><!--AfterComment(%d,%d)-->', array(
$this->comment_srl, $member_srl, $this->comment_srl, $member_srl, $additional_class, $content, $this->comment_srl, $member_srl
));
}
else
{
if($add_xe_content_class)
{
$content = sprintf('<div class="xe_content">%s</div>', $content);
$content = sprintf('<div class="xe_content%s">%s</div>', $additional_class, $content);
}
}