From 154957b0816b382c4465d518b01ad5b8bf7f0d1f Mon Sep 17 00:00:00 2001 From: KNKIM Date: Tue, 14 Dec 2021 18:04:07 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=A9=EB=8F=8C=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp | 59 +++++++++++-------- .../webapp/WEB-INF/jsp/nlib/bbs/listQnas.jsp | 8 +-- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp b/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp index 48f7a594..b066b91d 100644 --- a/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/nlib/bbs/insertQnaForm.jsp @@ -42,11 +42,11 @@ - + - + @@ -73,7 +73,7 @@ $(window.document).ready(function() { nhn.husky.EZCreator.createInIFrame({ oAppRef: oEditors, elPlaceHolder: "content", - sSkinURI: "${pageContext.request.contextPath}/js/smartEditor/SmartEditor2Skin.html", + sSkinURI: "/js/smartEditor/SmartEditor2Skin.html", fCreator: "createSEditor2" }); @@ -82,20 +82,24 @@ $(window.document).ready(function() { //-------------------------------------------------------------------- // 파일업로드 객체 생성 myDropzone = new Dropzone("form#myDropzone", { - url: "${pageContext.request.contextPath}/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath&attachFileId=" - }); + url: "/fileupload/uploadFilesAjax.do?subPathKey=fileupload.bbs.qna.subpath&attachFileId=", + maxFilesize: , + maxFiles: , + parallelUploads: , + acceptedFiles: "" + }); // 기존 첨부파일 출력 var re = /(?:\.([^.]+))?$/; myDropzone.addFile({ - name: '${attachFile.orignlFileNm}', - size:${attachFile.fileSize}, - type:re.exec('${attachFile.orignlFileNm}')[1], - attachFileId: '${attachFile.attachFileId}', - streFileNm: '${attachFile.streFileNm}', - fileSn: '${attachFile.fileSn}', + name: '', + size: , + type:re.exec('')[1], + attachFileId: '', + streFileNm: '', + fileSn: '', fileUploadType: 'uploaded' }); @@ -104,8 +108,14 @@ $(window.document).ready(function() { // 각 파일별 업로드 성공시 호출됨 (1th called) myDropzone.on("success", function(file, 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; fileList[idx++] = { "attachFileId" : jobj[0].attachFileId, @@ -118,12 +128,10 @@ $(window.document).ready(function() { console.log("success : " + file.name + " -> " + "data > " + jobj[0].streFileNm); }); - /* myDropzone.on("error", function(file, message) { myDropzone.removeFile(file); alert(message); - }); - */ + }); myDropzone.on("removedfile", function(file) { var idx = delFileList.length; @@ -138,25 +146,28 @@ $(window.document).ready(function() { // 각 파일별 업로드 처리 완료 시 호출됨 (2th called) myDropzone.on("complete", function(file) { - console.log("개별 파일 처리 완료 > file = " + JSON.stringify(file)); + //alert("개별 파일 처리 완료 > file = " + JSON.stringify(file)); }); - + // 모든 업로드 처리 완료 시 호출됨 myDropzone.on("queuecomplete", function() { var targetCnt = this.getAcceptedFiles().length; var uploadCnt = fileList.length; - var queuedCnt = this.getQueuedFiles(); + + console.log(targetCnt + " > " + uploadCnt); if(uploadCnt > 0) { $("#fileList").val(JSON.stringify(JSON.stringify(fileList))); } if(IN_PROC) { - if(queuedCnt > 0 && targetCnt > 0 && targetCnt != uploadCnt) { + if(targetCnt > 0 && targetCnt != uploadCnt) { alert("일부 첨부파일 등록이 실패하였습니다.\n총 " + targetCnt + "건의 첨부파일 중 " + uploadCnt + "건이 정상적으로 업로드 되었습니다.\n글 등록을 계속 진행합니다."); } fn_saveSubmit(); } + + }); //-------------------------------------------------------------------- @@ -180,7 +191,7 @@ function fn_list() { $('#articleForm').removeAttr('onsubmit'); - $("#articleForm").attr("action", "${pageContext.request.contextPath}/bbs/listQnas.do"); + $("#articleForm").attr("action", "/bbs/listQnas.do"); $("#articleForm").submit(); } @@ -253,7 +264,6 @@ function fn_saveSubmit() { $("#articleForm").submit(); } - //파일 다운로드 function fn_downloadFile(attachFileId, fileSn) { @@ -272,6 +282,7 @@ function fn_downloadFile(attachFileId, fileSn) { $("#downloadFileForm").submit(); } + @@ -376,9 +387,11 @@ function fn_downloadFile(attachFileId, fileSn) {
- +
+ + diff --git a/src/main/webapp/WEB-INF/jsp/nlib/bbs/listQnas.jsp b/src/main/webapp/WEB-INF/jsp/nlib/bbs/listQnas.jsp index 28fb8c2e..9698e738 100644 --- a/src/main/webapp/WEB-INF/jsp/nlib/bbs/listQnas.jsp +++ b/src/main/webapp/WEB-INF/jsp/nlib/bbs/listQnas.jsp @@ -38,7 +38,7 @@ $( document ).ready(function() { - fn_setPageTitle(""); + fn_setPageTitle("Q&A"); // 검색 수행 이벤트 $("#btnSearch").on("click", function(e) { @@ -51,10 +51,10 @@ }); // 메시지 표출 - if(!gfn_isEmpty("")) { + if(!gfn_isEmpty("") || !gfn_isEmpty("")) { setTimeout(function() { - alert(""); - }, 1000); // 화면 표출되도록 딜레이 줌 + alert("" + " "); + }, 700); // 화면 표출되도록 딜레이 줌 } //초기 자료 조회