염성찬 염성찬 3 days ago
게시글 첨부 드래그·미리보기, 이전글/다음글, 목록 말줄임 수정
@a704bad495d24ebcd16ebc6957473dbaad5912fb
src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java
--- src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java
+++ src/main/java/kcc/let/cop/bbs/web/EgovBBSManageController.java
@@ -771,10 +771,11 @@
 		// 위/아래 게시글 번호, 제목 조회
 		EgovMap upDownNttid =  bbsMngService.getUpDownNttIdNSj(boardVO);
 		if(null != upDownNttid) {
-			/*model.addAttribute("nextNttIdNSj", upDownNttid.get("nextNttIdNSj"));
-			model.addAttribute("prevNttIdNSj", upDownNttid.get("prevNttIdNSj"));*/
-			model.addAttribute("nextNttIdNSj", upDownNttid.get("nextnttidnsj"));
-			model.addAttribute("prevNttIdNSj", upDownNttid.get("prevnttidnsj"));
+			// DB 드라이버에 따라 컬럼 별칭 대소문자가 달라 두 키 모두 확인 (MariaDB : prevNttIdNSj, CUBRID : prevnttidnsj)
+			Object nextNttIdNSj = upDownNttid.get("nextNttIdNSj") != null ? upDownNttid.get("nextNttIdNSj") : upDownNttid.get("nextnttidnsj");
+			Object prevNttIdNSj = upDownNttid.get("prevNttIdNSj") != null ? upDownNttid.get("prevNttIdNSj") : upDownNttid.get("prevnttidnsj");
+			model.addAttribute("nextNttIdNSj", nextNttIdNSj);
+			model.addAttribute("prevNttIdNSj", prevNttIdNSj);
 		}else {
 			model.addAttribute("nextNttIdNSj", null);
 			model.addAttribute("prevNttIdNSj", null);
src/main/webapp/WEB-INF/jsp/cmm/fms/EgovBBSFileList.jsp
--- src/main/webapp/WEB-INF/jsp/cmm/fms/EgovBBSFileList.jsp
+++ src/main/webapp/WEB-INF/jsp/cmm/fms/EgovBBSFileList.jsp
@@ -137,7 +137,7 @@
 					
 					<a href="javascript:fn_egov_downFile('<c:out value="${fileVO.atchFileId}"/>','<c:out value="${fileVO.fileSn}"/>')" class="fileName file_row" title="다운로드">
 						<i class="icon file"></i>
-						<span><c:out value="${fileVO.orignlFileNm}"/>&nbsp;<%-- [<c:out value="${fileVO.fileMg}"/>&nbsp;byte] --%></span>
+						<span title="<c:out value='${fileVO.orignlFileNm}'/>"><c:out value="${fileVO.orignlFileNm}"/>&nbsp;<%-- [<c:out value="${fileVO.fileMg}"/>&nbsp;byte] --%></span>
 					</a>
 				</c:otherwise>
 			</c:choose>
src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovUserSelectUpdt.jsp
--- src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovUserSelectUpdt.jsp
+++ src/main/webapp/WEB-INF/jsp/cmm/uss/umt/EgovUserSelectUpdt.jsp
@@ -186,27 +186,7 @@
 // 서명이미지 미리보기 (저장된 파일)
 function fn_sign_preview(atchFileId, fileSn) {
 	var src = "<c:url value='/cmm/fms/getImage.do'/>?atchFileId=" + encodeURIComponent(atchFileId) + "&fileSn=" + encodeURIComponent(fileSn);
-	fn_open_image_popup(src);
-}
-
-// 이미지 미리보기 팝업 (새로 첨부한 파일은 ncms_common.js 의 previewNewFile 에서 호출)
-// 화면 중앙 레이어로 표시. 바깥 영역 클릭, 닫기 버튼, ESC 로 닫힘
-function fn_open_image_popup(src) {
-	fn_close_image_popup();
-	var $layer = $('<div id="signPreviewLayer" style="position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;background:rgba(0,0,0,0.6);display:flex;align-items:center;justify-content:center;"></div>');
-	var $box = $('<div style="position:relative;background:#fff;padding:20px;border-radius:8px;max-width:90vw;max-height:90vh;box-shadow:0 4px 20px rgba(0,0,0,0.3);"></div>');
-	var $close = $('<button type="button" title="닫기" style="position:absolute;top:-14px;right:-14px;width:32px;height:32px;border-radius:50%;border:none;background:#333;color:#fff;font-size:18px;line-height:32px;cursor:pointer;">&times;</button>');
-	var $img = $('<img alt="서명이미지" style="display:block;max-width:calc(90vw - 40px);max-height:calc(90vh - 40px);">').attr('src', src);
-	$box.append($close).append($img).on('click', function(e){ e.stopPropagation(); });
-	$close.on('click', fn_close_image_popup);
-	$layer.append($box).on('click', fn_close_image_popup);
-	$('body').append($layer);
-	$(document).on('keydown.signPreview', function(e){ if (e.keyCode == 27) fn_close_image_popup(); });
-}
-
-function fn_close_image_popup() {
-	$('#signPreviewLayer').remove();
-	$(document).off('keydown.signPreview');
+	fn_open_image_popup(src); // ncms_common.js 공통 팝업
 }
 
 function updateMemberAjax(){
src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeList.jsp
--- src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeList.jsp
+++ src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeList.jsp
@@ -300,7 +300,7 @@
 								</td>
 								<td><b style="color:#1e4fc0;">공지</b></td>
 								<td>
-									<a href="javascript:fn_egov_inqire_notice('<c:out value="${result.bbsId}"/>', '<c:out value="${result.nttId}"/>');">
+									<a href="javascript:fn_egov_inqire_notice('<c:out value="${result.bbsId}"/>', '<c:out value="${result.nttId}"/>');" title="<c:out value='${result.nttSj}'/>">
 									<c:out value="${result.nttSj}" />
 										<c:if test="${brdMstrVO.openYn == 'Y'}">
 											<c:if test="${result.secretAt == 'Y'}">
@@ -364,7 +364,7 @@
 											<i class="icon lock"></i>
 										</c:if>
 									</c:if>
-									<a href="javascript:fn_egov_inqire_notice('<c:out value="${result.bbsId}"/>', '<c:out value="${result.nttId}"/>');">
+									<a href="javascript:fn_egov_inqire_notice('<c:out value="${result.bbsId}"/>', '<c:out value="${result.nttId}"/>');" title="<c:out value='${result.nttSj}'/>">
 										<c:out value="${result.nttSj}" />
 									</a>
 								</td>
src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeRegist.jsp
--- src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeRegist.jsp
+++ src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeRegist.jsp
@@ -181,7 +181,8 @@
 	
 	<!-- 드래그앤 드롭 파라미터 -->
 	<input type="hidden" name="limitcount" value="${bdMstr.posblAtchFileNumber}" />
-	
+	<input type="hidden" name="filePreviewYn" value="Y" /><!-- 이미지 첨부 시 미리보기 버튼 노출 -->
+
 	
 	<!-- cont_tit -->
 	<div class="content_title">
@@ -332,7 +333,7 @@
 							<span class="required">*</span>
 							첨부파일
 						</th>
-						<td>
+						<td class="upload_area">
 							<!-- <input type="text" id="fileNm" size="30" class="file_input" readonly> --><!-- <button type="button" class="btnType01 btn_add_file">파일 첨부하기</button> -->
 							<div class="file_upload_wrap">
 								<input type="file" id="file_temp" name="file_temp" class="uploadFile" style="display:none"/>
src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeUpdt.jsp
--- src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeUpdt.jsp
+++ src/main/webapp/WEB-INF/jsp/cop/bbs/EgovNoticeUpdt.jsp
@@ -185,6 +185,7 @@
 			<input type="hidden" name="previewImgs" value="" />
 			<input type="hidden" name="checkProhibitCn" value="" />
 			<input type="hidden" name="limitcount" value="${bdMstr.posblAtchFileNumber}" />
+			<input type="hidden" name="filePreviewYn" value="Y" /><!-- 이미지 첨부 시 미리보기 버튼 노출 -->
 			<!-- 기 업로드 파일 개수 -->
 			
 			<!-- 드래그앤 드롭 파라미터 -->
@@ -349,7 +350,7 @@
 								<th class="req_text">
 									<p>첨부파일</p>
 								</th>
-								<td>
+								<td class="upload_area">
 									<!-- <input type="text" id="fileNm" size="30" class="file_input" readonly> --><!-- <button type="button" class="btnType01 btn_add_file">파일 첨부하기</button> -->
 									
 									<div class="file_upload_wrap">
@@ -408,6 +409,10 @@
 															<td class="td_filename">
 																<!-- <img src="/direct/img/upload_hwp_img.png" alt="" /> -->
 																<span class="file_name_text">${fileList.orignlFileNm}</span>
+																<c:set var="_ext" value="${fn:toLowerCase(fileList.fileExtsn)}"/>
+																<c:if test="${_ext eq 'jpg' or _ext eq 'jpeg' or _ext eq 'png' or _ext eq 'gif'}">
+																	<button type="button" class="btn line primary ssmall" style="margin-left:10px;" onclick="fn_saved_file_preview('<c:out value='${fileList.atchFileId}'/>', '<c:out value='${fileList.fileSn}'/>'); return false;">미리보기</button>
+																</c:if>
 															</td>
 															<td class="td_filesort">
 																<span class="file_filesort_text" value="<c:out value="${fileList.fileExtsn}"/>"><c:out value="${fileList.fileExtsn}"/></span>
src/main/webapp/js/ncms_common.js
--- src/main/webapp/js/ncms_common.js
+++ src/main/webapp/js/ncms_common.js
@@ -256,16 +256,37 @@
    }
 }
 
+/* 이미지 미리보기 팝업 (공통)
+ * 화면 중앙 레이어로 표시. 바깥 영역 클릭, 닫기 버튼, ESC 로 닫힘 */
+function fn_open_image_popup(src) {
+	fn_close_image_popup();
+	var $layer = $('<div id="imagePreviewLayer" style="position:fixed;top:0;left:0;right:0;bottom:0;z-index:10000;background:rgba(0,0,0,0.6);display:flex;align-items:center;justify-content:center;"></div>');
+	var $box = $('<div style="position:relative;background:#fff;padding:20px;border-radius:8px;max-width:90vw;max-height:90vh;box-shadow:0 4px 20px rgba(0,0,0,0.3);"></div>');
+	var $close = $('<button type="button" title="닫기" style="position:absolute;top:-14px;right:-14px;width:32px;height:32px;border-radius:50%;border:none;background:#333;color:#fff;font-size:18px;line-height:32px;cursor:pointer;">&times;</button>');
+	var $img = $('<img alt="미리보기" style="display:block;max-width:calc(90vw - 40px);max-height:calc(90vh - 40px);">').attr('src', src);
+	$box.append($close).append($img).on('click', function(e){ e.stopPropagation(); });
+	$close.on('click', fn_close_image_popup);
+	$layer.append($box).on('click', fn_close_image_popup);
+	$('body').append($layer);
+	$(document).on('keydown.imagePreview', function(e){ if (e.keyCode == 27) fn_close_image_popup(); });
+}
+
+function fn_close_image_popup() {
+	$('#imagePreviewLayer').remove();
+	$(document).off('keydown.imagePreview');
+}
+
+/* 저장된 첨부 이미지 미리보기 */
+function fn_saved_file_preview(atchFileId, fileSn) {
+	fn_open_image_popup("/cmm/fms/getImage.do?atchFileId=" + encodeURIComponent(atchFileId) + "&fileSn=" + encodeURIComponent(fileSn));
+}
+
 /* 새로 첨부한 이미지 미리보기 (저장 전, 브라우저 메모리의 파일을 띄움) */
 var _previewUrls = {};
 function previewNewFile(idx){
 	var url = _previewUrls[idx];
 	if (!url) return;
-	if (typeof fn_open_image_popup === 'function') {
-		fn_open_image_popup(url);
-	} else {
-		window.open(url, "filePreview", "width=600,height=400,resizable=yes,scrollbars=yes");
-	}
+	fn_open_image_popup(url);
 }
 
 function sendFileToServer(formData, obj , fileObj, _fileIdx)
src/main/webapp/publish/adm/css/table.css
--- src/main/webapp/publish/adm/css/table.css
+++ src/main/webapp/publish/adm/css/table.css
@@ -50,3 +50,9 @@
 .file_table#egov_file_view_table tr{border:0;}
 .file_table#egov_file_view_table td{height:auto;text-align:left;}
 .file_table#egov_file_view_table td .file_row{display:inline-flex;font-size:16px;font-weight:400;align-items:center;gap:8px;}
+
+/* 목록 제목/첨부파일명 말줄임(...) : 링크(a)가 inline-block 이라 칸 말줄임이 안 먹어 링크 자체에 적용 */
+.table_type_cols tbody>tr>td>a{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;}
+.table_type_cols td>.file_table#egov_file_view_table{width:100%;table-layout:fixed;}
+.table_type_cols td>.file_table#egov_file_view_table td .file_row{display:flex;max-width:100%;}
+.table_type_cols td>.file_table#egov_file_view_table td .file_row span{flex:1;min-width:0;width:auto;}
Add a comment
List