|
|
@ -6,15 +6,15 @@
|
|
|
|
* 이미지 url 사용
|
|
|
|
* 이미지 url 사용
|
|
|
|
* @param {object} cmmFileDtls
|
|
|
|
* @param {object} cmmFileDtls
|
|
|
|
* @param {string} appendElementId - '#ctznImg'
|
|
|
|
* @param {string} appendElementId - '#ctznImg'
|
|
|
|
* @param {string} dtlSeq - 시민신고상세순번
|
|
|
|
* @param {object} stmtDtlDTO - 시민신고상세정보
|
|
|
|
* </pre>
|
|
|
|
* </pre>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function imgDownload(cmmFileDtls, appendElementId, dtlSeq, isEditor) {
|
|
|
|
function imgDownload(cmmFileDtls, appendElementId, reqDTO, 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 = "?filename=" +dtl.orginlFileNm+ $.param(dtl);
|
|
|
|
const params = "?filename=" +dtl.orginlFileNm+ $.param(dtl);
|
|
|
|
const title = dtlSeq ? dtl.orginlFileNm+'['+dtlSeq+']' : dtl.orginlFileNm;
|
|
|
|
const title = reqDTO ? dtl.orginlFileNm+'['+reqDTO.ctznSttemntDetailSn+']' : dtl.orginlFileNm;
|
|
|
|
const x = document.createElement("img");
|
|
|
|
const x = document.createElement("img");
|
|
|
|
x.setAttribute("src", downloadUrl+params);
|
|
|
|
x.setAttribute("src", downloadUrl+params);
|
|
|
|
x.setAttribute("id", dtl.fileId);
|
|
|
|
x.setAttribute("id", dtl.fileId);
|
|
|
@ -24,9 +24,13 @@ function imgDownload(cmmFileDtls, appendElementId, dtlSeq, isEditor) {
|
|
|
|
//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("name", dtl.orginlFileNm);
|
|
|
|
x.setAttribute("name", dtl.orginlFileNm);
|
|
|
|
x.setAttribute("ctznSttemntDetailSn", dtlSeq);
|
|
|
|
x.setAttribute("data-file-mastr-id", dtl.fileMastrId);
|
|
|
|
|
|
|
|
x.setAttribute("data-file-id", dtl.fileId);
|
|
|
|
|
|
|
|
if(reqDTO) {
|
|
|
|
|
|
|
|
x.setAttribute("data-interface-seq-n", reqDTO.interfaceSeqN);
|
|
|
|
|
|
|
|
x.setAttribute("data-ctzn-sttemnt-detail-sn", reqDTO.ctznSttemntDetailSn);
|
|
|
|
|
|
|
|
}
|
|
|
|
x.addEventListener('click', (e)=>{
|
|
|
|
x.addEventListener('click', (e)=>{
|
|
|
|
if(isEditor) {
|
|
|
|
if(isEditor) {
|
|
|
|
fnBiz.pagePopup('imageEditor', {imageTagId: dtl.fileId});
|
|
|
|
fnBiz.pagePopup('imageEditor', {imageTagId: dtl.fileId});
|
|
|
@ -40,56 +44,6 @@ 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>
|
|
|
@ -126,6 +80,7 @@ function imgDownload2(cmmFileDtls, appendElementId, dtlSeq) {
|
|
|
|
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("fileMastrId", dtl.fileMastrId);
|
|
|
|
x.setAttribute("ctznSttemntDetailSn", dtlSeq);
|
|
|
|
x.setAttribute("ctznSttemntDetailSn", dtlSeq);
|
|
|
|
x.addEventListener('click', (e)=>{
|
|
|
|
x.addEventListener('click', (e)=>{
|
|
|
|
$('#uploadImage').attr("src", url);
|
|
|
|
$('#uploadImage').attr("src", url);
|
|
|
|