|
|
@ -13,7 +13,7 @@ function imgDownload(cmmFileDtls, appendElementId, dtlSeq, isEditor) {
|
|
|
|
const downloadUrl = '/framework/biz/cmm/file/download.do';
|
|
|
|
const downloadUrl = '/framework/biz/cmm/file/download.do';
|
|
|
|
cmmFileDtls.forEach((dtl, idx) => {
|
|
|
|
cmmFileDtls.forEach((dtl, idx) => {
|
|
|
|
|
|
|
|
|
|
|
|
const params = "?" + $.param(dtl);
|
|
|
|
const params = "?filename=" +dtl.orginlFileNm+ $.param(dtl);
|
|
|
|
const title = dtlSeq ? dtl.orginlFileNm+'['+dtlSeq+']' : dtl.orginlFileNm;
|
|
|
|
const title = dtlSeq ? dtl.orginlFileNm+'['+dtlSeq+']' : dtl.orginlFileNm;
|
|
|
|
const x = document.createElement("img");
|
|
|
|
const x = document.createElement("img");
|
|
|
|
x.setAttribute("src", downloadUrl+params);
|
|
|
|
x.setAttribute("src", downloadUrl+params);
|
|
|
@ -40,6 +40,57 @@ function imgDownload(cmmFileDtls, appendElementId, dtlSeq, isEditor) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function imageSaveTo(idata, width, height){
|
|
|
|
|
|
|
|
var ex = /\?filename=([a-z0-9\-]+)\&?/i;
|
|
|
|
|
|
|
|
var dashdash = '--';
|
|
|
|
|
|
|
|
var crlf = '\r\n';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
|
|
|
|
|
|
var progressBar = doc.createElement("div");
|
|
|
|
|
|
|
|
progressBar.style.left = ((w-200)/2) + "px";
|
|
|
|
|
|
|
|
progressBar.className = "progressBar";
|
|
|
|
|
|
|
|
document.body.appendChild(progressBar);
|
|
|
|
|
|
|
|
var progressRate = doc.createElement("div");
|
|
|
|
|
|
|
|
progressRate.innerText = "Saving";
|
|
|
|
|
|
|
|
progressRate.className = "progressRate";
|
|
|
|
|
|
|
|
progressBar.appendChild(progressRate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var url = srcImg.src;
|
|
|
|
|
|
|
|
var filename = url.match(ex)[1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var boundary = 'multipartformboundary' + (new Date).getTime();
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
|
|
|
xhr.open("POST", _self.config.imageSaveURL);
|
|
|
|
|
|
|
|
xhr.setRequestHeader('content-type', 'multipart/form-data; boundary='+ boundary);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var builder = dashdash + boundary + crlf + 'Content-Disposition: form-data; name="imageFile"' +
|
|
|
|
|
|
|
|
'; filename="' + filename + '";' + crlf + ' Content-Type: application/octet-stream' + crlf + crlf;
|
|
|
|
|
|
|
|
builder += idata;
|
|
|
|
|
|
|
|
builder += crlf + dashdash + boundary + crlf + 'Content-Disposition: form-data; name="filename"' + crlf + crlf + filename;
|
|
|
|
|
|
|
|
builder += crlf + dashdash + boundary + dashdash + crlf;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
|
|
|
var newImg = document.createElement("IMG");
|
|
|
|
|
|
|
|
newImg.onload = function () {
|
|
|
|
|
|
|
|
srcImg.src = newImg.src + "#img" + (new Date()).getTime();
|
|
|
|
|
|
|
|
if (_self.config.afterImageSave) _self.config.afterImageSave();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
newImg.src = _self.config.imageDownloadURL + "?filename=" + filename+ "#img" + (new Date()).getTime();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
xhr.upload.addEventListener("progress", function(evt){
|
|
|
|
|
|
|
|
if (evt.lengthComputable) {
|
|
|
|
|
|
|
|
var p = evt.loaded / evt.total * 100;
|
|
|
|
|
|
|
|
progressRate.style.width = p + "%";
|
|
|
|
|
|
|
|
progressRate.innerText = progressRate.style.width;
|
|
|
|
|
|
|
|
if (p==100) {
|
|
|
|
|
|
|
|
progressRate.innerText = "Saved";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
xhr.send(builder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <pre>
|
|
|
|
* <pre>
|
|
|
|
* 첨부파일 정보 목록으로 부터 이미지 download
|
|
|
|
* 첨부파일 정보 목록으로 부터 이미지 download
|
|
|
@ -60,68 +111,35 @@ function imgDownload2(cmmFileDtls, appendElementId, dtlSeq) {
|
|
|
|
,body: JSON.stringify(dtl)
|
|
|
|
,body: JSON.stringify(dtl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.then(response => response.blob())
|
|
|
|
.then(response => response.blob())
|
|
|
|
.then(blob => {
|
|
|
|
.then(blob => {
|
|
|
|
const title = dtlSeq ? dtl.orginlFileNm+'['+dtlSeq+']' : dtl.orginlFileNm;
|
|
|
|
const title = dtlSeq ? dtl.orginlFileNm+'['+dtlSeq+']' : dtl.orginlFileNm;
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
const url = URL.createObjectURL(blob);
|
|
|
|
|
|
|
|
|
|
|
|
const x = document.createElement("img");
|
|
|
|
const x = document.createElement("img");
|
|
|
|
x.setAttribute("src", url);
|
|
|
|
x.setAttribute("src", url);
|
|
|
|
//x.style = 'width:150px; display: block;';
|
|
|
|
//x.style = 'width:150px; display: block;';
|
|
|
|
x.style = 'height:300px;';
|
|
|
|
x.style = 'height:300px;';
|
|
|
|
//x.setAttribute("width", "304");
|
|
|
|
//x.setAttribute("width", "304");
|
|
|
|
//x.setAttribute("height", "228");
|
|
|
|
//x.setAttribute("height", "228");
|
|
|
|
x.setAttribute("title", title);
|
|
|
|
x.setAttribute("title", title);
|
|
|
|
x.setAttribute("alt", dtl.orginlFileNm);
|
|
|
|
x.setAttribute("alt", dtl.orginlFileNm);
|
|
|
|
//x.setAttribute("id", dtl.fileMastrId);
|
|
|
|
//x.setAttribute("id", dtl.fileMastrId);
|
|
|
|
x.setAttribute("name", dtl.orginlFileNm);
|
|
|
|
x.setAttribute("name", dtl.orginlFileNm);
|
|
|
|
x.setAttribute("ctznSttemntDetailSn", dtlSeq);
|
|
|
|
x.setAttribute("ctznSttemntDetailSn", dtlSeq);
|
|
|
|
x.addEventListener('click', (e)=>{
|
|
|
|
x.addEventListener('click', (e)=>{
|
|
|
|
$('#uploadImage').attr("src", url);
|
|
|
|
$('#uploadImage').attr("src", url);
|
|
|
|
$('#imageEditor').css('display', 'inline-block');
|
|
|
|
$('#imageEditor').css('display', 'inline-block');
|
|
|
|
fnBiz.pagePopup('imageEditor');
|
|
|
|
fnBiz.pagePopup('imageEditor');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
document.querySelector(appendElementId).appendChild(x);
|
|
|
|
document.querySelector(appendElementId).appendChild(x);
|
|
|
|
|
|
|
|
|
|
|
|
// Revoke Blob URL after DOM updates..
|
|
|
|
// Revoke Blob URL after DOM updates..
|
|
|
|
//window.URL.revokeObjectURL(objectURL);
|
|
|
|
//window.URL.revokeObjectURL(objectURL);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fn_uploadImage() {
|
|
|
|
|
|
|
|
$("#uploadImageFile").click();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function uploadImageFileChange() {
|
|
|
|
|
|
|
|
var formData = new FormData();
|
|
|
|
|
|
|
|
formData.append('upfile', $('#uploadImageFile')[0].files[0]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
url: '/fileUpload.do',
|
|
|
|
|
|
|
|
data: formData,
|
|
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
|
|
contentType: false,
|
|
|
|
|
|
|
|
processData: false,
|
|
|
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
|
|
$('#uploadImage').attr("src", "/fileDownload.do?filename=" + data);
|
|
|
|
|
|
|
|
$('#imageEditor').css('display', 'inline-block');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fn_modifyImage() {
|
|
|
|
|
|
|
|
fnBiz.pagePopup('imageEditor');
|
|
|
|
|
|
|
|
//var w = window.open("/imageEditor.do", "", "width=800,height=650,top=0px,left=200px,status=,resizable=false,scrollbars=no");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fn_removeImage() {
|
|
|
|
|
|
|
|
$('#uploadImage').removeAttr("src");
|
|
|
|
|
|
|
|
$('#imageEditor').css('display', 'none');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function download(img) {
|
|
|
|
function download(img) {
|
|
|
|
var link = document.createElement("a");
|
|
|
|
var link = document.createElement("a");
|
|
|
|
link.href = img.src;
|
|
|
|
link.href = img.src;
|
|
|
|