From 03e186f80cfc13df8867a0b9878a97b47f36a435 Mon Sep 17 00:00:00 2001 From: dewekk <60457472+dewekk@users.noreply.github.com> Date: Wed, 23 Nov 2022 23:16:48 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=B6=94=EC=B2=9C/?= =?UTF-8?q?=EB=B9=84=EC=B6=94=EC=B2=9C=20=EC=B7=A8=EC=86=8C=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 댓글 메뉴에 댓글 추천/비추천 취소 버튼 추가 --- modules/comment/comment.model.php | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 963ab4889..6eb116bf3 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -47,21 +47,36 @@ class commentModel extends comment $oComment = self::getComment($comment_srl, FALSE, $columnList); $module_srl = $oComment->get('module_srl'); $member_srl = abs($oComment->get('member_srl')); + if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest; - $comment_config = ModuleModel::getModulePartConfig('document', $module_srl); - + $comment_config = ModuleModel::getModulePartConfig('comment', $module_srl); + $oCommentisVoted = $oComment->getMyVote(); if($comment_config->use_vote_up != 'N' && $member_srl != $this->user->member_srl) { - // Add a vote-up button for positive feedback - $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl); - $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript'); + if($oCommentisVoted === false || $oCommentisVoted < 0) + { + $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl); + $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript'); + } + elseif($oCommentisVoted > 0) + { + $url = sprintf("doCallModuleAction('comment','procCommentVoteUpCancel','%s')", $comment_srl); + $oCommentController->addCommentPopupMenu($url, 'cmd_cancel_vote', '', 'javascript'); + } } if($comment_config->use_vote_down != 'N' && $member_srl != $this->user->member_srl) { - // Add a vote-down button for negative feedback - $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl); - $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); + if($oCommentisVoted === false || $oCommentisVoted > 0) + { + $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl); + $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); + } + else if($oCommentisVoted < 0) + { + $url = sprintf("doCallModuleAction('comment','procCommentVoteDownCancel','%s')", $comment_srl); + $oCommentController->addCommentPopupMenu($url,'cmd_cancel_vote_down','','javascript'); + } } // Add the report feature against abused posts