123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?xml version="1.0" encoding="EUC-KR"?>
- <?xml-stylesheet href="../../../com/commonweb/css/common.css" type="text/css" ?>
- <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
- <xhtml:head>
- <xhtml:title>이미지 저장/조회 예제</xhtml:title>
- <model id="model1">
- <instance id="instance1">
- <root xmlns="">
- <main>
- <curfile>
- <filename/>
- <rtfcode/>
- </curfile>
- <rtflist/>
- </main>
- <send>
- <rtfcode/>
- <filename/>
- </send>
- <init>
- </init>
- <temp/>
- <imgdata/>
- </root>
- </instance>
- <script type="javascript" ev:event="xforms-ready">
- <![CDATA[
- fInitialize();
- ]]>
- </script>
- <submission id="TXTSS00601" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/hidden"/>
- <submission id="TRTSS00601" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/hidden" resultref="/root/main/rtflist"/>
- <submission id="TRTSS00602" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/main/curfile"/>
- <submission id="TXTSS00602" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/main/rtflist"/>
- </model>
- <script type="javascript" src="../../../com/commonweb/js/common.js"/>
- <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
- <script type="javascript">
- <![CDATA[
- function fOpenRtfFileDialog() {
- var file = window.fileDialog("open","","false","","","RTF Files(*.rtf)|*.rtf");
- return file;
- }
-
- function fGetFileName(path) {
- var lastIdx = path.lastIndexOf("\\");
- if (lastIdx >= 0) {
- return path.substr(lastIdx+1);
- } else {
- return path;
- }
- }
-
- // 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
- function fInitialize() {
- model.removeNodeset("/root/main/rtflist");
- model.resetInstanceNode("/root/main/curfile/filename");
- model.resetInstanceNode("/root/main/curfile/rtfcode");
- model.resetInstanceNode("/root/send/rtfcode");
- model.resetInstanceNode("/root/send/filename");
- rtfviewer.clear();
- model.refresh();
- }
-
- function fEnableInsertButton() {
- }
- function fEnableUpdateButton() {
- }
-
- ]]>
- </script>
- </xhtml:head>
- <xhtml:body guideline="1,1194;" style="margin-left:8; margin-top:0; margin-right:8; margin-bottom:0; ">
- <group id="group1" style="left:0px; top:0px; width:1195px; height:13px; ">
- <caption id="caption6" class="tit_1" style="left:0px; top:0px; width:189px; height:14px; ">RTF 파일 마스터 관리</caption>
- </group>
- <group id="group3" scroll="auto" style="left:0px; top:40px; width:1195px; height:744px; ">
- <line id="line3" class="line_2" style="x1:265px; y1:536px; x2:1195px; y2:536px; "/>
- <group id="group2" style="left:0px; top:14px; width:1194px; height:35px; vertical-align:top; ">
- <shape id="roundrect1" appearance="roundrect" ellipsewidth="10" ellipseheight="10" style="left:0px; top:0px; width:1194px; height:35px; background-color:#fffbf2; border-color:#ffd799; "/>
- <line id="line13" style="x1:1106px; y1:7px; x2:1106px; y2:29px; border-color:#ffe4bb; border-left-style:solid; "/>
- <button id="btn_search" class="btn1_letter2" navindex="4" style="left:1122px; top:7px; width:56px; height:22px; ">
- <caption>조회</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- submit("TRTSS00601");
- ]]>
- </script>
- </button>
- </group>
- <caption id="caption20" class="tit_2" style="left:6px; top:60px; width:148px; height:14px; ">RTF 마스터 파일 목록</caption>
- <line id="line8" class="line_1" style="x1:0px; y1:77px; x2:260px; y2:77px; "/>
- <button id="btn_delete" class="btn5_letter2" style="left:216px; top:56px; width:42px; height:19px; ">
- <caption>삭제</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- var cur_row = grd_rtflist.row;
- var filename = model.getValue("/root/main/rtflist["+cur_row+"]/filename");
- model.setValue("/root/send/filename",filename);
- submit("TXTSS00602");
- ]]>
- </script>
- </button>
- <input id="ipt_imgnminput" ref="/root/main/curfile/filename" class="input_search" navindex="3" style="left:340px; top:539px; width:215px; height:19px; "/>
- <line id="line1" class="line_1" style="x1:265px; y1:77px; x2:1194px; y2:77px; "/>
- <caption id="caption1" class="tit_2" style="left:265px; top:62px; width:135px; height:14px; ">RTF 파일 내용 보기</caption>
- <caption id="caption7" class="cell_1" style="left:265px; top:538px; width:70px; height:22px; vertical-align:middle; ">파일명</caption>
- <line id="line7" class="line_3" style="x1:265px; y1:560px; x2:1194px; y2:560px; "/>
- <object id="rtfviewer" clsid="{a4bf7e18-5f67-4868-a726-eed421632374}" style="left:265px; top:85px; width:929px; height:450px; "/>
- <button id="btn_fileopen" class="btn2_letter4" navindex="13" style="left:558px; top:539px; width:64px; height:19px; ">
- <caption>파일열기</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- var file = fOpenRtfFileDialog();
- if (file == "") {
- return;
- }
-
- // 선택한 파일을 RTF viewer로 보여준다.
- rtfviewer.OpenRtfFile(file);
- rtfviewer.ReadOnly = "true";
-
- model.setValue("/root/main/curfile/filename",fGetFileName(file));
- model.refresh();
- ]]>
- </script>
- </button>
- <button id="btn_fileedit" class="btn2_letter4" navindex="13" style="left:918px; top:539px; width:64px; height:19px; ">
- <caption>수정하기</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- // 기본 코드
- //var filename = rtfviewer.getFileName();
- //window.exec(filename);
-
- // 변경 코드
- var filename = rtfviewer.getFileName();
- rtfviewer.ModifyWithWord(filename);
- ]]>
- </script>
- </button>
- <button id="btn_apply" class="btn2_letter4" navindex="13" style="left:988px; top:539px; width:64px; height:19px; ">
- <caption>적용하기</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- // 기존 코드
- //var filename = rtfviewer.getFileName();
- //rtfviewer.OpenRtfFile(filename);
- //rtfviewer.ReadOnly = "true";
-
- // 변경 코드
- rtfviewer.Reload();
- ]]>
- </script>
- </button>
- <button id="btn_save" class="btn2_letter4" navindex="13" style="left:1058px; top:539px; width:64px; height:19px; ">
- <caption>서버저장</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- // RTF code 값을 인스턴스에 저장
- // file 명과 함께 서버로 submit
- model.setValue("/root/send/rtfcode",rtfviewer.TextRtf);
- model.setValue("/root/send/filename",model.getValue("/root/main/curfile/filename"));
- submit("TXTSS00601");
- ]]>
- </script>
- </button>
- <datagrid id="grd_rtflist" nodeset="/root/main/rtflist" caption="파일명^최초등록자^등록일자^최종수정자^수정일자" colwidth="237, 100, 100, 100, 100" dataheight="25" defaultrows="0" extendlastcol="scroll" mergecellsfixedrows="bycolrec" rowheader="update" rowheight="25" style="left:0px; top:82px; width:260px; height:478px; border-color:#808080; ">
- <col ref="filename"/>
- <col ref="fstrgstrid"/>
- <col ref="fstrgstdt" format="yyyy-mm-dd"/>
- <col ref="lastupdtrid"/>
- <col ref="lastupdtdt" format="yyyy-mm-dd"/>
- <script type="javascript" ev:event="ondblclick">
- <![CDATA[
- var cur_row = grd_rtflist.row;
- if ( cur_row > 0 ) {
- var filename = model.getValue("/root/main/rtflist["+cur_row+"]/filename");
- model.setValue("/root/send/filename",filename);
- model.setValue("/root/send/rtfcode","");
- if (submit("TRTSS00602")) {
- model.setValue("/root/main/curfile/filename",filename);
- rtfviewer.TextRtf = model.getValue("/root/main/curfile/rtfcode");
- rtfviewer.ReadOnly = "true";
- model.refresh();
- }
- }
- ]]>
- </script>
- </datagrid>
- <button id="btn_print" class="btn2_letter4" navindex="13" style="left:1128px; top:539px; width:64px; height:19px; ">
- <caption>출력하기</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- rtfviewer.SaveRtfFile(); // 현재 내용을 파일에 저장
- rtfviewer.print();
- ]]>
- </script>
- </button>
- <button id="button1" class="btn2_letter3" navindex="13" style="left:860px; top:539px; width:53px; height:19px; ">
- <caption>바꾸기</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- rtfviewer.ReplaceRtfCode(ipt_from.value,ipt_to.value);
- ]]>
- </script>
- </button>
- <caption id="caption2" style="left:735px; top:540px; width:20px; height:20px; ">
- <![CDATA[>>]]>
- </caption>
- <input id="ipt_from" style="left:630px; top:539px; width:100px; height:19px; "/>
- <input id="ipt_to" style="left:755px; top:539px; width:100px; height:19px; "/>
- <caption id="caption3" style="left:5px; top:565px; width:1189px; height:105px; word-wrap:word; ">
- <![CDATA[바꾸기는 기존에는 RTF 내부 코드에서 바꾸기를 수행하였으나, 일부 문서에서 에러가 발생하는 현상이 발견되어, MS-Word를 Background로 실행하여 문자를 변경하는 방식으로 변경됨.
- 따라서, MS-OFFICE를 반드시 설치하도록 권장함.
- 바꾸기는 @@pid 와 같이 정해진 문자열을 실제 값을 바꾸어 출력하기 위한 용도로만 사용한다. 바꾸기를 한 후에는 출력하기 전에 명시적으로 저장을 해야한다.
- 수정하기는 RTF 내부 코드를 파일로 저장한 후 그 파일을 MS-Word 로 전달하여 수정한다.
- 적용하기는 파일을 다시 load 하여 변경된 내용을 RTF Viewer로 반영시킨다.
- 출력하기는 RTF 내부 코드를 파일로 저장한 후 그 파일을 MS-Word로 전달하여 수정한다.
- 서버 저장은 RTF 내부 코드를 서버로 submit 하여 파일명과 함께 DB의 clob 필드로 저장한다.]]>
- </caption>
- </group>
- <group id="group4" scroll="auto" style="left:0px; top:13px; width:1195px; height:27px; ">
- <line id="line32" class="line_6" style="x1:0px; y1:25px; x2:1194px; y2:25px; "/>
- <button id="btn_init" class="btn4_letter3" navindex="16" style="left:1126px; top:3px; width:68px; height:22px; ">
- <caption>초기화</caption>
- <script type="javascript" ev:event="DOMActivate">
- <![CDATA[
- fInitialize();
- ]]>
- </script>
- </button>
- </group>
- </xhtml:body>
- </xhtml:html>
|