SPZZZ00600_파일다운로드.xfdl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FDL version="1.5">
  3. <TypeDefinition url="..\..\..\default_typedef.xml"/>
  4. <Form id="SPZZZ00600" classname="SPZZZ00600_파일다운로드" inheritanceid="" position="absolute 0 0 330 127" titletext="파일다운로드" oninit="SPZZZ00600_oninit" onload="SPZZZ00600_onload" onactivate="SPZZZ00600_onactivate" onbeforeclose="SPZZZ00600_onbeforeclose">
  5. <Layouts>
  6. <Layout>
  7. <Div id="div_download" taborder="0" style="background:blanchedalmond URL('..\..\..\IMAGES\com\filedownbg.png');border:1 solid black ;shadow:outer 5,5 5 gray;" visible="false" position="absolute 0 0 322 118">
  8. <Layouts>
  9. <Layout>
  10. <ProgressBar id="ProgressBar00" taborder="1" text="0 %" max="100" min="0" blockgap="3" blocksize="292" position="absolute 14 52 306 74" style="color:black;bordertype:round 5 5 ;font:Dotum,11,bold;opacity:60;"/>
  11. <Static id="Static00" text="다운로드 준비중..." position="absolute 15 29 123 49" anchor="default"/>
  12. <Button id="btn_ok" taborder="2" text="확인" position="absolute 166 82 232 102" class="btn2" enable="false" onclick="div_download_btn_ok_onclick" anchor="default"/>
  13. <Button id="btn_cancel" taborder="3" text="취소" class="btn2" position="absolute 240 82 306 102" onclick="div_download_btn_cancel_onclick" anchor="default"/>
  14. <Static id="stt_mcnt" text="(0 / 0)" position="absolute 115 29 183 49" visible="false"/>
  15. </Layout>
  16. </Layouts>
  17. </Div>
  18. </Layout>
  19. </Layouts>
  20. <Objects>
  21. <HttpObject asyncflag="true" id="HttpObject00" retry="10" onstatus="HttpObject00_onstatus" timeout="30000" onload="HttpObject00_onload"/>
  22. </Objects>
  23. <Script type="xscript4.0"><![CDATA[include "com_commonxp::comm_main.xjs";
  24. var vFile_down = null;
  25. var nMultiDownloadCnt = 0;
  26. function SPZZZ00600_oninit(obj:Form, e:InitEventInfo)
  27. {
  28. }
  29. function SPZZZ00600_onload(obj:Form, e:LoadEventInfo)
  30. {
  31. // trace(sysf_getActionURL(arg_submitid) + "&filepath=" + arg_filepath);
  32. HttpObject00._showui = arg_showui;
  33. fStartDownload();
  34. }
  35. function fStartDownload() {
  36. if(arg_showui) {
  37. div_download.ProgressBar00.pos = 0;
  38. div_download.ProgressBar00.text = "0 %";
  39. div_download.Static00.text = "다운로드 준비중...";
  40. div_download.btn_ok.enable = false;
  41. div_download.btn_cancel.enable = true;
  42. div_download.visible = true;
  43. }
  44. if(arg_multi) {
  45. div_download.stt_mcnt.text = "(" + (nMultiDownloadCnt + 1) + " / " + arg_filepath.length + ")";
  46. div_download.stt_mcnt.visible = true;
  47. var filenm = arg_filepath[nMultiDownloadCnt].split(/\/|\\/); // / 또는 \ 로 split 하여 마지막 항목을 default 파일 명으로 사용한다.
  48. var len = filenm.length;
  49. filenm = filenm[len-1];
  50. vFile_down = new VirtualFile();
  51. vFile_down.open(arg_localfile + "\\" + filenm, VirtualFile.openWrite);
  52. try { // 취소 버튼 눌러서 강제 종료시 에러 방지
  53. HttpObject00.download(sysf_getActionURL(arg_submitid) + "&filepath=" + arg_filepath[nMultiDownloadCnt], vFile_down, true);
  54. } catch(e) {}
  55. } else {
  56. try { // 취소 버튼 눌러서 강제 종료시 에러 방지
  57. HttpObject00.download(sysf_getActionURL(arg_submitid, true) + "&filepath=" + arg_filepath, arg_localfile, true);
  58. } catch(e) {}
  59. }
  60. }
  61. function HttpObject00_onload(obj:HttpObject, e:HttpObjLoadEventInfo) {
  62. //trace("e.errorcode : " + e.errorcode);
  63. if(!utlf_isNull(vFile_down)) vFile_down.close();
  64. div_download.btn_ok.enable = true;
  65. div_download.btn_cancel.enable = false;
  66. if(e.errorcode == 0) { // 성공
  67. if(obj._showui) {
  68. div_download.Static00.text = "다운로드 완료";
  69. }
  70. } else { // 실패
  71. if(obj._showui) {
  72. div_download.Static00.text = "다운로드 실패";
  73. return;
  74. }
  75. }
  76. if(arg_multi) {
  77. if(++nMultiDownloadCnt < arg_filepath.length) {
  78. fStartDownload();
  79. }
  80. }
  81. }
  82. function HttpObject00_onstatus(obj:HttpObject, e:HttpObjStatusEventInfo) {
  83. //trace("e.status : " + e.status);
  84. if(obj._showui) {
  85. div_download.ProgressBar00.pos = e.status;
  86. div_download.ProgressBar00.text = e.status + " %";
  87. if(e.status == 1) {
  88. div_download.Static00.text = "다운로드 중...";
  89. }
  90. }
  91. }
  92. function div_download_btn_ok_onclick(obj:Button, e:ClickEventInfo)
  93. {
  94. this.close();
  95. }
  96. function div_download_btn_cancel_onclick(obj:Button, e:ClickEventInfo)
  97. {
  98. this.close();
  99. }
  100. function SPZZZ00600_onactivate(obj:Form, e:ActivateEventInfo)
  101. {
  102. frmf_setFocusOpener();
  103. }
  104. function SPZZZ00600_onbeforeclose(obj:Form, e:CloseEventInfo)
  105. {
  106. if(!utlf_isNull(vFile_down)) vFile_down.close();
  107. }
  108. ]]></Script>
  109. </Form>
  110. </FDL>