#130 파일을 여러개 첨부후 다중 선택을 가능하게 하고 선택된 대상들을 일괄 삭제 및 일괄 본문 삽입 기능 추가. 또빛나리님의 제안

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2447 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-31 05:36:36 +00:00
parent 2c016d8d5a
commit 299f3d7c73
4 changed files with 54 additions and 32 deletions

View file

@ -24,8 +24,8 @@ function getImage() {
var border = node.getAttribute("border");
var align = node.getAttribute("align");
var alt = node.getAttribute("alt");
var width = node.getAttribute("width");
var height = node.getAttribute("height");
var width = xWidth(node);
var height = xHeight(node);
orig_width = width;
orig_height = height;
var link_url = node.getAttribute("link_url");

View file

@ -45,7 +45,7 @@ function insertMultimedia(obj) {
return;
}
var text = "<img src=\"./common/tpl/images/blank.gif\" editor_component=\"multimedia_link\" multimedia_src=\""+url+"\" width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;\" auto_start=\""+auto_start+"\" alt=\""+caption+"\" />";
var text = "<img src=\"./common/tpl/images/blank.gif\" editor_component=\"multimedia_link\" multimedia_src=\""+url+"\" width=\""+width+"\" height=\""+height+"\" style=\"display:block;width:"+width+"px;height:"+height+"px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;\" auto_start=\""+auto_start+"\" alt=\""+caption+"\" />";
opener.editorFocus(opener.editorPrevSrl);

View file

@ -151,7 +151,7 @@
<!-- 파일 업로드 영역 -->
<div class="fileListArea">
<select id="uploaded_file_list_{$upload_target_srl}" size="7" class="fileList" onclick="editor_preview(this, '{$upload_target_srl}');"></select>
<select id="uploaded_file_list_{$upload_target_srl}" multiple="multiple" size="7" class="fileList" onclick="editor_preview(this, '{$upload_target_srl}');"></select>
<span class="file_attach_info" id="uploader_status_{$upload_target_srl}"></span>
</div>

View file

@ -223,20 +223,28 @@ function editor_preview(sel_obj, upload_target_srl) {
function editor_remove_file(upload_target_srl) {
var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
if(obj.options.length<1) return;
var file_srl = obj.options[obj.selectedIndex].value;
if(!file_srl) return;
// 삭제하려는 파일의 정보를 챙김;;
var fo_obj = obj;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
var mid = fo_obj.mid.value;
var url = request_uri+"/?act=procFileDelete&upload_target_srl="+upload_target_srl+"&file_srl="+file_srl+"&mid="+current_url.getQuery('mid');
// iframe에 url을 보내버림
// 빈 iframe 구함
var iframe_obj = xGetElementById('tmp_upload_iframe');
if(!iframe_obj) return;
iframe_obj.contentWindow.document.location.href=url;
for(var i=0;i<obj.options.length;i++) {
var sel_obj = obj.options[i];
if(!sel_obj.selected) continue;
var file_srl = sel_obj.value;
if(!file_srl) continue;
var url = request_uri+"/?act=procFileDelete&upload_target_srl="+upload_target_srl+"&file_srl="+file_srl+"&mid="+current_url.getQuery('mid');
iframe_obj.contentWindow.document.location.href=url;
}
var preview_obj = xGetElementById('preview_uploaded_'+upload_target_srl);
xInnerHtml(preview_obj, "");
@ -246,30 +254,44 @@ function editor_remove_file(upload_target_srl) {
function editor_insert_file(upload_target_srl) {
var obj = xGetElementById('uploaded_file_list_'+upload_target_srl);
if(obj.options.length<1) return;
var file_srl = obj.options[obj.selectedIndex].value;
if(!file_srl) return;
var file_obj = uploaded_files[file_srl];
var filename = file_obj.filename;
var sid = file_obj.sid;
var uploaded_filename = file_obj.uploaded_filename;
// 바로 링크 가능한 파일의 경우 (이미지, 플래쉬, 동영상 등..)
if(uploaded_filename.indexOf("binaries")==-1) {
// 이미지 파일의 경우 image_link 컴포넌트 열결
if(/\.(jpg|jpeg|png|gif)$/i.test(uploaded_filename)) {
openComponent("image_link", upload_target_srl, uploaded_filename);
var iframe_obj = editorGetIFrame(upload_target_srl);
editorFocus(upload_target_srl);
// 이미지외의 경우는 multimedia_link 컴포넌트 연결
var fo_obj = obj;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
// 다중 선택된 경우를 위해 loop
for(var i=0;i<obj.options.length;i++) {
var sel_obj = obj.options[i];
if(!sel_obj.selected) continue;
var file_srl = sel_obj.value;
if(!file_srl) continue;
var file_obj = uploaded_files[file_srl];
var filename = file_obj.filename;
var sid = file_obj.sid;
var url = file_obj.uploaded_filename.replace(request_uri,'');
// 바로 링크 가능한 파일의 경우 (이미지, 플래쉬, 동영상 등..)
if(url.indexOf("binaries")==-1) {
// 이미지 파일의 경우 image_link 컴포넌트 열결
if(/\.(jpg|jpeg|png|gif)$/i.test(url)) {
var text = "<img editor_component=\"image_link\" src=\""+url+"\" alt=\""+file_obj.filename+"\" />";
editorReplaceHTML(iframe_obj, text);
// 이미지외의 경우는 multimedia_link 컴포넌트 연결
} else {
var text = "<img src=\"./common/tpl/images/blank.gif\" editor_component=\"multimedia_link\" multimedia_src=\""+url+"\" width=\"400\" height=\"320\" style=\"display:block;width:400px;height:320px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;\" auto_start=\"false\" alt=\"\" />";
editorReplaceHTML(iframe_obj, text);
}
// binary파일의 경우 url_link 컴포넌트 연결
} else {
openComponent("multimedia_link", upload_target_srl, uploaded_filename);
}
// binary파일의 경우 url_link 컴포넌트 연결
} else {
var fo_obj = obj;
while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; }
var mid = fo_obj.mid.value;
var url = request_uri+"/?module=file&amp;act=procFileDownload&amp;file_srl="+file_srl+"&amp;sid="+sid;
openComponent("url_link", upload_target_srl, url);
}
var mid = fo_obj.mid.value;
var url = request_uri+"/?module=file&amp;act=procFileDownload&amp;file_srl="+file_srl+"&amp;sid="+sid;
var text = "<a href=\""+url+"\">"+filename+"</a><br />\n";
editorReplaceHTML(iframe_obj, text);
}
}
}