|
|
|
@ -15,49 +15,51 @@ function cmmImgDownload(divImgListElementId, cmmFileDtls, fnBizPagePopup = fnBiz
|
|
|
|
|
const downloadUrl = '/framework/biz/cmm/file/download.do';
|
|
|
|
|
|
|
|
|
|
$(divImgListElementId).children().remove();
|
|
|
|
|
if(cmmFileDtls != null){
|
|
|
|
|
cmmFileDtls.forEach((dtl, idx) => {
|
|
|
|
|
let imgDiv = document.getElementById(dtl.fileJobId);
|
|
|
|
|
if(!imgDiv?.hasChildNodes()){
|
|
|
|
|
imgDiv = document.createElement("div");
|
|
|
|
|
imgDiv.setAttribute("id", dtl.fileJobId);
|
|
|
|
|
imgDiv.setAttribute("value", dtl.fileMastrId);
|
|
|
|
|
imgDiv.setAttribute("class", "dragDiv")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmmFileDtls.forEach((dtl, idx) => {
|
|
|
|
|
let imgDiv = document.getElementById(dtl.fileJobId);
|
|
|
|
|
if(!imgDiv?.hasChildNodes()){
|
|
|
|
|
imgDiv = document.createElement("div");
|
|
|
|
|
imgDiv.setAttribute("id", dtl.fileJobId);
|
|
|
|
|
imgDiv.setAttribute("value", dtl.fileMastrId);
|
|
|
|
|
imgDiv.setAttribute("class", "dragDiv")
|
|
|
|
|
}
|
|
|
|
|
//const params = `?filename=${dtl.orginlFileNm}&` + $.param(dtl);
|
|
|
|
|
const params = `?fileId=${dtl.fileId}&fileCours=${dtl.fileCours}&orginlFileNm=${dtl.orginlFileNm}`;
|
|
|
|
|
const title = dtl.orginlFileNm;
|
|
|
|
|
|
|
|
|
|
const x = document.createElement("img");
|
|
|
|
|
//x.setAttribute("class", "draggable")
|
|
|
|
|
x.setAttribute("src", downloadUrl+params);
|
|
|
|
|
x.setAttribute("id", dtl.fileId);
|
|
|
|
|
x.setAttribute("class", "draggable")
|
|
|
|
|
x.style = 'width:'+ thumbnailSize;
|
|
|
|
|
x.style = 'height:'+ thumbnailSize;
|
|
|
|
|
//x.style = 'object-fit: "contain";';
|
|
|
|
|
//x.style = 'object-fit: scale-down;';
|
|
|
|
|
x.setAttribute("title", title);
|
|
|
|
|
x.setAttribute("alt", dtl.orginlFileNm);
|
|
|
|
|
x.setAttribute("name", dtl.orginlFileNm);
|
|
|
|
|
x.setAttribute("data-file-mastr-id", dtl.fileMastrId);
|
|
|
|
|
x.setAttribute("data-file-id", dtl.fileId);
|
|
|
|
|
x.setAttribute("data-file-cours", dtl.fileCours);
|
|
|
|
|
x.setAttribute("data-file-cpcty", dtl.fileCpcty);
|
|
|
|
|
|
|
|
|
|
x.addEventListener('dblclick', (e)=>{
|
|
|
|
|
if(isEditor) {
|
|
|
|
|
fnBizPagePopup('imageEditor', {imageTagId: dtl.fileId});
|
|
|
|
|
}else{
|
|
|
|
|
dtl.downloadUrl = downloadUrl+params;
|
|
|
|
|
//dtl.editor = true;
|
|
|
|
|
fnBizPagePopup('imageView', dtl);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
imgDiv.appendChild(x);
|
|
|
|
|
document.querySelector(divImgListElementId).appendChild(imgDiv);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//const params = `?filename=${dtl.orginlFileNm}&` + $.param(dtl);
|
|
|
|
|
const params = `?fileId=${dtl.fileId}&fileCours=${dtl.fileCours}&orginlFileNm=${dtl.orginlFileNm}`;
|
|
|
|
|
const title = dtl.orginlFileNm;
|
|
|
|
|
|
|
|
|
|
const x = document.createElement("img");
|
|
|
|
|
//x.setAttribute("class", "draggable")
|
|
|
|
|
x.setAttribute("src", downloadUrl+params);
|
|
|
|
|
x.setAttribute("id", dtl.fileId);
|
|
|
|
|
x.setAttribute("class", "draggable")
|
|
|
|
|
x.style = 'width:'+ thumbnailSize;
|
|
|
|
|
x.style = 'height:'+ thumbnailSize;
|
|
|
|
|
//x.style = 'object-fit: "contain";';
|
|
|
|
|
//x.style = 'object-fit: scale-down;';
|
|
|
|
|
x.setAttribute("title", title);
|
|
|
|
|
x.setAttribute("alt", dtl.orginlFileNm);
|
|
|
|
|
x.setAttribute("name", dtl.orginlFileNm);
|
|
|
|
|
x.setAttribute("data-file-mastr-id", dtl.fileMastrId);
|
|
|
|
|
x.setAttribute("data-file-id", dtl.fileId);
|
|
|
|
|
x.setAttribute("data-file-cours", dtl.fileCours);
|
|
|
|
|
x.setAttribute("data-file-cpcty", dtl.fileCpcty);
|
|
|
|
|
|
|
|
|
|
x.addEventListener('dblclick', (e)=>{
|
|
|
|
|
if(isEditor) {
|
|
|
|
|
fnBizPagePopup('imageEditor', {imageTagId: dtl.fileId});
|
|
|
|
|
}else{
|
|
|
|
|
dtl.downloadUrl = downloadUrl+params;
|
|
|
|
|
//dtl.editor = true;
|
|
|
|
|
fnBizPagePopup('imageView', dtl);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
imgDiv.appendChild(x);
|
|
|
|
|
document.querySelector(divImgListElementId).appendChild(imgDiv);
|
|
|
|
|
})
|
|
|
|
|
dragable();
|
|
|
|
|
if(callback) callback();
|
|
|
|
|
}
|
|
|
|
|