SMTSS00601_RTF관리샘플.xrw 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?xml version="1.0" encoding="EUC-KR"?>
  2. <?xml-stylesheet href="../../../com/commonweb/css/common.css" type="text/css" ?>
  3. <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">
  4. <xhtml:head>
  5. <xhtml:title>이미지 저장/조회 예제</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <main>
  10. <curfile>
  11. <filename/>
  12. <rtfcode/>
  13. </curfile>
  14. <rtflist/>
  15. </main>
  16. <send>
  17. <rtfcode/>
  18. <filename/>
  19. </send>
  20. <init>
  21. </init>
  22. <temp/>
  23. <imgdata/>
  24. </root>
  25. </instance>
  26. <script type="javascript" ev:event="xforms-ready">
  27. <![CDATA[
  28. fInitialize();
  29. ]]>
  30. </script>
  31. <submission id="TXTSS00601" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/hidden"/>
  32. <submission id="TRTSS00601" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/hidden" resultref="/root/main/rtflist"/>
  33. <submission id="TRTSS00602" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/main/curfile"/>
  34. <submission id="TXTSS00602" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/main/rtflist"/>
  35. </model>
  36. <script type="javascript" src="../../../com/commonweb/js/common.js"/>
  37. <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
  38. <script type="javascript">
  39. <![CDATA[
  40. function fOpenRtfFileDialog() {
  41. var file = window.fileDialog("open","","false","","","RTF Files(*.rtf)|*.rtf");
  42. return file;
  43. }
  44. function fGetFileName(path) {
  45. var lastIdx = path.lastIndexOf("\\");
  46. if (lastIdx >= 0) {
  47. return path.substr(lastIdx+1);
  48. } else {
  49. return path;
  50. }
  51. }
  52. // 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
  53. function fInitialize() {
  54. model.removeNodeset("/root/main/rtflist");
  55. model.resetInstanceNode("/root/main/curfile/filename");
  56. model.resetInstanceNode("/root/main/curfile/rtfcode");
  57. model.resetInstanceNode("/root/send/rtfcode");
  58. model.resetInstanceNode("/root/send/filename");
  59. rtfviewer.clear();
  60. model.refresh();
  61. }
  62. function fEnableInsertButton() {
  63. }
  64. function fEnableUpdateButton() {
  65. }
  66. ]]>
  67. </script>
  68. </xhtml:head>
  69. <xhtml:body guideline="1,1194;" style="margin-left:8; margin-top:0; margin-right:8; margin-bottom:0; ">
  70. <group id="group1" style="left:0px; top:0px; width:1195px; height:13px; ">
  71. <caption id="caption6" class="tit_1" style="left:0px; top:0px; width:189px; height:14px; ">RTF 파일 마스터 관리</caption>
  72. </group>
  73. <group id="group3" scroll="auto" style="left:0px; top:40px; width:1195px; height:744px; ">
  74. <line id="line3" class="line_2" style="x1:265px; y1:536px; x2:1195px; y2:536px; "/>
  75. <group id="group2" style="left:0px; top:14px; width:1194px; height:35px; vertical-align:top; ">
  76. <shape id="roundrect1" appearance="roundrect" ellipsewidth="10" ellipseheight="10" style="left:0px; top:0px; width:1194px; height:35px; background-color:#fffbf2; border-color:#ffd799; "/>
  77. <line id="line13" style="x1:1106px; y1:7px; x2:1106px; y2:29px; border-color:#ffe4bb; border-left-style:solid; "/>
  78. <button id="btn_search" class="btn1_letter2" navindex="4" style="left:1122px; top:7px; width:56px; height:22px; ">
  79. <caption>조회</caption>
  80. <script type="javascript" ev:event="DOMActivate">
  81. <![CDATA[
  82. submit("TRTSS00601");
  83. ]]>
  84. </script>
  85. </button>
  86. </group>
  87. <caption id="caption20" class="tit_2" style="left:6px; top:60px; width:148px; height:14px; ">RTF 마스터 파일 목록</caption>
  88. <line id="line8" class="line_1" style="x1:0px; y1:77px; x2:260px; y2:77px; "/>
  89. <button id="btn_delete" class="btn5_letter2" style="left:216px; top:56px; width:42px; height:19px; ">
  90. <caption>삭제</caption>
  91. <script type="javascript" ev:event="DOMActivate">
  92. <![CDATA[
  93. var cur_row = grd_rtflist.row;
  94. var filename = model.getValue("/root/main/rtflist["+cur_row+"]/filename");
  95. model.setValue("/root/send/filename",filename);
  96. submit("TXTSS00602");
  97. ]]>
  98. </script>
  99. </button>
  100. <input id="ipt_imgnminput" ref="/root/main/curfile/filename" class="input_search" navindex="3" style="left:340px; top:539px; width:215px; height:19px; "/>
  101. <line id="line1" class="line_1" style="x1:265px; y1:77px; x2:1194px; y2:77px; "/>
  102. <caption id="caption1" class="tit_2" style="left:265px; top:62px; width:135px; height:14px; ">RTF 파일 내용 보기</caption>
  103. <caption id="caption7" class="cell_1" style="left:265px; top:538px; width:70px; height:22px; vertical-align:middle; ">파일명</caption>
  104. <line id="line7" class="line_3" style="x1:265px; y1:560px; x2:1194px; y2:560px; "/>
  105. <object id="rtfviewer" clsid="{a4bf7e18-5f67-4868-a726-eed421632374}" style="left:265px; top:85px; width:929px; height:450px; "/>
  106. <button id="btn_fileopen" class="btn2_letter4" navindex="13" style="left:558px; top:539px; width:64px; height:19px; ">
  107. <caption>파일열기</caption>
  108. <script type="javascript" ev:event="DOMActivate">
  109. <![CDATA[
  110. var file = fOpenRtfFileDialog();
  111. if (file == "") {
  112. return;
  113. }
  114. // 선택한 파일을 RTF viewer로 보여준다.
  115. rtfviewer.OpenRtfFile(file);
  116. rtfviewer.ReadOnly = "true";
  117. model.setValue("/root/main/curfile/filename",fGetFileName(file));
  118. model.refresh();
  119. ]]>
  120. </script>
  121. </button>
  122. <button id="btn_fileedit" class="btn2_letter4" navindex="13" style="left:918px; top:539px; width:64px; height:19px; ">
  123. <caption>수정하기</caption>
  124. <script type="javascript" ev:event="DOMActivate">
  125. <![CDATA[
  126. // 기본 코드
  127. //var filename = rtfviewer.getFileName();
  128. //window.exec(filename);
  129. // 변경 코드
  130. var filename = rtfviewer.getFileName();
  131. rtfviewer.ModifyWithWord(filename);
  132. ]]>
  133. </script>
  134. </button>
  135. <button id="btn_apply" class="btn2_letter4" navindex="13" style="left:988px; top:539px; width:64px; height:19px; ">
  136. <caption>적용하기</caption>
  137. <script type="javascript" ev:event="DOMActivate">
  138. <![CDATA[
  139. // 기존 코드
  140. //var filename = rtfviewer.getFileName();
  141. //rtfviewer.OpenRtfFile(filename);
  142. //rtfviewer.ReadOnly = "true";
  143. // 변경 코드
  144. rtfviewer.Reload();
  145. ]]>
  146. </script>
  147. </button>
  148. <button id="btn_save" class="btn2_letter4" navindex="13" style="left:1058px; top:539px; width:64px; height:19px; ">
  149. <caption>서버저장</caption>
  150. <script type="javascript" ev:event="DOMActivate">
  151. <![CDATA[
  152. // RTF code 값을 인스턴스에 저장
  153. // file 명과 함께 서버로 submit
  154. model.setValue("/root/send/rtfcode",rtfviewer.TextRtf);
  155. model.setValue("/root/send/filename",model.getValue("/root/main/curfile/filename"));
  156. submit("TXTSS00601");
  157. ]]>
  158. </script>
  159. </button>
  160. <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; ">
  161. <col ref="filename"/>
  162. <col ref="fstrgstrid"/>
  163. <col ref="fstrgstdt" format="yyyy-mm-dd"/>
  164. <col ref="lastupdtrid"/>
  165. <col ref="lastupdtdt" format="yyyy-mm-dd"/>
  166. <script type="javascript" ev:event="ondblclick">
  167. <![CDATA[
  168. var cur_row = grd_rtflist.row;
  169. if ( cur_row > 0 ) {
  170. var filename = model.getValue("/root/main/rtflist["+cur_row+"]/filename");
  171. model.setValue("/root/send/filename",filename);
  172. model.setValue("/root/send/rtfcode","");
  173. if (submit("TRTSS00602")) {
  174. model.setValue("/root/main/curfile/filename",filename);
  175. rtfviewer.TextRtf = model.getValue("/root/main/curfile/rtfcode");
  176. rtfviewer.ReadOnly = "true";
  177. model.refresh();
  178. }
  179. }
  180. ]]>
  181. </script>
  182. </datagrid>
  183. <button id="btn_print" class="btn2_letter4" navindex="13" style="left:1128px; top:539px; width:64px; height:19px; ">
  184. <caption>출력하기</caption>
  185. <script type="javascript" ev:event="DOMActivate">
  186. <![CDATA[
  187. rtfviewer.SaveRtfFile(); // 현재 내용을 파일에 저장
  188. rtfviewer.print();
  189. ]]>
  190. </script>
  191. </button>
  192. <button id="button1" class="btn2_letter3" navindex="13" style="left:860px; top:539px; width:53px; height:19px; ">
  193. <caption>바꾸기</caption>
  194. <script type="javascript" ev:event="DOMActivate">
  195. <![CDATA[
  196. rtfviewer.ReplaceRtfCode(ipt_from.value,ipt_to.value);
  197. ]]>
  198. </script>
  199. </button>
  200. <caption id="caption2" style="left:735px; top:540px; width:20px; height:20px; ">
  201. <![CDATA[>>]]>
  202. </caption>
  203. <input id="ipt_from" style="left:630px; top:539px; width:100px; height:19px; "/>
  204. <input id="ipt_to" style="left:755px; top:539px; width:100px; height:19px; "/>
  205. <caption id="caption3" style="left:5px; top:565px; width:1189px; height:105px; word-wrap:word; ">
  206. <![CDATA[바꾸기는 기존에는 RTF 내부 코드에서 바꾸기를 수행하였으나, 일부 문서에서 에러가 발생하는 현상이 발견되어, MS-Word를 Background로 실행하여 문자를 변경하는 방식으로 변경됨.
  207. 따라서, MS-OFFICE를 반드시 설치하도록 권장함.
  208. 바꾸기는 @@pid 와 같이 정해진 문자열을 실제 값을 바꾸어 출력하기 위한 용도로만 사용한다. 바꾸기를 한 후에는 출력하기 전에 명시적으로 저장을 해야한다.
  209. 수정하기는 RTF 내부 코드를 파일로 저장한 후 그 파일을 MS-Word 로 전달하여 수정한다.
  210. 적용하기는 파일을 다시 load 하여 변경된 내용을 RTF Viewer로 반영시킨다.
  211. 출력하기는 RTF 내부 코드를 파일로 저장한 후 그 파일을 MS-Word로 전달하여 수정한다.
  212. 서버 저장은 RTF 내부 코드를 서버로 submit 하여 파일명과 함께 DB의 clob 필드로 저장한다.]]>
  213. </caption>
  214. </group>
  215. <group id="group4" scroll="auto" style="left:0px; top:13px; width:1195px; height:27px; ">
  216. <line id="line32" class="line_6" style="x1:0px; y1:25px; x2:1194px; y2:25px; "/>
  217. <button id="btn_init" class="btn4_letter3" navindex="16" style="left:1126px; top:3px; width:68px; height:22px; ">
  218. <caption>초기화</caption>
  219. <script type="javascript" ev:event="DOMActivate">
  220. <![CDATA[
  221. fInitialize();
  222. ]]>
  223. </script>
  224. </button>
  225. </group>
  226. </xhtml:body>
  227. </xhtml:html>