충돌해결

This commit is contained in:
KNKIM 2021-12-14 18:04:07 +09:00
parent 0c2e66fcf1
commit 154957b081
2 changed files with 40 additions and 27 deletions

View File

@ -42,11 +42,11 @@
</c:if> </c:if>
<!-- File Upload : 시작--> <!-- File Upload : 시작-->
<script src="${pageContext.request.contextPath}/js/fileupload/dropzone.js"></script> <script src="<c:out value='${pageContext.request.contextPath}' />/js/fileupload/dropzone.js"></script>
<!-- File Upload : 종료 --> <!-- File Upload : 종료 -->
<!-- SmartEditor : 시작 --> <!-- SmartEditor : 시작 -->
<script src="${pageContext.request.contextPath}/js/smartEditor/js/service/HuskyEZCreator.js"></script> <script src="<c:out value='${pageContext.request.contextPath}' />/js/smartEditor/js/service/HuskyEZCreator.js"></script>
<!-- SmartEditor : 종료 --> <!-- SmartEditor : 종료 -->
@ -73,7 +73,7 @@ $(window.document).ready(function() {
nhn.husky.EZCreator.createInIFrame({ nhn.husky.EZCreator.createInIFrame({
oAppRef: oEditors, oAppRef: oEditors,
elPlaceHolder: "content", elPlaceHolder: "content",
sSkinURI: "${pageContext.request.contextPath}/js/smartEditor/SmartEditor2Skin.html", sSkinURI: "<c:out value='${pageContext.request.contextPath}' />/js/smartEditor/SmartEditor2Skin.html",
fCreator: "createSEditor2" fCreator: "createSEditor2"
}); });
@ -82,7 +82,11 @@ $(window.document).ready(function() {
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// 파일업로드 객체 생성 // 파일업로드 객체 생성
myDropzone = new Dropzone("form#myDropzone", { myDropzone = new Dropzone("form#myDropzone", {
url: "${pageContext.request.contextPath}/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath&attachFileId=<c:out value='${searchArticle.bdAttachFileId}'/>" url: "<c:out value='${pageContext.request.contextPath}' />/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath&attachFileId=<c:out value='${searchArticle.bdAttachFileId}'/>",
maxFilesize: <c:out value="${maxFilesize}" />,
maxFiles: <c:out value="${maxFiles}" />,
parallelUploads: <c:out value="${maxFiles}" />,
acceptedFiles: "<c:out value="${acceptedFiles}" />"
}); });
// 기존 첨부파일 출력 // 기존 첨부파일 출력
@ -90,12 +94,12 @@ $(window.document).ready(function() {
var re = /(?:\.([^.]+))?$/; var re = /(?:\.([^.]+))?$/;
<c:forEach var="attachFile" items="${searchArticle.attachFiles }" varStatus="status"> <c:forEach var="attachFile" items="${searchArticle.attachFiles }" varStatus="status">
myDropzone.addFile({ myDropzone.addFile({
name: '${attachFile.orignlFileNm}', name: '<c:out value="${attachFile.orignlFileNm}" />',
size:${attachFile.fileSize}, size: <c:out value="${attachFile.fileSize}" />,
type:re.exec('${attachFile.orignlFileNm}')[1], type:re.exec('<c:out value="${attachFile.orignlFileNm}" />')[1],
attachFileId: '${attachFile.attachFileId}', attachFileId: '<c:out value="${attachFile.attachFileId}" />',
streFileNm: '${attachFile.streFileNm}', streFileNm: '<c:out value="${attachFile.streFileNm}" />',
fileSn: '${attachFile.fileSn}', fileSn: '<c:out value="${attachFile.fileSn}" />',
fileUploadType: 'uploaded' fileUploadType: 'uploaded'
}); });
</c:forEach> </c:forEach>
@ -104,8 +108,14 @@ $(window.document).ready(function() {
// 각 파일별 업로드 성공시 호출됨 (1th called) // 각 파일별 업로드 성공시 호출됨 (1th called)
myDropzone.on("success", function(file, responseText) { myDropzone.on("success", function(file, responseText) {
var jobj = JSON.parse(responseText); var jobj = JSON.parse(responseText);
console.log("file upload success : responseText = " + responseText);
console.log("fileUpDone count : " + fileList.length); //console.log("file upload success : responseText = " + responseText);
//console.log("fileUpDone count : " + fileList.length);
if(jobj.length < 1) {
alert("[" + file.name + "] 첨부파일 업로드 처리가 취소되었습니다. \n\n다음에 해당하는 경우, 업로드가 취소됩니다.\n- 최대 파일수 초과 \n- 파일용량 초과 \n- 첨부가능한 파일 종류가 아닌 경우");
return;
}
var idx = fileList.length; var idx = fileList.length;
fileList[idx++] = { fileList[idx++] = {
"attachFileId" : jobj[0].attachFileId, "attachFileId" : jobj[0].attachFileId,
@ -118,12 +128,10 @@ $(window.document).ready(function() {
console.log("success : " + file.name + " -> " + "data > " + jobj[0].streFileNm); console.log("success : " + file.name + " -> " + "data > " + jobj[0].streFileNm);
}); });
/*
myDropzone.on("error", function(file, message) { myDropzone.on("error", function(file, message) {
myDropzone.removeFile(file); myDropzone.removeFile(file);
alert(message); alert(message);
}); });
*/
myDropzone.on("removedfile", function(file) { myDropzone.on("removedfile", function(file) {
var idx = delFileList.length; var idx = delFileList.length;
@ -138,25 +146,28 @@ $(window.document).ready(function() {
// 각 파일별 업로드 처리 완료 시 호출됨 (2th called) // 각 파일별 업로드 처리 완료 시 호출됨 (2th called)
myDropzone.on("complete", function(file) { myDropzone.on("complete", function(file) {
console.log("개별 파일 처리 완료 > file = " + JSON.stringify(file)); //alert("개별 파일 처리 완료 > file = " + JSON.stringify(file));
}); });
// 모든 업로드 처리 완료 시 호출됨 // 모든 업로드 처리 완료 시 호출됨
myDropzone.on("queuecomplete", function() { myDropzone.on("queuecomplete", function() {
var targetCnt = this.getAcceptedFiles().length; var targetCnt = this.getAcceptedFiles().length;
var uploadCnt = fileList.length; var uploadCnt = fileList.length;
var queuedCnt = this.getQueuedFiles();
console.log(targetCnt + " > " + uploadCnt);
if(uploadCnt > 0) { if(uploadCnt > 0) {
$("#fileList").val(JSON.stringify(JSON.stringify(fileList))); $("#fileList").val(JSON.stringify(JSON.stringify(fileList)));
} }
if(IN_PROC) { if(IN_PROC) {
if(queuedCnt > 0 && targetCnt > 0 && targetCnt != uploadCnt) { if(targetCnt > 0 && targetCnt != uploadCnt) {
alert("일부 첨부파일 등록이 실패하였습니다.\n총 " + targetCnt + "건의 첨부파일 중 " + uploadCnt + "건이 정상적으로 업로드 되었습니다.\n글 등록을 계속 진행합니다."); alert("일부 첨부파일 등록이 실패하였습니다.\n총 " + targetCnt + "건의 첨부파일 중 " + uploadCnt + "건이 정상적으로 업로드 되었습니다.\n글 등록을 계속 진행합니다.");
} }
fn_saveSubmit(); fn_saveSubmit();
} }
}); });
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -180,7 +191,7 @@ function fn_list() {
$('#articleForm').removeAttr('onsubmit'); $('#articleForm').removeAttr('onsubmit');
$("#articleForm").attr("action", "${pageContext.request.contextPath}/bbs/listQnas.do"); $("#articleForm").attr("action", "<c:out value='${pageContext.request.contextPath}' />/bbs/listQnas.do");
$("#articleForm").submit(); $("#articleForm").submit();
} }
@ -253,7 +264,6 @@ function fn_saveSubmit() {
$("#articleForm").submit(); $("#articleForm").submit();
} }
//파일 다운로드 //파일 다운로드
function fn_downloadFile(attachFileId, fileSn) { function fn_downloadFile(attachFileId, fileSn) {
@ -272,6 +282,7 @@ function fn_downloadFile(attachFileId, fileSn) {
$("#downloadFileForm").submit(); $("#downloadFileForm").submit();
} }
</script> </script>
@ -376,9 +387,11 @@ function fn_downloadFile(attachFileId, fileSn) {
<form name="downloadFileForm" id="downloadFileForm" <form name="downloadFileForm" id="downloadFileForm"
action="${pageContext.request.contextPath}/fileupload/downloadAttachFile.do" action="${pageContext.request.contextPath}/fileupload/downloadAttachFile.do"
method="post"> method="post">
<input type="hidden" name="bdType" id="bdType" value="ANCMNT" /> <input type="hidden" name="bdType" id="bdType" value="QNA" />
<input type="hidden" name="attachFileId" id="attachFileId" value="" /> <input type="hidden" name="attachFileId" id="attachFileId" value="" />
<input type="hidden" name="streFileNm" id="streFileNm" value="" /> <input type="hidden" name="streFileNm" id="streFileNm" value="" />
<input type="hidden" name="fileSn" id="fileSn" value="" /> <input type="hidden" name="fileSn" id="fileSn" value="" />
<input type="hidden" name="orignlFileNm" id="orignlFileNm" value="" /> <input type="hidden" name="orignlFileNm" id="orignlFileNm" value="" />
</form> </form>

View File

@ -38,7 +38,7 @@
$( document ).ready(function() { $( document ).ready(function() {
fn_setPageTitle("<c:out value='${pageTitle}'/>"); fn_setPageTitle("Q&A");
// 검색 수행 이벤트 // 검색 수행 이벤트
$("#btnSearch").on("click", function(e) { $("#btnSearch").on("click", function(e) {
@ -51,10 +51,10 @@
}); });
// 메시지 표출 // 메시지 표출
if(!gfn_isEmpty("<c:out value='${message}'/>")) { if(!gfn_isEmpty("<c:out value='${message}'/>") || !gfn_isEmpty("<c:out value='${searchArticle.resultMessage}'/>")) {
setTimeout(function() { setTimeout(function() {
alert("<c:out value='${message}'/>"); alert("<c:out value='${message}'/>" + " <c:out value='${searchArticle.resultMessage}'/>");
}, 1000); // 화면 표출되도록 딜레이 줌 }, 700); // 화면 표출되도록 딜레이 줌
} }
//초기 자료 조회 //초기 자료 조회