From 4556470a9e9834b36fada1f91e71fe2319f14457 Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 12 Jun 2007 07:36:56 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1611 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/blog/blog.model.php | 39 ---------- modules/blog/blog.view.php | 15 ++-- modules/blog/conf/module.xml | 6 +- modules/blog/skins/default/comment.html | 2 +- modules/blog/skins/default/js/blog.js | 65 ---------------- modules/blog/skins/default/view_document.html | 11 +-- modules/blog/skins/xe_blog/comment.html | 2 +- modules/blog/skins/xe_blog/js/blog.js | 75 ------------------- modules/blog/skins/xe_blog/view_document.html | 11 +-- 9 files changed, 23 insertions(+), 203 deletions(-) diff --git a/modules/blog/blog.model.php b/modules/blog/blog.model.php index db963a024..8ffd670d1 100644 --- a/modules/blog/blog.model.php +++ b/modules/blog/blog.model.php @@ -1,4 +1,3 @@ - allow_fileupload = false; - $option->enable_autosave = false; - $option->enable_default_component = true; - $option->enable_component = true; - $option->resizable = true; - $option->height = 100; - $comment_editor = $oEditorModel->getEditor($upload_target_srl, $option); - - // 변수 설정 - Context::set('comment_editor', $comment_editor); - Context::set('document_srl', $document_srl); - Context::set('comment_srl', $upload_target_srl); - - // template 가져옴 - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); - - $oTemplate = &TemplateHandler::getInstance(); - $tpl = $oTemplate->compile($template_path, 'comment_form'); - $path = str_replace('index.php','',$_SERVER['SCRIPT_NAME']); - $tpl = preg_replace('!(href|src)=("|\'){0,1}\.\/([a-zA-Z0-9\_^\/]+)\/!is', '\\1=\\2'.$path.'$3/', $tpl); - - - // 결과 설정 - $this->add('document_srl', $document_srl); - $this->add('upload_target_srl', $upload_target_srl); - $this->add('tpl', $tpl); - } - /** * @brief DB 에 생성된 카테고리 정보를 구함 * 생성된 메뉴의 DB정보+XML정보를 return diff --git a/modules/blog/blog.view.php b/modules/blog/blog.view.php index 5eec64e94..a2a987853 100644 --- a/modules/blog/blog.view.php +++ b/modules/blog/blog.view.php @@ -91,7 +91,7 @@ unset($document_srl); Context::set('document_srl','',true); - // 글이 찾아졌으면 댓글 권한과 허용 여부를 체크 + // 글이 찾아졌으면 댓글 권한과 허용 여부를 체크하여 댓글 에디터 세팅 } elseif($this->grant->write_comment && $document->allow_comment == 'Y' && $document->lock_comment != 'Y') { // 브라우저 타이틀 $browser_title = $this->module_info->browser_title.' - '.$document->title; @@ -101,6 +101,9 @@ Context::set('document', $document); } + // 댓글 + $this->setCommentEditor(0, 100); + // 만약 document_srl은 있는데 page가 없다면 글만 호출된 경우 page를 구해서 세팅해주자.. if($document_srl && !$page) { $page = $oDocumentModel->getDocumentPage($document_srl, $this->module_srl, $this->list_count); @@ -251,7 +254,7 @@ Context::set('source_comment',$source_comment); // 댓글 에디터 세팅 - $this->setCommentEditor(); + $this->setCommentEditor(0,400); $this->setTemplateFile('comment_form'); } @@ -286,7 +289,7 @@ Context::set('comment', $comment); // 댓글 에디터 세팅 - $this->setCommentEditor($comment_srl); + $this->setCommentEditor($comment_srl,400); $this->setTemplateFile('comment_form'); } @@ -353,18 +356,18 @@ * 댓글의 경우 수정하는 경우가 아니라면 고유값이 없음.\n * 따라서 고유값이 없을 경우 고유값을 가져와서 지정해 주어야 함 **/ - function setCommentEditor($comment_srl=0) { + function setCommentEditor($comment_srl=0, $height = 100) { if(!$comment_srl) { $comment_srl = getNextSequence(); Context::set('comment_srl', $comment_srl); } $oEditorModel = &getModel('editor'); - $option->allow_fileupload = false; + $option->allow_fileupload = $this->grant->comment_fileupload; $option->enable_autosave = false; $option->enable_default_component = true; $option->enable_component = true; $option->resizable = true; - $option->height = 400; + $option->height = $height; $comment_editor = $oEditorModel->getEditor($comment_srl, $option); Context::set('comment_editor', $comment_editor); } diff --git a/modules/blog/conf/module.xml b/modules/blog/conf/module.xml index bc3e777be..ecd8491fa 100644 --- a/modules/blog/conf/module.xml +++ b/modules/blog/conf/module.xml @@ -17,6 +17,10 @@ 파일 첨부 file upload + + 댓글 파일 첨부 + comment file upload + 관리 manager @@ -32,8 +36,6 @@ - - diff --git a/modules/blog/skins/default/comment.html b/modules/blog/skins/default/comment.html index 99a9b036d..5d7a89e74 100644 --- a/modules/blog/skins/default/comment.html +++ b/modules/blog/skins/default/comment.html @@ -58,5 +58,5 @@ -
+ diff --git a/modules/blog/skins/default/js/blog.js b/modules/blog/skins/default/js/blog.js index 3bd9353ea..d57637070 100644 --- a/modules/blog/skins/default/js/blog.js +++ b/modules/blog/skins/default/js/blog.js @@ -4,71 +4,6 @@ * @brief blog 모듈의 javascript **/ -/** - * url에 #comment_번호가 있을 경우 댓글창을 열고 위치 이동 - **/ -if(location.href.indexOf('#comment')>0) { - function openCommentAndMove() { - doDisplayComment(current_url.getQuery('document_srl')); - location.href = location.href; - } - - xAddEventListener(window,'load', openCommentAndMove); -} - -/** - * 댓글 오픈 - * 댓글의 경우 editor를 동반해서 불러야 하기에 ajax로 tpl파일을 가져와서 쓰는걸로 한다. - **/ -var _opend_comment = new Array(); -function doDisplayComment(document_srl) { - var comment_zone = xGetElementById('comment_'+document_srl); - - // 닫혀 있는 상태라면 한번이라도 열렸었는지 검사하여 열린적이 없다면 에디터를 가져온다 - if(comment_zone.style.display != "block") { - if(!_opend_comment[document_srl]) { - _opend_comment[document_srl] = true; - doGetCommentEditorForm(document_srl); - } - comment_zone.style.display = "block"; - } - else comment_zone.style.display = "none"; -} - -function doGetCommentEditorForm(document_srl) { - var params = new Array(); - params['document_srl'] = document_srl; - - var response_tags = new Array('error','message','document_srl','upload_target_srl','tpl'); - show_waiting_message = false; - exec_xml('blog','getBlogCommentEditorForm', params, completeCommentEditorForm, response_tags); - show_waiting_message = true; -} - -var editor_path = "./modules/editor/tpl"; -function completeCommentEditorForm(ret_obj) { - var document_srl = ret_obj['document_srl']; - var upload_target_srl = ret_obj['upload_target_srl']; - var tpl = ret_obj['tpl']; - var comment_form_zone = xGetElementById('comment_form_'+document_srl); - if(!comment_form_zone) return; - - // tpl 입력 - xInnerHtml(comment_form_zone, tpl); - - // 에디터 실행 - editorStart(upload_target_srl, true, 100); -} - -/** - * 엮인글 오픈 - **/ -function doDisplayTrackback(document_srl) { - var trackback_zone = xGetElementById('trackback_'+document_srl); - if(trackback_zone.style.display != "block") trackback_zone.style.display = "block"; - else trackback_zone.style.display = "none"; -} - /* 글쓰기 작성후 */ function completeDocumentInserted(ret_obj) { var error = ret_obj['error']; diff --git a/modules/blog/skins/default/view_document.html b/modules/blog/skins/default/view_document.html index 00d6b6053..4c9a33cfb 100644 --- a/modules/blog/skins/default/view_document.html +++ b/modules/blog/skins/default/view_document.html @@ -64,26 +64,23 @@ - + - - diff --git a/modules/blog/skins/xe_blog/comment.html b/modules/blog/skins/xe_blog/comment.html index 566f2a5f4..048ab2236 100644 --- a/modules/blog/skins/xe_blog/comment.html +++ b/modules/blog/skins/xe_blog/comment.html @@ -54,5 +54,5 @@ -
+ diff --git a/modules/blog/skins/xe_blog/js/blog.js b/modules/blog/skins/xe_blog/js/blog.js index f2ae6f701..dba8c67a6 100644 --- a/modules/blog/skins/xe_blog/js/blog.js +++ b/modules/blog/skins/xe_blog/js/blog.js @@ -4,81 +4,6 @@ * @brief blog 모듈의 javascript **/ -/** - * url에 #comment_번호가 있을 경우 댓글창을 열고 위치 이동 - **/ -if(location.href.indexOf('#comment')>0) { - function openCommentAndMove() { - doDisplayComment(current_url.getQuery('document_srl')); - location.href = location.href; - } - - xAddEventListener(window,'load', openCommentAndMove); -} - -if(location.href.indexOf('#trackback')>0) { - function openTrackbackAndMove() { - doDisplayTrackback(current_url.getQuery('document_srl')); - location.href = location.href; - } - - xAddEventListener(window,'load', openTrackbackAndMove); -} - - -/** - * 댓글 오픈 - * 댓글의 경우 editor를 동반해서 불러야 하기에 ajax로 tpl파일을 가져와서 쓰는걸로 한다. - **/ -var _opend_comment = new Array(); -function doDisplayComment(document_srl) { - var comment_zone = xGetElementById('comment_'+document_srl); - - // 닫혀 있는 상태라면 한번이라도 열렸었는지 검사하여 열린적이 없다면 에디터를 가져온다 - if(comment_zone.style.display != "block") { - if(!_opend_comment[document_srl]) { - _opend_comment[document_srl] = true; - doGetCommentEditorForm(document_srl); - } - comment_zone.style.display = "block"; - } - else comment_zone.style.display = "none"; -} - -function doGetCommentEditorForm(document_srl) { - var params = new Array(); - params['document_srl'] = document_srl; - - var response_tags = new Array('error','message','document_srl','upload_target_srl','tpl'); - show_waiting_message = false; - exec_xml('blog','getBlogCommentEditorForm', params, completeCommentEditorForm, response_tags); - show_waiting_message = true; -} - -var editor_path = "./modules/editor/tpl"; -function completeCommentEditorForm(ret_obj) { - var document_srl = ret_obj['document_srl']; - var upload_target_srl = ret_obj['upload_target_srl']; - var tpl = ret_obj['tpl']; - var comment_form_zone = xGetElementById('comment_form_'+document_srl); - if(!comment_form_zone) return; - - // tpl 입력 - xInnerHtml(comment_form_zone, tpl); - - // 에디터 실행 - editorStart(upload_target_srl, true, 100); -} - -/** - * 엮인글 오픈 - **/ -function doDisplayTrackback(document_srl) { - var trackback_zone = xGetElementById('trackback_'+document_srl); - if(trackback_zone.style.display != "block") trackback_zone.style.display = "block"; - else trackback_zone.style.display = "none"; -} - /* 글쓰기 작성후 */ function completeDocumentInserted(ret_obj) { var error = ret_obj['error']; diff --git a/modules/blog/skins/xe_blog/view_document.html b/modules/blog/skins/xe_blog/view_document.html index ddd4e212c..d98aa0c68 100644 --- a/modules/blog/skins/xe_blog/view_document.html +++ b/modules/blog/skins/xe_blog/view_document.html @@ -84,27 +84,24 @@ - - -