mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-15 00:12:43 +09:00
Merge pull request #511 from bjrambo/pr/comment-delete-message
댓글 삭제 메세지옵션 추가.
This commit is contained in:
commit
807ea42b6d
10 changed files with 166 additions and 11 deletions
|
|
@ -510,10 +510,37 @@ class boardController extends board
|
|||
// generate comment controller object
|
||||
$oCommentController = getController('comment');
|
||||
|
||||
$output = $oCommentController->deleteComment($comment_srl, $this->grant->manager);
|
||||
if(!$output->toBool())
|
||||
if($this->module_info->comment_delete_message === 'yes')
|
||||
{
|
||||
return $output;
|
||||
$comment->content = '';
|
||||
$comment->status = 7;
|
||||
$output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager);
|
||||
}
|
||||
elseif($this->module_info->comment_delete_message === 'only_commnet')
|
||||
{
|
||||
$childs = $oCommentModel->getChildComments($comment_srl);
|
||||
if(count($childs) > 0)
|
||||
{
|
||||
$comment->content = '';
|
||||
$comment->status = 7;
|
||||
$output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $oCommentController->deleteComment($comment_srl, $this->grant->manager, FALSE, $childs);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $oCommentController->deleteComment($comment_srl, $this->grant->manager);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$this->add('mid', Context::get('mid'));
|
||||
|
|
|
|||
|
|
@ -42,3 +42,8 @@ $lang->about_hide_category = 'You can disable a category feature.';
|
|||
$lang->protect_content = 'Protect contents';
|
||||
$lang->about_protect_content = 'If there is any comment on document, document\'s owner cannot modify or delete that.';
|
||||
$lang->msg_protect_content = 'You cannot modify or delete document which has any comment on it.';
|
||||
$lang->comment_delete_message = 'Leave Placeholder for Deleted Comment';
|
||||
$lang->about_comment_delete_message = 'When a comment is deleted, leave a placeholder saying that it has been deleted.';
|
||||
$lang->cmd_only_p_comment = 'Only if there are replies';
|
||||
$lang->cmd_all_comment_message = 'Always';
|
||||
$lang->cmd_do_not_massage = 'Never';
|
||||
|
|
|
|||
|
|
@ -71,3 +71,10 @@ $lang->write_admin = '관리자작성';
|
|||
$lang->revert_reason_update = '이 버전으로 되돌림';
|
||||
$lang->document_force_to_move = '삭제시 휴지통으로 강제이동';
|
||||
$lang->about_document_force_to_move = '게시글을 삭제시 휴지통으로 강제이동할지 않할지를 선택하는 옵션입니다.';
|
||||
$lang->comment_delete_message = '댓글자리 남김';
|
||||
$lang->about_comment_delete_message = '댓글 삭제시 완전히 삭제하지 않고 "삭제된 댓글"이라는 메시지를 남깁니다.';
|
||||
$lang->cmd_only_p_comment = '대댓글이 있는 경우에만 남김';
|
||||
$lang->cmd_all_comment_message = '모든댓글에 남김';
|
||||
$lang->cmd_do_not_massage = '남기지 않음';
|
||||
$lang->msg_delete_comment = '댓글이 삭제되었습니다.';
|
||||
$lang->msg_admin_delete_comment = '관리자에 의해 댓글이 삭제되었습니다.';
|
||||
|
|
|
|||
|
|
@ -25,7 +25,16 @@
|
|||
<input type="hidden" name="comment_srl" value="{$comment->get('comment_srl')}" />
|
||||
</form>
|
||||
<!--@else-->
|
||||
{$comment->getContent(false)}
|
||||
<div class="xe_content">
|
||||
<!--@if($comment->status == 7)-->
|
||||
{$lang->msg_delete_comment}
|
||||
<!--@elseif($comment->status == 8)-->
|
||||
{$lang->msg_admin_delete_comment}
|
||||
<!--@end-->
|
||||
</div>
|
||||
<block cond="$comment->status < 7">
|
||||
{$comment->getContent(false)}
|
||||
</block>
|
||||
<!--@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>
|
||||
|
|
@ -33,7 +42,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">
|
||||
<p class="action" cond="$comment->status < 7">
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -274,6 +274,18 @@
|
|||
<p>{$lang->about_protect_regdate}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="comment_delete_message">{$lang->comment_delete_message}</label>
|
||||
<div class="x_controls">
|
||||
<select name="comment_delete_message" id="comment_delete_message">
|
||||
<option value="no" selected="selected"|cond="$module_info->comment_delete_message == 'no'">{$lang->cmd_do_not_massage}</option>
|
||||
<option value="yes" selected="selected"|cond="$module_info->comment_delete_message == 'yes'">{$lang->cmd_all_comment_message}</option>
|
||||
<option value="only_commnet" selected="selected"|cond="$module_info->comment_delete_message == 'only_commnet'">{$lang->cmd_only_p_comment}</option>
|
||||
</select>
|
||||
<p class="x_help-block">{$lang->about_comment_delete_message}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->status}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
|
|
@ -904,14 +904,75 @@ class commentController extends comment
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix comment the delete comment message
|
||||
* @param object $obj
|
||||
* @param bool $is_admin
|
||||
* @return object
|
||||
*/
|
||||
function updateCommentByDelete($obj, $is_admin = FALSE)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// begin transaction
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// If the case manager to delete comments, it indicated that the administrator deleted.
|
||||
if($is_admin === true && $obj->member_srl !== $logged_info->member_srl)
|
||||
{
|
||||
$obj->content = lang('msg_admin_delete_comment');
|
||||
$obj->status = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
$obj->content = lang('msg_delete_comment');
|
||||
}
|
||||
$obj->member_srl = 0;
|
||||
$output = executeQuery('comment.updateCommentByDelete', $obj);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// call a trigger by delete (after)
|
||||
ModuleHandler::triggerCall('comment.updateCommentByDelete', 'after', $obj);
|
||||
|
||||
// update the number of comments
|
||||
$oCommentModel = getModel('comment');
|
||||
$comment_count = $oCommentModel->getCommentCount($obj->document_srl);
|
||||
// only document is exists
|
||||
if(isset($comment_count))
|
||||
{
|
||||
// create the controller object of the document
|
||||
$oDocumentController = getController('document');
|
||||
|
||||
// update comment count of the article posting
|
||||
$output = $oDocumentController->updateCommentCount($obj->document_srl, $comment_count, NULL, FALSE);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$output->add('document_srl', $obj->document_srl);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete comment
|
||||
* @param int $comment_srl
|
||||
* @param bool $is_admin
|
||||
* @param bool $isMoveToTrash
|
||||
* @param object $childs
|
||||
* @return object
|
||||
*/
|
||||
function deleteComment($comment_srl, $is_admin = FALSE, $isMoveToTrash = FALSE)
|
||||
function deleteComment($comment_srl, $is_admin = FALSE, $isMoveToTrash = FALSE, $childs = null)
|
||||
{
|
||||
// create the comment model object
|
||||
$oCommentModel = getModel('comment');
|
||||
|
|
@ -944,7 +1005,10 @@ class commentController extends comment
|
|||
}
|
||||
|
||||
// check if child comment exists on the comment
|
||||
$childs = $oCommentModel->getChildComments($comment_srl);
|
||||
if(!$childs)
|
||||
{
|
||||
$childs = $oCommentModel->getChildComments($comment_srl);
|
||||
}
|
||||
if(count($childs) > 0)
|
||||
{
|
||||
$deleteAllComment = TRUE;
|
||||
|
|
|
|||
|
|
@ -248,14 +248,20 @@ class commentModel extends comment
|
|||
|
||||
//check if module is using validation system
|
||||
$oCommentController = getController('comment');
|
||||
|
||||
$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
|
||||
$module_info = getModel('module')->getModuleInfoByDocumentSrl($document_srl);
|
||||
$use_comment_massage = $module_info->comment_delete_message;
|
||||
|
||||
if($using_validation)
|
||||
{
|
||||
$args->status = 1;
|
||||
}
|
||||
elseif($use_comment_massage == 'Y')
|
||||
{
|
||||
$args->status = 1;
|
||||
}
|
||||
|
||||
$output = executeQuery('comment.getCommentCount', $args, NULL, 'master');
|
||||
$output = executeQuery('comment.getCommentCount', $args, NULL);
|
||||
$total_count = $output->data->count;
|
||||
|
||||
return (int) $total_count;
|
||||
|
|
|
|||
|
|
@ -10,5 +10,6 @@
|
|||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" pipe="and" />
|
||||
<condition operation="in" column="module_srl" var="module_srl" filter="number" pipe="and" />
|
||||
<condition operation="like_prefix" column="regdate" var="regDate" pipe="and" />
|
||||
<condition operation="equal" column="status" var="status" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -8,14 +8,13 @@
|
|||
<column name="comments_list.depth" alias="depth" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comments.status" var="status" pipe="and" />
|
||||
<condition operation="more" column="comments.status" var="status" pipe="and" />
|
||||
<condition operation="equal" column="comments_list.document_srl" var="document_srl" notnull="notnull" pipe="and" />
|
||||
<condition operation="equal" column="comments_list.comment_srl" var="comments.comment_srl" filter="number" pipe="and" />
|
||||
<condition operation="more" column="comments_list.head" default="0" pipe="and" />
|
||||
<condition operation="more" column="comments_list.arrange" default="0" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="list_order" default="comments.status" order="desc" />
|
||||
<index var="list_order" default="comments_list.head" order="asc" />
|
||||
<index var="list_order" default="comments_list.arrange" order="asc" />
|
||||
<list_count var="list_count" default="list_count" />
|
||||
|
|
|
|||
25
modules/comment/queries/updateCommentByDelete.xml
Normal file
25
modules/comment/queries/updateCommentByDelete.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<query id="updateCommentByDelete" action="update">
|
||||
<tables>
|
||||
<table name="comments" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="module_srl" var="module_srl" filter="number" default="0" />
|
||||
<column name="member_srl" var="member_srl" />
|
||||
<column name="parent_srl" var="parent_srl" filter="number" />
|
||||
<column name="is_secret" var="is_secret" default="N" />
|
||||
<column name="notify_message" var="notify_message" default="N" />
|
||||
<column name="content" var="content" notnull="notnull" />
|
||||
<column name="password" var="password" minlength="2" maxlength="60" />
|
||||
<column name="user_id" var="user_id" />
|
||||
<column name="user_name" var="user_name" default="" />
|
||||
<column name="nick_name" var="nick_name" notnull="notnull" minlength="1" maxlength="40" />
|
||||
<column name="email_address" var="email_address" filter="email" maxlength="250" />
|
||||
<column name="homepage" var="homepage" filter="homepage" maxlength="250" />
|
||||
<column name="uploaded_count" var="uploaded_count" default="0" />
|
||||
<column name="last_update" var="last_update" default="curdate()" />
|
||||
<column name="status" var="status" default="1" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue