mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 15:21:40 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@461 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ed7391e775
commit
aada9b99d7
3 changed files with 29 additions and 20 deletions
|
|
@ -1,9 +1,13 @@
|
|||
/**
|
||||
* richtext 에디터 관련
|
||||
**/
|
||||
|
||||
// iframe의 id prefix
|
||||
var iframe_id = 'editor_iframe_';
|
||||
|
||||
// upload_target_srl에 대한 form문을 객체로 보관함
|
||||
var editor_form_list = new Array();
|
||||
|
||||
// srl값에 해당하는 iframe의 object를 return
|
||||
function editorGetIFrame(upload_target_srl) {
|
||||
var obj_id = iframe_id+upload_target_srl;
|
||||
|
|
@ -13,8 +17,8 @@ function editorGetIFrame(upload_target_srl) {
|
|||
// editor 초기화를 onload이벤트 후에 시작시킴
|
||||
function editorInit(upload_target_srl) {
|
||||
var start_func = function() { editorStart(upload_target_srl); }
|
||||
var init_func = function() { setTimeout(start_func, 300); }
|
||||
xAddEventListener(window, 'load', init_func);
|
||||
//var init_func = function() { setTimeout(start_func, 300); }
|
||||
xAddEventListener(window, 'load', start_func);
|
||||
}
|
||||
|
||||
// editor 초기화 (upload_target_srl로 iframe객체를 얻어서 쓰기 모드로 전환)
|
||||
|
|
@ -27,6 +31,10 @@ function editorStart(upload_target_srl) {
|
|||
var fo_obj = iframe_obj.parentNode;
|
||||
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
|
||||
|
||||
// 구해진 form 객체를 저장
|
||||
editor_form_list[upload_target_srl] = fo_obj;
|
||||
|
||||
// 대상 form의 content object에서 데이터를 구함
|
||||
var content = fo_obj.content.value;
|
||||
|
||||
// 기본 폰트를 가져옴
|
||||
|
|
@ -35,8 +43,7 @@ function editorStart(upload_target_srl) {
|
|||
// iframe내의 document object
|
||||
var contentDocument = iframe_obj.contentWindow.document;
|
||||
|
||||
// editing가능하도록 설정
|
||||
|
||||
// editing가능하도록 설정 시작
|
||||
|
||||
// 기본 내용 작성
|
||||
var contentHtml = ''+
|
||||
|
|
@ -528,7 +535,6 @@ function editor_upload_form_set(upload_target_srl) {
|
|||
if(fo_obj["module"]) module = fo_obj.module.value;
|
||||
var mid = "";
|
||||
if(fo_obj["mid"]) mid = fo_obj.mid.value;
|
||||
var upload_target_srl = fo_obj.upload_target_srl.value;
|
||||
|
||||
var url = "./?act=procDeleteFile&upload_target_srl="+upload_target_srl;
|
||||
if(module) url+="&module="+module;
|
||||
|
|
@ -553,8 +559,8 @@ function editor_file_upload(field_obj, upload_target_srl) {
|
|||
uploading_file = false;
|
||||
|
||||
var sel_obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
|
||||
var string = 'wait for uploading...';
|
||||
var opt_obj = new Option(string, '', true, true);
|
||||
var str = 'wait for uploading...';
|
||||
var opt_obj = new Option(str, '', true, true);
|
||||
sel_obj.options[sel_obj.options.length] = opt_obj;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
editor_upload_init("{$upload_target_srl}");
|
||||
</script>
|
||||
|
||||
<input type="hidden" name="upload_target_srl" value="{$upload_target_srl}" />
|
||||
|
||||
<div class="editor_uploader_box">
|
||||
<table>
|
||||
<tr valign="top">
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
* @brief 문서 입력
|
||||
**/
|
||||
function procInsertDocument() {
|
||||
|
||||
// 글작성시 필요한 변수를 세팅
|
||||
$obj = Context::getRequestVars();
|
||||
$obj->module_srl = $this->module_srl;
|
||||
|
|
@ -252,8 +251,8 @@
|
|||
* 에디터에서 개별 파일 삭제시 사용
|
||||
**/
|
||||
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');
|
||||
|
||||
|
|
@ -262,26 +261,28 @@
|
|||
if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
|
||||
|
||||
// 첨부파일의 목록을 java script로 출력
|
||||
$oFileController->printUploadedFileList($document_srl);
|
||||
$oFileController->printUploadedFileList($upload_target_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 첨부파일 업로드
|
||||
*
|
||||
* editor에서는 upload_target_srl을 넘겨주고 게시판에서는 document_srl을 upload_target_srl로 설정해 놓은 상태이다.
|
||||
**/
|
||||
function procUploadFile() {
|
||||
// 업로드 권한이 없거나 정보가 없을시 종료
|
||||
if(!Context::isUploaded() || !$this->grant->fileupload) 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -307,16 +308,16 @@
|
|||
* javascript로 빠져나가는 경우 확인이 어려워서 사용되지 않을 코드
|
||||
**/
|
||||
function procClearFile() {
|
||||
$document_srl = Context::get('document_srl');
|
||||
$upload_target_srl = Context::get('upload_target_srl');
|
||||
|
||||
// document_srl의 글이 등록되어 있다면 pass
|
||||
$oDocumentModel = &getModel('document');
|
||||
$data = $oDocumentModel->getDocument($document_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, $document_srl);
|
||||
$oFileController->deleteFiles($this->module_srl, $upload_target_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue