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

This commit is contained in:
zero 2007-03-15 09:45:29 +00:00
parent 3ff59ad225
commit fc5fbe3cc4
3 changed files with 101 additions and 101 deletions

View file

@ -4,19 +4,19 @@
<!-- 에디터 활성화 --> <!-- 에디터 활성화 -->
<script type="text/javascript"> <script type="text/javascript">
var editor_path = "{$editor_path}"; var editor_path = "{$editor_path}";
editorInit("{$parent_srl}"); editorInit("{$upload_target_srl}");
</script> </script>
<!-- 에디터 --> <!-- 에디터 -->
<div class="editor_content"> <div class="editor_content">
<div class="editor_fontbox"> <div class="editor_fontbox">
<select onChange="editorChangeFontName(this,'{$parent_srl}')" id="editor_font_{$parent_srl}"> <select onChange="editorChangeFontName(this,'{$upload_target_srl}')" id="editor_font_{$upload_target_srl}">
<option value="">{$lang->edit->fontname}</option> <option value="">{$lang->edit->fontname}</option>
<!--@foreach($lang->edit->fontlist as $key=>$obj)--> <!--@foreach($lang->edit->fontlist as $key=>$obj)-->
<option style="font-family:{$obj}" value="{$obj}">{$obj}</option> <option style="font-family:{$obj}" value="{$obj}">{$obj}</option>
<!--@end--> <!--@end-->
</select> </select>
<select onChange="editorChangeFontSize(this,'{$parent_srl}')" id="editor_fontsize_{$parent_srl}"> <select onChange="editorChangeFontSize(this,'{$upload_target_srl}')" id="editor_fontsize_{$upload_target_srl}">
<option value="" selected>{$lang->edit->fontsize}</option> <option value="" selected>{$lang->edit->fontsize}</option>
<option value="1">8pt</option> <option value="1">8pt</option>
<option value="2">10pt</option> <option value="2">10pt</option>
@ -28,32 +28,32 @@
</select> </select>
</div> </div>
<div class="editor_iconbox"> <div class="editor_iconbox">
<img src="./images/font_color.gif" alt="{$lang->edit->help_fontcolor}" class="editor_icon" id="editor_ForeColor_{$parent_srl}" /> <img src="./images/font_color.gif" alt="{$lang->edit->help_fontcolor}" class="editor_icon" id="editor_ForeColor_{$upload_target_srl}" />
<img src="./images/font_bg_color.gif" alt="{$lang->edit->help_fontbgcolor}" class="editor_icon" id="editor_BackColor_{$parent_srl}" /> <img src="./images/font_bg_color.gif" alt="{$lang->edit->help_fontbgcolor}" class="editor_icon" id="editor_BackColor_{$upload_target_srl}" />
<img src="./images/bold.gif" alt="{$lang->edit->help_bold}" class="editor_icon" id="editor_Bold_{$parent_srl}" /> <img src="./images/bold.gif" alt="{$lang->edit->help_bold}" class="editor_icon" id="editor_Bold_{$upload_target_srl}" />
<img src="./images/italic.gif" alt="{$lang->edit->help_italic}" class="editor_icon" id="editor_Italic_{$parent_srl}" /> <img src="./images/italic.gif" alt="{$lang->edit->help_italic}" class="editor_icon" id="editor_Italic_{$upload_target_srl}" />
<img src="./images/underline.gif" alt="{$lang->edit->help_underline}" class="editor_icon" id="editor_Underline_{$parent_srl}" /> <img src="./images/underline.gif" alt="{$lang->edit->help_underline}" class="editor_icon" id="editor_Underline_{$upload_target_srl}" />
<img src="./images/strike.gif" alt="{$lang->edit->help_strike}" class="editor_icon" id="editor_StrikeThrough_{$parent_srl}" /> <img src="./images/strike.gif" alt="{$lang->edit->help_strike}" class="editor_icon" id="editor_StrikeThrough_{$upload_target_srl}" />
<img src="./images/add_url.gif" alt="{$lang->edit->help_add_url}" class="editor_icon" id="editor_addurl_{$parent_srl}" /> <img src="./images/add_url.gif" alt="{$lang->edit->help_add_url}" class="editor_icon" id="editor_addurl_{$upload_target_srl}" />
<img src="./images/add_image.gif" alt="{$lang->edit->help_add_image}" class="editor_icon" id="editor_addimage_{$parent_srl}" /> <img src="./images/add_image.gif" alt="{$lang->edit->help_add_image}" class="editor_icon" id="editor_addimage_{$upload_target_srl}" />
<img src="./images/add_multi.gif" alt="{$lang->edit->help_add_multimedia}" class="editor_icon" id="editor_addmultimedia_{$parent_srl}" /> <img src="./images/add_multi.gif" alt="{$lang->edit->help_add_multimedia}" class="editor_icon" id="editor_addmultimedia_{$upload_target_srl}" />
<img src="./images/emoticon.gif" alt="{$lang->edit->help_add_emoticon}" class="editor_icon" id="editor_addemoticon_{$parent_srl}" /> <img src="./images/emoticon.gif" alt="{$lang->edit->help_add_emoticon}" class="editor_icon" id="editor_addemoticon_{$upload_target_srl}" />
<img src="./images/quotation.gif" alt="{$lang->edit->help_add_quotation}" class="editor_icon" id="editor_quotation_{$parent_srl}" /> <img src="./images/quotation.gif" alt="{$lang->edit->help_add_quotation}" class="editor_icon" id="editor_quotation_{$upload_target_srl}" />
<img src="./images/html_add.gif" alt="{$lang->edit->help_add_html}" class="editor_icon" id="editor_addhtml_{$parent_srl}" /> <img src="./images/html_add.gif" alt="{$lang->edit->help_add_html}" class="editor_icon" id="editor_addhtml_{$upload_target_srl}" />
</div> </div>
<div id="editor_paragraph_{$parent_srl}" class="editor_iconbox" style="display:none"> <div id="editor_paragraph_{$upload_target_srl}" class="editor_iconbox" style="display:none">
<img src="./images/align_left.gif" alt="{$lang->edit->help_align_left}" id="editor_justifyleft_{$parent_srl}" /> <img src="./images/align_left.gif" alt="{$lang->edit->help_align_left}" id="editor_justifyleft_{$upload_target_srl}" />
<img src="./images/align_center.gif" alt="{$lang->edit->help_align_center}" id="editor_justifycenter_{$parent_srl}" /> <img src="./images/align_center.gif" alt="{$lang->edit->help_align_center}" id="editor_justifycenter_{$upload_target_srl}" />
<img src="./images/align_right.gif" alt="{$lang->edit->help_align_right}" id="editor_justifyright_{$parent_srl}" /> <img src="./images/align_right.gif" alt="{$lang->edit->help_align_right}" id="editor_justifyright_{$upload_target_srl}" />
<img src="./images/remove_indent.gif" alt="{$lang->edit->help_remove_indent}" id="editor_outdent_{$parent_srl}" /> <img src="./images/remove_indent.gif" alt="{$lang->edit->help_remove_indent}" id="editor_outdent_{$upload_target_srl}" />
<img src="./images/add_indent.gif" alt="{$lang->edit->help_add_indent}" id="editor_indent_{$parent_srl}" /> <img src="./images/add_indent.gif" alt="{$lang->edit->help_add_indent}" id="editor_indent_{$upload_target_srl}" />
<img src="./images/list_number.gif" alt="list number" id="editor_insertorderedlist_{$parent_srl}" /> <img src="./images/list_number.gif" alt="list number" id="editor_insertorderedlist_{$upload_target_srl}" />
<img src="./images/list_bullet.gif" alt="list bullet" id="editor_insertunorderedlist_{$parent_srl}" /> <img src="./images/list_bullet.gif" alt="list bullet" id="editor_insertunorderedlist_{$upload_target_srl}" />
</div> </div>
<div class="editor_parabox" id="editor_use_paragraph_box_{$parent_srl}"> <div class="editor_parabox" id="editor_use_paragraph_box_{$upload_target_srl}">
<input type="checkbox" name="use_paragraph" id="editor_use_paragraph_{$parent_srl}" onclick="editorUseParagraph(this,'{$parent_srl}');" /> <input type="checkbox" name="use_paragraph" id="editor_use_paragraph_{$upload_target_srl}" onclick="editorUseParagraph(this,'{$upload_target_srl}');" />
<label for="editor_use_paragraph_{$parent_srl}">{$lang->edit->use_paragraph}</label> <label for="editor_use_paragraph_{$upload_target_srl}">{$lang->edit->use_paragraph}</label>
</div> </div>
<div class="editor_iframe_box"><iframe id="editor_iframe_{$parent_srl}" frameBorder="0" style="border:0px;width:99%;height:300px;margin:0px;"></iframe><div class="editor_drag_down_area" id="editor_drag_bar_{$parent_srl}"></div></div> <div class="editor_iframe_box"><iframe id="editor_iframe_{$upload_target_srl}" frameBorder="0" style="border:0px;width:99%;height:300px;margin:0px;"></iframe><div class="editor_drag_down_area" id="editor_drag_bar_{$upload_target_srl}"></div></div>
</div> </div>

View file

@ -5,22 +5,22 @@
var iframe_id = 'editor_iframe_'; var iframe_id = 'editor_iframe_';
// srl값에 해당하는 iframe의 object를 return // srl값에 해당하는 iframe의 object를 return
function editorGetIFrame(parent_srl) { function editorGetIFrame(upload_target_srl) {
var obj_id = iframe_id+parent_srl; var obj_id = iframe_id+upload_target_srl;
return xGetElementById(obj_id); return xGetElementById(obj_id);
} }
// editor 초기화를 onload이벤트 후에 시작시킴 // editor 초기화를 onload이벤트 후에 시작시킴
function editorInit(parent_srl) { function editorInit(upload_target_srl) {
var start_func = function() { editorStart(parent_srl); } var start_func = function() { editorStart(upload_target_srl); }
var init_func = function() { setTimeout(start_func, 300); } var init_func = function() { setTimeout(start_func, 300); }
xAddEventListener(window, 'load', init_func); xAddEventListener(window, 'load', init_func);
} }
// editor 초기화 (parent_srl로 iframe객체를 얻어서 쓰기 모드로 전환) // editor 초기화 (upload_target_srl로 iframe객체를 얻어서 쓰기 모드로 전환)
function editorStart(parent_srl) { function editorStart(upload_target_srl) {
// iframe obj를 찾음 // iframe obj를 찾음
var iframe_obj = editorGetIFrame(parent_srl); var iframe_obj = editorGetIFrame(upload_target_srl);
if(!iframe_obj) return; if(!iframe_obj) return;
// 현 에디터를 감싸고 있는 form문을 찾아서 content object를 찾아서 내용 sync // 현 에디터를 감싸고 있는 form문을 찾아서 content object를 찾아서 내용 sync
@ -30,7 +30,7 @@ function editorStart(parent_srl) {
var content = fo_obj.content.value; var content = fo_obj.content.value;
// 기본 폰트를 가져옴 // 기본 폰트를 가져옴
var default_font = xGetElementById('editor_font_'+parent_srl).options[1].value; var default_font = xGetElementById('editor_font_'+upload_target_srl).options[1].value;
// iframe내의 document object // iframe내의 document object
var contentDocument = iframe_obj.contentWindow.document; var contentDocument = iframe_obj.contentWindow.document;
@ -73,27 +73,27 @@ function editorStart(parent_srl) {
// 문단작성기능 on/off // 문단작성기능 on/off
if(xIE4Up) { if(xIE4Up) {
xDisplay('editor_paragraph_'+parent_srl, 'none'); xDisplay('editor_paragraph_'+upload_target_srl, 'none');
xDisplay('editor_use_paragraph_box_'+parent_srl, 'inline'); xDisplay('editor_use_paragraph_box_'+upload_target_srl, 'inline');
} else { } else {
xDisplay('editor_paragraph_'+parent_srl, 'block'); xDisplay('editor_paragraph_'+upload_target_srl, 'block');
xDisplay('editor_use_paragraph_box_'+parent_srl, 'none'); xDisplay('editor_use_paragraph_box_'+upload_target_srl, 'none');
} }
// 에디터의 내용을 지속적으로 fo_obj.content.value에 입력 // 에디터의 내용을 지속적으로 fo_obj.content.value에 입력
editorSyncContent(fo_obj.content, parent_srl); editorSyncContent(fo_obj.content, upload_target_srl);
} }
var _editorSyncList = new Array(); var _editorSyncList = new Array();
function editorSyncContent(obj, parent_srl) { function editorSyncContent(obj, upload_target_srl) {
_editorSyncList[_editorSyncList.length] = {field:obj, parent_srl:parent_srl} _editorSyncList[_editorSyncList.length] = {field:obj, upload_target_srl:upload_target_srl}
} }
function _editorSync() { function _editorSync() {
for(var i=0;i<_editorSyncList.length;i++) { for(var i=0;i<_editorSyncList.length;i++) {
var field = _editorSyncList[i].field; var field = _editorSyncList[i].field;
var parent_srl = _editorSyncList[i].parent_srl; var upload_target_srl = _editorSyncList[i].upload_target_srl;
var content = editorGetContent(parent_srl); var content = editorGetContent(upload_target_srl);
if(typeof(content)=='undefined'||!content) continue; if(typeof(content)=='undefined'||!content) continue;
field.value = content; field.value = content;
} }
@ -102,13 +102,13 @@ function _editorSync() {
xAddEventListener(window, 'load', _editorSync); xAddEventListener(window, 'load', _editorSync);
// 문단기능 toggle // 문단기능 toggle
function editorUseParagraph(obj, parent_srl) { function editorUseParagraph(obj, upload_target_srl) {
toggleDisplay('editor_paragraph_'+parent_srl); toggleDisplay('editor_paragraph_'+upload_target_srl);
} }
// 에디터의 내용 return // 에디터의 내용 return
function editorGetContent(parent_srl) { function editorGetContent(upload_target_srl) {
var iframe_obj = editorGetIFrame(parent_srl); var iframe_obj = editorGetIFrame(upload_target_srl);
if(!iframe_obj) return; if(!iframe_obj) return;
var html = ''; var html = '';
html = xInnerHtml(iframe_obj.contentWindow.document.body); html = xInnerHtml(iframe_obj.contentWindow.document.body);
@ -117,8 +117,8 @@ function editorGetContent(parent_srl) {
} }
// 에디터 내의 선택된 부분의 html 코드를 return // 에디터 내의 선택된 부분의 html 코드를 return
function editorGetSelectedHtml(parent_srl) { function editorGetSelectedHtml(upload_target_srl) {
var iframe_obj = editorGetIFrame(parent_srl); var iframe_obj = editorGetIFrame(upload_target_srl);
if(xIE4Up) { if(xIE4Up) {
var range = iframe_obj.contentWindow.document.selection.createRange(); var range = iframe_obj.contentWindow.document.selection.createRange();
var html = range.htmlText; var html = range.htmlText;
@ -197,7 +197,7 @@ function editorEventCheck(evt) {
if(target_id.indexOf('editor_')!=-1) { if(target_id.indexOf('editor_')!=-1) {
var tmp_str = target_id.split('_'); var tmp_str = target_id.split('_');
var method_name = tmp_str[1]; var method_name = tmp_str[1];
var parent_srl = tmp_str[2]; var upload_target_srl = tmp_str[2];
switch(method_name) { switch(method_name) {
case 'Bold' : case 'Bold' :
case 'Italic' : case 'Italic' :
@ -210,10 +210,10 @@ function editorEventCheck(evt) {
case 'outdent' : case 'outdent' :
case 'insertorderedlist' : case 'insertorderedlist' :
case 'insertunorderedlist' : case 'insertunorderedlist' :
editorDo(method_name, '', parent_srl); editorDo(method_name, '', upload_target_srl);
break; break;
default : default :
editorPrevSrl = parent_srl; editorPrevSrl = upload_target_srl;
switch(method_name) { switch(method_name) {
case "addemoticon" : case "addemoticon" :
var x = (screen.availWidth - 225)/2; var x = (screen.availWidth - 225)/2;
@ -272,8 +272,8 @@ function editorEventCheck(evt) {
} }
// focus // focus
function editorFocus(parent_srl) { function editorFocus(upload_target_srl) {
var iframe_obj = editorGetIFrame(parent_srl); var iframe_obj = editorGetIFrame(upload_target_srl);
iframe_obj.contentWindow.focus(); iframe_obj.contentWindow.focus();
} }
@ -284,12 +284,12 @@ function editorDo(name, value, target) {
else _editorDoSrl(name, value, target); else _editorDoSrl(name, value, target);
} }
function _editorDoSrl(name, value, parent_srl) { function _editorDoSrl(name, value, upload_target_srl) {
var iframe_obj = editorGetIFrame(parent_srl); var iframe_obj = editorGetIFrame(upload_target_srl);
editorFocus(parent_srl); editorFocus(upload_target_srl);
if(xIE4Up) iframe_obj.contentWindow.document.execCommand(name, false, value); if(xIE4Up) iframe_obj.contentWindow.document.execCommand(name, false, value);
else iframe_obj.contentWindow.document.execCommand(name, false, value); else iframe_obj.contentWindow.document.execCommand(name, false, value);
editorFocus(parent_srl); editorFocus(upload_target_srl);
} }
function _editorDoObject(name, value, obj) { function _editorDoObject(name, value, obj) {
@ -347,8 +347,8 @@ function editorInsertEmoticon(obj) {
editorFocus(editorPrevSrl); editorFocus(editorPrevSrl);
} }
function editorDoInsertUrl(link, parent_srl) { function editorDoInsertUrl(link, upload_target_srl) {
editorFocus(parent_srl); editorFocus(upload_target_srl);
var iframe_obj = editorGetIFrame(srl); var iframe_obj = editorGetIFrame(srl);
editorReplaceHTML(iframe_obj, link); editorReplaceHTML(iframe_obj, link);
} }
@ -493,12 +493,12 @@ var uploading_file = false;
var uploaded_files = new Array(); var uploaded_files = new Array();
// 업로드를 하기 위한 준비 시작 // 업로드를 하기 위한 준비 시작
function editor_upload_init(parent_srl) { function editor_upload_init(upload_target_srl) {
xAddEventListener(window,'load',function() {editor_upload_form_set(parent_srl);} ); xAddEventListener(window,'load',function() {editor_upload_form_set(upload_target_srl);} );
} }
// parent_srl에 해당하는 form의 action을 iframe으로 변경 // upload_target_srl에 해당하는 form의 action을 iframe으로 변경
function editor_upload_form_set(parent_srl) { function editor_upload_form_set(upload_target_srl) {
// 업로드용 iframe을 생성 // 업로드용 iframe을 생성
if(!xGetElementById('tmp_upload_iframe')) { if(!xGetElementById('tmp_upload_iframe')) {
if(xIE4Up) { if(xIE4Up) {
@ -517,20 +517,20 @@ function editor_upload_form_set(parent_srl) {
} }
// form의 action 을 변경 // form의 action 을 변경
var field_obj = xGetElementById("uploaded_file_list_"+parent_srl); var field_obj = xGetElementById("uploaded_file_list_"+upload_target_srl);
if(!field_obj) return; if(!field_obj) return;
var fo_obj = field_obj.parentNode; var fo_obj = field_obj.parentNode;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; } while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
fo_obj.target = 'tmp_upload_iframe'; fo_obj.target = 'tmp_upload_iframe';
// parent_srl에 해당하는 첨부파일 목록을 로드 // upload_target_srl에 해당하는 첨부파일 목록을 로드
var module = ""; var module = "";
if(fo_obj["module"]) module = fo_obj.module.value; if(fo_obj["module"]) module = fo_obj.module.value;
var mid = ""; var mid = "";
if(fo_obj["mid"]) mid = fo_obj.mid.value; if(fo_obj["mid"]) mid = fo_obj.mid.value;
var parent_srl = fo_obj.parent_srl.value; var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?act=procDeleteFile&parent_srl="+parent_srl; var url = "./?act=procDeleteFile&upload_target_srl="+upload_target_srl;
if(module) url+="&module="+module; if(module) url+="&module="+module;
if(mid) url+="&mid="+mid; if(mid) url+="&mid="+mid;
@ -542,7 +542,7 @@ function editor_upload_form_set(parent_srl) {
} }
// 파일 업로드 // 파일 업로드
function editor_file_upload(field_obj, parent_srl) { function editor_file_upload(field_obj, upload_target_srl) {
if(uploading_file) return; if(uploading_file) return;
var fo_obj = field_obj.parentNode; var fo_obj = field_obj.parentNode;
@ -552,25 +552,25 @@ function editor_file_upload(field_obj, parent_srl) {
fo_obj.submit(); fo_obj.submit();
uploading_file = false; uploading_file = false;
var sel_obj = xGetElementById('uploaded_file_list_'+parent_srl); var sel_obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
var string = 'wait for uploading...'; var string = 'wait for uploading...';
var opt_obj = new Option(string, '', true, true); var opt_obj = new Option(string, '', true, true);
sel_obj.options[sel_obj.options.length] = opt_obj; sel_obj.options[sel_obj.options.length] = opt_obj;
} }
// 업로드된 파일 목록을 삭제 // 업로드된 파일 목록을 삭제
function editor_upload_clear_list(parent_srl) { function editor_upload_clear_list(upload_target_srl) {
var obj = xGetElementById('uploaded_file_list_'+parent_srl); var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
while(obj.options.length) { while(obj.options.length) {
obj.remove(0); obj.remove(0);
} }
var preview_obj = xGetElementById('uploaded_file_preview_box_'+parent_srl); var preview_obj = xGetElementById('uploaded_file_preview_box_'+upload_target_srl);
xInnerHtml(preview_obj,'') xInnerHtml(preview_obj,'')
} }
// 업로드된 파일 정보를 목록에 추가 // 업로드된 파일 정보를 목록에 추가
function editor_insert_uploaded_file(parent_srl, file_srl, filename, file_size, disp_file_size, uploaded_filename, sid) { function editor_insert_uploaded_file(upload_target_srl, file_srl, filename, file_size, disp_file_size, uploaded_filename, sid) {
var obj = xGetElementById('uploaded_file_list_'+parent_srl); var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
var string = filename+' ('+disp_file_size+')'; var string = filename+' ('+disp_file_size+')';
var opt_obj = new Option(string, file_srl, true, true); var opt_obj = new Option(string, file_srl, true, true);
obj.options[obj.options.length] = opt_obj; obj.options[obj.options.length] = opt_obj;
@ -578,17 +578,17 @@ function editor_insert_uploaded_file(parent_srl, file_srl, filename, file_size,
var file_obj = {file_srl:file_srl, filename:filename, file_size:file_size, uploaded_filename:uploaded_filename, sid:sid} var file_obj = {file_srl:file_srl, filename:filename, file_size:file_size, uploaded_filename:uploaded_filename, sid:sid}
uploaded_files[file_srl] = file_obj; uploaded_files[file_srl] = file_obj;
editor_preview(obj, parent_srl); editor_preview(obj, upload_target_srl);
} }
// 파일 목록창에서 클릭 되었을 경우 미리 보기 // 파일 목록창에서 클릭 되었을 경우 미리 보기
function editor_preview(sel_obj, parent_srl) { function editor_preview(sel_obj, upload_target_srl) {
if(sel_obj.options.length<1) return; if(sel_obj.options.length<1) return;
var file_srl = sel_obj.options[sel_obj.selectedIndex].value; var file_srl = sel_obj.options[sel_obj.selectedIndex].value;
var obj = uploaded_files[file_srl]; var obj = uploaded_files[file_srl];
if(typeof(obj)=='undefined'||!obj) return; if(typeof(obj)=='undefined'||!obj) return;
var uploaded_filename = obj.uploaded_filename; var uploaded_filename = obj.uploaded_filename;
var preview_obj = xGetElementById('uploaded_file_preview_box_'+parent_srl); var preview_obj = xGetElementById('uploaded_file_preview_box_'+upload_target_srl);
if(!uploaded_filename) { if(!uploaded_filename) {
xInnerHtml(preview_obj, ''); xInnerHtml(preview_obj, '');
@ -614,8 +614,8 @@ function editor_preview(sel_obj, parent_srl) {
} }
// 업로드된 파일 삭제 // 업로드된 파일 삭제
function editor_remove_file(parent_srl) { function editor_remove_file(upload_target_srl) {
var obj = xGetElementById('uploaded_file_list_'+parent_srl); var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
if(obj.options.length<1) return; if(obj.options.length<1) return;
var file_srl = obj.options[obj.selectedIndex].value; var file_srl = obj.options[obj.selectedIndex].value;
if(!file_srl) return; if(!file_srl) return;
@ -624,8 +624,8 @@ function editor_remove_file(parent_srl) {
var fo_obj = obj; var fo_obj = obj;
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 parent_srl = fo_obj.parent_srl.value; var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?mid="+mid+"&act=procDeleteFile&parent_srl="+parent_srl+"&file_srl="+file_srl; var url = "./?mid="+mid+"&act=procDeleteFile&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');
@ -635,8 +635,8 @@ function editor_remove_file(parent_srl) {
} }
// 업로드 목록의 선택된 파일을 내용에 추가 // 업로드 목록의 선택된 파일을 내용에 추가
function editor_insert_file(parent_srl, align) { function editor_insert_file(upload_target_srl, align) {
var obj = xGetElementById('uploaded_file_list_'+parent_srl); var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
if(obj.options.length<1) return; if(obj.options.length<1) return;
var file_srl = obj.options[obj.selectedIndex].value; var file_srl = obj.options[obj.selectedIndex].value;
if(!file_srl) return; if(!file_srl) return;
@ -644,7 +644,7 @@ function editor_insert_file(parent_srl, align) {
var filename = file_obj.filename; var filename = file_obj.filename;
var sid = file_obj.sid; var sid = file_obj.sid;
var uploaded_filename = file_obj.uploaded_filename; var uploaded_filename = file_obj.uploaded_filename;
editorPrevSrl = parent_srl; editorPrevSrl = upload_target_srl;
// 바로 링크 가능한 파일의 경우 (이미지, 플래쉬, 동영상 등..) // 바로 링크 가능한 파일의 경우 (이미지, 플래쉬, 동영상 등..)
if(uploaded_filename && typeof(align)!='undefined') { if(uploaded_filename && typeof(align)!='undefined') {
@ -688,8 +688,8 @@ function editor_insert_file(parent_srl, align) {
var fo_obj = obj; var fo_obj = obj;
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 parent_srl = fo_obj.parent_srl.value; var upload_target_srl = fo_obj.upload_target_srl.value;
var url = "./?mid="+mid+"&amp;act=procDownload&amp;parent_srl="+parent_srl+"&amp;file_srl="+file_srl+"&amp;sid="+sid; var url = "./?mid="+mid+"&amp;act=procDownload&amp;upload_target_srl="+upload_target_srl+"&amp;file_srl="+file_srl+"&amp;sid="+sid;
var x = (screen.availWidth - 400)/2; var x = (screen.availWidth - 400)/2;
var y = (screen.availHeight - 220)/2; var y = (screen.availHeight - 220)/2;
@ -702,11 +702,11 @@ function editor_insert_file(parent_srl, align) {
/** /**
* 글을 쓰다가 페이지 이동시 첨부파일에 대한 정리 * 글을 쓰다가 페이지 이동시 첨부파일에 대한 정리
**/ **/
function editorRemoveAttachFiles(mid, parent_srl) { function editorRemoveAttachFiles(mid, upload_target_srl) {
var obj = xGetElementById('uploaded_file_list_'+parent_srl); var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
if(obj.options.length<1) return; if(obj.options.length<1) return;
var params = new Array(); var params = new Array();
params['parent_srl'] = parent_srl; params['upload_target_srl'] = upload_target_srl;
exec_xml(mid, 'procClearFile', params, null, null, null); exec_xml(mid, 'procClearFile', params, null, null, null);
} }

View file

@ -1,41 +1,41 @@
<!--@if($grant->fileupload)--> <!--@if($grant->fileupload)-->
<script type="text/javascript"> <script type="text/javascript">
editor_upload_init("{$parent_srl}"); editor_upload_init("{$upload_target_srl}");
</script> </script>
<div class="editor_uploader_box"> <div class="editor_uploader_box">
<table> <table>
<tr valign="top"> <tr valign="top">
<td width="125"><div id="uploaded_file_preview_box_{$parent_srl}" class="uploaded_file_preview_box"></div></td> <td width="125"><div id="uploaded_file_preview_box_{$upload_target_srl}" class="uploaded_file_preview_box"></div></td>
<td width="150"> <td width="150">
<div class="editor_align_icon"> <div class="editor_align_icon">
<img src="./images/icon_align_article.gif" border="0" onclick="editor_insert_file('{$parent_srl}', '');" alt="{$lang->edit->icon_align_article}"/> <img src="./images/icon_align_article.gif" border="0" onclick="editor_insert_file('{$upload_target_srl}', '');" alt="{$lang->edit->icon_align_article}"/>
{$lang->edit->icon_align_article} {$lang->edit->icon_align_article}
</div> </div>
<div class="editor_align_icon"> <div class="editor_align_icon">
<img src="./images/icon_align_left.gif" border="0" onclick="editor_insert_file('{$parent_srl}', 'left');" alt="{$lang->edit->icon_align_left}"/> <img src="./images/icon_align_left.gif" border="0" onclick="editor_insert_file('{$upload_target_srl}', 'left');" alt="{$lang->edit->icon_align_left}"/>
{$lang->edit->icon_align_left} {$lang->edit->icon_align_left}
</div> </div>
<div class="editor_align_icon"> <div class="editor_align_icon">
<img src="./images/icon_align_middle.gif" border="0" onclick="editor_insert_file('{$parent_srl}', 'middle');" alt="{$lang->edit->icon_align_middle}"/> <img src="./images/icon_align_middle.gif" border="0" onclick="editor_insert_file('{$upload_target_srl}', 'middle');" alt="{$lang->edit->icon_align_middle}"/>
{$lang->edit->icon_align_middle} {$lang->edit->icon_align_middle}
</div> </div>
<div class="editor_align_icon"> <div class="editor_align_icon">
<img src="./images/icon_align_right.gif" border="0" onclick="editor_insert_file('{$parent_srl}', 'right');" alt="{$lang->edit->icon_align_right}"/> <img src="./images/icon_align_right.gif" border="0" onclick="editor_insert_file('{$upload_target_srl}', 'right');" alt="{$lang->edit->icon_align_right}"/>
{$lang->edit->icon_align_right} {$lang->edit->icon_align_right}
</div> </div>
</td> </td>
<td><select id='uploaded_file_list_{$parent_srl}' size='9' class="uploaded_file_list" onclick="editor_preview(this, '{$parent_srl}')"></select></td> <td><select id='uploaded_file_list_{$upload_target_srl}' size='9' class="uploaded_file_list" onclick="editor_preview(this, '{$upload_target_srl}')"></select></td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="button" value="{$lang->edit->delete_selected}" onclick="editor_remove_file('{$parent_srl}');return false;" style="width:100%;"/> <input type="button" value="{$lang->edit->delete_selected}" onclick="editor_remove_file('{$upload_target_srl}');return false;" style="width:100%;"/>
</td> </td>
<td> <td>
<input type="button" value="{$lang->edit->link_selected}" onclick="editor_insert_file('{$parent_srl}');return false;" style="width:100%;"/> <input type="button" value="{$lang->edit->link_selected}" onclick="editor_insert_file('{$upload_target_srl}');return false;" style="width:100%;"/>
</td> </td>
<td align="right"> <td align="right">
<input type="file" name="file" onchange="editor_file_upload(this, '{$parent_srl}')" value="{$lang->edit->upload}" style="width:100%;" /> <input type="file" name="file" onchange="editor_file_upload(this, '{$upload_target_srl}')" value="{$lang->edit->upload}" style="width:100%;" />
</td> </td>
</tr> </tr>
</table> </table>