From ee8e180f22b8e703218f467fd52789f5e08b028b Mon Sep 17 00:00:00 2001 From: haneul Date: Wed, 14 May 2008 08:30:36 +0000 Subject: [PATCH] =?UTF-8?q?comment=EB=8F=84=20=EC=B6=94=EC=B2=9C/=EB=B9=84?= =?UTF-8?q?=EC=B6=94=EC=B2=9C=20=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4197 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/board/skins/xe_board/comment.html | 4 ++-- modules/comment/comment.class.php | 12 +++++++++++ modules/comment/comment.controller.php | 21 ++++++++++++++++--- .../comment/queries/insertCommentVotedLog.xml | 1 + modules/comment/queries/updateBlamedCount.xml | 11 ++++++++++ modules/comment/schemas/comment_voted_log.xml | 1 + modules/comment/schemas/comments.xml | 1 + 7 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 modules/comment/queries/updateBlamedCount.xml diff --git a/modules/board/skins/xe_board/comment.html b/modules/board/skins/xe_board/comment.html index 58b734212..bbce49468 100644 --- a/modules/board/skins/xe_board/comment.html +++ b/modules/board/skins/xe_board/comment.html @@ -40,10 +40,10 @@ - +
({$lang->voted_count}: - {$comment->get('voted_count')}) + {$comment->get('voted_count')?$comment->get('voted_count'):0} / {$comment->get('blamed_count')?$comment->get('blamed_count'):0})
diff --git a/modules/comment/comment.class.php b/modules/comment/comment.class.php index 04e4952d4..a59119792 100644 --- a/modules/comment/comment.class.php +++ b/modules/comment/comment.class.php @@ -52,6 +52,10 @@ // 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가 if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true; + // 2008. 05. 14 blamed count 컬럼 추가 + if(!$oDB->isColumnExists("comments", "blamed_count")) return true; + if(!$oDB->isColumnExists("comment_voted_log", "point")) return true; + return false; } @@ -88,6 +92,14 @@ if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); + // 2008. 05. 14 blamed count 컬럼 추가 + if(!$oDB->isColumnExists("comments", "blamed_count")) { + $oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true); + $oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count')); + } + if(!$oDB->isColumnExists("comment_voted_log", "point")) + $oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, true); + return new Object(0, 'success_updated'); } diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 86efca68f..543746fbf 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -398,6 +398,9 @@ * @brief 해당 comment의 추천수 증가 **/ function updateVotedCount($comment_srl, $point = 1) { + if($point > 0) $failed_voted = 'failed_voted'; + else $failed_voted = 'failed_blamed'; + // 세션 정보에 추천 정보가 있으면 중단 if($_SESSION['voted_comment'][$comment_srl]) return new Object(-1, 'failed_voted'); @@ -440,17 +443,29 @@ } // 추천수 업데이트 - $args->voted_count = $oComment->get('voted_count') + $point; - $output = executeQuery('comment.updateVotedCount', $args); + if($point < 0) + { + $args->blamed_count = $oComment->get('blamed_count') + $point; + $output = executeQuery('comment.updateBlamedCount', $args); + } + else + { + $args->voted_count = $oComment->get('voted_count') + $point; + $output = executeQuery('comment.updateVotedCount', $args); + } // 로그 남기기 + $args->point = $point; $output = executeQuery('comment.insertCommentVotedLog', $args); // 세션 정보에 남김 $_SESSION['voted_comment'][$comment_srl] = true; // 결과 리턴 - return new Object(0, 'success_voted'); + if($point > 0) + return new Object(0, 'success_voted'); + else + return new Object(0, 'success_blamed'); } /** diff --git a/modules/comment/queries/insertCommentVotedLog.xml b/modules/comment/queries/insertCommentVotedLog.xml index 37bfe5ce2..6d9ab5020 100644 --- a/modules/comment/queries/insertCommentVotedLog.xml +++ b/modules/comment/queries/insertCommentVotedLog.xml @@ -7,5 +7,6 @@ + diff --git a/modules/comment/queries/updateBlamedCount.xml b/modules/comment/queries/updateBlamedCount.xml new file mode 100644 index 000000000..ccb3cff47 --- /dev/null +++ b/modules/comment/queries/updateBlamedCount.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/modules/comment/schemas/comment_voted_log.xml b/modules/comment/schemas/comment_voted_log.xml index d5d2ff155..095cca0f8 100644 --- a/modules/comment/schemas/comment_voted_log.xml +++ b/modules/comment/schemas/comment_voted_log.xml @@ -3,4 +3,5 @@ +
diff --git a/modules/comment/schemas/comments.xml b/modules/comment/schemas/comments.xml index e381b7f0c..c272c5d53 100644 --- a/modules/comment/schemas/comments.xml +++ b/modules/comment/schemas/comments.xml @@ -6,6 +6,7 @@ +