diff --git a/modules/board/skins/default/comment.html b/modules/board/skins/default/comment.html index d7d930f1a..3f8e1e2e6 100644 --- a/modules/board/skins/default/comment.html +++ b/modules/board/skins/default/comment.html @@ -30,6 +30,16 @@ ipaddress {$val->ipaddress} + + + {$lang->uploaded_file} + + +
{$file->source_filename} ({FileHandler::filesize($file->file_size)}) ({number_format($file->download_count)})
+ + + + [{$lang->cmd_reply}] diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index c31ab2901..e31d2976e 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -53,6 +53,12 @@ $obj->homepage = $logged_info->homepage; } + // file의 Model객체 생성 + $oFileModel = &getModel('file'); + + // 첨부 파일의 갯수를 구함 + $obj->uploaded_count = $oFileModel->getFilesCount($obj->comment_srl); + // 댓글을 입력 $output = $oDB->executeQuery('comment.insertComment', $obj); @@ -116,6 +122,12 @@ $obj->homepage = $source_obj->homepage; } + // file의 Model객체 생성 + $oFileModel = &getModel('file'); + + // 첨부 파일의 갯수를 구함 + $obj->uploaded_count = $oFileModel->getFilesCount($obj->document_srl); + // 업데이트 $output = $oDB->executeQuery('comment.updateComment', $obj); @@ -149,6 +161,12 @@ $output = $oDB->executeQuery('comment.deleteComment', $args); if(!$output->toBool()) return new Object(-1, 'msg_error_occured'); + // 첨부 파일 삭제 + if($comment->uploaded_count) { + $oFileController = &getController('file'); + $oFileController->deleteFiles($comment->module_srl, $comment_srl); + } + // 댓글 수를 구해서 업데이트 $comment_count = $oCommentModel->getCommentCount($document_srl); diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 54d8fe1c2..3361024f8 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -42,6 +42,13 @@ $output = $oDB->executeQuery('comment.getComment', $args); $comment = $output->data; + // 첨부파일 가져오기 + if($comment->uploaded_count) { + $oFileModel = &getModel('file'); + $file_list = $oFileModel->getFiles($comment_srl, $is_admin); + $comment->uploaded_list = $file_list; + } + // 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음 $logged_info = Context::get('logged_info'); @@ -95,6 +102,10 @@ // 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음 $logged_info = Context::get('logged_info'); + // 첨부파일이 있을 경우를 대비한 File 모듈의 model객체 미리 생성 + $oFileModel = &getModel('file'); + + // loop를 돌면서 코멘트의 계층 구조 만듬 for($i=$comment_count-1;$i>=0;$i--) { $comment_srl = $source_list[$i]->comment_srl; $parent_srl = $source_list[$i]->parent_srl; @@ -103,6 +114,13 @@ if($is_admin || $this->isGranted($comment_srl) || $member_srl == $logged_info->member_srl) $source_list[$i]->is_granted = true; + // 첨부파일 가져오기 + if($source_list[$i]->uploaded_count) { + $file_list = $oFileModel->getFiles($comment_srl, $is_admin); + $source_list[$i]->uploaded_list = $file_list; + } + + // 목록을 만듬 $list[$comment_srl] = $source_list[$i]; if($parent_srl) { diff --git a/modules/comment/queries/insertComment.xml b/modules/comment/queries/insertComment.xml index 7ecaa5c4d..ac70cc883 100644 --- a/modules/comment/queries/insertComment.xml +++ b/modules/comment/queries/insertComment.xml @@ -14,6 +14,7 @@ + diff --git a/modules/comment/queries/updateComment.xml b/modules/comment/queries/updateComment.xml index e263590ac..b3821ac75 100644 --- a/modules/comment/queries/updateComment.xml +++ b/modules/comment/queries/updateComment.xml @@ -11,6 +11,7 @@ + diff --git a/modules/comment/schemas/comments.xml b/modules/comment/schemas/comments.xml index 411218401..1968e74c7 100644 --- a/modules/comment/schemas/comments.xml +++ b/modules/comment/schemas/comments.xml @@ -11,6 +11,7 @@ +