ZRM001.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. /**
  2. * @---------------------------------------------------
  3. * @desc : 입력/수정 모드에 따라 답변 컨트롤을 활성화 시킨다.
  4. * @
  5. * @param :
  6. * @return :
  7. * @author :
  8. * @---------------------------------------------------
  9. */
  10. function fDisableMainDataControls(disabled)
  11. {
  12. //tar_fstrpttxt.editable = disabled;
  13. //tar_rpttxt.editable = disabled;
  14. }
  15. /**
  16. * @---------------------------------------------------
  17. * @desc : 추가할 수 있게 초기화
  18. * @
  19. * @param :
  20. * @return :
  21. * @author :
  22. * @---------------------------------------------------
  23. */
  24. function fInsertMode()
  25. {
  26. model.setValue("/root/main/mode/modelabel", "사용자요구사항>등록");
  27. model.setValue("/root/main/mode/modestatus", "insert");
  28. fInitMainData(false);
  29. // 현재 세션정보 저장
  30. model.setValue("/root/main/data/posinstnm", getUserInfo("posinstnm"));
  31. model.setValue("/root/main/data/posdeptnm", getUserInfo("posdeptnm"));
  32. model.setValue("/root/main/data/usernm", getUserInfo("usernm"));
  33. model.setValue("/root/main/data/userid", getUserInfo("userid"));
  34. }
  35. /**
  36. * @---------------------------------------------------
  37. * @desc : 수정할 수 있게 초기화
  38. * @
  39. * @param :
  40. * @return :
  41. * @author :
  42. * @---------------------------------------------------
  43. */
  44. function fUpdateMode()
  45. {
  46. model.setValue("/root/main/mode/modelabel", "사용자요구사항>수정");
  47. model.setValue("/root/main/mode/modestatus", "update");
  48. fInitMainData(true);
  49. model.setValue("/root/main/data/updateuserid", getUserInfo("userid"));
  50. }
  51. /**
  52. * @---------------------------------------------------
  53. * @desc : 파일 더블클릭시 파일 다운받아서 열기
  54. * @
  55. * @param :
  56. * @return :
  57. * @author :
  58. * @---------------------------------------------------
  59. */
  60. function fFileExcute(host, port, user, pass, pathRemote, filename)
  61. {
  62. var fso, folder;
  63. var temp_path = "C:\\tempReq";
  64. var pathLocal;
  65. FSO = new ActiveXObject("Scripting.FileSystemObject");
  66. // 객체 생성 실패하면 리턴
  67. if (FSO == null)
  68. {
  69. return;
  70. }
  71. // 시스템 드라이브가 없다면..
  72. if (FSO.DriveExists("C") == false)
  73. {
  74. return;
  75. }
  76. // 임시디렉토리가 없으면 생성
  77. if (FSO.FolderExists(temp_path) == false)
  78. {
  79. folder = FSO.CreateFolder(temp_path);
  80. }
  81. // 로컬 경로
  82. pathLocal = temp_path + "\\" + filename;
  83. if (FSO.FileExists (pathLocal) == false)
  84. {
  85. var ret = getFiles(host, port, user, pass, pathRemote, pathLocal);
  86. }
  87. // 파일 열기
  88. window.exec(pathLocal, "");
  89. }
  90. /**
  91. * @---------------------------------------------------
  92. * @desc : ftp 파일 다운로드
  93. * @
  94. * @param :
  95. * @return :
  96. * @author :
  97. * @---------------------------------------------------
  98. */
  99. function getFiles(host, port, user, pass, pathRemote, pathLocal)
  100. {
  101. var result;
  102. objSFT.Host = host;
  103. objSFT.Port = port;
  104. objSFT.Account = user;
  105. objSFT.Password = pass;
  106. objSFT.Connect();
  107. if(objSFT.IsOnline() == false) return false;
  108. //alert("pathRemote : " + pathRemote + "\npathLocal : " + pathLocal);
  109. result = objSFT.GetFiles(pathRemote, pathLocal);
  110. objSFT.Close();
  111. return result;
  112. }
  113. /**
  114. * @---------------------------------------------------
  115. * @desc : ftp 파일 업로드
  116. * @
  117. * @param :
  118. * @return :
  119. * @author :
  120. * @---------------------------------------------------
  121. */
  122. function putFiles(host, port, user, pass, pathRemote, pathLocal)
  123. {
  124. var result;
  125. objSFT.Host = host;
  126. objSFT.Port = port;
  127. objSFT.Account = user;
  128. objSFT.Password = pass;
  129. objSFT.Connect();
  130. if(objSFT.IsOnline() == false) return false;
  131. //alert("pathRemote : " + pathRemote + "\npathLocal : " + pathLocal);
  132. result = objSFT.PutFile(pathRemote, pathLocal);
  133. objSFT.Close();
  134. return result;
  135. }
  136. /**
  137. * @---------------------------------------------------
  138. * @desc : ftp 파일 삭제
  139. * @
  140. * @param :
  141. * @return :
  142. * @author :
  143. * @---------------------------------------------------
  144. */
  145. function delRemoteFiles(host, port, user, pass, pathRemote)
  146. {
  147. var result;
  148. objSFT.Host = host;
  149. objSFT.Port = port;
  150. objSFT.Account = user;
  151. objSFT.Password = pass;
  152. objSFT.Connect();
  153. if(objSFT.IsOnline() == false) return false;
  154. result = objSFT.DeleteFile(pathRemote);
  155. objSFT.Close();
  156. return result;
  157. }
  158. /**
  159. * @---------------------------------------------------
  160. * @desc : 데이터 입력 전 null 값 체크
  161. * @
  162. * @param :
  163. * @return :
  164. * @author :
  165. * @---------------------------------------------------
  166. */
  167. function fValueCheck()
  168. {
  169. var tmp;
  170. tmp = model.getValue("/root/main/data/instcd");
  171. if (tmp == "") {
  172. messageBox("발의기관은","I003");
  173. model.setFocus("combo4");
  174. return false;
  175. }
  176. tmp = model.getValue("/root/main/data/reqdeptnm");
  177. if (tmp == "") {
  178. messageBox("요청부서는","I003");
  179. model.setFocus("ipt_reqdeptnm");
  180. return false;
  181. }
  182. tmp = model.getValue("/root/main/data/requsernm");
  183. if (tmp == "") {
  184. messageBox("요청자명은","I003");
  185. model.setFocus("ipt_requsernm");
  186. return false;
  187. }
  188. tmp = model.getValue("/root/main/data/telno");
  189. if (tmp == "") {
  190. messageBox("전화번호는","I003");
  191. model.setFocus("ipt_telno");
  192. return false;
  193. }
  194. tmp = model.getValue("/root/main/data/reqgubun");
  195. if (tmp == "") {
  196. messageBox("요청구분은","I003");
  197. model.setFocus("combo5");
  198. return false;
  199. }
  200. tmp = model.getValue("/root/main/data/impcd");
  201. if (tmp == "") {
  202. messageBox("중요도는","I003");
  203. model.setFocus("combo6");
  204. return false;
  205. }
  206. tmp = model.getValue("/root/main/data/prcstitl");
  207. if (tmp == "") {
  208. messageBox("요청제목은","I003");
  209. model.setFocus("ipt_prcstitl");
  210. return false;
  211. }
  212. tmp = model.getValue("/root/main/data/prcsmsg");
  213. if (tmp == "") {
  214. messageBox("요청내용은","I003");
  215. model.setFocus("tar_prcsmsg");
  216. return false;
  217. }
  218. tmp = model.getValue("/root/main/data/reqpart");
  219. if (tmp == "") {
  220. messageBox("요청분야는","I003");
  221. model.setFocus("ipt_reqpart");
  222. return false;
  223. }
  224. tmp = model.getValue("/root/main/data/appinst");
  225. if (tmp == "") {
  226. messageBox("적용병원은 ","I003");
  227. model.setFocus("input3");
  228. return false;
  229. }
  230. return true;
  231. }
  232. /**
  233. * @---------------------------------------------------
  234. * @desc : 세자리로 폴더명 맞추기 위한 함수. 세자리가 안넘으면 세자리로 맞추고, 넘으면 뒤에 세자리로 맞춘다.
  235. * @
  236. * @param :
  237. * @return :
  238. * @author :
  239. * @---------------------------------------------------
  240. */
  241. function flpad(str,n,ch) {
  242. str = String(str);
  243. var result = "";
  244. var len = str.length;
  245. if ( len < n )
  246. {
  247. for ( var i=0; i<(n-len); i++ )
  248. {
  249. result += ch;
  250. }
  251. result += str;
  252. }
  253. else
  254. {
  255. result = str.substring(str.length-3);
  256. }
  257. return result;
  258. }
  259. function fCheckFileOpen(filepath){
  260. var fso;
  261. fso = new ActiveXObject("Scripting.FileSystemObject");
  262. // 객체 생성 실패하면 리턴
  263. if (fso == null)
  264. {
  265. return;
  266. }
  267. if (fso.FileExists(filepath) == false)
  268. {
  269. return;
  270. }
  271. var strFileName, strFilePath, strTmpFile, strExt;
  272. strExt = fso.GetExtensionName (filepath);
  273. strFilePath = fso.GetParentFolderName (filepath);
  274. strFileName = fso.GetFileName (filepath);
  275. if (strExt.toUpperCase() == "DOC" || strExt.toUpperCase() == "DOCX" ){
  276. strTmpFile = "~$" + strFileName.substring(2, getStringLength(strFileName));
  277. strTmpFile = strFilePath + "\\" + strTmpFile;
  278. if ( fso.FileExists(strTmpFile) ) {
  279. messageBox("파일이 오픈되어 있어 첨부", "E001");
  280. fso = null;
  281. return false;
  282. }
  283. }
  284. if (strExt.toUpperCase() == "XLSX" || strExt.toUpperCase() == "PPTX" ){
  285. strTmpFile = "~$" + strFileName;
  286. strTmpFile = strFilePath + "\\" + strTmpFile;
  287. if ( fso.FileExists(strTmpFile) ) {
  288. messageBox("파일이 오픈되어 있어 첨부", "E001");
  289. fso = null;
  290. return false;
  291. }
  292. }
  293. if( strExt.toUpperCase() == "XLS" || strExt.toUpperCase() == "PPT"){
  294. if(messageBox("파일이 오픈되어 있는지 확인할 수 없으니 열려있다면 파일을 닫고 진행하여 주십시요.", "Q003") == 7){
  295. fso = null;
  296. return false;
  297. }
  298. }
  299. fso = null;
  300. return true;
  301. }