diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index 7989adbae..1b153b1d0 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -125,16 +125,18 @@ // comment 모듈의 controller 객체 생성 $oCommentController = &getController('comment'); + // comment_srl이 존재하는지 체크 + $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager); + // comment_srl이 없을 경우 신규 입력 - if(!$obj->comment_srl) { + if($comment->comment_srl != $obj->comment_srl) { // parent_srl이 있으면 답변으로 if($obj->parent_srl) { - $comment = $oCommentModel->getComment($obj->parent_srl); - if(!$comment) return new Object(-1, 'msg_invalid_request'); + $parent_comment = $oCommentModel->getComment($obj->parent_srl); + if(!$parent_comment->comment_srl) return new Object(-1, 'msg_invalid_request'); $output = $oCommentController->insertComment($obj); - $comment_srl = $output->get('comment_srl'); // 없으면 신규 } else { @@ -143,10 +145,6 @@ // comment_srl이 있으면 수정으로 } else { - - $comment = $oCommentModel->getComment($obj->comment_srl); - if(!$comment) return new Object(-1, 'msg_invalid_request'); - $obj->parent_srl = $comment->parent_srl; $output = $oCommentController->updateComment($obj); $comment_srl = $obj->comment_srl; diff --git a/modules/board/board.view.php b/modules/board/board.view.php index a869fb86c..a59fe2b4a 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -458,13 +458,14 @@ **/ function setCommentEditor($comment_srl=0) { if(!$comment_srl) { - $oDB = &DB::getNextSequence(); + $oDB = &DB::getInstance(); $comment_srl = $oDB->getNextSequence(); + Context::set('comment_srl', $comment_srl); } // 에디터 모듈의 dispEditor를 호출하여 세팅 $oEditorView = &getView('editor'); - $comment_editor = $oEditorView->getEditor($comment, $this->grant->fileupload); + $comment_editor = $oEditorView->getEditor($comment_srl, $this->grant->fileupload); Context::set('comment_editor', $comment_editor); } diff --git a/modules/board/skins/default/comment_form.html b/modules/board/skins/default/comment_form.html index 63c6a3e00..a2a4a2c44 100644 --- a/modules/board/skins/default/comment_form.html +++ b/modules/board/skins/default/comment_form.html @@ -2,6 +2,8 @@ + + @@ -27,7 +29,7 @@ -