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

This commit is contained in:
zero 2007-03-20 06:29:01 +00:00
parent 6e6856e1eb
commit ca67eeea6e
19 changed files with 113 additions and 376 deletions

View file

@ -262,38 +262,20 @@ function editorEventCheck(evt) {
// 추가 컴포넌트의 경우 서버에 요청을 시도
default :
editorPrevSrl = upload_target_srl;
var params = new Array();
params['component'] = component_name;
params['upload_target_srl'] = upload_target_srl;
var response_tags = new Array('error', 'message', 'component', 'upload_target_srl', 'tpl', 'open_window', 'popup_url');
exec_xml('editor', 'dispComponent', params, editorProcComponent, response_tags, editor_form_list[upload_target_srl]);
openComponent(component_name, upload_target_srl);
break;
}
return;
}
// 컴포넌트 요청 후 결과를 처리할 함수
function editorProcComponent(ret_obj, response_tags) {
var upload_target_srl = ret_obj['upload_target_srl'];
var tpl = ret_obj['tpl'];
var open_window = ret_obj['open_window'];
var popup_url = ret_obj['popup_url'];
// 컴포넌트 팝업 열기
function openComponent(component_name, upload_target_srl, manual_url) {
editorPrevSrl = upload_target_srl;
var popup_url = "./?module=editor&act=dispPopup&upload_target_srl="+upload_target_srl+"&component="+component_name;
if(typeof(manual_url)!="undefined" && manual_url) popup_url += "&manual_url="+escape(manual_url);
// 컴포넌트의 동작이 새창 열기 일 경우
if(open_window == 'Y') {
var win_left = 10;
var win_top = 10;
winopen(popup_url, 'editorComponent', 'left='+win_left+',top='+win_top+',width=10,height=10,toolbars=no,scrollbars=no');
// 새창 열기가 아니면 정해진 영역에 innerHTML로 tpl 입력
} else {
var zone = xGetElementById("editor_component_area_"+upload_target_srl);
xInnerHtml(zone, tpl);
}
winopen(popup_url, 'editorComponent', 'left=10,top=10,width=10,height=10,toolbars=no,scrollbars=no');
}
// 본문내에 포함된 컴포넌트를 찾는 함수 (더블클릭시)
@ -348,14 +330,7 @@ function editorSearchComponent(evt) {
var upload_target_srl = tobj.getAttribute("upload_target_srl");
// 해당 컴포넌트를 찾아서 실행
editorPrevSrl = upload_target_srl;
var params = new Array();
params['component'] = editor_component;
params['upload_target_srl'] = upload_target_srl;
var response_tags = new Array('error', 'message', 'component', 'upload_target_srl', 'tpl', 'open_window', 'popup_url');
exec_xml('editor', 'dispComponent', params, editorProcComponent, response_tags, editor_form_list[upload_target_srl]);
openComponent(editor_component, upload_target_srl);
}
// focus

View file

@ -13,6 +13,20 @@ function editor_upload_init(upload_target_srl) {
// upload_target_srl에 해당하는 form의 action을 iframe으로 변경
function editor_upload_form_set(upload_target_srl) {
// input type=file의 위치 및 설정 변경
var uploader = xGetElementById("file_uploader_"+upload_target_srl);
if(xIE4Up) {
xLeft(uploader, -40);
xTop(uploader, -85);
uploader.style.filter = "alpha(opacity=0)";
} else {
xLeft(uploader, -15);
xTop(uploader, -85);
uploader.style.opacity = 0;
}
uploader.style.display = "block";
// 업로드용 iframe을 생성
if(!xGetElementById('tmp_upload_iframe')) {
if(xIE4Up) {
@ -104,7 +118,7 @@ function editor_preview(sel_obj, upload_target_srl) {
var obj = uploaded_files[file_srl];
if(typeof(obj)=='undefined'||!obj) return;
var uploaded_filename = obj.uploaded_filename;
var preview_obj = xGetElementById('uploaded_file_preview_box_'+upload_target_srl);
var preview_obj = xGetElementById('preview_uploaded_'+upload_target_srl);
if(!uploaded_filename) {
xInnerHtml(preview_obj, '');
@ -115,16 +129,16 @@ function editor_preview(sel_obj, upload_target_srl) {
// 플래쉬 동영상의 경우
if(/\.flv$/i.test(uploaded_filename)) {
html = "<EMBED src=\""+editor_path+"component/flvplayer/flvplayer.swf?autoStart=true&file="+uploaded_filename+"\" width=\"120\" height=\"120\" type=\"application/x-shockwave-flash\"></EMBED>";
html = "<EMBED src=\"./common/tpl/images/flvplayer.swf?autoStart=false&file="+uploaded_filename+"\" width=\"110\" height=\"110\" type=\"application/x-shockwave-flash\"></EMBED>";
// 플래쉬 파일의 경우
} else if(/\.swf$/i.test(uploaded_filename)) {
html = "<EMBED src=\""+uploaded_filename+"\" width=\"120\" height=\"120\" type=\"application/x-shockwave-flash\"></EMBED>";
html = "<EMBED src=\""+uploaded_filename+"\" width=\"110\" height=\"110\" type=\"application/x-shockwave-flash\"></EMBED>";
// wmv, avi, mpg, mpeg등의 동영상 파일의 경우
} else if(/\.(wmv|avi|mpg|mpeg|asx|asf|mp3)$/i.test(uploaded_filename)) {
html = "<EMBED src=\""+uploaded_filename+"\" width=\"120\" height=\"120\" autostart=\"true\" Showcontrols=\"0\"></EMBED>";
html = "<EMBED src=\""+uploaded_filename+"\" width=\"110\" height=\"110\" autostart=\"true\" Showcontrols=\"0\"></EMBED>";
// 이미지 파일의 경우
} else if(/\.(jpg|jpeg|png|gif)$/i.test(uploaded_filename)) {
html = "<img src=\""+uploaded_filename+"\" border=\"0\" width=\"120\" height=\"120\" />";
html = "<img src=\""+uploaded_filename+"\" border=\"0\" width=\"110\" height=\"110\" />";
}
xInnerHtml(preview_obj, html);
}
@ -151,7 +165,7 @@ function editor_remove_file(upload_target_srl) {
}
// 업로드 목록의 선택된 파일을 내용에 추가
function editor_insert_file(upload_target_srl, align) {
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;
@ -160,58 +174,28 @@ function editor_insert_file(upload_target_srl, align) {
var filename = file_obj.filename;
var sid = file_obj.sid;
var uploaded_filename = file_obj.uploaded_filename;
editorPrevSrl = upload_target_srl;
// 바로 링크 가능한 파일의 경우 (이미지, 플래쉬, 동영상 등..)
if(uploaded_filename && typeof(align)!='undefined') {
if(uploaded_filename) {
var type = "";
// 이미지 파일의 경우
// 이미지 파일의 경우 image_link 컴포넌트 열결
if(/\.(jpg|jpeg|png|gif)$/i.test(uploaded_filename)) {
openComponent("image_link", upload_target_srl, uploaded_filename);
editorFocus(editorPrevSrl);
var html = "<img src=\""+uploaded_filename+"\" border=\"0\" alt=\""+filename+"\" ";
if(typeof(align)!='undefined'&&align) html += " align=\""+align+"\"";
html += " />"
var obj = editorGetIFrame(editorPrevSrl);
editorReplaceHTML(obj, html);
// 이미지외의 경우는 대체 이미지를 넣음
// 이미지외의 경우는 multimedia_link 컴포넌트 연결
} else {
// 플래쉬 동영상의 경우
if(/\.flv$/i.test(uploaded_filename)) {
type = "flv";
uploaded_filename = editor_path+"component/flvplayer/flvplayer.swf?autoStart=true&file="+uploaded_filename;
// 플래쉬 파일의 경우
} else if(/\.swf$/i.test(uploaded_filename)) {
type = "swf";
// wmv, avi, mpg, mpeg등의 동영상 파일의 경우
} else if(/\.(wmv|avi|mpg|mpeg)$/i.test(uploaded_filename)) {
type = "multimedia";
}
var alt = "align="+align+"|@|src="+uploaded_filename+"|@|type="+type;
var html = "<img src=\""+editor_path+"images/blank.gif\" style=\"width:400px;height:300px;\" alt=\""+alt+"\" class=\"editor_multimedia\"/>";
var iframe_obj = editorGetIFrame(editorPrevSrl);
editorReplaceHTML(iframe_obj, html);
openComponent("multimedia_link", upload_target_srl, uploaded_filename);
}
// binary파일의 경우 다운로드 링크를 추가
// 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 upload_target_srl = fo_obj.upload_target_srl.value;
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 y = (screen.availHeight - 220)/2;
winopen(editor_path+"popup/add_url.php?title="+escape(filename)+"&url="+escape(url),"_editorPopup","top="+y+",left="+x+",width=400,height=220,resizable=no,toolbars=no,scrollbars=no");
var url = "./?mid="+mid+"&amp;act=procDownloadFile&amp;upload_target_srl="+upload_target_srl+"&amp;file_srl="+file_srl+"&amp;sid="+sid;
openComponent("url_link", upload_target_srl, url);
}
}
/**