SPRSC00201_이미지.xrw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?xml version="1.0" encoding="EUC-KR"?>
  2. <?xml-stylesheet type="text/css" href="../../../com/commonweb/css/common.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. <view>
  11. <goodimage>
  12. <status/>
  13. <instcd/>
  14. <goodcd/>
  15. <photimg/>
  16. <photimg2/>
  17. <filename1/>
  18. <filename2/>
  19. </goodimage>
  20. </view>
  21. </main>
  22. <target>
  23. <defaultvalue>
  24. <instcd/>
  25. <goodcd/>
  26. </defaultvalue>
  27. </target>
  28. <send>
  29. <instcd/>
  30. <goodcd/>
  31. </send>
  32. <init/>
  33. <temp/>
  34. </root>
  35. </instance>
  36. <script type="javascript" ev:event="xforms-ready">
  37. <![CDATA[
  38. //화면 Control을 초기화한다
  39. fCheckAuth();
  40. fInitialize();
  41. ]]>
  42. </script>
  43. <submission id="TRRSC00201" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/main/view"/>
  44. <submission id="TXRSC00201" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/temp"/>
  45. </model>
  46. <script type="javascript" src="../../../com/commonweb/js/common.js"/>
  47. <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
  48. <script type="javascript" src="../../../mis/miscommonweb/js/MIS.js"/>
  49. <script type="javascript" src="../../../mis/miscommonweb/js/RSZ001.js"/>
  50. <script type="javascript">
  51. <![CDATA[
  52. // 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
  53. function fInitialize() {
  54. // model.resetInstanceNode("/root/send");
  55. // model.resetInstanceNode("/root/main/view");
  56. model.setValue("/root/send/instcd" , model.getValue(PURTARGET_NODE + "/instcd"));
  57. model.setValue("/root/send/goodcd", model.getValue(PURTARGET_NODE + "/goodcd"));
  58. model.refresh();
  59. fRetrImage();
  60. }
  61. // function fChangeImage(imgsrc) {
  62. // img_hidden.src = imgsrc; // 파일에서 읽은 이미지의 base64 encoding 값을 가져오기 위한 이미지 컨트롤
  63. // var data = img_hidden.getbase64data(); // base64 encoding 문자열을 가져온다.
  64. // var imgSize = getImageSize(imgsrc);
  65. // var imgWidthSize = imgSize.split("^")[0];
  66. // var imgHeightSize = imgSize.split("^")[1];
  67. //
  68. // model.setValue("/root/main/view/goodimage/photimg",data,true); // 이미지를 보여주기 위하여 view용 이미지컨트롤의 ref instance에 값을 저장
  69. // setImageRefInstance("/root/main/view/goodimage/photimg");
  70. //
  71. // if( imgWidthSize <= 340)
  72. // img_good.attribute("width")= imgWidthSize;
  73. //
  74. // if( imgWidthSize <= 270)
  75. // img_good.attribute("height")= imgHeightSize;
  76. //
  77. // model.refresh();
  78. // }
  79. function fChangeImage(fimg_target, fimg_hidden, fTfile, fcheck)
  80. {
  81. if(fcheck == "Y")
  82. {
  83. file = fTfile;
  84. }else if(fcheck == "N")
  85. {
  86. var file = openImageFileDialog(1048576); // image 파일이 너무 크면 submit 시간이 매우 오래(5분이상) 걸리므로 가급적 사이즈를 작게 제한한다.
  87. if (file == "") {
  88. return;
  89. }
  90. }
  91. fimg_hidden.src = file; // 파일에서 읽은 이미지의 base64 encoding 값을 가져오기 위한 이미지 컨트롤
  92. var fileName = file.substr(file.lastIndexOf('\\')+1);
  93. if(fimg_target.attribute("ref") == "/root/main/view/goodimage/photimg") {
  94. model.removenode("/root/main/view/goodimage/filename1");
  95. model.makeValue("/root/main/view/goodimage/filename1",fileName);
  96. } else if(fimg_target.attribute("ref") == "/root/main/view/goodimage/photimg2"){
  97. model.removenode("/root/main/view/goodimage/filename2");
  98. model.makeValue("/root/main/view/goodimage/filename2",fileName);
  99. }
  100. var fdata = fimg_hidden.getbase64data(); // encoding 문자열을 가져온다.
  101. model.setValue(fimg_target.attribute("ref"), fdata, true); // 이미지를 보여주기 위하여 view용 이미지컨트롤의 ref instance에 값을 저장
  102. setImageRefInstance(fimg_target.attribute("ref"));
  103. fimg_target.attribute("width") = 232;
  104. fimg_target.attribute("height") = 277;
  105. model.refresh();
  106. return true;
  107. }
  108. function fMakeNode(pgoodcd){
  109. model.resetInstanceNode("/root/main/view");
  110. model.makeNode("/root/main/view/goodimage/status");
  111. model.makeNode("/root/main/view/goodimage/goodcd");
  112. model.makeNode("/root/main/view/goodimage/photimg");
  113. model.makeNode("/root/main/view/goodimage/photimg2");
  114. model.setValue("/root/main/view/goodimage/goodcd", pgoodcd);
  115. }
  116. function fRetrImage() {
  117. submit("TRRSC00201",false);
  118. setImageRefInstance("/root/main/view/goodimage/photimg");
  119. setImageRefInstance("/root/main/view/goodimage/photimg2");
  120. model.refresh();
  121. var data = img_gL.getbase64data() + img_gR.getbase64data();
  122. if(data == null || data.length == 0)
  123. {
  124. fMakeNode(model.getValue(PURTARGET_NODE + "/goodcd"));
  125. model.setValue("/root/main/view/goodimage/status","i");
  126. fChangeImage(img_gL, img_hL, "../../../com/commonweb/images/no_image.gif", "Y");
  127. fChangeImage(img_gR, img_hR, "../../../com/commonweb/images/no_image.gif", "Y");
  128. // fChangeImage( , , "../../../com/commonweb/images/no_image.gif", "");
  129. }
  130. else
  131. {
  132. model.makeNode("/root/main/view/goodimage/status");
  133. model.setValue("/root/main/view/goodimage/status","");
  134. }
  135. model.refresh();
  136. }
  137. function fSaveImage(){
  138. model.copyNode("/root/send","/root/main/view/goodimage");
  139. model.copyNode("/root/send/goodcd", PURTARGET_NODE + "/goodcd");
  140. model.refresh();
  141. submit("TXRSC00201");
  142. }
  143. function fCheckAuth() {
  144. //btn_search.disabled = !checkAuth("R") ;
  145. //btn_save.disabled = !checkAuth("X") ;
  146. //btn_delete.disabled = !checkAuth("X") ;
  147. //btn_prt.disabled = !checkAuth("P") ;
  148. }
  149. ]]>
  150. </script>
  151. </xhtml:head>
  152. <xhtml:body pagewidth="520" pageheight="400" style="margin-left:8; margin-top:0; margin-right:8; margin-bottom:0; ">
  153. <group id="grp_tle" style="left:0px; top:0px; width:495px; height:13px; ">
  154. <caption id="caption6" class="tit_1" style="left:0px; top:0px; width:243px; height:14px; ">사진 등록/변경</caption>
  155. </group>
  156. <shape id="rectangle9" fillStyle="solid" shape="rectangle" fillColor="#bbbbbb" style="left:0px; top:42px; width:496px; height:333px; border-color:#788daf; "/>
  157. <group id="grp_btn" scroll="auto" style="left:0px; top:14px; width:495px; height:27px; ">
  158. <button id="button45" class="btn4_letter2" style="left:433px; top:3px; width:56px; height:22px; ">
  159. <caption>닫기</caption>
  160. <script type="javascript" ev:event="DOMActivate">
  161. <![CDATA[
  162. window.close();
  163. ]]>
  164. </script>
  165. </button>
  166. <button id="btn_delete" class="btn4_letter2" style="left:376px; top:3px; width:56px; height:22px; ">
  167. <caption>삭제</caption>
  168. <script type="javascript" ev:event="DOMActivate">
  169. <![CDATA[
  170. if( messageBox("사진을 삭제 하시겠습니까", "Q999") != 6) return;
  171. model.setValue("/root/main/view/goodimage/status","d");
  172. btn_save.dispatch("DOMActivate");
  173. fRetrImage();
  174. ]]>
  175. </script>
  176. </button>
  177. <button id="btn_save" class="btn4_letter2" style="left:320px; top:3px; width:56px; height:22px; ">
  178. <caption>저장</caption>
  179. <script type="javascript" ev:event="DOMActivate">
  180. <![CDATA[
  181. fSaveImage();
  182. ]]>
  183. </script>
  184. </button>
  185. </group>
  186. <caption id="cap_gL" class="cell_1" style="left:5px; top:47px; width:240px; height:323px; text-align:center; vertical-align:middle; "/>
  187. <caption id="cap_gR" class="cell_1" style="left:251px; top:47px; width:240px; height:323px; text-align:center; vertical-align:middle; "/>
  188. <img id="img_hL" style="left:9px; top:51px; width:232px; height:277px; background-stretch:no-stretch; "/>
  189. <img id="img_hR" style="left:255px; top:51px; width:232px; height:277px; background-stretch:no-stretch; "/>
  190. <img id="img_gL" ref="/root/main/view/goodimage/photimg" style="left:10px; top:51px; width:232px; height:277px; background-stretch:stretch; ">
  191. <script type="javascript" ev:event="ondblclick">
  192. <![CDATA[
  193. var fileName = model.getValue("/root/main/view/goodimage/filename1");
  194. var fileExt = "jpg";
  195. if(fileName != null) {
  196. fileExt = fileName.substr(fileName.lastIndexOf('.')+1);
  197. }
  198. model.base64decode(model.getValue("/root/main/view/goodimage/photimg"),"c:\\Temp\\Image1." + fileExt);
  199. window.load("file:///C:/temp/image1." + fileExt,"html","ImageView");
  200. ]]>
  201. </script>
  202. </img>
  203. <img id="img_gR" ref="/root/main/view/goodimage/photimg2" style="left:256px; top:51px; width:232px; height:277px; background-stretch:stretch; ">
  204. <script type="javascript" ev:event="ondblclick">
  205. <![CDATA[
  206. var fileName = model.getValue("/root/main/view/goodimage/filename2");
  207. var fileExt = "jpg";
  208. if(fileName != null) {
  209. fileExt = fileName.substr(fileName.lastIndexOf('.')+1);
  210. }
  211. model.base64decode(model.getValue("/root/main/view/goodimage/photimg2"),"c:\\Temp\\Image2." + fileExt);
  212. window.load("file:///C:/temp/image2." + fileExt,"html","ImageView");
  213. ]]>
  214. </script>
  215. </img>
  216. <button id="btn_imageLoadR" class="btn2_letter4" style="left:275px; top:340px; width:64px; height:19px; ">
  217. <caption>불러오기</caption>
  218. <script type="javascript" ev:event="DOMActivate">
  219. <![CDATA[
  220. fChangeImage(img_gR, img_hR, "", "N");
  221. if(model.getValue("/root/main/view/goodimage/status") == "") model.setValue("/root/main/view/goodimage/status","u");
  222. model.refresh();
  223. ]]>
  224. </script>
  225. </button>
  226. <button id="btn_imageLoadL" class="btn2_letter4" style="left:35px; top:340px; width:64px; height:19px; ">
  227. <caption>불러오기</caption>
  228. <script type="javascript" ev:event="DOMActivate">
  229. <![CDATA[
  230. fChangeImage(img_gL, img_hL, "", "N");
  231. if(model.getValue("/root/main/view/goodimage/status") == "") model.setValue("/root/main/view/goodimage/status","u");
  232. model.refresh();
  233. ]]>
  234. </script>
  235. </button>
  236. <button id="btn_cleanL" class="btn2_letter3" style="left:165px; top:340px; width:53px; height:19px; ">
  237. <caption>초기화</caption>
  238. <script type="javascript" ev:event="DOMActivate">
  239. <![CDATA[
  240. fChangeImage(img_gL, img_hL, "../../../com/commonweb/images/no_image.gif", "Y");
  241. model.refresh();
  242. ]]>
  243. </script>
  244. </button>
  245. <button id="btn_cleanR" class="btn2_letter4" style="left:405px; top:340px; width:64px; height:19px; ">
  246. <caption>초기화</caption>
  247. <script type="javascript" ev:event="DOMActivate">
  248. <![CDATA[
  249. fChangeImage(img_gR, img_hR, "../../../com/commonweb/images/no_image.gif", "Y");
  250. model.refresh();
  251. ]]>
  252. </script>
  253. </button>
  254. <button id="button1" class="btn2_letter4" style="left:100px; top:340px; width:64px; height:19px; ">
  255. <caption>파일저장</caption>
  256. <script type="javascript" ev:event="DOMActivate">
  257. <![CDATA[
  258. var fileName = model.getValue("/root/main/view/goodimage/filename1");
  259. var fileExt = "jpg";
  260. if(fileName != null) {
  261. fileExt = fileName.substr(fileName.lastIndexOf('.')+1);
  262. }
  263. var file = window.fileDialog("save", "", false, model.getValue("/root/main/view/goodimage/goodcd") + "_Photo1." + fileExt, fileExt, "*." + fileExt + "|*." + fileExt);
  264. if (file != "") {
  265. model.base64decode(model.getValue("/root/main/view/goodimage/photimg"),file);
  266. }
  267. ]]>
  268. </script>
  269. </button>
  270. <button id="button2" class="btn2_letter4" style="left:340px; top:340px; width:64px; height:19px; ">
  271. <caption>파일저장</caption>
  272. <script type="javascript" ev:event="DOMActivate">
  273. <![CDATA[
  274. var fileName = model.getValue("/root/main/view/goodimage/filename2");
  275. var fileExt = "jpg";
  276. if(fileName != null) {
  277. fileExt = fileName.substr(fileName.lastIndexOf('.')+1);
  278. }
  279. var file = window.fileDialog("save", "", false, model.getValue("/root/main/view/goodimage/goodcd") + "_Photo2." + fileExt, fileExt, "*." + fileExt + "|*." + fileExt);
  280. if (file != "") {
  281. model.base64decode(model.getValue("/root/main/view/goodimage/photimg2"),file);
  282. }
  283. ]]>
  284. </script>
  285. </button>
  286. </xhtml:body>
  287. </xhtml:html>