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

This commit is contained in:
zero 2007-03-26 11:38:02 +00:00
parent 403603ec0d
commit 3b980a8183
14 changed files with 132 additions and 401 deletions

View file

@ -299,25 +299,6 @@
$oFileModel->procDownload($file_srl, $sid);
}
/**
* @brief document_srl의 등록 유무를 체크하여 등록되지 않았다면 첨부파일 삭제
*
* 작성중 저장하지 않고 빠져나갔을 경우에 대비한 코드인데\n
* javascript로 빠져나가는 경우 확인이 어려워서 사용되지 않을 코드
**/
function procClearFile() {
$upload_target_srl = Context::get('upload_target_srl');
// upload_target_srl의 글이 등록되어 있다면 pass
$oDocumentModel = &getModel('upload_target');
$data = $oDocumentModel->getDocument($upload_target_srl);
if($data) exit();
// 등록되어 있지 않다면 첨부파일 삭제
$oFileController = &getController('file');
$oFileController->deleteFiles($this->module_srl, $upload_target_srl);
}
/**
* @brief 권한 추가
**/

View file

@ -51,7 +51,6 @@
<action name="procDeleteFile" type="controller" />
<action name="procUploadFile" type="controller" />
<action name="procDownloadFile" type="controller" />
<action name="procClearFile" type="controller" />
<action name="dispAdminContent" type="view" standalone="true" admin_index="true" />
<action name="dispAdminModuleConfig" type="view" standalone="true" />

View file

@ -2,10 +2,7 @@
<module>
<grants />
<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="dispAdminContent" type="view" admin_index="true" standalone="true" />
<action name="procUploadFile" type="controller" standalone="true" />
<action name="procDeleteFile" type="controller" standalone="true" />
</actions>

View file

@ -31,38 +31,5 @@
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,89 +11,22 @@
* @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');
// 기본적으로 필요한 변수 설정
$upload_target_srl = Context::get('upload_target_srl');
$module_srl = $this->module_srl;
// file class의 controller 객체 생성
$oFileController = &getController('file');
$output = $oFileController->insertFile($module_srl, $document_srl);
$output = $oFileController->insertFile($module_srl, $upload_target_srl);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($document_srl);
$oFileController->printUploadedFileList($upload_target_srl);
}
/**
@ -101,17 +34,17 @@
* 에디터에서 개별 파일 삭제시 사용
**/
function procDeleteFile() {
// 기본적으로 필요한 변수인 document_srl, module_srl을 설정
$document_srl = Context::get('document_srl');
// 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정
$upload_target_srl = Context::get('upload_target_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);
if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($document_srl);
$oFileController->printUploadedFileList($upload_target_srl);
}

View file

@ -13,17 +13,5 @@
function init() {
}
/**
* @brief pagemaker로 등록된 module_srl을 찾아서 return
* pagemaker의 내용은 게시판처럼 document에 저장이 된다.
* 설치시에 pagemaker 모듈을 modules에 등록을 하며 module_srl은 sequence값으로 입력되기에 찾아야한다.
**/
function getModuleSrl() {
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByMid('pagemaker');
$module_srl = $module_info->module_srl;
return $module_srl;
}
}
?>

View file

@ -20,88 +20,46 @@
}
/**
* @brief 목록 출력
* @brief 페이지 관리 목록 보여줌
**/
function dispList() {
$this->initAdmin();
// 목록 구현에 필요한 변수들을 가져온다
$page_srl = Context::get('page_srl');
$page = Context::get('page');
function dispAdminContent() {
// 등록된 page 모듈을 불러와 세팅
$oDB = &DB::getInstance();
$args->sort_index = "module_srl";
$args->page = Context::get('page');
$args->list_count = 40;
$args->page_count = 10;
$args->s_module_category_srl = Context::get('module_category_srl');
$output = $oDB->executeQuery('pagemaker.getPageList', $args);
// document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-;
$oDocumentModel = &getModel('document');
// 목록을 구하기 위한 옵션
$args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl
$args->page = $page; ///< 페이지
$args->list_count = $this->list_count; ///< 한페이지에 보여줄 글 수
$args->page_count = $this->page_count; ///< 페이지 네비게이션에 나타날 페이지의 수
$args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...)
$args->search_keyword = Context::get('search_keyword'); ///< 검색어
if($this->module_info->use_category=='Y') $args->category_srl = Context::get('category'); ///< 카테고리 사용시 선택된 카테고리
$args->sort_index = 'list_order'; ///< 소팅 값
// 목록 구함, document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
$output = $oDocumentModel->getDocumentList($args);
// 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅
// 템플릿에 쓰기 위해서 context::set
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('document_list', $output->data);
Context::set('page_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿에서 사용할 검색옵션 세팅
$count_search_option = count($this->search_option);
for($i=0;$i<$count_search_option;$i++) {
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
}
Context::set('search_option', $search_option);
$this->setTemplateFile('list');
// 템플릿 파일 지정
$this->setTemplateFile('index');
}
/**
* @brief 작성 화면 출력
* @brief 페이지에 필요한 기본 설정들
**/
function dispWrite() {
function dispAdminModuleConfig() {
// 관리자 관련 정보 세팅
$this->initAdmin();
// GET parameter에서 document_srl을 가져옴
$document_srl = Context::get('document_srl');
// 설정 정보를 받아옴 (module model 객체를 이용)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('page');
Context::set('config',$config);
// document 모듈 객체 생성
$oDocumentModel = &getModel('document');
// 지정된 글이 없다면 (신규) 새로운 번호를 만든다
if($document_srl) {
$document = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
if(!$document) {
unset($document_srl);
Context::set('document_srl','');
}
}
// 문서 번호가 없으면 새로운 값을 받아옴
if(!$document_srl) {
$oDB = &DB::getInstance();
$document_srl = $oDB->getNextSequence();
}
Context::set('document_srl',$document_srl);
Context::set('document', $document);
// 에디터 모듈의 getEditor를 호출하여 세팅
$oEditorView = &getView('editor');
$editor = $oEditorView->getEditor($document_srl, true);
Context::set('editor', $editor);
$this->setTemplateFile('write_form');
// 템플릿 파일 지정
$this->setTemplateFile('page_config');
}
}
?>

View file

@ -0,0 +1,24 @@
<query id="getPageList" action="select">
<tables>
<table name="modules" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="module" default="page" />
<group pipe="and">
<condition operation="like" column="mid" var="s_mid" pipe="or" />
<condition operation="like" column="title" var="s_title" pipe="or" />
<condition operation="like" column="comment" var="s_comment" pipe="or" />
<condition operation="equal" column="module" var="s_module" pipe="or" />
<condition operation="equal" column="module_category_srl" var="s_module_category_srl" pipe="or" />
</group>
</conditions>
<navigation>
<index var="sort_index" order="desc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -1,13 +0,0 @@
<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,75 @@
<!--%import("js/admin.js")-->
<!-- 페이지 정보 -->
<div>
{$lang->total_count} {number_format($total_count)},
{$lang->page_count} : {number_format($page)} / {number_format($total_page)}
</div>
<!-- 목록 -->
<div>
<table>
<tr>
<th>{$lang->no}</th>
<th>
<form action="./" method="get">
<select name="category" onchange="doChangeCategory(this, '{getUrl('module_category_srl','')}')" >
<option value="">{$lang->category}</option>
<!--@foreach($module_category as $key => $val)-->
<option value="{$key}" <!--@if($module_category_srl==$key)-->selected="true"<!--@end-->>{$val->title}</option>
<!--@end-->
</select>
</form>
</th>
<th>{$lang->mid}</th>
<th>{$lang->browser_title}</th>
<th>{$lang->is_default}</th>
<th>{$lang->skin}</th>
<th>{$lang->admin_id}</th>
<th>{$lang->regdate}</th>
<th>{$lang->cmd_move}</th>
<th>{$lang->cmd_delete}</th>
</tr>
<!--@foreach($page_list as $no => $val)-->
<tr>
<td>{$no}</td>
<td>
<!--@if(!$val->module_category_srl)-->
{$lang->not_exists}
<!--@else-->
{$module_category[$val->module_category_srl]->title}
<!--@end-->
</td>
<td><a href="{getUrl('act','dispAdminBoardInfo','module_srl',$val->module_srl)}">{$val->mid}</a></td>
<td>{$val->browser_title}</td>
<td>{$val->is_default}</td>
<td>{$val->skin}</td>
<td>{$val->admin_id}</td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
<td><a href="./?mid={$val->mid}" target="_blank">{$lang->cmd_move}</a></td>
<td><!--@if($val->is_default!='Y')--><a href="{getUrl('act','dispAdminDeleteBoard','module_srl', $val->module_srl)}">{$lang->cmd_delete}</a><!--@end--></td>
</tr>
<!--@end-->
</table>
</div>
<!-- 버튼 -->
<div>
[<a href="{getUrl('act','dispAdminInsertBoard','module_srl','')}">{$lang->cmd_make}</a>]
</div>
<!-- 페이지 네비게이션 -->
<div>
<a href="{getUrl('page','','module_srl','')}">[{$lang->first_page}]</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
{$page_no}
<!--@else-->
<a href="{getUrl('page',$page_no,'module_srl','')}">[{$page_no}]</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'module_srl','')}">[{$lang->last_page}]</a>
</div>

View file

@ -1,23 +0,0 @@
/* 글쓰기 작성후 */
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

@ -1,76 +0,0 @@
<!-- 정보 -->
<div>
{$lang->document_count} : {number_format($total_count)},
{$lang->page_count} : {number_format($page)} / {number_format($total_page)}
</div>
<!-- 목록 -->
<div>
<table>
<tr>
<th>{$lang->no}</th>
<!--@if($category_list)-->
<th>
<form action="./" method="get">
<select name="category" onchange="doChangeCategory(this, '{getUrl('category','')}')" >
<option value="">{$lang->category}</option>
<!--@foreach($category_list as $val)-->
<option value="{$val->category_srl}" <!--@if($category==$val->category_srl)-->selected="true"<!--@end-->>{$val->title} <!--@if($val->document_count)-->({$val->document_count})<!--@end--></option>
<!--@end-->
</select>
</form>
</th>
<!--@end-->
<th>{$lang->title}</th>
<th>{$lang->date}</th>
</tr>
<!--@foreach($document_list as $no => $val)-->
<tr>
<td>{$no}</td>
<!--@if($category_list)-->
<td>{$category_list[$val->category_srl]->title}</td>
<!--@end-->
<td>
<a href="{getUrl('document_srl',$val->document_srl,'act','dispWrite')}">{$val->title}</a>
</td>
<td>{zdate($val->regdate,"Y-m-d")}</td>
</tr>
<!--@end-->
</table>
</div>
<!-- 버튼 -->
<div>
<a href="{getUrl('act','dispWrite','document_srl','')}">[{$lang->cmd_make}]</a>
</div>
<!-- 검색 -->
<div>
<form action="./" method="get" onsubmit="return procFilter(this, search)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="category" value="{$category}" />
<select name="search_target">
<!--@foreach($search_option as $key => $val)-->
<option value="{$key}" <!--@if($search_target==$key)-->selected="true"<!--@end-->>{$val}</option>
<!--@end-->
</select>
<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" />
<input type="submit" value="{$lang->cmd_search}" />
<input type="button" value="{$lang->cmd_cancel}" onclick="location.href='{getUrl('search_target','','search_keyword','','page','1','document_srl','')}'"/>
</form>
</div>
<!-- 페이지 네비게이션 -->
<div>
<a href="{getUrl('page','','document_srl','')}">[{$lang->first_page}]</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
{$page_no}
<!--@else-->
<a href="{getUrl('page',$page_no,'document_srl','')}">[{$page_no}]</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page,'document_srl','')}">[{$lang->last_page}]</a>
</div>

View file

@ -1,79 +0,0 @@
<!--%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%">
<col width="120" />
<col width="*" />
<!--@if($category_list)-->
<tr>
<th>{$lang->category}</th>
<td>
<select name="category_srl" >
<option value="">{$lang->category}</option>
<!--@foreach($category_list as $val)-->
<option value="{$val->category_srl}" <!--@if($category==$val->category_srl||$val->category_srl==$document->category_srl)-->selected="true"<!--@end-->>{$val->title} <!--@if($val->document_count)-->({$val->document_count})<!--@end--></option>
<!--@end-->
</select>
</td>
<!--@end-->
<tr>
<th>{$lang->title}</th>
<td><input type="text" name="title" value="{$document->title}" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="checkbox" name="is_secret" value="Y" <!--@if($document->is_secret== "Y")-->checked="true"<!--@end--> id="is_secret" />
<label for="is_secret">{$lang->secret}</label>
<input type="checkbox" name="allow_comment" value="Y" <!--@if($document->allow_comment != "N")-->checked="true"<!--@end--> id="allow_comment" />
<label for="allow_comment">{$lang->allow_comment}</label>
<input type="checkbox" name="lock_comment" value="Y" <!--@if($document->lock_comment == "Y")-->checked="true"<!--@end--> id="lock_comment" />
<label for="lock_comment">{$lang->lock_comment}</label>
<input type="checkbox" name="allow_trackback" value="Y" <!--@if($document->allow_trackback != "N")-->checked="true"<!--@end--> id="allow_trackback" />
<label for="allow_trackback">{$lang->allow_trackback}</label>
</td>
</tr>
<tr>
<th>{$lang->content}</th>
<td>{$editor}</td>
</tr>
<tr>
<th>{$lang->cmd_send_trackback}</th>
<td>
<input type="text" name="trackback_url" />
<select name="trackback_charset">
<option value='UTF-8'>UTF-8</option>
<option value='EUC-KR'>EUC-KR</option>
<option value='EUC-JP'>EUC-JP</option>
<option value='SHIFT_JIS'>SHIFT_JIS</option>
<option value='EUC-CN'>EUC-CN</option>
<option value='HZ'>HZ</option>
<option value='BIG5'>BIG5</option>
</select>
</td>
</tr>
<tr>
<th>{$lang->tag}</th>
<td>
<input type="text" name="tags" value="{htmlspecialchars($document->tags)}" /> <br />
{$lang->about_tag}
</td>
</tr>
<tr>
<td colspan="2">
<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>
</table>
</form>