diff --git a/modules/wiki/conf/module.xml b/modules/wiki/conf/module.xml
index 1a2ae5780..43e7cd00d 100644
--- a/modules/wiki/conf/module.xml
+++ b/modules/wiki/conf/module.xml
@@ -24,6 +24,8 @@
+
+
@@ -33,5 +35,7 @@
+
+
diff --git a/modules/wiki/lang/ko.lang.php b/modules/wiki/lang/ko.lang.php
index 291248805..58ffa183d 100644
--- a/modules/wiki/lang/ko.lang.php
+++ b/modules/wiki/lang/ko.lang.php
@@ -10,4 +10,6 @@
$lang->cmd_create = '문서 생성';
$lang->cmd_wiki_list = '목록';
$lang->cmd_view_info = '위키 정보';
+ $lang->use_comment = '댓글 사용';
+ $lang->about_use_comment = '댓글을 활성화하거나 비활성화할 수 있습니다';
?>
diff --git a/modules/wiki/skins/xe_wiki/comment.html b/modules/wiki/skins/xe_wiki/comment.html
new file mode 100644
index 000000000..b1063213e
--- /dev/null
+++ b/modules/wiki/skins/xe_wiki/comment.html
@@ -0,0 +1,105 @@
+
+
+
+ {@ $_comment_list = $oDocument->getComments() }
+ {@ debugPrint($oDocument) }
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/wiki/skins/xe_wiki/comment_form.html b/modules/wiki/skins/xe_wiki/comment_form.html
new file mode 100644
index 000000000..6fb227b7f
--- /dev/null
+++ b/modules/wiki/skins/xe_wiki/comment_form.html
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+ {$oSourceComment->getRegdate("Y.m.d H:i")}
+
+ ({$oSourceComment->get('ipaddress')})
+
+
+
+
+
+ {$oSourceComment->getContent(false)}
+
+
+
+
+
+
+
+
+
diff --git a/modules/wiki/skins/xe_wiki/delete_comment_form.html b/modules/wiki/skins/xe_wiki/delete_comment_form.html
new file mode 100644
index 000000000..04c371f45
--- /dev/null
+++ b/modules/wiki/skins/xe_wiki/delete_comment_form.html
@@ -0,0 +1,23 @@
+
+
+
+
+
diff --git a/modules/wiki/skins/xe_wiki/header.html b/modules/wiki/skins/xe_wiki/header.html
index 9e276f512..08c768356 100644
--- a/modules/wiki/skins/xe_wiki/header.html
+++ b/modules/wiki/skins/xe_wiki/header.html
@@ -1,4 +1,7 @@
+
+ {@$module_info->colorset = "white"}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/wiki/tpl/filter/delete_comment.xml b/modules/wiki/tpl/filter/delete_comment.xml
new file mode 100644
index 000000000..faee3b3b1
--- /dev/null
+++ b/modules/wiki/tpl/filter/delete_comment.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/wiki/tpl/filter/insert_comment.xml b/modules/wiki/tpl/filter/insert_comment.xml
new file mode 100644
index 000000000..dcb6f1d69
--- /dev/null
+++ b/modules/wiki/tpl/filter/insert_comment.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/wiki/tpl/filter/insert_wiki.xml b/modules/wiki/tpl/filter/insert_wiki.xml
index e8120f645..f1304d220 100644
--- a/modules/wiki/tpl/filter/insert_wiki.xml
+++ b/modules/wiki/tpl/filter/insert_wiki.xml
@@ -15,6 +15,7 @@
+
diff --git a/modules/wiki/tpl/header.html b/modules/wiki/tpl/header.html
index 8be2427b1..ee3632e54 100644
--- a/modules/wiki/tpl/header.html
+++ b/modules/wiki/tpl/header.html
@@ -16,7 +16,7 @@
{$lang->cmd_back}
- class="on">{$lang->cmd_view_info}
+ class="on">{$lang->cmd_view_info}
class="on">{$lang->cmd_manage_grant}
class="on">{$lang->cmd_addition_setup}
class="on">{$lang->cmd_manage_skin}
diff --git a/modules/wiki/tpl/wiki_insert.html b/modules/wiki/tpl/wiki_insert.html
index 7e7bc1fc9..63f9f7d94 100644
--- a/modules/wiki/tpl/wiki_insert.html
+++ b/modules/wiki/tpl/wiki_insert.html
@@ -38,6 +38,16 @@
{$lang->about_module_category}
+
+ {$lang->use_comment} |
+
+
+ {$lang->about_use_comment}
+ |
+
{$lang->browser_title} |
diff --git a/modules/wiki/wiki.admin.controller.php b/modules/wiki/wiki.admin.controller.php
index ac2433f83..ef732014c 100644
--- a/modules/wiki/wiki.admin.controller.php
+++ b/modules/wiki/wiki.admin.controller.php
@@ -20,6 +20,8 @@
$args = Context::getRequestVars();
$args->module = 'wiki';
$args->mid = $args->wiki_name;
+ if($args->use_comment!='N') $args->use_comment = 'Y';
+
unset($args->wiki_name);
if($args->module_srl) {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
diff --git a/modules/wiki/wiki.controller.php b/modules/wiki/wiki.controller.php
index 4750a612d..2d9709c72 100644
--- a/modules/wiki/wiki.controller.php
+++ b/modules/wiki/wiki.controller.php
@@ -13,6 +13,15 @@
// 글작성시 필요한 변수를 세팅
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
+ if($this->module_info->use_comment != 'N')
+ {
+ $obj->allow_comment = 'Y';
+ }
+ else
+ {
+ $obj->allow_comment = 'N';
+ }
+
if(!$obj->nick_name) $obj->nick_name = "anonymous";
if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N';
@@ -53,6 +62,98 @@
// 성공 메세지 등록
$this->setMessage($msg_code);
}
+
+ function procWikiInsertComment() {
+ // 권한 체크
+ if(!$this->grant->write_comment) return new Object(-1, 'msg_not_permitted');
+
+ // 댓글 입력에 필요한 데이터 추출
+ $obj = Context::gets('document_srl','comment_srl','parent_srl','content','password','nick_name','nick_name','member_srl','email_address','homepage','is_secret','notify_message');
+ $obj->module_srl = $this->module_srl;
+
+ // 원글이 존재하는지 체크
+ $oDocumentModel = &getModel('document');
+ $oDocument = $oDocumentModel->getDocument($obj->document_srl);
+ if(!$oDocument->isExists()) return new Object(-1,'msg_not_permitted');
+
+ // comment 모듈의 model 객체 생성
+ $oCommentModel = &getModel('comment');
+
+ // comment 모듈의 controller 객체 생성
+ $oCommentController = &getController('comment');
+
+ // comment_srl이 존재하는지 체크
+ // 만일 comment_srl이 n/a라면 getNextSequence()로 값을 얻어온다.
+ if(!$obj->comment_srl) {
+ $obj->comment_srl = getNextSequence();
+ } else {
+ $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
+ }
+
+ // comment_srl이 없을 경우 신규 입력
+ if($comment->comment_srl != $obj->comment_srl) {
+
+ // parent_srl이 있으면 답변으로
+ if($obj->parent_srl) {
+ $parent_comment = $oCommentModel->getComment($obj->parent_srl);
+ if(!$parent_comment->comment_srl) return new Object(-1, 'msg_invalid_request');
+
+ $output = $oCommentController->insertComment($obj);
+
+ // 없으면 신규
+ } else {
+ $output = $oCommentController->insertComment($obj);
+ }
+
+ // 문제가 없고 모듈 설정에 관리자 메일이 등록되어 있으면 메일 발송
+ if($output->toBool() && $this->module_info->admin_mail) {
+ $oMail = new Mail();
+ $oMail->setTitle($oDocument->getTitleText());
+ $oMail->setContent( sprintf("From : %s#comment_%d
\r\n%s", $oDocument->getPermanentUrl(), $obj->comment_srl, $oDocument->getPermanentUrl(), $obj->comment_srl, $obj->content));
+ $oMail->setSender($obj->user_name, $obj->email_address);
+
+ $target_mail = explode(',',$this->module_info->admin_mail);
+ for($i=0;$isetReceiptor($email_address, $email_address);
+ $oMail->send();
+ }
+ }
+
+ // comment_srl이 있으면 수정으로
+ } else {
+ $obj->parent_srl = $comment->parent_srl;
+ $output = $oCommentController->updateComment($obj, $this->grant->manager);
+ $comment_srl = $obj->comment_srl;
+ }
+
+ if(!$output->toBool()) return $output;
+
+ $this->setMessage('success_registed');
+ $this->add('mid', Context::get('mid'));
+ $this->add('document_srl', $obj->document_srl);
+ $this->add('comment_srl', $obj->comment_srl);
+ }
+
+ function procWikiDeleteComment() {
+ // check the comment's sequence number
+ debugPrint('here');
+ $comment_srl = Context::get('comment_srl');
+ if(!$comment_srl) return $this->doError('msg_invalid_request');
+
+ // create controller object of comment module
+ $oCommentController = &getController('comment');
+
+ $output = $oCommentController->deleteComment($comment_srl, $this->grant->manager);
+ debugPrint($output);
+ if(!$output->toBool()) return $output;
+
+ $this->add('mid', Context::get('mid'));
+ $this->add('page', Context::get('page'));
+ $this->add('document_srl', $output->get('document_srl'));
+ $this->setMessage('success_deleted');
+ }
}
?>
diff --git a/modules/wiki/wiki.view.php b/modules/wiki/wiki.view.php
index 3741057c8..9eecaeb78 100644
--- a/modules/wiki/wiki.view.php
+++ b/modules/wiki/wiki.view.php
@@ -172,5 +172,112 @@
return new Object();
}
+
+ /**
+ * @brief 댓글의 답글 화면 출력
+ **/
+ function dispWikiReplyComment() {
+ // 권한 체크
+ if(!$this->grant->write_comment) return $this->dispWikiMessage('msg_not_permitted');
+
+ // 목록 구현에 필요한 변수들을 가져온다
+ $parent_srl = Context::get('comment_srl');
+
+ // 지정된 원 댓글이 없다면 오류
+ if(!$parent_srl) return new Object(-1, 'msg_invalid_request');
+
+ // 해당 댓글를 찾아본다
+ $oCommentModel = &getModel('comment');
+ $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager);
+
+ // 댓글이 없다면 오류
+ if(!$oSourceComment->isExists()) return $this->dispWikiMessage('msg_invalid_request');
+ if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) return $this->dispWikiMessage('msg_invalid_request');
+
+ // 대상 댓글을 생성
+ $oComment = $oCommentModel->getComment();
+ $oComment->add('parent_srl', $parent_srl);
+ $oComment->add('document_srl', $oSourceComment->get('document_srl'));
+
+ // 필요한 정보들 세팅
+ Context::set('oSourceComment',$oSourceComment);
+ Context::set('oComment',$oComment);
+
+ /**
+ * 사용되는 javascript 필터 추가
+ **/
+ Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml');
+
+ $this->setTemplateFile('comment_form');
+ }
+
+ /**
+ * @brief 댓글 수정 폼 출력
+ **/
+ function dispWikiModifyComment() {
+ // 권한 체크
+ if(!$this->grant->write_comment) return $this->dispWikiMessage('msg_not_permitted');
+
+ // 목록 구현에 필요한 변수들을 가져온다
+ $document_srl = Context::get('document_srl');
+ $comment_srl = Context::get('comment_srl');
+
+ // 지정된 댓글이 없다면 오류
+ if(!$comment_srl) return new Object(-1, 'msg_invalid_request');
+
+ // 해당 댓글를 찾아본다
+ $oCommentModel = &getModel('comment');
+ $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
+
+ // 댓글이 없다면 오류
+ if(!$oComment->isExists()) return $this->dispWikiMessage('msg_invalid_request');
+
+ // 글을 수정하려고 할 경우 권한이 없는 경우 비밀번호 입력화면으로
+ if(!$oComment->isGranted()) return $this->setTemplateFile('input_password_form');
+
+ // 필요한 정보들 세팅
+ Context::set('oSourceComment', $oCommentModel->getComment());
+ Context::set('oComment', $oComment);
+
+ /**
+ * 사용되는 javascript 필터 추가
+ **/
+ Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml');
+
+ $this->setTemplateFile('comment_form');
+ }
+
+ /**
+ * @brief 댓글 삭제 화면 출력
+ **/
+ function dispWikiDeleteComment() {
+ // 권한 체크
+ if(!$this->grant->write_comment) return $this->dispWikiMessage('msg_not_permitted');
+
+ // 삭제할 댓글번호를 가져온다
+ $comment_srl = Context::get('comment_srl');
+
+ // 삭제하려는 댓글이 있는지 확인
+ if($comment_srl) {
+ $oCommentModel = &getModel('comment');
+ $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
+ }
+
+ // 삭제하려는 글이 없으면 에러
+ if(!$oComment->isExists() ) return $this->dispWikiContent();
+
+ // 권한이 없는 경우 비밀번호 입력화면으로
+ if(!$oComment->isGranted()) return $this->setTemplateFile('input_password_form');
+
+ Context::set('oComment',$oComment);
+
+ /**
+ * 필요한 필터 추가
+ **/
+ Context::addJsFilter($this->module_path.'tpl/filter', 'delete_comment.xml');
+
+ $this->setTemplateFile('delete_comment_form');
+ }
+
}
?>
+ {@ $_uploaded_files = $comment->getUploadedFiles() } + +- {$file->source_filename} ({FileHandler::filesize($file->file_size)})({number_format($file->download_count)})
+
+
+ +