SPMNW04703.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. /*
  2. (SMMNW04703.xrw - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. - Desc : 피부욕창상처기록첨부파일 화면에서 사용하는 스크립트
  6. */
  7. var isUpdated = false;
  8. /**
  9. * @group :
  10. * @ver : 2008.05.31
  11. * @by : dhkim
  12. * @-------------------------------------------------------
  13. * @type : function
  14. * @access : public
  15. * @desc : 화면을 초기화한다. 화면로딩이 끝난 시점에 호출된다.
  16. * @param :
  17. * @return :
  18. * @-------------------------------------------------------
  19. */
  20. function fInit(){
  21. model.removeNodeset("/root/main/list/reportlist");
  22. model.removeNodeset("/root/send/attach");
  23. model.resetInstanceNode("/root/send");
  24. var pid = opener.javascript.getParameter('pid');
  25. var grupcd = opener.javascript.getParameter('grupcd');
  26. var obsrecseq = opener.javascript.getParameter('obsrecseq');
  27. //alert(pid + grupcd + obsrecseq);
  28. if(pid != '' && grupcd != '' && obsrecseq != ''){
  29. model.removenode('/root/init');
  30. model.makeValue('/root/init/pid', pid);
  31. model.makeValue('/root/init/grupcd', grupcd);
  32. model.makeValue('/root/init/obsrecseq', obsrecseq);
  33. fSearch();
  34. }else{
  35. messageBox('화면을 초기화 할 수', 'I004');
  36. }
  37. }
  38. /**
  39. * @group :
  40. * @ver : 2008.05.31
  41. * @by : dhkim
  42. * @-------------------------------------------------------
  43. * @type : function
  44. * @access : public
  45. * @desc : 조건에 해당하는 첨부파일을 조회한다.
  46. * @param :
  47. * @return :
  48. * @-------------------------------------------------------
  49. */
  50. function fSearch(){
  51. model.removenode('/root/send');
  52. model.makenode('/root/send');
  53. model.copyNode('/root/send', '/root/init');
  54. /*//그리드 초기화가 안되서 임시방편.. 수정할것!
  55. for(var i = 1; i <= grd_report.rows; i++){
  56. grd_report.deleteRow(i);
  57. }
  58. //그리드 초기화가 안되서 임시방편.. 수정할것!
  59. for(var i = 1; i <= grd_attach.rows; i++){
  60. grd_attach.deleteRow(i);
  61. }*/
  62. if(!submit('TRMNW04704')){
  63. messageBox('첨부파일 조회를', 'E009');
  64. }else{
  65. model.refresh();
  66. }
  67. }
  68. /**
  69. * @group :
  70. * @ver : 2008.06.16
  71. * @by : dhkim
  72. * @-------------------------------------------------------
  73. * @type : function
  74. * @access : public
  75. * @desc : 첨부파일을 그리드에 추가한다.
  76. * @param :
  77. * @return :
  78. * @-------------------------------------------------------
  79. */
  80. function fAddRow(){
  81. var maxsize = upload1.attribute("filesize");
  82. files = window.fileDialog("open", "|", true);
  83. filelist = files.split("|");
  84. for(var i = 0 ; i < filelist.length ; i++ ) {
  85. grd_attach.addRow(false);
  86. grd_attach.valueMatrix(grd_attach.rows - 1, 0) = filelist[i];
  87. grd_report.addRow(false);
  88. grd_report.valueMatrix(grd_report.rows - 1, 0) = filelist[i];
  89. if (!checkFileSize(upload1)){
  90. grd_attach.removeItem();
  91. grd_report.removeItem();
  92. messageBox("파일 크기가 최대치("+maxsize+"Byte)를", "E003");
  93. }else{
  94. isUpdated = true;
  95. }
  96. }
  97. }
  98. /**
  99. * @group :
  100. * @ver : 2008.06.16
  101. * @by : dhkim
  102. * @-------------------------------------------------------
  103. * @type : function
  104. * @access : public
  105. * @desc : 첨부파일을 저장한다.
  106. * @param :
  107. * @return :
  108. * @-------------------------------------------------------
  109. */
  110. function fSave(){
  111. if(grd_report.rows < 1 || !isUpdated){
  112. return;
  113. }
  114. if(submit("TXMNW04701")) {
  115. model.removeNodeset("/root/send/attach");
  116. model.resetInstanceNode("/root/send/title");
  117. model.refresh();
  118. }else{
  119. messageBox('첨부파일 저장을', 'E009');
  120. return ;
  121. }
  122. }
  123. /**
  124. * @group :
  125. * @ver : 2008.06.16
  126. * @by : dhkim
  127. * @-------------------------------------------------------
  128. * @type : function
  129. * @access : public
  130. * @desc : 선택한 첨부파일을 삭제한다.
  131. * @param :
  132. * @return :
  133. * @-------------------------------------------------------
  134. */
  135. function fDelete(cur_row){
  136. if(cur_row < 0){
  137. messageBox('삭제할 파일을', 'C002');
  138. return;
  139. }else{
  140. var rptid = model.getValue("/root/main/list/reportlist["+cur_row+"]/reportid");
  141. var pid = model.getValue("/root/main/list/reportlist["+cur_row+"]/pid");
  142. var grupcd = model.getValue("/root/main/list/reportlist["+cur_row+"]/grupcd");
  143. var obsrecseq = model.getValue("/root/main/list/reportlist["+cur_row+"]/obsrecseq");
  144. var filenm = model.getValue("/root/main/list/reportlist["+cur_row+"]/filenm");
  145. var filesize = model.getValue("/root/main/list/reportlist["+cur_row+"]/filesize");
  146. var filetype = model.getValue("/root/main/list/reportlist["+cur_row+"]/filetype");
  147. var filepath = model.getValue("/root/main/list/reportlist["+cur_row+"]/filepath");
  148. //alert(rptid + ', ' + pid+ ', ' + grupcd + ', ' + obsrecseq + ', ' + filenm + ', ' + filesize + ', ' + filetype + ', ' + filepath);
  149. model.removenode("/root/send");
  150. model.makeValue('/root/send/reportid', rptid);
  151. model.makeValue('/root/send/pid', pid);
  152. model.makeValue('/root/send/grupcd', grupcd);
  153. model.makeValue('/root/send/obsrecseq', obsrecseq);
  154. model.makeValue('/root/send/filenm', filenm);
  155. model.makeValue('/root/send/filesize', filesize);
  156. model.makeValue('/root/send/filetype', filetype);
  157. model.makeValue('/root/send/filepath', filepath);
  158. if(!submit("TXMNW04702")){
  159. messageBox('첨부파일의 삭제를', 'E009');
  160. }
  161. }
  162. }
  163. /**
  164. * @group :
  165. * @ver : 2008.05.31
  166. * @by : dhkim
  167. * @-------------------------------------------------------
  168. * @type : function
  169. * @access : public
  170. * @desc : 저장되 있는 첨부파일을 다운로드 한다.
  171. * 이미지가 아니면 pc에 미리 저장한 후 파일을 연다.(미구현)
  172. * @param :
  173. * @return :
  174. * @-------------------------------------------------------
  175. */
  176. function fDownLoad(){
  177. //저장되어 있는 파일만 열 수 있다.
  178. if(model.getValue('/root/main/list/reportlist[' + (grd_report.row) + ']/reportid') != ''){
  179. //alert(getActionURL("TRMNW04706"));
  180. var idx = grd_report.row;
  181. var filepath = model.getValue("/root/main/list/reportlist["+idx+"]/filepath");
  182. var filenm = model.getValue("/root/main/list/reportlist["+idx+"]/filenm");
  183. //var isImg = fIsImg(filenm);
  184. var realfile = getActionURL("TRMNW04706") + "&filepath=" + filepath;
  185. var localfile = window.fileDialog("save", "|", false, filenm, "", "All Files(*.*)|*.*");
  186. if (localfile != "") {
  187. model.download(realfile, localfile);
  188. window.exec(localfile);
  189. }
  190. /*
  191. if(isImg){
  192. alert(realfile);
  193. return;
  194. window.exec(realfile);
  195. }else{
  196. var localfile = window.fileDialog("save", "|", false, filenm, "", "All Files(*.*)|*.*");
  197. if (localfile != "") {
  198. model.download(realfile, localfile);
  199. window.exec(localfile);
  200. }
  201. }
  202. */
  203. }
  204. }
  205. /**
  206. * @group :
  207. * @ver : 2008.05.31
  208. * @by : dhkim
  209. * @-------------------------------------------------------
  210. * @type : function
  211. * @access : public
  212. * @desc : 해당 파일 확장자가 이미지 파일인지 아닌지 판단한다.
  213. * @param :
  214. * @return :
  215. * @-------------------------------------------------------
  216. */
  217. function fIsImg(file){
  218. var pos = file.toString().lastIndexOf('.');
  219. var ext = file.toString().substring(pos+1).toLowerCase();
  220. if(ext != 'jpg' || ext != 'jpeg' || ext != 'bmp' || ext != 'gif' || ext != 'png' || ext != 'tif' || ext != 'tiff'
  221. || ext != 'tga' || ext != 'pdf' || ext != 'psd' || ext != 'cdr' || ext != 'drw' || ext != 'dxf' || ext != 'kdc'
  222. || ext != 'pcd' || ext != 'swf'){
  223. //alert('img');
  224. return true;
  225. }else{
  226. //alert('is not img');
  227. return false;
  228. }
  229. }