글 본문의 이미지나 첨부파일의 경로가 잘 못 입력되는 문제 수정 (IE7에서 src의 경로를 임의로 절대경로로 함으로서 생기는 문제)

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4397 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-07-21 08:07:51 +00:00
parent 3b72bd138c
commit cad37b31ba
2 changed files with 28 additions and 3 deletions

View file

@ -305,7 +305,32 @@ function procFilter(fo_obj, filter_func) {
// form문 안에 위지윅 에디터가 세팅되어 있을 경우 에디터의 값과 지정된 content field를 sync
var editor_sequence = fo_obj.getAttribute('editor_sequence');
if(typeof(editor_sequence)!='undefined' && editor_sequence && typeof(editorRelKeys)!='undefined') {
editorRelKeys[editor_sequence]['content'].value = editorGetContent(editor_sequence);
var content = editorGetContent(editor_sequence);
var dummy = xCreateElement("div");
xInnerHtml(dummy, content);
// IE에서 컨텐츠 전체를 P태그로 감싸는 경우가 있어서 이 의미없는 P태그를 제거
if(dummy.firstChild && dummy.firstChild.nodeName == 'P' && dummy.firstChild == dummy.lastChild) {
var content = xInnerHtml(dummy.firstChild);
xInnerHtml(dummy,content);
}
// img/a 태그의 대상에 대해 경로 재설정 (IE브라우저에서 위지윅 에디터내의 경로를 절대 경로로 바꾸는 버그때문ㅇ)
var imgTags = xGetElementsByTagName('IMG', dummy);
for(var i=0;i<imgTags.length;i++) {
if(imgTags[i].src.indexOf(request_uri)!=-1) {
imgTags[i].src = imgTags[i].src.replace(/(.*)files\/(.*)/i,'files/$2');
}
}
var aTags = xGetElementsByTagName('A', dummy);
for(var i=0;i<aTags.length;i++) {
if(aTags[i].href.indexOf(request_uri)!=-1) {
aTags[i].href = aTags[i].href.replace(/(.*)\?module=file&(.*)/i,'./?module=file&$2');
}
}
var content = xInnerHtml(dummy);
editorRelKeys[editor_sequence]['content'].value = content;
}
filter_func(fo_obj);

View file

@ -311,7 +311,7 @@ function editor_insert_file(editor_sequence) {
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,'');
var url = file_obj.uploaded_filename.replace(/(.*)files\/(.*)/i,'files/$2');
// 바로 링크 가능한 파일의 경우 (이미지, 플래쉬, 동영상 등..)
if(url.indexOf("binaries")==-1) {
@ -328,7 +328,7 @@ function editor_insert_file(editor_sequence) {
// binary파일의 경우 url_link 컴포넌트 연결
} else {
var mid = fo_obj.mid.value;
var url = request_uri+"/?module=file&amp;act=procFileDownload&amp;file_srl="+file_srl+"&amp;sid="+sid;
var url = "./?module=file&amp;act=procFileDownload&amp;file_srl="+file_srl+"&amp;sid="+sid;
var text = "<a href=\""+url+"\">"+filename+"</a>\n";
editorReplaceHTML(iframe_obj, text);
}