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

This commit is contained in:
zero 2007-03-15 08:56:22 +00:00
parent 6c077be600
commit 437a8b1395
11 changed files with 195 additions and 40 deletions

View file

@ -59,6 +59,9 @@
// ModuleModel 객체 생성
$oModuleModel = &getModel('module');
// 특별히 module이 지정되지 않았을 시에 모듈을 찾기 위해 시도
if(!$this->module) {
// document_srl이 있으면 document_srl로 모듈과 모듈 정보를 구함
if($this->document_srl) $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
@ -67,9 +70,9 @@
// 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
if(!$module_info && !$this->module) $module_info = $oModuleModel->getModuleInfoByMid();
}
// 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함
// 모듈 정보에서 module 이름을 구해움
// 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함, 모듈 정보에서 module 이름을 구해움
if($module_info) {
$this->module = $module_info->module;
$this->mid = $module_info->mid;

View file

@ -15,6 +15,7 @@ function exec_xml(module, act, params, callback_func, response_tags, callback_fu
oXml.addParam("module", module);
oXml.addParam("act", act);
if(typeof(response_tags)=="undefined") response_tags = new Array();
response_tags[response_tags.length] = "redirect_url";
var waiting_obj = document.getElementById("waitingforserverresponse");

View file

@ -259,7 +259,7 @@
// file class의 controller 객체 생성
$oFileController = &getController('file');
$output = $oFileController->deleteFile($file_srl, $this->grant->manager);
if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($document_srl);

View file

@ -4,5 +4,9 @@
<actions>
<action name="dispList" type="view" admin_index="true" standalone="true" />
<action name="dispWrite" type="view" standalone="true" />
<action name="procInsertDocument" type="controller" standalone="true" />
<action name="procDeleteDocument" type="controller" standalone="true" />
<action name="procUploadFile" type="controller" standalone="true" />
<action name="procDeleteFile" type="controller" standalone="true" />
</actions>
</module>

View file

@ -49,5 +49,38 @@
return new Object();
}
/**
* @brief 관리자에서 요청될때 초기화 것들을 정리
**/
function initAdmin() {
// pagemaker 모듈로 등록된 module_srl을 구함
$oPagemakerModel = &getModel('pagemaker');
$this->module_srl = $oPagemakerModel->getModuleSrl();
// 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
/*
if($this->module_info->use_category=='Y') {
$oDocumentModel = &getModel('document');
$this->category_list = $oDocumentModel->getCategoryList($this->module_srl);
Context::set('category_list', $this->category_list);
}
*/
// 에디터 세팅
$editor = "default";
Context::set('editor', $editor);
$editor_path = sprintf("./editor/%s/", $editor);
Context::set('editor_path', $editor_path);
Context::loadLang($editor_path);
// 템플릿에서 사용할 변수를 Context::set()
if($this->module_srl) Context::set('module_srl',$this->module_srl);
// 업로드 권한 부여
$this->grant->fileupload = true;
}
}
?>

View file

@ -11,7 +11,109 @@
* @brief 초기화
**/
function init() {
$this->initAdmin();
}
/**
* @brief 문서 입력
**/
function procInsertDocument() {
// 글작성시 필요한 변수를 세팅
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
// document module의 model 객체 생성
$oDocumentModel = &getModel('document');
// document module의 controller 객체 생성
$oDocumentController = &getController('document');
// 이미 존재하는 글인지 체크
$document = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
// 이미 존재하는 경우 수정
if($document->document_srl == $obj->document_srl) {
$output = $oDocumentController->updateDocument($document, $obj);
$msg_code = 'success_updated';
// 그렇지 않으면 신규 등록
} else {
$output = $oDocumentController->insertDocument($obj);
$msg_code = 'success_registed';
$obj->document_srl = $output->get('document_srl');
}
if(!$output->toBool()) return $output;
// 트랙백 발송
$trackback_url = Context::get('trackback_url');
$trackback_charset = Context::get('trackback_charset');
if($trackback_url) {
$oTrackbackController = &getController('trackback');
$oTrackbackController->sendTrackback($obj, $trackback_url, $trackback_charset);
}
$this->add('document_srl', $output->get('document_srl'));
$this->add('page', $output->get('page'));
$this->setMessage($msg_code);
}
/**
* @brief 문서 삭제
**/
function procDeleteDocument() {
// 문서 번호 확인
$document_srl = Context::get('document_srl');
if(!$document_srl) return $this->doError('msg_invalid_document');
// document module model 객체 생성
$oDocumentController = &getController('document');
// 삭제 시도
$output = $oDocumentController->deleteDocument($document_srl, true);
if(!$output->toBool()) return $output;
$this->add('page', $output->get('page'));
$this->setMessage('success_deleted');
}
/**
* @brief 첨부파일 업로드
**/
function procUploadFile() {
// 업로드 권한이 없거나 정보가 없을시 종료
if(!Context::isUploaded()) exit();
// 기본적으로 필요한 변수인 document_srl, module_srl을 설정
$document_srl = Context::get('document_srl');
$module_srl = $this->module_srl;
// file class의 controller 객체 생성
$oFileController = &getController('file');
$output = $oFileController->insertFile($module_srl, $document_srl);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($document_srl);
}
/**
* @brief 첨부파일 삭제
* 에디터에서 개별 파일 삭제시 사용
**/
function procDeleteFile() {
// 기본적으로 필요한 변수인 document_srl, module_srl을 설정
$document_srl = Context::get('document_srl');
$module_srl = $this->module_srl;
$file_srl = Context::get('file_srl');
// file class의 controller 객체 생성
$oFileController = &getController('file');
if($file_srl) $output = $oFileController->deleteFile($file_srl, true);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($document_srl);
}
}
?>

View file

@ -15,39 +15,10 @@
* @brief 초기화
**/
function init() {
// pagemaker 모듈로 등록된 module_srl을 구함
$oPagemakerModel = &getModel('pagemaker');
$this->module_srl = $oPagemakerModel->getModuleSrl();
// template path 지정
$this->setTemplatePath($this->module_path.'tpl.admin');
}
/**
* @brief 관리자에서 요청될때 초기화 것들을 정리
**/
function initAdmin() {
// 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
/*
if($this->module_info->use_category=='Y') {
$oDocumentModel = &getModel('document');
$this->category_list = $oDocumentModel->getCategoryList($this->module_srl);
Context::set('category_list', $this->category_list);
}
*/
// 에디터 세팅
$editor = "default";
Context::set('editor', $editor);
$editor_path = sprintf("./editor/%s/", $editor);
Context::set('editor_path', $editor_path);
Context::loadLang($editor_path);
// 템플릿에서 사용할 변수를 Context::set()
if($this->module_srl) Context::set('module_srl',$this->module_srl);
}
/**
* @brief 목록 출력
**/

View file

@ -0,0 +1,13 @@
<filter name="insert" module="pagemaker" act="procInsertDocument" confirm_msg_code="confirm_submit">
<form>
<node target="document_srl" required="true" />
<node target="title" required="true" minlength="1" maxlength="250" />
<node target="content" required="true" />
</form>
<response callback_func="completeDocumentInserted">
<tag name="error" />
<tag name="message" />
<tag name="page" />
<tag name="document_srl" />
</response>
</filter>

View file

@ -0,0 +1,23 @@
/* 글쓰기 작성후 */
function completeDocumentInserted(ret_obj) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var page = ret_obj['page'];
var document_srl = ret_obj['document_srl'];
var url = "./?module=admin&mo=pagemaker&act=dispWrite&document_srl="+document_srl;
if(page) url += "&page="+page;
location.href = url;
}
/* 글 삭제 */
function completeDeleteDocument(ret_obj) {
var error = ret_obj['error'];
var message = ret_obj['message'];
var page = ret_obj['page'];
alert(message);
var url = "./?module=admin&mo=pagemaker&act=dispWrite&document_srl="+document_srl;
if(page) url += "&page="+page;
location.href = url;
}

View file

@ -31,7 +31,7 @@
<td>{$category_list[$val->category_srl]->title}</td>
<!--@end-->
<td>
<a href="{getUrl('document_srl',$val->document_srl)}">{$val->title}</a>
<a href="{getUrl('document_srl',$val->document_srl,'act','dispWrite')}">{$val->title}</a>
</td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
</tr>

View file

@ -1,4 +1,9 @@
<!--%import("filter/insert.xml")-->
<!--%import("js/admin.js")-->
<form action="./" method="post" onsubmit="return procFilter(this, insert)" enctype="multipart/form-data">
<input type="hidden" name="module" value="{$mo}" />
<input type="hidden" name="act" value="procUploadFile" />
<input type="hidden" name="content" value="{htmlspecialchars($document->content)}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<table width="100%">
@ -68,7 +73,7 @@
</tr>
<tr>
<td colspan="2">
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('act','dispList')}'" />
<input type="button" value="{$lang->cmd_list}" onclick="location.href='{getUrl('act','dispList','document_srl','')}'" />
<input type="submit" value="{$lang->cmd_registration}" accesskey="s" />
</td>
</tr>