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

This commit is contained in:
zero 2007-06-12 07:36:56 +00:00
parent 57616a3396
commit 4556470a9e
9 changed files with 23 additions and 203 deletions

View file

@ -1,4 +1,3 @@
<?php
/**
* @class blogModel
@ -15,44 +14,6 @@
function init() {
}
/**
* @brief 블로그의 코멘트 폼을 찾아서 return
**/
function getBlogCommentEditorForm() {
$document_srl = Context::get('document_srl');
$upload_target_srl = getNextSequence();
// 에디터 모듈의 getEditor를 호출하여 세팅
$oEditorModel = &getModel('editor');
$option->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

View file

@ -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);
}

View file

@ -17,6 +17,10 @@
<title xml:lang="ko">파일 첨부</title>
<title xml:lang="en">file upload</title>
</grant>
<grant name="comment_fileupload" default="guest">
<title xml:lang="ko">댓글 파일 첨부</title>
<title xml:lang="en">comment file upload</title>
</grant>
<grant name="manager" default="root">
<title xml:lang="ko">관리</title>
<title xml:lang="en">manager</title>
@ -32,8 +36,6 @@
<action name="dispBlogDeleteTrackback" type="view" />
<action name="dispBlogMessage" type="view" />
<action name="getBlogCommentEditorForm" type="model" />
<action name="procBlogInsertDocument" type="controller" />
<action name="procBlogDeleteDocument" type="controller" />
<action name="procBlogInsertComment" type="controller" />

View file

@ -58,5 +58,5 @@
<!-- 댓글 입력 폼 -->
<!--@if($grant->write_comment && $document->lock_comment == 'N')-->
<div id="comment_form_{$document->document_srl}"></div>
<!--#include("./comment_form.html")-->
<!--@end-->

View file

@ -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'];

View file

@ -64,26 +64,23 @@
<!-- 댓글/ 엮인글 정보 출력 -->
<div>
<a href="#" onclick="doDisplayComment('{$document->document_srl}');return false;">{$lang->comment} : {count($document->comment_list)}</a>,
<a href="#" onclick="doDisplayTrackback('{$document->document_srl}');return false;">{$lang->trackback} : {count($document->trackback_list)}</a>
<a href="#comment_top_{$document->document_srl}">{$lang->comment} : {count($document->comment_list)}</a>,
<a href="#trackback_{$document->document_srl}">{$lang->trackback} : {count($document->trackback_list)}</a>
</div>
<!-- 엮인글 목록 -->
<a name="trackback_{$document->document}"></a>
<a name="trackback_{$document->document_srl}"></a>
<div id="trackback_{$document->document_srl}" style="display:none">
<!-- 엮인글 파일 include -->
<!--@if($document->allow_trackback=='Y')-->
<!--#include("./trackback.html")-->
<!--@end-->
</div>
<!-- 댓글 정보 출력 -->
<a name="comment_top_{$document->document_srl}"></a>
<div id="comment_{$document->document_srl}" style="display:none">
<!-- 댓글 파일 include -->
<!--@if($grant->write_comment&&$document->allow_comment=='Y')-->
{@ $document_srl = $document->document_srl; }
<!--#include("./comment.html")-->
<!--@end-->
</div>

View file

@ -54,5 +54,5 @@
<!-- 댓글 입력 폼 -->
<!--@if($grant->write_comment && $document->lock_comment == 'N')-->
<div id="comment_form_{$document->document_srl}"></div>
<!--#include("./comment_form.html")-->
<!--@end-->

View file

@ -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'];

View file

@ -84,27 +84,24 @@
<ul class="replyAndTrackback">
<!--@if($grant->write_comment&&$document->allow_comment=='Y')-->
<li class="reply"><a href="#" onclick="doDisplayComment('{$document->document_srl}');return false;">{$lang->comment} <strong>{count($document->comment_list)}</strong></a></li>
<li class="reply"><a href="#trackback_{$document->document_srl}">{$lang->comment} <strong>{count($document->comment_list)}</strong></a></li>
<!--@end-->
<!--@if($document->allow_trackback=='Y')-->
<li class="trackback"><a href="#" onclick="doDisplayTrackback('{$document->document_srl}');return false;">{$lang->trackback} <strong>{count($document->trackback_list)}</strong></a></li>
<li class="trackback"><a href="#comment_top_{$document->document_srl}">{$lang->trackback} <strong>{count($document->trackback_list)}</strong></a></li>
<!--@end-->
</ul>
</div>
<!-- 엮인글 파일 include -->
<a name="trackback_{$document->document}"></a>
<div id="trackback_{$document->document_srl}" style="display:none">
<a name="trackback_{$document->document_srl}"></a>
<!--@if($document->allow_trackback=='Y')-->
<!--#include("./trackback.html")-->
<!--@end-->
</div>
<!-- 댓글 파일 include -->
<a name="comment_top_{$document->document_srl}"></a>
<div id="comment_{$document->document_srl}" style="display:none">
<!--@if($grant->write_comment&&$document->allow_comment=='Y')-->
{@ $document_srl = $document->document_srl; }
<!--#include("./comment.html")-->
<!--@end-->
</div>