FileListNewPop.jsp 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="kr.co.hsnc.common.sql.*" %>
  3. <%@ page import="kr.co.hsnc.common.util.*"%>
  4. <%@ page import="kr.co.hsnc.common.config.*"%>
  5. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  6. <%@ include file="/jsp/work/taglib.jsp" %>
  7. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  8. <%
  9. ctx.init(request, response);
  10. ValueObject params = null;
  11. ValueObject user = null;
  12. String message = null;
  13. String event = null;
  14. HandlerStorage storage = ctx.getHandlerStorage();
  15. //user = storage.getUser();
  16. event = storage.getEvent();
  17. params = storage.getParams();
  18. RowSet fileListRowSet = storage.getRowSet("FileListRowSet");
  19. int size = (fileListRowSet != null ? fileListRowSet.size() : 0);
  20. String iframeID = params.get("iframeID");
  21. int defaultFileSize = params.getInt("file_size");
  22. if(defaultFileSize <= 0){
  23. defaultFileSize = WAFConfig.getInt("waf.repository.file.size");
  24. }
  25. %>
  26. <style type="text/css">
  27. .view_title {
  28. BACKGROUND-COLOR : #5F86B6 ;
  29. FONT-FAMILY : "굴림", "Verdana" ;
  30. FONT-SIZE : 9pt ;
  31. COLOR : #ffffff ;
  32. TEXT-INDENT : 9px ;
  33. }
  34. </style>
  35. <SCRIPT language="JavaScript">
  36. var m_enc = "multipart/form-data";
  37. var a_enc = "application/x-www-form-urlencoded";
  38. /**
  39. * 시트 시작
  40. */
  41. var sheet1;
  42. var sheet1Row;
  43. var sheet1PageNo = 1;
  44. var pageLastRowIndex = 1;
  45. var validationResult = false;
  46. var filterShow = false;
  47. // 마지막으로 선택된 행의 번호를 기억하고 있음
  48. var CurMasterRow = 0;
  49. function _onReady(){
  50. gridInit(sheet1);
  51. reloadProc();
  52. /* jQuery(window)
  53. //alert("close");
  54. $(window).on('beforeunload', function() {
  55. return doClose();
  56. }); */
  57. }
  58. function gridInit(sheetName){
  59. var init_sheet = {};
  60. init_sheet.Cfg = {SearchMode:2, Page:30};
  61. init_sheet.Cols = [
  62. {Header:'상태', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  63. {Header:'삭제', Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center"},
  64. {Header:'번호', Type:"Seq", SaveName:"NO", Width:40, Align:"Center", Hidden:"True"},
  65. {Header:'파일ID', Type:"Text", SaveName:"FILE_ID", Width:80, Align:"Left", Edit: 0, Hidden:"True"},
  66. {Header:'파일맵ID', Type:"Text", SaveName:"FILE_MAP_ID", Width:80, Align:"Left", Edit: 0, Hidden:"True"},
  67. {Header:'☞ 파일명', Type:"Text", SaveName:"FILE_NAME", Width:250, Align:"Left", Edit: 0},
  68. {Header:'파일크기', Type:"Text", SaveName:"FILE_SIZE", Width:60, Align:"Center", Edit: 0},
  69. {Header:'생성일시', Type:"Text", SaveName:"CRE_DATE", Width:80, Align:"Center", Edit: 0, Format: "YmdHms"},
  70. ];
  71. init_sheet.HeaderMode = {Sort:1};
  72. IBS_InitSheet(sheetName, init_sheet);
  73. setGridSize();
  74. }
  75. function setGridSize() {
  76. sheet1.FitColWidth();
  77. }
  78. function sheet1_OnSearchEnd(code, message) {
  79. if(code == 0) {
  80. setGridSize();
  81. } else {
  82. //조회 에러 수행
  83. alert(message);
  84. }
  85. }
  86. function sheet1_OnDblClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  87. if (sheet1.ColSaveName(Col) == "FILE_NAME") {
  88. var url="/common/file/FileDownloadServlet";
  89. url += "?file_id=" + sheet1.GetCellValue(Row, "FILE_ID");
  90. window.open(url, "_fileDown", "toolbar=no, width=400, height=100, top=500, left=400, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new")
  91. //var fd = document.getElementById("form_filedown");
  92. //fd.target = "_fileDown";
  93. //fd.file_id.value = sheet1.GetCellValue(Row, "FILE_ID");
  94. //fd.submit();
  95. }
  96. }
  97. function sheet1_OnSaveEnd(code, msg) {
  98. if(code >= 0) {
  99. alert("파일이 삭제 되었습니다.!");
  100. } else {
  101. //alert(msg);
  102. alert("파일 삭제에 실패 하였습니다.");
  103. }
  104. }
  105. /**
  106. * 시트 끝
  107. */
  108. function saveProc() {
  109. if(!checkFile(document.getElementById("attach_file"))) return;
  110. var f = document.form1;
  111. if( f.attach_file.value == "" ) {
  112. dlgAlert("파일을 선택하세요.");
  113. return;
  114. }
  115. f.fevent.value = "FileListWorker.Save";
  116. f.target = "worker";
  117. f.action = "FileListNewSave.screen";
  118. f.encoding = m_enc;
  119. f.method = "post";
  120. formSubmit(f, false);
  121. }
  122. // Form Lock 풀기
  123. function resetFormProc() {
  124. resetFormSubmit();
  125. }
  126. function delProc() {
  127. if(sheet1.RowCount("D") <= 0){
  128. alert("삭제할 파일이 없습니다.")
  129. return;
  130. }
  131. if (confirm("삭제하시겠습니까?")) {
  132. jQuery("#fevent").val("FileListWorker.Del");
  133. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/file/FileListNewDelete.screen";
  134. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  135. }
  136. }
  137. function resetProc(){
  138. var f = document.form1;
  139. f.attach_file.value="";
  140. }
  141. function reloadProc() {
  142. jQuery("#form1").attr("encoding", a_enc);
  143. jQuery("#fevent").val("GET_FILE_LIST");
  144. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/file/FileListNewData.screen";
  145. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  146. }
  147. function getFileSize(filePath)
  148. {
  149. var browser=navigator.appName;
  150. var size = 0;
  151. if (browser=="Microsoft Internet Explorer")
  152. {
  153. try{
  154. var oas = new ActiveXObject("Scripting.FileSystemObject");
  155. var filepath = document.getElementById('attach_file').value;
  156. var e = oas.getFile(filepath);
  157. size = e.size;
  158. }catch(e){
  159. alert("ActiveX 컨트롤을 허용 하시기 바랍니다.\n리플레쉬후 다시 시도 바랍니다.\n"+e);
  160. }
  161. }
  162. else
  163. {
  164. size = "";
  165. for(var i=0;i<document.getElementById("attach_file").files.length;i++){
  166. size += document.getElementById("attach_file").files[i].size + ";";
  167. }
  168. }
  169. return size;
  170. }
  171. function checkFile(obj)
  172. {
  173. var len = getFileSize(obj.value);
  174. var defSize = document.getElementById("defaultFileSize").value;
  175. var filelist = "";
  176. var cnt =0;
  177. if(isNaN(len)){
  178. filelist = len.split(";");
  179. for(var i=0;i<filelist.length-1;i++){
  180. if (filelist[i] > defSize * 1024 * 1024)
  181. {
  182. //alert("파일 크기는 "+defSize+"메가보다 작아야 합니다.");
  183. cnt += 1
  184. }
  185. }
  186. if(cnt > 0){
  187. alert("파일 크기는 "+defSize+"메가보다 작아야 합니다.");
  188. return false;
  189. }else{
  190. return true;
  191. }
  192. }else{
  193. if (len > defSize * 1024 * 1024)
  194. {
  195. alert("파일 크기는 "+defSize+"메가보다 작아야 합니다.");
  196. return false;
  197. } else{
  198. return true;
  199. }
  200. }
  201. }
  202. function closeProc(){
  203. window.close();
  204. return;
  205. /* var agent = navigator.userAgent.toLowerCase();
  206. var browse;
  207. if(agent.indexOf("chrome") != -1) browse = "chrome";
  208. var row = sheet1.RowCount();
  209. var array = new Array(row-1);
  210. var cnt = 0;
  211. for(var i = 1; i<=sheet1.RowCount(); i++){
  212. var obj = new Object();
  213. obj.str = i + " : " + sheet1.GetCellValue(i, "FILE_NAME") + "("+sheet1.GetCellValue(i, "FILE_SIZE")+")";
  214. obj.no = sheet1.GetCellValue(i, "NO");
  215. obj.file_id = sheet1.GetCellValue(i, "FILE_ID");
  216. obj.file_map_id = sheet1.GetCellValue(i, "FILE_MAP_ID");
  217. obj.file_name = sheet1.GetCellValue(i, "FILE_NAME");
  218. obj.file_size = sheet1.GetCellValue(i, "FILE_SIZE");
  219. array[cnt] = obj;
  220. cnt++;
  221. }
  222. if(browse == "chrome"){
  223. window.opener.returnValue = array;
  224. }else{
  225. window.returnValue = array;
  226. }
  227. window.close(); */
  228. }
  229. window.onunload = closeProc;
  230. </SCRIPT>
  231. <STYLE>
  232. BODY {
  233. padding : 0 0 0 0;
  234. }
  235. </STYLE>
  236. <modular:search id="form1">
  237. <modular:key id="fevent" />
  238. </modular:search>
  239. <FORM id="form1" name="form1" method="post" modular:type="search">
  240. <INPUT type="hidden" name="fevent" id="fevent" value="">
  241. <INPUT type="hidden" name="file_gb" value="<%= params.get("file_gb") %>">
  242. <INPUT type="hidden" name="id" value="<%= params.get("id") %>">
  243. <INPUT type="hidden" name="is_modify" value="<%= params.get("is_modify") %>">
  244. <INPUT type="hidden" name="is_corp" value="<%= params.get("is_corp") %>">
  245. <INPUT type="hidden" name="is_con" value="<%= params.get("is_con") %>">
  246. <INPUT type="hidden" name="is_techreq" value="<%= params.get("is_techreq") %>">
  247. <INPUT type="hidden" name="mod_no" value="<%= params.get("mod_no") %>">
  248. <INPUT type="hidden" name="sysGb" value="<%=params.get("sys_gb")%>">
  249. <INPUT type="hidden" name="acct_id" value="<%=params.get("acct_id")%>">
  250. <INPUT type="hidden" name="defaultFileSize" value="<%=defaultFileSize%>">
  251. <% if( params.get("IS_MODIFY").equals("Y") ) { %>
  252. <table id="search-table" class="search-form-table">
  253. <colgroup>
  254. <col width="100" />
  255. <col width="400" />
  256. <col width="*" />
  257. </colgroup>
  258. <tr>
  259. <th>파일선택</th>
  260. <td>
  261. <input id="attach_file" type="file" name="attach_file" class="input" contenteditable="false" multiple>
  262. </td>
  263. <td class="button">
  264. <span class="btnSearch center"><a href="javascript:saveProc();" id="btnSave">파일저장</a></span>
  265. <span class="btnSearch center"><a href="javascript:delProc();" id="btnDel">파일삭제</a></span>
  266. <span class="btnSearch center"><a href="javascript:closeProc();" id="btnClose">닫기</a></span>
  267. </td>
  268. </tr>
  269. </table>
  270. <%} %>
  271. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 200px; overflow: auto;">
  272. <script>createIBSheet('sheet1','100%', '380px');</script>
  273. </div>
  274. <IFRAME width="0" height="0" name="worker" style="display:none;"></IFRAME>
  275. </FORM>
  276. <FORM id="form_filedown" name="form_filedown" method="get" action="/common/file/FileDownloadServlet" style="display:none">
  277. <input type="hidden" id="file_id" name="file_id"/>
  278. </FORM>