From 4a55cfe522d4a9e1e622ae918bb164a3fc3d5a80 Mon Sep 17 00:00:00 2001 From: haneul Date: Wed, 21 Nov 2007 15:22:58 +0000 Subject: [PATCH] =?UTF-8?q?xquared=20=EC=A0=81=EC=9A=A9=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20javascript=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3038 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- common/js/xml_handler.js | 2 ++ common/js/xml_js_filter.js | 7 ++++--- modules/blog/skins/xe_blog/write_form.html | 2 +- modules/board/skins/xe_board/write_form.html | 2 +- modules/editor/skins/default/editor.html | 1 + modules/editor/tpl/js/editor.js | 14 ++++++-------- modules/editor/tpl/js/editor_common.js | 7 +++++++ modules/editor/tpl/js/uploader.js | 9 +++++---- modules/guestbook/skins/default/write_form.html | 2 +- 9 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 modules/editor/tpl/js/editor_common.js diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index 3c628cf00..c3dace935 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -10,6 +10,7 @@ function exec_xml(module, act, params, callback_func, response_tags, callback_fu var oXml = new xml_handler(); oXml.reset(); for(var key in params) { + if(!params.hasOwnProperty(key)) continue; var val = params[key]; oXml.addParam(key, val); } @@ -88,6 +89,7 @@ function xml_handlerRequest(callBackFunc, xmlObj, callBackFunc2, response_tags, + "\n" for (var key in this.params) { + if(!this.params.hasOwnProperty(key)) continue; var val = this.params[key]; rd += "<"+key+">\n"; } diff --git a/common/js/xml_js_filter.js b/common/js/xml_js_filter.js index 7930525ab..77dbc4889 100644 --- a/common/js/xml_js_filter.js +++ b/common/js/xml_js_filter.js @@ -302,9 +302,10 @@ function XmlJsFilterProc(confirm_msg) { 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' && typeof(editorGetContent)=='function') { - var content = editorGetContent(editor_sequence); - editorRelKeys[editor_sequence]['content'].value = content; + if(typeof(editor_sequence)!='undefined' && editor_sequence && typeof(editorRelKeys)!='undefined') { + if(typeof(editorRelKeys[editor_sequence]['func']) =='function') { + editorRelKeys[editor_sequence]['func'](editor_sequence); + } } filter_func(fo_obj); diff --git a/modules/blog/skins/xe_blog/write_form.html b/modules/blog/skins/xe_blog/write_form.html index 424e7fabd..dc8836973 100644 --- a/modules/blog/skins/xe_blog/write_form.html +++ b/modules/blog/skins/xe_blog/write_form.html @@ -2,7 +2,7 @@
-
fileupload)-->enctype="multipart/form-data" class="blogEditor" id="fo_write"> + fileupload)-->enctype="multipart/form-data" class="blogEditor" id="fo_write">
diff --git a/modules/board/skins/xe_board/write_form.html b/modules/board/skins/xe_board/write_form.html index adc3859f4..a35c15e7e 100644 --- a/modules/board/skins/xe_board/write_form.html +++ b/modules/board/skins/xe_board/write_form.html @@ -2,7 +2,7 @@
- fileupload)-->enctype="multipart/form-data" class="boardEditor" id="fo_write"> + fileupload)-->enctype="multipart/form-data" class="boardEditor" id="fo_write">
diff --git a/modules/editor/skins/default/editor.html b/modules/editor/skins/default/editor.html index cb0ce0c67..50a3b2392 100644 --- a/modules/editor/skins/default/editor.html +++ b/modules/editor/skins/default/editor.html @@ -2,6 +2,7 @@ + diff --git a/modules/editor/tpl/js/editor.js b/modules/editor/tpl/js/editor.js index 759745d1b..626bc934f 100755 --- a/modules/editor/tpl/js/editor.js +++ b/modules/editor/tpl/js/editor.js @@ -4,14 +4,6 @@ * @brief 에디터 관련 스크립트 */ -/** - * 에디터에서 사용하기 위한 변수 - **/ -var editorMode = new Array(); ///<< 에디터의 html편집 모드 flag 세팅 변수 (html or null) -var editorAutoSaveObj = {fo_obj:null, editor_sequence:0, title:'', content:'', locked:false} ///< 자동저장을 위한 정보를 가진 object -var editorRelKeys = new Array(); ///< 에디터와 각 모듈과의 연동을 위한 key 값을 보관하는 변수 -var editorDragObj = {isDrag:false, y:0, obj:null, id:'', det:0, source_height:0} - /** * 에디터 사용시 사용되는 이벤트 연결 함수 호출 **/ @@ -33,6 +25,11 @@ function editorGetTextArea(editor_sequence) { return xGetElementById( 'editor_textarea_' + editor_sequence ); } +function editorSync(editor_sequence) { + editorRelKeys[editor_sequence]['content'].value = editorGetContent(editor_sequence); +} + + // editor_sequence에 해당하는 form문 구함 function editorGetForm(editor_sequence) { var iframe_obj = editorGetIFrame(editor_sequence); @@ -112,6 +109,7 @@ function editorStart(editor_sequence, primary_key, content_key, editor_height) { editorRelKeys[editor_sequence] = new Array(); editorRelKeys[editor_sequence]["primary"] = fo_obj[primary_key]; editorRelKeys[editor_sequence]["content"] = fo_obj[content_key]; + editorRelKeys[editor_sequence]["func"] = editorSync; // saved document(자동저장 문서)에 대한 확인 if(typeof(fo_obj._saved_doc_title)!="undefined" ) { ///<< _saved_doc_title field가 없으면 자동저장 하지 않음 diff --git a/modules/editor/tpl/js/editor_common.js b/modules/editor/tpl/js/editor_common.js new file mode 100644 index 000000000..d7f497a70 --- /dev/null +++ b/modules/editor/tpl/js/editor_common.js @@ -0,0 +1,7 @@ +/** + * 에디터에서 사용하기 위한 변수 + **/ +var editorMode = new Array(); ///<< 에디터의 html편집 모드 flag 세팅 변수 (html or null) +var editorAutoSaveObj = {fo_obj:null, editor_sequence:0, title:'', content:'', locked:false} ///< 자동저장을 위한 정보를 가진 object +var editorRelKeys = new Array(); ///< 에디터와 각 모듈과의 연동을 위한 key 값을 보관하는 변수 +var editorDragObj = {isDrag:false, y:0, obj:null, id:'', det:0, source_height:0} diff --git a/modules/editor/tpl/js/uploader.js b/modules/editor/tpl/js/uploader.js index 2912c8477..1cd7a6b01 100755 --- a/modules/editor/tpl/js/uploader.js +++ b/modules/editor/tpl/js/uploader.js @@ -18,8 +18,8 @@ var uploaded_files = new Array(); * 이 함수는 editor.html 에서 파일 업로드 가능할 경우 호출됨 **/ // window.load 이벤트일 경우 && 문서 번호가 가상의 번호가 아니면 기존에 저장되어 있을지도 모르는 파일 목록을 가져옴 -function editor_upload_init(editor_sequence) { - xAddEventListener(window,'load',function() { editor_upload_start(editor_sequence);} ); +function editor_upload_init(editor_sequence, el) { + xAddEventListener(window,'load',function() { editor_upload_start(editor_sequence, el);} ); } function editor_upload_get_target_srl(editor_sequence) { @@ -32,7 +32,7 @@ function editor_upload_get_uploader_name(editor_sequence) { } // 파일 업로드를 위한 기본 준비를 함 -function editor_upload_start(editor_sequence) { +function editor_upload_start(editor_sequence, fo_obj) { // 캐시 삭제 try { document.execCommand('BackgroundImageCache',false,true); } catch(e) { } @@ -58,7 +58,8 @@ function editor_upload_start(editor_sequence) { if(!field_obj) return; // 에디터를 감싸는 form을 구해 submit target을 임시 iframe으로 변경 - var fo_obj = editorGetForm(editor_sequence); + if(!fo_obj) + fo_obj = editorGetForm(editor_sequence); fo_obj.target = 'tmp_upload_iframe'; // SWF uploader 생성 diff --git a/modules/guestbook/skins/default/write_form.html b/modules/guestbook/skins/default/write_form.html index 57da8120b..466c93728 100644 --- a/modules/guestbook/skins/default/write_form.html +++ b/modules/guestbook/skins/default/write_form.html @@ -5,7 +5,7 @@
- +