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

This commit is contained in:
zero 2007-03-30 10:32:58 +00:00
parent 078ea34bc4
commit d94dc0d9a8
12 changed files with 116 additions and 106 deletions

View file

@ -105,7 +105,7 @@
// 미설치시에는 act값을 강제로 변경 // 미설치시에는 act값을 강제로 변경
if($this->module=="install") { if($this->module=="install") {
if(!$xml_info->action->{$this->act}) $this->act = $xml_info->default_index_act; if(!$this->act || !$xml_info->action->{$this->act}) $this->act = $xml_info->default_index_act;
} }
// 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용 // 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용

View file

@ -266,7 +266,7 @@
$xml_info = $oModuleModel->getModuleActionXml($forward->module); $xml_info = $oModuleModel->getModuleActionXml($forward->module);
$oModule->setAct($forward->act); $oModule->setAct($forward->act);
$oModule->init(); $oModule->init();
$oModule->setModuleInfo(null, $xml_info); $oModule->setModuleInfo($this->module_info, $xml_info);
$output = call_user_method($forward->act, $oModule); $output = call_user_method($forward->act, $oModule);
$this->setTemplatePath($oModule->getTemplatePath()); $this->setTemplatePath($oModule->getTemplatePath());

View file

@ -221,61 +221,6 @@
} }
} }
/**
* @brief 첨부파일 삭제
* 에디터에서 개별 파일 삭제시 사용
**/
function procBoardDeleteFile() {
// 기본적으로 필요한 변수인 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, $this->grant->manager);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($upload_target_srl);
}
/**
* @brief 첨부파일 업로드
*
* editor에서는 upload_target_srl을 넘겨주고 게시판에서는 document_srl을 upload_target_srl로 설정해 놓은 상태이다.
**/
function procBoardUploadFile() {
// 업로드 권한이 없거나 정보가 없을시 종료
if(!Context::isUploaded() || !$this->grant->fileupload) exit();
// 기본적으로 필요한 변수 설정
$upload_target_srl = Context::get('upload_target_srl');
$module_srl = $this->module_srl;
// file class의 controller 객체 생성
$oFileController = &getController('file');
$output = $oFileController->insertFile($module_srl, $upload_target_srl);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($upload_target_srl);
}
/**
* @brief 첨부파일 다운로드
* 직접 요청을 받음\n
* file_srl : 파일의 sequence\n
* sid : db에 저장된 비교 , 틀리면 다운로드 하지 낳음\n
**/
function procBoardDownloadFile() {
// 다운로드에 필요한 변수 체크
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
// document module 객체 생성후 해당 파일의 정보를 체크
$oFileModel = &getModel('file');
$oFileModel->procDownload($file_srl, $sid);
}
/** /**
* @brief 권한 추가 * @brief 권한 추가
**/ **/

View file

@ -192,8 +192,8 @@
Context::set('document', $document); Context::set('document', $document);
// 에디터 모듈의 getEditor를 호출하여 세팅 // 에디터 모듈의 getEditor를 호출하여 세팅
$oEditorView = &getView('editor'); $oEditorModel = &getModel('editor');
$editor = $oEditorView->getEditor($document_srl, $this->grant->fileupload, true); $editor = $oEditorModel->getEditor($document_srl, $this->grant->fileupload, true);
Context::set('editor', $editor); Context::set('editor', $editor);
$this->setTemplateFile('write_form'); $this->setTemplateFile('write_form');
@ -425,8 +425,8 @@
} }
// 에디터 모듈의 getEditor를 호출하여 세팅 // 에디터 모듈의 getEditor를 호출하여 세팅
$oEditorView = &getView('editor'); $oEditorModel = &getModel('editor');
$comment_editor = $oEditorView->getEditor($comment_srl, $this->grant->fileupload); $comment_editor = $oEditorModel->getEditor($comment_srl, $this->grant->fileupload);
Context::set('comment_editor', $comment_editor); Context::set('comment_editor', $comment_editor);
} }

View file

@ -7,6 +7,45 @@
class editorModel extends editor { class editorModel extends editor {
/**
* @brief 에디터를 return
**/
function getEditor($upload_target_srl, $allow_fileupload = false, $enable_autosave = false) {
// 저장된 임시본이 있는지 검사
if($enable_autosave) {
$saved_doc = $this->getSavedDoc($upload_target_srl);
Context::set('saved_doc', $saved_doc);
}
Context::set('enable_autosave', $enable_autosave);
// 업로드를 위한 변수 설정
Context::set('upload_target_srl', $upload_target_srl);
Context::set('allow_fileupload', $allow_fileupload);
// 에디터 컴포넌트를 구함
if(!Context::get('component_list')) {
$component_list = $this->getComponentList();
Context::set('component_list', $component_list);
}
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->module_path.'tpl';
$tpl_file = 'editor.html';
// editor_path를 지정
Context::set('editor_path', $tpl_path);
// 만약 allow_fileupload == true 이면 upload_target_srl에 upload가능하다고 설정
if($allow_fileupload) {
$oFileController = &getController('file');
$oFileController->setUploadEnable($upload_target_srl);
}
require_once("./classes/template/TemplateHandler.class.php");
$oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/** /**
* @brief 자동저장되어 있는 정보를 가져옴 * @brief 자동저장되어 있는 정보를 가져옴
**/ **/

View file

@ -91,40 +91,5 @@
$this->setLayoutFile("popup_layout"); $this->setLayoutFile("popup_layout");
} }
/**
* @brief 에디터를 return
**/
function getEditor($upload_target_srl, $allow_fileupload = false, $enable_autosave = false) {
$oEditorModel = &getModel('editor');
// 저장된 임시본이 있는지 검사
if($enable_autosave) {
$saved_doc = $oEditorModel->getSavedDoc($upload_target_srl);
Context::set('saved_doc', $saved_doc);
}
Context::set('enable_autosave', $enable_autosave);
// 업로드를 위한 변수 설정
Context::set('upload_target_srl', $upload_target_srl);
Context::set('allow_fileupload', $allow_fileupload);
// 에디터 컴포넌트를 구함
if(!Context::get('component_list')) {
$component_list = $oEditorModel->getComponentList();
Context::set('component_list', $component_list);
}
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->module_path.'tpl';
$tpl_file = 'editor.html';
// editor_path를 지정
Context::set('editor_path', $tpl_path);
require_once("./classes/template/TemplateHandler.class.php");
$oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file);
}
} }
?> ?>

View file

@ -102,7 +102,7 @@
<div class="editor_uploader_box"> <div class="editor_uploader_box">
<input type="hidden" name="upload_target_srl" value="{$upload_target_srl}" /> <input type="hidden" name="upload_target_srl" value="{$upload_target_srl}" />
<input type="hidden" name="act" value="procFileUploadFile" /> <input type="hidden" name="act" value="procFileUpload" />
<!-- 미리보기 --> <!-- 미리보기 -->
<div class="editor_preview_uploaded" id="preview_uploaded_{$upload_target_srl}"><img src="./images/blank.gif" width="100" height="100" alt="preview" /></div> <div class="editor_preview_uploaded" id="preview_uploaded_{$upload_target_srl}"><img src="./images/blank.gif" width="100" height="100" alt="preview" /></div>

View file

@ -60,9 +60,6 @@ function editor_upload_form_set(upload_target_srl) {
if(fo_obj["document_srl"]) document_srl = fo_obj.document_srl.value; if(fo_obj["document_srl"]) document_srl = fo_obj.document_srl.value;
var url = "./?act=procFileDelete&upload_target_srl="+upload_target_srl; var url = "./?act=procFileDelete&upload_target_srl="+upload_target_srl;
if(module) url+="&module="+module;
if(mid) url+="&mid="+mid;
if(document_srl) url+="&document_srl="+document_srl;
// iframe에 url을 보내버림 // iframe에 url을 보내버림
var iframe_obj = xGetElementById('tmp_upload_iframe'); var iframe_obj = xGetElementById('tmp_upload_iframe');
@ -159,7 +156,7 @@ function editor_remove_file(upload_target_srl) {
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; } while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
var mid = fo_obj.mid.value; var mid = fo_obj.mid.value;
var upload_target_srl = fo_obj.upload_target_srl.value; var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?mid="+mid+"&act=procFileDelete&upload_target_srl="+upload_target_srl+"&file_srl="+file_srl; var url = "./?act=procFileDelete&upload_target_srl="+upload_target_srl+"&file_srl="+file_srl;
// iframe에 url을 보내버림 // iframe에 url을 보내버림
var iframe_obj = xGetElementById('tmp_upload_iframe'); var iframe_obj = xGetElementById('tmp_upload_iframe');

View file

@ -4,8 +4,9 @@
<actions> <actions>
<action name="dispFileAdminList" type="view" admin_index="true" standalone="true" /> <action name="dispFileAdminList" type="view" admin_index="true" standalone="true" />
<action name="procFileDownload" type="model" standalone="true" /> <action name="procFileUpload" type="controller" standalone="true" />
<action name="procFileDelete" type="controller" standalone="true" /> <action name="procFileDelete" type="controller" standalone="true" />
<action name="procFileDownload" type="controller" standalone="true" />
<action name="procFileAdminDeleteChecked" type="controller" standalone="true" /> <action name="procFileAdminDeleteChecked" type="controller" standalone="true" />
</actions> </actions>
</module> </module>

View file

@ -14,8 +14,10 @@
// action forward에 등록 (관리자 모드에서 사용하기 위함) // action forward에 등록 (관리자 모드에서 사용하기 위함)
$oModuleController = &getController('module'); $oModuleController = &getController('module');
$oModuleController->insertActionForward('file', 'view', 'dispFileAdminList'); $oModuleController->insertActionForward('file', 'view', 'dispFileAdminList');
$oModuleController->insertActionForward('file', 'controller', 'dispFileDownload'); $oModuleController->insertActionForward('file', 'controller', 'procFileUpload');
$oModuleController->insertActionForward('file', 'controller', 'dispFileAdminDeleteChecked'); $oModuleController->insertActionForward('file', 'controller', 'procFileDelete');
$oModuleController->insertActionForward('file', 'controller', 'procFileDownload');
$oModuleController->insertActionForward('file', 'controller', 'procFileAdminDeleteChecked');
// file 모듈에서 사용할 디렉토리 생성 // file 모듈에서 사용할 디렉토리 생성
FileHandler::makeDir('./files/attach/images'); FileHandler::makeDir('./files/attach/images');

View file

@ -13,6 +13,67 @@
function init() { function init() {
} }
/**
* @brief 에디터에서 첨부파일 업로드
**/
function procFileUpload() {
// 기본적으로 필요한 변수 설정
$upload_target_srl = Context::get('upload_target_srl');
$module_srl = $this->module_srl;
debugPrint($module_srl);
// 업로드 권한이 없거나 정보가 없을시 종료
if(!$_SESSION['upload_enable'][$upload_target_srl]) exit();
$output = $this->insertFile($module_srl, $upload_target_srl);
debugPrint($output);
// 첨부파일의 목록을 java script로 출력
$this->printUploadedFileList($upload_target_srl);
}
/**
* @brief 에디터에서 첨부 파일 삭제
**/
function procFileDelete() {
// 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정
$upload_target_srl = Context::get('upload_target_srl');
$file_srl = Context::get('file_srl');
if(!$file_srl) exit();
// 업로드 권한이 없거나 정보가 없을시 종료
if(!$_SESSION['upload_enable'][$upload_target_srl]) exit();
$output = $this->deleteFile($file_srl, $this->grant->manager);
// 첨부파일의 목록을 java script로 출력
$this->printUploadedFileList($upload_target_srl);
}
/**
* @brief 첨부파일 다운로드
* 직접 요청을 받음
* file_srl : 파일의 sequence
* sid : db에 저장된 비교 , 틀리면 다운로드 하지 낳음
**/
function procFileDownload() {
// 다운로드에 필요한 변수 체크
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
// document module 객체 생성후 해당 파일의 정보를 체크
$oFileModel = &getModel('file');
$oFileModel->procDownload($file_srl, $sid);
}
/**
* @brief 업로드 가능하다고 세팅
**/
function setUploadEnable($upload_target_srl) {
$_SESSION['upload_enable'][$upload_target_srl] = true;
}
/** /**
* @brief 첨부파일 추가 * @brief 첨부파일 추가
**/ **/

View file

@ -169,8 +169,8 @@
Context::set('plugin_list', $plugin_list); Context::set('plugin_list', $plugin_list);
// 에디터 모듈의 getEditor를 호출하여 세팅 // 에디터 모듈의 getEditor를 호출하여 세팅
$oEditorView = &getView('editor'); $oEditorModel = &getModel('editor');
$editor = $oEditorView->getEditor($module_srl, true); $editor = $oEditorModel->getEditor($module_srl, true);
Context::set('editor', $editor); Context::set('editor', $editor);
// 템플릿 파일 지정 // 템플릿 파일 지정