<%--
  Class Name : EgovNoticeInqire.jsp
  Description : 게시물 조회 화면
  Modification Information
 
      수정일      수정자              수정내용
     ----------  --------    ---------------------------
     2009.03.23   이삼섭        최초 생성
     2009.06.26   한성곤        2단계 기능 추가 (댓글관리, 만족도조사)
     2011.08.31   JJY       	경량환경 버전 생성
     2013.05.23   이기하       	상세보기 오류수정
 
    author   : 공통서비스 개발팀 이삼섭
    since    : 2009.03.23
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator"%>
<%
	pageContext.setAttribute("crlf", "\r\n");
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko">
<script type="text/javascript" src="<c:url value='/js/EgovBBSMng.js' />"></script>
<script type="text/javascript">
	function fn_egov_select_noticeList(pageNo) {
		document.searchForm.action = "<c:url value='/cop/bbs/selectBoardList.do'/>";
		document.searchForm.submit();
	}

	function fn_egov_delete_notice() {
		var bbsId = $("#bbsId");
		if (confirm('<spring:message code="common.delete.msg" />')) {
			document.searchForm.action = "<c:url value='/cop/bbs/deleteBoardArticle.do?bbsId='/>"+bbsId;
			document.searchForm.submit();
		}
	}

	function fn_egov_moveUpdt_notice() {
		document.searchForm.action = "<c:url value='/cop/bbs/forUpdateBoardArticle.do'/>";
		document.searchForm.method = "get";
		document.searchForm.submit();
	}

	function fn_egov_addReply() {
		document.frm.action = "<c:url value='/cop/bbs/addReplyBoardArticle.do'/>";
		document.frm.submit();
	}
</script>

<!-- 댓글 작성 스크립트  -->
<c:if test="${brdMstrVO.addYn == 'Y'}">
	<script type="text/javascript" src="<c:url value="/validator.do"/>"></script>
	<validator:javascript formName="articleComment" staticJavascript="false" xhtml="true" cdata="false" />
	<script type="text/javascript">
		// 댓글 등록
		function fn_egov_insert_commentList() {

			var form = document.getElementById("articleCommentVO");

			if (!validateArticleComment(form)) {
				return;
			}
			if (confirm('<spring:message code="common.regist.msg" />')) {
				form.submit();
			}
		}

		// 댓글 수정
		function fn_egov_updt_commentList() {

			var form = document.getElementById("articleCommentVO");

			if (!validateArticleComment(form)) {
				return;
			}

			if (confirm('<spring:message code="common.update.msg" />')) {
				form.modified.value = "true";
				form.action = "<c:url value='/cop/cmt/updateArticleComment.do'/>";
				form.submit();
			}
		}

		// 댓글 수정 화면
		function fn_egov_selectCommentForupdt(commentNo) {

			var form = document.getElementById("articleCommentVO");

			//form.subPageIndex.value = pageNo;

			form.commentNo.value = commentNo;
			form.action = "<c:url value='/cop/bbs/selectBoardArticle.do'/>";
			form.submit();
		}

		// 댓글 삭제
		function fn_egov_deleteCommentList(commentNo) {

			var form = document.getElementById("articleCommentVO");

			if (confirm('<spring:message code="common.delete.msg" />')) {
				form.modified.value = "true";
				form.commentNo.value = commentNo;
				form.action = "<c:url value='/cop/cmt/deleteArticleComment.do'/>";
				form.submit();
			}
		}

		/* 댓글페이징 */
		function fn_egov_select_commentList(pageNo) {

			var form = document.getElementById("articleCommentVO");

			form.subPageIndex.value = pageNo;
			form.commentNo.value = '';
			form.action = "<c:url value='/cop/bbs/selectBoardArticle.do'/>";
			form.submit();
		}
	</script>
</c:if>
<!-- //댓글 작성 스크립트  -->
<title><c:out value='${result.bbsNm}' /> - 글 조회</title>
</head>
<body>
<style lang="text/css">
.tdCn img {max-width: 100%;}
</style>
	<div class="cont_area">
		<div class="cont_main_title">
			<img src="/direct/img/home_icon.png" alt="">
			<span id="cnt_cate_list"></span>&ensp;>&ensp;글 상세
		</div>

		<div class="list_wrap setting_list_wrap">
		
		<form:form commandName="searchForm" name="searchForm" method="get" action="<c:url value='/cop/bbs/selectBoardList.do'/>">
			<input name="pageIndex" type="hidden" value="<c:out value='${searchVO.pageIndex}'/>" />
			<input name="searchCnd" type="hidden" value="<c:out value='${searchVO.searchCnd}'/>" />
			<input name="searchWrd" type="hidden" value="<c:out value='${searchVO.searchWrd}'/>" />
			<input type="hidden" name="atchFileId" value="<c:out value='${result.atchFileId}'/>">
			<input name="bbsId" id="bbsId" type="hidden" value="<c:out value='${result.bbsId}'/>" />
			<input name="nttId" type="hidden" value="<c:out value='${result.nttId}'/>" />
			<c:if test="${not empty brdMstrVO.seCmmnCdId}"> <!-- 구분 조회 -->
				<input type="hidden" name="searchSeCd" value="<c:out value='${searchVO.searchSeCd}'/>" />
			</c:if>
		</form:form>

		<form name="frm" method="post" action="<c:url value='/cop/bbs/selectBoardList.do'/>">
			<input type="hidden" name="pageIndex" value="<c:out value='${searchVO.pageIndex}'/>">
			<input type="hidden" name="searchCnd" value="<c:out value='${searchVO.searchCnd}'/>" />
			<input type="hidden" name="searchWrd" value="<c:out value='${searchVO.searchWrd}'/>" />
			<c:if test="${not empty brdMstrVO.seCmmnCdId}"> <!-- 구분 조회 -->
			<input type="hidden" name="searchSeCd" value="<c:out value='${searchVO.searchSeCd}'/>" />
			</c:if>
			
			<input type="hidden" name="bbsId" value="<c:out value='${result.bbsId}'/>">
			<input type="hidden" name="nttId" value="<c:out value='${result.nttId}'/>">
			<input type="hidden" name="parnts" value="<c:out value='${result.parnts}'/>">
			<input type="hidden" name="sortOrdr" value="<c:out value='${result.sortOrdr}'/>">
			<input type="hidden" name="replyLc" value="<c:out value='${result.replyLc}'/>">
			<input type="hidden" name="nttSj" value="<c:out value='${result.nttSj}'/>">

			<input type="hidden" name="atchFileId" value="<c:out value='${result.atchFileId}'/>">
			<input type="hidden" name="thumbAtchFileId" value="<c:out value='${result.thumbAtchFileId}'/>">
			
			<table class="list_view">
				<colgroup>
					<col style="width: 150px;">
					<col style="width: auto;">
					<col style="width: 150px;">
					<col style="width: auto;">
					<col style="width: 150px;">
					<col style="width: auto;">
				</colgroup>
				<c:if test="${not empty brdMstrVO.seCmmnCdId}">
					<tr>
						<th><div class="listTitle">구분</div></th>
						<td colspan="5"><c:out value="${result.seNm}" /></td>
					</tr>
					</c:if>

					<c:if test="${brdMstrVO.ntceDateYn == 'Y'}">
					<tr>
						<th><div class="listTitle">기간</div></th>
						<td colspan="5">
							<c:if test="${not empty result.ntceBgnde && not empty result.ntceEndde}">
								<c:out value="${result.ntceBgnde}" /> ~ <c:out value="${result.ntceEndde}" />
							</c:if>
						</td>
					</tr>
					</c:if>

					<tr>
						<th style="min-width: 100px;"><div class="listTitle">제목</div></th>
						<td colspan="5"><c:out value="${result.nttSj}" /></td>
					</tr>
					<tr>
						<th><div class="listTitle">등록자</div></th>
						<td>
							<c:out value="${result.frstRegisterNm}" />
							<c:out value="${result.partTitle}" />
							<c:out value="${result.offmTelno}" />
						</td>
						
						<c:if test="${brdMstrVO.bbsTyCode == 'BBST03'}">
						<th>신고유형</th>
						<td>
							<c:out value="${result.reportTyNm}" />
						</td>
						</c:if>
						
						<th>등록시간</th>
						<td>
							<c:out value="${result.frstRegisterPnttm}" />
						</td>
						<th>조회수</th>
						<td>
							<c:out value="${result.inqireCo}" />
						</td>
					</tr>
					<c:if test="${brdMstrVO.ipYn == 'Y'}">
					<tr>
						<th>등록자 IP</th>
						<td colspan="5"><c:out value="${result.ntcrIp}" /></td>
					</tr>
					</c:if>
					<tr>
						<th><div class="listTitle">글내용</div></th>
						<td colspan="5" class="tdCn" style="overflow: auto;">
							<div id="bbs_cn">
								<c:out value="${result.nttCn}" escapeXml="false" />
							</div>
						</td>
					</tr>
					
					<c:if test="${not empty result.atchFileId}">
					<tr>
						<th>첨부파일 목록</th>
						<td colspan="5">
							<c:import url="/cmm/fms/selectBBSFileInfs.do" charEncoding="utf-8">
								<c:param name="param_atchFileId" value="${result.atchFileId}" />
								<c:param name="pdf_view" value="Y" />
							</c:import>
						</td>
					</tr>
					</c:if>
					<c:if test="${brdMstrVO.thumbAtchFileYn == 'Y'}">
					<tr>
						<th>썸네일파일</th>
						<td colspan="5">
							<c:import url="/cmm/fms/selectBBSFileInfs.do" charEncoding="utf-8">
								<c:param name="param_atchFileId" value="${result.thumbAtchFileId}" />
							</c:import>
						</td>
					</tr>
					</c:if>
					
					<!-- 링크 -->
					<c:if test="${brdMstrVO.linkUrlYn == 'Y'}">
					<tr>
						<th>링크URL</th>
						<td colspan="5"><c:out value="${result.linkUrl}" /></td>
					</tr>
					</c:if>
					
					<!-- 링크 -->
					<c:if test="${brdMstrVO.koglCnYn == 'Y'}">
					<tr>
						<th>공공누리</th>
						<td colspan="5">
							<c:if test="${not empty result.koglCn}">
								<c:out value="${result.koglCn}" />유형
							</c:if>
						</td>
					</tr>
					</c:if>
					
					<tr>
						<th><div class="listTitle">최종수정일</div></th>
						<td colspan="5">
							<c:out value="${result.lastUpdusrPnttm}" />
						</td>
					</tr>
					<tr>
						<th><div class="listTitle">최종작성자</div></th>
						<td colspan="5">
							<c:out value="${result.lastUpdusrNm}" />
						</td>
					</tr>
			</table>
			</form>
		</div>
		<div class="setting_btn">
			<input type="button" value="목록" class="list_btn" onclick="javascript:fn_egov_select_noticeList(); return false;">
			<c:if test="${userCheck.authorCode == 'ROLE_ADMIN'}">
			<input type="button" value="삭제" class="del_btn" onclick="javascript:fn_egov_delete_notice(); return false;">
			<input type="button" value="수정" class="edit_btn" onclick="javascript:fn_egov_moveUpdt_notice(); return false;">
			</c:if>
		</div>
	

		<!-- 윗글 아랫글 -->
		<div class="updown_bbs setListTitle_wrap setting_list_wrap">
			<table style="width: 100%; table-layout: fixed;"><!-- div class="up_bbs" -->
				<colgroup>
					<col style="width: 150px;">
					<col style="width: auto;">
				</colgroup>
				<tr>
				<c:choose>
					<c:when test="${empty nextNttIdNSj}">
						<th>이전글</th>
						<td class="setListnbTitle"><span class="setListTitle">이전글이 없습니다.</span></td>
						<td><span class="dateCmmt"></span></td>
						</c:when>
					<c:otherwise>
						<c:set var="nextNttId" value="${fn:split(nextNttIdNSj, '|')[0]}" />
						<c:set var="nextNttSj" value="${fn:split(nextNttIdNSj, '|')[1]}" />
						<th>이전글 <input type="button" class="beforeListBtn"></th>
						<td class="setListnbTitle">
							<span class="setListTitle">
								<a href="<c:url value='/cop/bbs/selectBoardArticle.do'/>?bbsId=<c:out value='${result.bbsId}'/>&nttId=<c:out value='${nextNttId}'/>">
									<c:out value="${nextNttSj}" />
								</a>
							</span>
						</td>
						<td>
<!-- 							<span class="dateCmmt">2019-09-09</span> -->
						</td>
					</c:otherwise>
				</c:choose>
				</tr>
				<tr>
				<c:choose>
					<c:when test="${empty prevNttIdNSj}">
						<th>다음글</th> <!-- span class="down_arrow" -->
						<td class="setListnbTitle"><span class="setListTitle">다음글이 없습니다.</span></td>
						<td><span class="dateCmmt"></span></td>
					</c:when>
					<c:otherwise>
						<c:set var="prevNttId" value="${fn:split(prevNttIdNSj, '|')[0]}" />
						<c:set var="prevNttSj" value="${fn:split(prevNttIdNSj, '|')[1]}" />
						<th>다음글 <input type="button" class="nextListBtn"></th>
						<td class="setListnbTitle">
							<span class="setListTitle">				
								<a href="<c:url value='/cop/bbs/selectBoardArticle.do'/>?bbsId=<c:out value='${result.bbsId}'/>&nttId=<c:out value='${prevNttId}'/>">
									<c:out value="${prevNttSj}" />
								</a>
							</span>
						</td>
						<!-- <td>
							<span class="dateCmmt">2019-09-09</span>
						</td> -->
					</c:otherwise>
				</c:choose>
				</tr>
			</table>		
			</div>
					<c:if test="${brdMstrVO.addYn == 'Y'}">
						<c:import url="/cop/cmt/selectArticleCommentList.do" charEncoding="utf-8">
						</c:import>
					</c:if>	
	</div>
	<!-- //content 끝 -->
</body>
</html>

