diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp
index 12dffc0..0d8fbcf 100644
--- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp
+++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp
@@ -436,7 +436,7 @@
$("#tbody--productList").append(tr);
- fnMakeGridImageViewer(
+ AddsComponentization.fnMakeGridImageViewer(
$("#tbody--productList").find("td.prdDsuseImg").last()[0],
"dsusePrdImgFiles",
di.data.fileInfo
@@ -570,7 +570,7 @@
fileInfo.MIME_TYPE = this.dataset.mimeType;
fileInfo.FILE_NM = this.dataset.fileNm;
fileInfo.FILE_ID = this.dataset.fileId;
- promiseArr.push(fnCreateFileFromFileInfo(fileInfo));
+ promiseArr.push(AddsSupport.fnCreateFileFromFileInfo(fileInfo));
}
});
diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp
index 05527b8..a48ff26 100644
--- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp
+++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp
@@ -405,7 +405,7 @@
$("#tbody--productList").append(tr);
- fnMakeGridImageViewer(
+ AddsComponentization.fnMakeGridImageViewer(
$("#tbody--productList").find("td.prdDsuseImg").last()[0],
"dsusePrdImgFiles",
di.data.fileInfo
@@ -506,7 +506,7 @@
fileInfo.MIME_TYPE = this.dataset.mimeType;
fileInfo.FILE_NM = this.dataset.fileNm;
fileInfo.FILE_ID = this.dataset.fileId;
- promiseArr.push(fnCreateFileFromFileInfo(fileInfo));
+ promiseArr.push(AddsSupport.fnCreateFileFromFileInfo(fileInfo));
}
});
diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp
index 7ae081d..d150f7a 100644
--- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp
+++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp
@@ -606,7 +606,7 @@
}
try{
- promiseArr.push(fnCreateFileFromFileInfo(f));
+ promiseArr.push(AddsSupport.fnCreateFileFromFileInfo(f));
}catch(e){
console.log(e);
}
diff --git a/src/main/webapp/WEB-INF/jsp/include/tail.jsp b/src/main/webapp/WEB-INF/jsp/include/tail.jsp
index 0e4e40a..4596585 100644
--- a/src/main/webapp/WEB-INF/jsp/include/tail.jsp
+++ b/src/main/webapp/WEB-INF/jsp/include/tail.jsp
@@ -40,7 +40,7 @@
">
-">
+">
">
diff --git a/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js b/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js
deleted file mode 100644
index 6784418..0000000
--- a/src/main/webapp/resources/js/adds/cmmn/adds-cmmnUtil.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**************************************************************************
-* 서버의 파일 정보로 javascript File 객체 생성
-**************************************************************************/
-async function fnCreateFileFromFileInfo(fileInfo){
- if(/^[a-zA-Z][\:]/.test(fileInfo.URL)){
- fileInfo.URL = fileInfo.URL.substring(2);
- }
-
- let response = null;
- try {
- response = await fetch(fileInfo.URL);
- } catch(error){
- let data = new Blob();
- let metadata = {
- type: fileInfo.MIME_TYPE
- };
- let file = new File([data], fileInfo.FILE_NM, metadata);
- file.id = fileInfo.FILE_ID;
- file.url = fileInfo.URL;
-
- return new Promise(resolve => { resolve(file); });
- }
-
- let data = await response.blob();
- let metadata = {
- type: fileInfo.MIME_TYPE
- };
- let file = new File([data], fileInfo.FILE_NM, metadata);
- file.id = fileInfo.FILE_ID;
- file.url = fileInfo.URL;
-
- return new Promise(resolve => { resolve(file); });
-}
\ No newline at end of file
diff --git a/src/main/webapp/resources/js/adds/cmmn/adds-componentization.js b/src/main/webapp/resources/js/adds/cmmn/adds-componentization.js
index a39f902..eb8b73b 100644
--- a/src/main/webapp/resources/js/adds/cmmn/adds-componentization.js
+++ b/src/main/webapp/resources/js/adds/cmmn/adds-componentization.js
@@ -1,62 +1,65 @@
-/**************************************************************************
- * 그리드 내부 이미지 첨부
- **************************************************************************/
-function fnMakeGridImageViewer(tdEl, fileInputElName, fileInfo) {
-
- let fileInputEl = document.createElement("input");
- fileInputEl.name = fileInputElName;
- fileInputEl.type = "file";
- fileInputEl.setAttribute("hidden", "hidden");
- fileInputEl.setAttribute("accept", "image/*")
- tdEl.appendChild(fileInputEl);
-
- if (fileInfo != null) {
- fileInputEl.dataset.url = fileInfo.URL;
- fileInputEl.dataset.fileNm = fileInfo.FILE_NM;
- fileInputEl.dataset.mimeType = fileInfo.MIME_TYPE;
- fileInputEl.dataset.fileId = fileInfo.FILE_ID;
- }
-
- let uploadButtonEl = document.createElement("button");
- uploadButtonEl.type = "button";
- uploadButtonEl.classList.add("btn", "btn-primary", "w-px-50", "mx-1");
- uploadButtonEl.textContent = "등록";
- tdEl.appendChild(uploadButtonEl);
-
- let viewButtonEl = document.createElement("button");
- viewButtonEl.type = "button";
- viewButtonEl.classList.add("btn", "btn-primary", "w-px-50", "mx-1");
- viewButtonEl.setAttribute("hidden", "hidden");
- viewButtonEl.textContent = "보기";
- tdEl.appendChild(viewButtonEl);
-
- $(fileInputEl).on("change", function () {
- if (this.files != null && this.files.length > 0) {
- $(uploadButtonEl).text("변경");
- $(viewButtonEl).removeAttr("hidden");
- } else if (this.dataset.url != null) {
- $(uploadButtonEl).text("변경");
- $(viewButtonEl).removeAttr("hidden");
- } else {
- $(uploadButtonEl).text("등록");
- $(viewButtonEl).attr("hidden", "hidden");
- }
- });
-
- $(uploadButtonEl).on("click", function () {
- $(fileInputEl).click();
- });
-
- $(viewButtonEl).on("click", function () {
-
- let viewUrl = "";
- if (fileInputEl.files.length != 0) {
- viewUrl = (window.URL || window.webkitURL).createObjectURL(fileInputEl.files[0]);
- } else {
- viewUrl = fileInputEl.dataset.url;
- }
- window.open(viewUrl, "이미지", "width=500, height=500");
- });
-
- $(fileInputEl).trigger("change");
+class AddsComponentization {
+
+ /**************************************************************************
+ * 그리드 내부 이미지 첨부
+ **************************************************************************/
+ static fnMakeGridImageViewer(tdEl, fileInputElName, fileInfo) {
+
+ let fileInputEl = document.createElement("input");
+ fileInputEl.name = fileInputElName;
+ fileInputEl.type = "file";
+ fileInputEl.setAttribute("hidden", "hidden");
+ fileInputEl.setAttribute("accept", "image/*")
+ tdEl.appendChild(fileInputEl);
+
+ if (fileInfo != null) {
+ fileInputEl.dataset.url = fileInfo.URL;
+ fileInputEl.dataset.fileNm = fileInfo.FILE_NM;
+ fileInputEl.dataset.mimeType = fileInfo.MIME_TYPE;
+ fileInputEl.dataset.fileId = fileInfo.FILE_ID;
+ }
+
+ let uploadButtonEl = document.createElement("button");
+ uploadButtonEl.type = "button";
+ uploadButtonEl.classList.add("btn", "btn-primary", "w-px-50", "mx-1");
+ uploadButtonEl.textContent = "등록";
+ tdEl.appendChild(uploadButtonEl);
+
+ let viewButtonEl = document.createElement("button");
+ viewButtonEl.type = "button";
+ viewButtonEl.classList.add("btn", "btn-primary", "w-px-50", "mx-1");
+ viewButtonEl.setAttribute("hidden", "hidden");
+ viewButtonEl.textContent = "보기";
+ tdEl.appendChild(viewButtonEl);
+
+ $(fileInputEl).on("change", function () {
+ if (this.files != null && this.files.length > 0) {
+ $(uploadButtonEl).text("변경");
+ $(viewButtonEl).removeAttr("hidden");
+ } else if (this.dataset.url != null) {
+ $(uploadButtonEl).text("변경");
+ $(viewButtonEl).removeAttr("hidden");
+ } else {
+ $(uploadButtonEl).text("등록");
+ $(viewButtonEl).attr("hidden", "hidden");
+ }
+ });
+
+ $(uploadButtonEl).on("click", function () {
+ $(fileInputEl).click();
+ });
+
+ $(viewButtonEl).on("click", function () {
+
+ let viewUrl = "";
+ if (fileInputEl.files.length != 0) {
+ viewUrl = (window.URL || window.webkitURL).createObjectURL(fileInputEl.files[0]);
+ } else {
+ viewUrl = fileInputEl.dataset.url;
+ }
+ window.open(viewUrl, "이미지", "width=500, height=500");
+ });
+
+ $(fileInputEl).trigger("change");
+ }
}
diff --git a/src/main/webapp/resources/js/adds/cmmn/adds-support.js b/src/main/webapp/resources/js/adds/cmmn/adds-support.js
new file mode 100644
index 0000000..a26e594
--- /dev/null
+++ b/src/main/webapp/resources/js/adds/cmmn/adds-support.js
@@ -0,0 +1,36 @@
+class AddsSupport {
+
+ /**************************************************************************
+ * 서버의 파일 정보로 javascript File 객체 생성
+ **************************************************************************/
+ static async fnCreateFileFromFileInfo(fileInfo){
+ if(/^[a-zA-Z][\:]/.test(fileInfo.URL)){
+ fileInfo.URL = fileInfo.URL.substring(2);
+ }
+
+ let response = null;
+ try {
+ response = await fetch(fileInfo.URL);
+ } catch(error){
+ let data = new Blob();
+ let metadata = {
+ type: fileInfo.MIME_TYPE
+ };
+ let file = new File([data], fileInfo.FILE_NM, metadata);
+ file.id = fileInfo.FILE_ID;
+ file.url = fileInfo.URL;
+
+ return new Promise(resolve => { resolve(file); });
+ }
+
+ let data = await response.blob();
+ let metadata = {
+ type: fileInfo.MIME_TYPE
+ };
+ let file = new File([data], fileInfo.FILE_NM, metadata);
+ file.id = fileInfo.FILE_ID;
+ file.url = fileInfo.URL;
+
+ return new Promise(resolve => { resolve(file); });
+ }
+}
\ No newline at end of file