From fcf10812a66d16408b8aae5070af2f1db7e09ab7 Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 16 Mar 2007 05:06:31 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@485 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/board/board.controller.php | 14 ++++++-------- modules/board/board.view.php | 5 +++-- modules/board/skins/default/comment_form.html | 4 +++- modules/board/skins/default/write_form.html | 1 - modules/comment/comment.controller.php | 1 - modules/editor/editor.view.php | 3 ++- modules/editor/tpl/editor.html | 4 ++-- modules/editor/tpl/js/uploader.js | 5 ++++- modules/file/file.controller.php | 2 +- 9 files changed, 21 insertions(+), 18 deletions(-) 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 @@ -
+fileupload)-->enctype="multipart/form-data"> diff --git a/modules/board/skins/default/write_form.html b/modules/board/skins/default/write_form.html index e7f617921..d25ff6b4f 100644 --- a/modules/board/skins/default/write_form.html +++ b/modules/board/skins/default/write_form.html @@ -3,7 +3,6 @@ fileupload)-->enctype="multipart/form-data"> - diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 577bc86a3..c31ab2901 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -40,7 +40,6 @@ $oDB = &DB::getInstance(); - $obj->comment_srl = $oDB->getNextSequence(); $obj->list_order = $obj->comment_srl * -1; if($obj->password) $obj->password = md5($obj->password); diff --git a/modules/editor/editor.view.php b/modules/editor/editor.view.php index f38baaafa..20ef9160c 100644 --- a/modules/editor/editor.view.php +++ b/modules/editor/editor.view.php @@ -16,8 +16,9 @@ /** * @brief 에디터를 return **/ - function getEditor($upload_target_srl) { + function getEditor($upload_target_srl, $allow_fileupload = false) { Context::set('upload_target_srl', $upload_target_srl); + Context::set('allow_fileupload', $allow_fileupload); $tpl_path = $this->module_path.'tpl'; $tpl_file = 'editor.html'; diff --git a/modules/editor/tpl/editor.html b/modules/editor/tpl/editor.html index 9ddffcbb1..e786a306f 100644 --- a/modules/editor/tpl/editor.html +++ b/modules/editor/tpl/editor.html @@ -65,14 +65,14 @@
- - + +
diff --git a/modules/editor/tpl/js/uploader.js b/modules/editor/tpl/js/uploader.js index 477c3cc5a..e18160e7e 100755 --- a/modules/editor/tpl/js/uploader.js +++ b/modules/editor/tpl/js/uploader.js @@ -37,15 +37,18 @@ function editor_upload_form_set(upload_target_srl) { while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; } fo_obj.target = 'tmp_upload_iframe'; - // upload_target_srl에 해당하는 첨부파일 목록을 로드 + // upload_target_srl에 해당하는 첨부파일 목록을 로드 (procDeleteFile에 file_srl을 보내주지 않으면 삭제시도는 없이 목록만 갱신할 수 있음) var module = ""; if(fo_obj["module"]) module = fo_obj.module.value; var mid = ""; if(fo_obj["mid"]) mid = fo_obj.mid.value; + var document_srl = ""; + if(fo_obj["document_srl"]) document_srl = fo_obj.document_srl.value; var url = "./?act=procDeleteFile&upload_target_srl="+upload_target_srl; if(module) url+="&module="+module; if(mid) url+="&mid="+mid; + if(document_srl) url+="&document_srl="+document_srl; // iframe에 url을 보내버림 var iframe_obj = xGetElementById('tmp_upload_iframe'); diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index eeb2278d1..75f924236 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -70,7 +70,7 @@ /** * @brief 첨부파일 삭제 **/ - function deleteFile($file_srl) { + function deleteFile($file_srl, $is_admin = false) { $oDB = &DB::getInstance(); // 파일 정보를 가져옴