git-svn-id: http://xe-core.googlecode.com/svn/trunk@1257 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-20 04:26:28 +00:00
parent 875f2d87a1
commit dc6fcf3fe0
9 changed files with 78 additions and 17 deletions

View file

@ -15,6 +15,34 @@
function init() { function init() {
} }
/**
* @brief 블로그의 코멘트 폼을 찾아서 return
**/
function getBlogCommentEditorForm() {
$document_srl = Context::get('document_srl');
$upload_target_srl = getNextSequence();
// 에디터 모듈의 getEditor를 호출하여 세팅
$oEditorModel = &getModel('editor');
$comment_editor = $oEditorModel->getEditor($upload_target_srl, false);
// 변수 설정
Context::set('comment_editor', $comment_editor);
Context::set('document_srl', $document_srl);
Context::set('comment_srl', $upload_target_srl);
// template 가져옴
$oTemplate = new TemplateHandler();
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->skin);
$tpl = $oTemplate->compile($template_path, 'comment_form');
// 결과 설정
$this->add('document_srl', $document_srl);
$this->add('upload_target_srl', $upload_target_srl);
$this->add('tpl', $tpl);
}
/** /**
* @brief DB 생성된 카테고리 정보를 구함 * @brief DB 생성된 카테고리 정보를 구함
* 생성된 메뉴의 DB정보+XML정보를 return * 생성된 메뉴의 DB정보+XML정보를 return

View file

@ -124,15 +124,11 @@
unset($document_srl); unset($document_srl);
Context::set('document_srl','',true); Context::set('document_srl','',true);
// 글이 찾아졌으면 댓글 권한과 허용 여부를 체크하여 댓글 에디터 세팅 // 글이 찾아졌으면 댓글 권한과 허용 여부를 체크
} elseif($this->grant->write_comment && $document->allow_comment == 'Y' && $document->lock_comment != 'Y') { } elseif($this->grant->write_comment && $document->allow_comment == 'Y' && $document->lock_comment != 'Y') {
// 브라우저 타이틀 // 브라우저 타이틀
$browser_title = $this->module_info->browser_title.' - '.$document->title; $browser_title = $this->module_info->browser_title.' - '.$document->title;
Context::setBrowserTitle($browser_title); Context::setBrowserTitle($browser_title);
// 댓글
$this->setCommentEditor();
} }
Context::set('document', $document); Context::set('document', $document);
@ -174,6 +170,10 @@
} }
Context::set('search_option', $search_option); Context::set('search_option', $search_option);
// 블로그의 코멘트는 ajax로 호출되기에 미리 css, js파일을 import
Context::addJsFile('./modules/editor/tpl/js/editor.js');
Context::addCSSFile('./modules/editor/tpl/css/editor.css');
$this->setTemplateFile('list'); $this->setTemplateFile('list');
} }

View file

@ -37,6 +37,8 @@
<action name="dispBlogMessage" type="view" /> <action name="dispBlogMessage" type="view" />
<action name="dispBlogRss" type="view" /> <action name="dispBlogRss" type="view" />
<action name="getBlogCommentEditorForm" type="model" />
<action name="procBlogInsertDocument" type="controller" /> <action name="procBlogInsertDocument" type="controller" />
<action name="procBlogDeleteDocument" type="controller" /> <action name="procBlogDeleteDocument" type="controller" />
<action name="procBlogInsertComment" type="controller" /> <action name="procBlogInsertComment" type="controller" />

View file

@ -1,8 +1,10 @@
<!--%import("filter/insert_comment.xml")-->
<!-- 댓글 정보 출력 --> <!-- 댓글 정보 출력 -->
<a name="comment_top_{$document_srl}"></a> <a name="comment_top_{$document->document_srl}"></a>
<!-- 댓글 출력 --> <!-- 댓글 출력 -->
<div id="comment_{$document_srl}" style="display:none"> <div id="comment_{$document->document_srl}" style="display:none">
<!-- 댓글 목록 --> <!-- 댓글 목록 -->
<!--@if($document->comment_list)--> <!--@if($document->comment_list)-->
@ -65,6 +67,6 @@
<!-- 댓글 입력 폼 --> <!-- 댓글 입력 폼 -->
<!--@if($grant->write_comment && $document->lock_comment == 'N')--> <!--@if($grant->write_comment && $document->lock_comment == 'N')-->
<div id="comment_form_{$document_srl}"></div> <div id="comment_form_{$document->document_srl}"></div>
<!--@end--> <!--@end-->
</div> </div>

View file

@ -1,8 +1,5 @@
<!--%import("filter/insert_comment.xml")-->
<!--@if($source_comment)--> <!--@if($source_comment)-->
<!--#include("header.html")--> <!--#include("header.html")-->
<!--@else-->
<!--%import("js/blog.js")--> <!--%import("js/blog.js")-->
<!--@end--> <!--@end-->

View file

@ -6,19 +6,52 @@
/** /**
* 댓글 오픈 * 댓글 오픈
* 댓글의 경우 editor를 동반해서 불러야 하기에 ajax로 tpl파일을 가져와서 쓰는걸로 한다.
**/ **/
var _opend_comment = new Array();
function doDisplayComment(document_srl) { function doDisplayComment(document_srl) {
var comment_zone = xGetElementById('comment_'+document_srl); var comment_zone = xGetElementById('comment_'+document_srl);
if(comment_zone.style.display == "none") comment_zone.style.display = "block";
// 닫혀 있는 상태라면 한번이라도 열렸었는지 검사하여 열린적이 없다면 에디터를 가져온다
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"; 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');
exec_xml('blog','getBlogCommentEditorForm', params, completeCommentEditorForm, response_tags);
}
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);
}
/** /**
* 엮인글 오픈 * 엮인글 오픈
**/ **/
function doDisplayTrackback(document_srl) { function doDisplayTrackback(document_srl) {
var trackback_zone = xGetElementById('trackback_'+document_srl); var trackback_zone = xGetElementById('trackback_'+document_srl);
if(trackback_zone.style.display == "none") trackback_zone.style.display = "block"; if(trackback_zone.style.display != "block") trackback_zone.style.display = "block";
else trackback_zone.style.display = "none"; else trackback_zone.style.display = "none";
} }

View file

@ -1,5 +1,5 @@
<!-- 엮인글 목록 --> <!-- 엮인글 목록 -->
<div id="trackback_{$document_srl}" style="display:none"> <div id="trackback_{$document->document_srl}" style="display:none">
<!--@if($document->trackback_list)--> <!--@if($document->trackback_list)-->
<!--@foreach($document->trackback_list as $key => $val)--> <!--@foreach($document->trackback_list as $key => $val)-->
<a name="trackback_{$val->trackback_srl}"></a> <a name="trackback_{$val->trackback_srl}"></a>

View file

@ -105,8 +105,8 @@
<!-- 댓글/ 엮인글 정보 출력 --> <!-- 댓글/ 엮인글 정보 출력 -->
<div> <div>
<a href="#" onclick="doDisplayComment('{$document_srl}');return false;">{$lang->comment} : {count($document->comment_list)}</a>, <a href="#" onclick="doDisplayComment('{$document->document_srl}');return false;">{$lang->comment} : {count($document->comment_list)}</a>,
<a href="#" onclick="doDisplayTrackback('{$document_srl}');return false;">{$lang->trackback} : {count($document->trackback_list)}</a> <a href="#" onclick="doDisplayTrackback('{$document->document_srl}');return false;">{$lang->trackback} : {count($document->trackback_list)}</a>
</div> </div>
<!-- 엮인글 파일 include --> <!-- 엮인글 파일 include -->

View file

@ -59,7 +59,6 @@
return $oTemplate->compile($tpl_path, $tpl_file); return $oTemplate->compile($tpl_path, $tpl_file);
} }
/** /**
* @brief 자동저장되어 있는 정보를 가져옴 * @brief 자동저장되어 있는 정보를 가져옴
**/ **/