From d95c9611b66bd0b001852974eba051b11ad0eb6a Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 16 Oct 2007 06:32:30 +0000 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=94=94=ED=84=B0=20js=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=EB=A5=BC=20=EA=B0=80=EB=B3=8D?= =?UTF-8?q?=EA=B2=8C=20=EC=88=98=EC=A0=95.=20onsubmit=EC=8B=9C=EC=97=90=20?= =?UTF-8?q?procFilter()=ED=95=A8=EC=88=98=EC=97=90=EC=84=9C=20content=20?= =?UTF-8?q?=EC=8B=B1=ED=81=AC=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD.=20=EA=B2=8C=EC=8B=9C=ED=8C=90/=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80/=EC=99=B8=EB=B6=80=ED=8E=98=EC=9D=B4=EC=A7=80/?= =?UTF-8?q?=EB=B0=A9=EB=AA=85=EB=A1=9D/=EB=B8=94=EB=A1=9C=EA=B7=B8=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=EC=9E=90=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EC=9D=98=20=EB=AA=A9=EB=A1=9D=20display=20=EB=B3=80=EA=B2=BD?= 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@2793 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- common/js/x.js | 1 + common/js/xml_js_filter.js | 7 + modules/admin/tpl/css/admin.css | 1 + modules/blog/tpl/index.html | 14 +- modules/board/tpl/index.html | 16 +- .../editor/components/url_link/tpl/popup.js | 2 +- modules/editor/tpl/js/editor.js | 245 ++++++------------ modules/editor/tpl/js/uploader.js | 8 +- modules/guestbook/tpl/index.html | 21 +- modules/opage/tpl/index.html | 14 +- modules/page/tpl/index.html | 14 +- 11 files changed, 135 insertions(+), 208 deletions(-) diff --git a/common/js/x.js b/common/js/x.js index dc2f90356..fa6df72d3 100644 --- a/common/js/x.js +++ b/common/js/x.js @@ -21,6 +21,7 @@ else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){ } else if(document.layers){xNN4=true;} var xMac=xUA.indexOf('mac')!=-1; +var xFF=xUA.indexOf('firefox')!=-1; // (element, event(without 'on'), event listener(function name)[, caption]) function xAddEventListener(e,eT,eL,cap) diff --git a/common/js/xml_js_filter.js b/common/js/xml_js_filter.js index 0844dc418..bb9c3fcf9 100644 --- a/common/js/xml_js_filter.js +++ b/common/js/xml_js_filter.js @@ -300,6 +300,13 @@ function XmlJsFilterProc(confirm_msg) { // form proc 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; + } + filter_func(fo_obj); return false; } diff --git a/modules/admin/tpl/css/admin.css b/modules/admin/tpl/css/admin.css index e884be66a..59806849b 100644 --- a/modules/admin/tpl/css/admin.css +++ b/modules/admin/tpl/css/admin.css @@ -87,6 +87,7 @@ select.time_zone { width:70%; position:relative; top:4px; } .tableType1 td a { color:#1d1d1d;} .tableType1 .tahoma { font-size:.9em; font-family:Tahoma;} .tableType1 .tahoma a { font-size:1em;} +.tableType1 td.subject { padding:3px 0 3px 0; } .tableType1 td.blue a { color:#158692;} .tableType1 td.red a { color:#c95b53;} .tableType1 td.red { color:#c95b53;} diff --git a/modules/blog/tpl/index.html b/modules/blog/tpl/index.html index d768b1ba3..9ed080803 100644 --- a/modules/blog/tpl/index.html +++ b/modules/blog/tpl/index.html @@ -9,9 +9,8 @@ ---++@@ -38,8 +37,7 @@ - - + @@ -62,8 +60,10 @@ {$module_category[$val->module_category_srl]->title} - - + diff --git a/modules/board/tpl/index.html b/modules/board/tpl/index.html index d8971fa97..845c978a6 100644 --- a/modules/board/tpl/index.html +++ b/modules/board/tpl/index.html @@ -9,9 +9,8 @@
{$lang->mid}{$lang->browser_title}{$lang->browser_title} / {$lang->mid} {$lang->is_default} {$lang->skin} {$lang->admin_id}
{htmlspecialchars($val->browser_title)}
+ {htmlspecialchars($val->browser_title)}
+ {$val->mid} +
{$val->is_default} {$val->skin} {$val->admin_id} 
---++@@ -38,8 +37,7 @@ - - + @@ -60,14 +58,16 @@ {$module_category[$val->module_category_srl]->title} - - + - + diff --git a/modules/editor/components/url_link/tpl/popup.js b/modules/editor/components/url_link/tpl/popup.js index 316560528..220315f3b 100644 --- a/modules/editor/components/url_link/tpl/popup.js +++ b/modules/editor/components/url_link/tpl/popup.js @@ -15,7 +15,7 @@ function getText() { if(node.nodeName == "A") { var url = node.getAttribute("HREF"); - var text = node.text.replace(/</ig,'<').replace(/>/ig,'>').replace(/&/ig,'&'); + var text = node.innerHTML.replace(/</ig,'<').replace(/>/ig,'>').replace(/&/ig,'&'); var open_window = false; var bold = false; diff --git a/modules/editor/tpl/js/editor.js b/modules/editor/tpl/js/editor.js index 5b3a3f676..80d7c9dbc 100755 --- a/modules/editor/tpl/js/editor.js +++ b/modules/editor/tpl/js/editor.js @@ -2,21 +2,22 @@ * @author zero (zero@nzeo.com) * @version 0.1 * @brief 에디터 관련 스크립트 - **/ + */ /** - * 에디터에서 사용하는 iframe, textarea의 prefix + * 에디터에서 사용하기 위한 변수 **/ -var editor_mode = new Array(); ///<< 에디터의 html편집 모드 flag 세팅 변수 -var _editorSyncList = new Array(); ///< 에디터와 form 동기화를 위한 동기화 대상 목록 -var _autoSaveObj = {fo_obj:null, editor_sequence:0, title:'', content:'', locked:false} ///< 자동저장을 위한 정보를 가진 object -var editor_rel_keys = new Array(); ///< 에디터와 각 모듈과의 연동을 위한 key 값을 보관하는 변수 +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} /** * 에디터 사용시 사용되는 이벤트 연결 함수 호출 **/ -xAddEventListener(window, 'load', _editorSync); ///< 에디터의 동기화를 하는 함수를 window.load시 실행 - +xAddEventListener(document, 'mousedown', editorDragStart); +xAddEventListener(document, 'mouseup', editorDragStop); +xAddEventListener(document, 'mouseup', editorEventCheck); /** * 에디터의 상태나 객체를 구하기 위한 함수 @@ -24,41 +25,37 @@ xAddEventListener(window, 'load', _editorSync); ///< 에디터의 동기화를 // editor_sequence값에 해당하는 iframe의 object를 return function editorGetIFrame(editor_sequence) { - var obj_id = 'editor_iframe_'+ editor_sequence; - return xGetElementById(obj_id); + return xGetElementById( 'editor_iframe_'+ editor_sequence ); } // editor_sequence값에 해당하는 textarea object를 return function editorGetTextArea(editor_sequence) { - var obj_id = 'editor_textarea_' + editor_sequence; - return xGetElementById(obj_id); + return xGetElementById( 'editor_textarea_' + editor_sequence ); } // editor_sequence에 해당하는 form문 구함 function editorGetForm(editor_sequence) { var iframe_obj = editorGetIFrame(editor_sequence); if(!iframe_obj) return; + var fo_obj = iframe_obj.parentNode; while(fo_obj.nodeName != 'FORM') { fo_obj = fo_obj.parentNode; } if(fo_obj.nodeName == 'FORM') return fo_obj; return; } -// 에디터의 전체 내용 return, HTML 편집모드일 경우에 데이터를 이전후 값 return +// 에디터의 전체 내용 return function editorGetContent(editor_sequence) { - var iframe_obj = editorGetIFrame(editor_sequence); - if(!iframe_obj) return null; - - var html = null; - if(editor_mode[editor_sequence]=='html') { + var html = ""; + if(editorMode[editor_sequence]=='html') { var textarea_obj = editorGetTextArea(editor_sequence); - var html = textarea_obj.value; - var contentDocument = iframe_obj.contentWindow.document; - contentDocument.body.innerHTML = html; + if(!textarea_obj) return ""; + html = textarea_obj.value; + } else { + var iframe_obj = editorGetIFrame(editor_sequence); + if(!iframe_obj) return ""; + html = xInnerHtml(iframe_obj.contentWindow.document.body).replace(/^]*)>$/i,''); } - - html = xInnerHtml(iframe_obj.contentWindow.document.body); - if(html) html = html.replace(/^]*)>$/i,''); return html; } @@ -68,7 +65,6 @@ function editorGetSelectedHtml(editor_sequence) { if(xIE4Up) { var range = iframe_obj.contentWindow.document.selection.createRange(); var html = range.htmlText; - //range.select(); return html; } else { var range = iframe_obj.contentWindow.getSelection().getRangeAt(0); @@ -96,12 +92,9 @@ function editorGetSelectedNode(editor_sequence) { } } - /** * editor 시작 (editor_sequence로 iframe객체를 얻어서 쓰기 모드로 전환) **/ -var editor_is_started = new Array(); -var editor_start_func = new Array(); function editorStart(editor_sequence, primary_key, content_key, resizable, editor_height) { // resize 가/불가에 대한 체크 if(typeof(resizable)=="undefined"||!resizable) resizable = false; @@ -112,14 +105,17 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito if(!iframe_obj) return; xWidth(iframe_obj, xWidth(iframe_obj.parentNode)-20); - // 현 에디터를 감싸고 있는 form문을 찾아서 content object를 찾아서 내용 sync + // 현 에디터를 감싸고 있는 form문을 찾음 var fo_obj = editorGetForm(editor_sequence); if(!fo_obj) return; + // fo_obj에 editor_sequence 값 지정 + fo_obj.setAttribute('editor_sequence', editor_sequence); + // 모듈 연관 키 값을 세팅 - editor_rel_keys[editor_sequence] = new Array(); - editor_rel_keys[editor_sequence]["primary"] = fo_obj[primary_key]; - editor_rel_keys[editor_sequence]["content"] = fo_obj[content_key]; + editorRelKeys[editor_sequence] = new Array(); + editorRelKeys[editor_sequence]["primary"] = fo_obj[primary_key]; + editorRelKeys[editor_sequence]["content"] = fo_obj[content_key]; // saved document(자동저장 문서)에 대한 확인 if(typeof(fo_obj._saved_doc_title)!="undefined" ) { ///<< _saved_doc_title field가 없으면 자동저장 하지 않음 @@ -131,7 +127,7 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito // 자동저장된 문서 활용여부를 물은 후 사용하지 않는다면 자동저장된 문서 삭제 if(confirm(fo_obj._saved_doc_message.value)) { if(typeof(fo_obj.title)!='undefined') fo_obj.title.value = saved_title; - editor_rel_keys[editor_sequence]['content'].value = saved_content; + editorRelKeys[editor_sequence]['content'].value = saved_content; } else { editorRemoveSavedDoc(); } @@ -139,7 +135,7 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito } // 대상 form의 content element에서 데이터를 구함 - var content = editor_rel_keys[editor_sequence]['content'].value; + var content = editorRelKeys[editor_sequence]['content'].value; // IE가 아니고 내용이 없으면
추가 (FF등에서 iframe 선택시 focus를 주기 위한 꽁수) if(!content && !xIE4Up) content = "
"; @@ -148,20 +144,26 @@ function editorStart(editor_sequence, primary_key, content_key, resizable, edito var contentDocument = iframe_obj.contentWindow.document; // 크기 변경 불가일 경우 드래그바 숨김 - if(resizable == false) xGetElementById("editor_drag_bar_"+editor_sequence).style.display = "none"; - else xGetElementById("editor_drag_bar_"+editor_sequence).style.display = "block"; - - // IE일 경우 ctrl-Enter 안내 문구를 노출 - if(xIE4Up && xGetElementById('for_ie_help_'+editor_sequence)) { - xGetElementById('for_ie_help_'+editor_sequence).style.display = "block"; + var dragObj = xGetElementById("editor_drag_bar_"+editor_sequence); + if(dragObj) { + if(resizable == false) dragObj.style.display = "none"; + else dragObj.style.display = "block"; } + // IE일 경우 ctrl-Enter 안내 문구를 노출 + var ieHelpObj = xGetElementById("for_ie_help_"+editor_sequence); + if(xIE4Up && ieHelpObj) { + ieHelpObj.style.display = "block"; + } + + // content 생성 + editor_path = editor_path.replace(/^\.\//ig, ''); var contentHtml = ''+ ''+ ''+ ''+ - ''+ - ''+ + ''+ + ''+ '
{$lang->mid}{$lang->browser_title}{$lang->browser_title} / {$lang->mid} {$lang->is_default} {$lang->skin} {$lang->admin_id}
{htmlspecialchars($val->browser_title)}
+ {htmlspecialchars($val->browser_title)}
+ {$val->mid} +
{$val->is_default} {$val->skin} {$val->admin_id}  {zdate($val->regdate,"Y-m-d")} {$lang->cmd_view}{$lang->cmd_copy}{$lang->cmd_copy} {$lang->cmd_delete}