mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
파일첨부가 허용된 에디터 출력시 이미 등록된 첨부파일의 수를 count하여 첨부된 파일이 없으면 파일 목록을 구해오지 않도록 하여 쓸데없는 페이지 호출 및 서버 작업/ 클라이언트 부하를 없앰
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3749 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
27d176f9ec
commit
1dbe0daede
5 changed files with 18 additions and 9 deletions
|
|
@ -98,6 +98,7 @@
|
|||
if($enable_autosave) {
|
||||
// 자동 저장된 데이터를 추출
|
||||
$saved_doc = $this->getSavedDoc();
|
||||
if($saved_doc->document_srl && !$upload_target_srl) $upload_target_srl = $saved_doc->document_srl;
|
||||
|
||||
// 자동 저장 데이터를 context setting
|
||||
Context::set('saved_doc', $saved_doc);
|
||||
|
|
@ -116,6 +117,7 @@
|
|||
/**
|
||||
* 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정
|
||||
**/
|
||||
$files_count = 0;
|
||||
if($allow_fileupload) {
|
||||
$oFileModel = &getModel('file');
|
||||
|
||||
|
|
@ -133,7 +135,12 @@
|
|||
// upload가능하다고 설정 (내부적으로 캐싱하여 처리)
|
||||
$oFileController = &getController('file');
|
||||
$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
|
||||
|
||||
// 이미 등록된 파일이 있는지 검사
|
||||
if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
|
||||
}
|
||||
Context::set('files_count', (int)$files_count);
|
||||
|
||||
Context::set('allow_fileupload', $allow_fileupload);
|
||||
|
||||
// 에디터 동작을 위한 editor_sequence값 설정
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
var zbxe_session_name = "{session_name()}";
|
||||
var uploader_setting = { "allowed_filesize" : "{$file_config->allowed_filesize}", "allowed_filetypes" : "{$file_config->allowed_filetypes}", "allowed_filetypes_description" : "{$file_config->allowed_filetypes}" }
|
||||
<!--@if(!$editor_manual_start)-->
|
||||
editor_upload_init("{$editor_sequence}");
|
||||
editor_upload_init("{$editor_sequence}", '', "{$files_count}");
|
||||
<!--@end-->
|
||||
//]]></script>
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
var zbxe_session_name = "{session_name()}";
|
||||
var uploader_setting = { "allowed_filesize" : "{$file_config->allowed_filesize}", "allowed_filetypes" : "{$file_config->allowed_filetypes}", "allowed_filetypes_description" : "{$file_config->allowed_filetypes}" }
|
||||
editor_upload_init("{$editor_sequence}");
|
||||
editor_upload_init("{$editor_sequence}", '', "{$files_count}");
|
||||
//]]></script>
|
||||
|
||||
<table cellspacing="0" class="fileAttach">
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
var zbxe_session_name = "{session_name()}";
|
||||
var uploader_setting = { "allowed_filesize" : "{$file_config->allowed_filesize}", "allowed_filetypes" : "{$file_config->allowed_filetypes}", "allowed_filetypes_description" : "{$file_config->allowed_filetypes}" }
|
||||
<!--@if(!$editor_manual_start)-->
|
||||
editor_upload_init("{$editor_sequence}", editorGetForm_xq(document.getElementById("xqEditor_{$editor_sequence}")));
|
||||
editor_upload_init("{$editor_sequence}", editorGetForm_xq(document.getElementById("xqEditor_{$editor_sequence}")), "{$files_count}");
|
||||
<!--@end-->
|
||||
//]]></script>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ var uploaded_files = new Array();
|
|||
* 이 함수는 editor.html 에서 파일 업로드 가능할 경우 호출됨
|
||||
**/
|
||||
// window.load 이벤트일 경우 && 문서 번호가 가상의 번호가 아니면 기존에 저장되어 있을지도 모르는 파일 목록을 가져옴
|
||||
function editor_upload_init(editor_sequence, el) {
|
||||
xAddEventListener(window,'load',function() { editor_upload_start(editor_sequence, el);} );
|
||||
function editor_upload_init(editor_sequence, el, inserted_files_count) {
|
||||
xAddEventListener(window,'load',function() { editor_upload_start(editor_sequence, el, inserted_files_count);} );
|
||||
}
|
||||
|
||||
function editor_upload_get_target_srl(editor_sequence) {
|
||||
|
|
@ -32,7 +32,10 @@ function editor_upload_get_uploader_name(editor_sequence) {
|
|||
}
|
||||
|
||||
// 파일 업로드를 위한 기본 준비를 함
|
||||
function editor_upload_start(editor_sequence, fo_obj) {
|
||||
function editor_upload_start(editor_sequence, fo_obj, inserted_files_count) {
|
||||
if(typeof(inserted_files_count)=='undefined' || !inserted_files_count) inserted_files_count = 0;
|
||||
else inserted_files_count = parseInt(inserted_files_count, 10);
|
||||
|
||||
// 캐시 삭제
|
||||
try { document.execCommand('BackgroundImageCache',false,true); } catch(e) { }
|
||||
|
||||
|
|
@ -58,8 +61,7 @@ function editor_upload_start(editor_sequence, fo_obj) {
|
|||
if(!field_obj) return;
|
||||
|
||||
// 에디터를 감싸는 form을 구해 submit target을 임시 iframe으로 변경
|
||||
if(!fo_obj)
|
||||
fo_obj = editorGetForm(editor_sequence);
|
||||
if(!fo_obj) fo_obj = editorGetForm(editor_sequence);
|
||||
fo_obj.target = 'tmp_upload_iframe';
|
||||
|
||||
// SWF uploader 생성
|
||||
|
|
@ -101,7 +103,7 @@ function editor_upload_start(editor_sequence, fo_obj) {
|
|||
* upload_target_srl값이 실제 문서 번호일 경우 이미 등록되 있을지도 모르는 첨부파일 목록을 로드
|
||||
* procDeleteFile에 file_srl을 보내주지 않으면 삭제시도는 없이 목록만 갱신할 수 있음
|
||||
**/
|
||||
editor_display_uploaded_file(editor_sequence);
|
||||
if(inserted_files_count>0) editor_display_uploaded_file(editor_sequence);
|
||||
}
|
||||
|
||||
// 파일 업로드 에러 핸들링
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue