ErpFileList.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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. event = storage.getEvent();
  16. params = storage.getParams();
  17. ValueObject openParams = storage.getValueObject("openParams");
  18. String delHidden = "";
  19. String noHidden = ", Hidden:\"True\"";
  20. if( !openParams.get("MODIFY_YN").equals("Y") ) {
  21. delHidden = ", Hidden:\"True\"";
  22. noHidden = "";
  23. }
  24. String iframeID = params.get("iframeID");
  25. int defaultFileSize = params.getInt("file_size");
  26. if(defaultFileSize <= 0){
  27. defaultFileSize = WAFConfig.getInt("waf.repository.file.size");
  28. }
  29. String multi_yn = params.get("multi_yn");
  30. String user_fileName = "";
  31. %>
  32. <style type="text/css">
  33. .view_title {
  34. BACKGROUND-COLOR : #5F86B6 ;
  35. FONT-FAMILY : "굴림", "Verdana" ;
  36. FONT-SIZE : 9pt ;
  37. COLOR : #ffffff ;
  38. TEXT-INDENT : 9px ;
  39. }
  40. </style>
  41. <SCRIPT language="JavaScript">
  42. var m_enc = "multipart/form-data";
  43. var a_enc = "application/x-www-form-urlencoded";
  44. /**
  45. * 시트 시작
  46. */
  47. var sheet1;
  48. var sheet1Row;
  49. var sheet1PageNo = 1;
  50. var pageLastRowIndex = 1;
  51. var validationResult = false;
  52. var filterShow = false;
  53. // 마지막으로 선택된 행의 번호를 기억하고 있음
  54. var CurMasterRow = 0;
  55. function _onReady(){
  56. gridInit(sheet1);
  57. reloadProc();
  58. autoResize();
  59. }
  60. function gridInit(sheetName){
  61. var init_sheet = {};
  62. init_sheet.Cfg = {SearchMode:2, Page:30};
  63. init_sheet.Cols = [
  64. {Header:'상태', Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  65. {Header:'삭제', Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center" <%=delHidden%>},
  66. {Header:'번호', Type:"Seq", SaveName:"NO", Width:40, Align:"Center" <%=noHidden%> },
  67. {Header:'파일ID', Type:"Text", SaveName:"FILE_ID", Width:80, Align:"Left", Edit: 0, Hidden:"True"},
  68. {Header:'파일맵ID', Type:"Text", SaveName:"FILE_MAP_ID", Width:80, Align:"Left", Edit: 0, Hidden:"True"},
  69. {Header:'☞ 파일명', Type:"Text", SaveName:"FILE_NAME", Width:250, Align:"Left", Edit: 0},
  70. {Header:'파일크기', Type:"Text", SaveName:"FILE_SIZE", Width:60, Align:"Center", Edit: 0},
  71. {Header:'생성일시', Type:"Text", SaveName:"CRE_DATE", Width:80, Align:"Center", Edit: 0, Format: "YmdHms"},
  72. ];
  73. init_sheet.HeaderMode = {Sort:1};
  74. IBS_InitSheet(sheetName, init_sheet);
  75. sheetName.SetDataAutoTrim(0);
  76. setGridSize();
  77. }
  78. function setGridSize() {
  79. sheet1.FitColWidth();
  80. }
  81. function sheet1_OnSearchEnd(code, message) {
  82. if(code == 0) {
  83. setGridSize();
  84. } else {
  85. //조회 에러 수행
  86. alert(message);
  87. }
  88. }
  89. function sheet1_OnDblClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  90. if (sheet1.ColSaveName(Col) == "FILE_NAME") {
  91. var url="/common/file/FileDownloadServlet";
  92. url += "?file_id=" + sheet1.GetCellValue(Row, "FILE_ID");
  93. 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")
  94. //2020.03.12 왜 아래 또 submit 하는지 모르겠음.
  95. //var fd = document.getElementById("form_filedown");
  96. //fd.target = "_fileDown";
  97. //fd.file_id.value = sheet1.GetCellValue(Row, "FILE_ID");
  98. //fd.submit();
  99. }
  100. }
  101. function sheet1_OnSaveEnd(code, msg) {
  102. if(code >= 0) {
  103. alert("파일이 삭제 되었습니다.!");
  104. } else {
  105. //alert(msg);
  106. alert("파일 삭제에 실패 하였습니다.");
  107. }
  108. }
  109. /**
  110. * 시트 끝
  111. */
  112. function saveProc() {
  113. var f = document.form1;
  114. if(document.getElementById("multi_yn").value == "N" && sheet1.RowCount() >= 1){
  115. alert("1개의 첨부파일만 가능합니다.\n추가 된 첨부파일을 삭제후 추가 바랍니다.");
  116. return;
  117. }
  118. if( f.attach_file.value == "" ) {
  119. alert("파일을 선택하세요.");
  120. return;
  121. }
  122. if(!checkFile(document.getElementById("attach_file"))) return;
  123. f.fevent.value = "FileListWorker.Save";
  124. f.target = "worker";
  125. f.action = "FileListNewSave.screen";
  126. f.encoding = m_enc;
  127. f.method = "post";
  128. formSubmit(f, false);
  129. }
  130. function getFileSize(filePath)
  131. {
  132. var browser=navigator.appName;
  133. var size = 0;
  134. if (browser=="Microsoft Internet Explorer")
  135. {
  136. try{
  137. var oas = new ActiveXObject("Scripting.FileSystemObject");
  138. var filepath = document.getElementById('attach_file').value;
  139. var e = oas.getFile(filepath);
  140. size = e.size;
  141. }catch(e){
  142. alert("ActiveX 컨트롤을 허용 하시기 바랍니다.\n리플레쉬후 다시 시도 바랍니다.\n"+e);
  143. size = 1;
  144. }
  145. }
  146. else
  147. {
  148. size = "";
  149. for(var i=0;i<document.getElementById("attach_file").files.length;i++){
  150. size += document.getElementById("attach_file").files[i].size + ";";
  151. }
  152. }
  153. return size;
  154. }
  155. function checkFile(obj)
  156. {
  157. var len = getFileSize(obj.value);
  158. var defSize = document.getElementById("defaultFileSize").value;
  159. var filelist = "";
  160. var cnt =0;
  161. if(isNaN(len)){
  162. filelist = len.split(";");
  163. for(var i=0;i<filelist.length-1;i++){
  164. if (filelist[i] > defSize * 1024 * 1024)
  165. {
  166. //alert("파일 크기는 "+defSize+"메가보다 작아야 합니다.");
  167. cnt += 1
  168. }
  169. }
  170. if(cnt > 0){
  171. alert("파일 크기는 "+defSize+"메가보다 작아야 합니다.");
  172. return false;
  173. }else{
  174. return true;
  175. }
  176. }else{
  177. if (len > defSize * 1024 * 1024)
  178. {
  179. alert("파일 크기는 "+defSize+"메가보다 작아야 합니다.");
  180. return false;
  181. } else{
  182. return true;
  183. }
  184. }
  185. }
  186. // Form Lock 풀기
  187. function resetFormProc() {
  188. resetFormSubmit();
  189. }
  190. function delProc() {
  191. if(sheet1.RowCount("D") <= 0){
  192. alert("삭제할 파일이 없습니다.")
  193. return;
  194. }
  195. if (confirm("삭제하시겠습니까?")) {
  196. jQuery("#fevent").val("FileListWorker.Del");
  197. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/file/FileListNewDelete.screen";
  198. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  199. }
  200. }
  201. function resetProc(){
  202. var f = document.form1;
  203. f.attach_file.value="";
  204. }
  205. function reloadProc() {
  206. jQuery("#form1").attr("encoding", a_enc);
  207. jQuery("#fevent").val("GET_FILE_LIST");
  208. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/file/FileListNewData.screen";
  209. if('<%=openParams.get("validYn")%>' == 'Y'){
  210. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 10, "");
  211. }else {
  212. alert('유효하지 않은 접근입니다. 팝업창을 다시 띄워주시기 바랍니다.');
  213. window.colse();
  214. }
  215. }
  216. function viewFileListClose(layerID){
  217. var obj = parent.document.getElementById("<%=params.get("obj_id")%>");
  218. if(obj == null && '<%=iframeID%>' != ''){
  219. var childDiv = parent.document.getElementById("<%=params.get("iframeID")%>_divcontent");
  220. var objChild = childDiv.getElementsByTagName("iframe")[0];
  221. var objDoc = objChild.contentWindow || objChild.contentDocument;
  222. obj = eval(objDoc.document.getElementById("<%=params.get("obj_id")%>"));
  223. }
  224. if( obj != null ){
  225. if( obj.type == "textarea" ) {
  226. obj.value = "";
  227. for(var i = 1; i<=sheet1.RowCount(); i++){
  228. var str = i + " : " + sheet1.GetCellValue(i, "FILE_NAME") + " ( "+sheet1.GetCellValue(i, "FILE_SIZE")+" )";
  229. obj.value += str + "\n";
  230. }
  231. }else{
  232. var strHtml = "";
  233. for(var i = 1; i<=sheet1.RowCount(); i++){
  234. var temp = i + " : " + sheet1.GetCellValue(i, "FILE_NAME") + " ( "+sheet1.GetCellValue(i, "FILE_SIZE")+" )";
  235. strHtml += "<li><a href=\"javascript:fileDown('"+sheet1.GetCellValue(i, "FILE_ID")+"');\">" + temp +"</a></li>\n";
  236. }
  237. strHtml = "<ul>\n" + strHtml + "</ul>";
  238. obj.innerHTML = strHtml;
  239. }
  240. }
  241. parent.fLayerPopClose(layerID);
  242. }
  243. function viewFileListClose1(layerID){
  244. var obj = parent.document.getElementById("<%=params.get("obj_id")%>");
  245. if(obj == null && '<%=iframeID%>' != ''){
  246. var childDiv = parent.document.getElementById("<%=params.get("iframeID")%>_divcontent");
  247. var objChild = childDiv.getElementsByTagName("iframe")[0];
  248. var objDoc = objChild.contentWindow || objChild.contentDocument;
  249. obj = eval(objDoc.document.getElementById("<%=params.get("obj_id")%>"));
  250. }
  251. if( obj != null ){
  252. if( obj.type == "hidden" || obj.type == "text") {
  253. obj.value = "";
  254. for(var i = 1; i<=sheet1.RowCount(); i++){
  255. var str = i + " : " + sheet1.GetCellValue(i, "FILE_NAME") + " ( "+sheet1.GetCellValue(i, "FILE_SIZE")+" )";
  256. obj.value += str + "\n";
  257. }
  258. }else if( obj.type == "textarea" ) {
  259. obj.value = "";
  260. for(var i = 1; i<=sheet1.RowCount(); i++){
  261. var str = i + " : " + sheet1.GetCellValue(i, "FILE_NAME") + " ( "+sheet1.GetCellValue(i, "FILE_SIZE")+" )";
  262. obj.value += str + "\n";
  263. }
  264. }else{
  265. var strHtml = "";
  266. for(var i = 1; i<=sheet1.RowCount(); i++){
  267. var temp = i + " : " + sheet1.GetCellValue(i, "FILE_NAME") + " ( "+sheet1.GetCellValue(i, "FILE_SIZE")+" )";
  268. strHtml += "<li><a href=\"javascript:fileDown('"+sheet1.GetCellValue(i, "FILE_ID")+"');\">" + temp +"</a></li>\n";
  269. }
  270. strHtml = "<ul>\n" + strHtml + "</ul>";
  271. obj.innerHTML = strHtml;
  272. }
  273. }
  274. parent.fLayerPopClose(layerID);
  275. }
  276. </SCRIPT>
  277. <STYLE>
  278. BODY {
  279. padding : 0 0 0 0;
  280. }
  281. </STYLE>
  282. <modular:search id="form1">
  283. <modular:key id="fevent" />
  284. </modular:search>
  285. <FORM id="form1" name="form1" method="post" modular:type="search">
  286. <INPUT type="hidden" name="fevent" id="fevent" value="">
  287. <INPUT type="hidden" name="file_gb" value="<%= openParams.get("FILE_GB") %>">
  288. <INPUT type="hidden" name="id" value="<%= openParams.get("ID") %>">
  289. <INPUT type="hidden" name="defaultFileSize" value="<%=defaultFileSize%>">
  290. <INPUT type="hidden" name="multi_yn" value="<%=multi_yn%>">
  291. <INPUT type="hidden" name="is_modify" value="<%= openParams.get("MODIFY_YN") %>">
  292. <INPUT type="hidden" name="sysGb" value="<%=params.get("sys_gb")%>">
  293. <% if( openParams.get("MODIFY_YN").equals("Y") ) { %>
  294. <table id="search-table" class="search-form-table">
  295. <colgroup>
  296. <col width="100" />
  297. <col width="400" />
  298. <col width="*" />
  299. </colgroup>
  300. <tr>
  301. <th>파일선택</th>
  302. <td>
  303. <input id="attach_file" type="file" name="attach_file" class="input" contenteditable="false" <% if(!"N".equals(params.get("multi_yn"))){ %>multiple<%} %>>
  304. </td>
  305. <td class="button">
  306. <span class="btnSearch center"><a href="javascript:saveProc();" id="btnSave">파일저장</a></span>
  307. <span class="btnSearch center"><a href="javascript:delProc();" id="btnDel">파일삭제</a></span>
  308. </td>
  309. </tr>
  310. </table>
  311. <%} %>
  312. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 200px; overflow: auto;">
  313. <script>createIBSheet('sheet1','100%', '380px');</script>
  314. </div>
  315. <IFRAME width="0" height="0" name="worker" style="display:none;"></IFRAME>
  316. </FORM>
  317. <FORM id="form_filedown" name="form_filedown" method="get" action="/common/file/FileDownloadServlet" style="display:none">
  318. <input type="hidden" id="file_id" name="file_id"/>
  319. </FORM>