<%--
  Class Name : EgovNoticeReply.jsp
  Description : 게시물 답글 생성 화면
  Modification Information
 
      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.03.24   이삼섭              최초 생성
     2011.08.31   JJY       경량환경 버전 생성
 
    author   : 공통서비스 개발팀 이삼섭
    since    : 2009.03.24
--%>
<%@ 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"%>
<%@ taglib prefix="ckeditor" uri="http://ckeditor.com"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko">
<script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script>
<script type="text/javascript" src="<c:url value="/validator.do"/>"></script>
<validator:javascript formName="board" staticJavascript="false" xhtml="true" cdata="false" />
<script type="text/javascript">
    function fn_egov_validateForm(obj) {
        return true;
    }

    function fn_egov_regist_notice() {
    	CKEDITOR.instances.nttCn.updateElement();

        if (!validateBoard(document.board)){
            return;
        }
        
      	//금지어 확인
		/* var prohibitCheck = false;
		var form = document.board ;
		form.checkProhibitCn.value = form.nttSj.value + form.nttCn.value ; 
		var data = new FormData(form);
		
		$.ajax({
		type: "POST",
		     url: "/uss/ion/cnf/prohiCheckAjax.do",
		     async:false,
		     data: data,
		     dataType:'json',
		     processData: false,
		     contentType: false,
		     cache: false,
		     timeout: 600000,
		     success: function (returnData, status) {
		     	if(status == 'success'){
			    	if(returnData.result == 'fail'){
			        }else if(returnData.result == 'auth_fail'){
			        }else if(returnData.result =='success'){
			        	if(null != returnData.prohibitVO.prohibitCn){
			        		alert( returnData.prohibitVO.prohibitCn + " 단어는 금지어로 등록되어 있는 단어입니다." );
			        		prohibitCheck = true;
			        	}
		           	}
	           }else{
		           	//alert("등록에 실패하였습니다.");
	           }
	       },
	       error: function (e) {
	           //alert("등록에 실패하였습니다.");
	       }
		});
   
		if(prohibitCheck){
			return;
		} */
		
		
        if (confirm('<spring:message code="common.regist.msg" />')) {
        	goSave();
        	/* document.board.action = "<c:url value='/cop/bbs${prefix}/replyBoardArticle.do'/>";
            document.board.target = "_self";
            document.board.submit(); */                    
        }
    }
    
    function goList() {
        document.searchForm.action = "<c:url value='/cop/bbs/selectBoardList.do'/>";
        document.searchForm.submit();
    }
	
	function fn_egov_regist_preview() {
		var PCC_window = window.open('', 'PCCV3Window', 'width=850, height=570, resizable=1, scrollbars=yes, status=0, titlebar=0, toolbar=0, left=350, top=50' );
		
		var previewImgs = "";
		var i = 0;
		
		$("#DIV_IMG_VIEW").find("img").each(function() {
			previewImgs += $(this).get(0).src + "^";
			i++;
		});
		
		document.board.previewImgs.value = previewImgs;
		document.board.action = "<c:url value='/cop/bbs/bbsPreview.do'/>";
		document.board.target = "PCCV3Window";
		document.board.submit();
	}
</script>
<title><c:out value='${bdMstr.bbsNm}' /> - 답글 등록</title>
</head>
<body>
	<div class="contWrap">
		<div class="pageTitle">
			<div class="pageIcon"><img src="/pb/img/pageTitIcon4.png" alt=""></div>
			<h2 class="titType1 c_222222 fwBold"><c:out value='${bdMstr.bbsNm}' /> - 글 수정</h2>
			<p class="tType6 c_999999">사이트별로 게시판을 생성할 수 있습니다.</p>
		</div>

		<div class="pageCont">
			<div class="listTop resisterList">
				<p class="right block fwMd"><span class="tType4 c_e40000 fwBold">*</span>는 필수입력 항목입니다.</p>
			</div>
			
			<form:form commandName="searchForm" name="searchForm" method="get" action="">
				<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 name="bbsId" type="hidden" value="<c:out value='${searchVO.bbsId}'/>" />
			</form:form>
			<form:form commandName="board" name="board" method="post" enctype="multipart/form-data">
				<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}'/>" />
				<input type="hidden" name="nttId" value="<c:out value='${searchVO.nttId}'/>" />
				<input type="hidden" name="bbsId" value="<c:out value='${bdMstr.bbsId}'/>" />
				<input type="hidden" name="parnts" value="<c:out value='${searchVO.parnts}'/>" />
				<input type="hidden" name="sortOrdr" value="<c:out value='${searchVO.sortOrdr}'/>" />
				<input type="hidden" name="replyLc" value="<c:out value='${searchVO.replyLc}'/>" />
				<input type="hidden" name="previewImgs" value="" />
				<input type="hidden" name="pageType" id="pageType" value="replay" /><!--  답글 -->
				
				<input type="hidden" name="checkProhibitCn" value="" />
				
				<!-- 기 업로드 파일 개수 -->
				
				<!-- 드래그앤 드롭 파라미터 -->
				<input type="hidden" name="menuName" value="board" />
				<input type="hidden" name="fmsId" value="${board.nttId}" />
				<input type="hidden" name="atchFileId" value="${board.atchFileId}" />
				<input type="hidden" name="atchFileNece" id="atchFileNece" value="N" /> <!-- 첨부파일 필수체크 -->
				<input type="hidden" name="limitcount" value="${bdMstr.posblAtchFileNumber}" />
	
				<table class="tbType2">
					<colgroup>
						<col style="width: 20%">
						<col style="width: 80%">
					</colgroup>
					<tbody>
						<tr>
							<th>
								<spring:message code="cop.nttSj" var="msgNttSj" />
								<span class="reqArea"><c:out value="${msgNttSj}" /></span>
							</th>
							<td>
								<form:input path="nttSj" title="${msgNttSj}" />
								<form:errors path="nttSj" />
							</td>
						</tr>
						<tr>
							<th><span class="reqArea"><spring:message code="cop.nttCn" /></span></th>
							<td>
								<textarea id="nttCn" name="nttCn" title="<spring:message code="cop.nttCn" />" cols="500" rows="20">
									<c:out value="${board.nttCn}" escapeXml="false" />
								</textarea>
								<ckeditor:replace replace="nttCn" basePath="${pageContext.request.contextPath}/html/egovframework/com/cmm/utl/ckeditor/" />
								<form:errors path="nttCn" />
							</td>
						</tr>
						<c:if test="${bdMstr.fileAtchPosblAt == 'Y'}">
						<c:set var="isImgView" value="false" />
						<c:set var="isImgBbs" value="false" />
						<c:if test="${bdMstr.bbsTyCode == 'BBST05' || bdMstr.bbsTyCode == 'BBST06'}">
						<c:set var="isImgView" value="true" />
						<c:set var="isImgBbs" value="true" />
							<tr>
								<th>첨부파일 이미지</th>
								<td>
									<div>
										<c:import url="/cmm/fms/selectImageFileInfs.do" charEncoding="utf-8">
											<c:param name="atchFileId" value="${board.atchFileId}" />
										</c:import>
									</div>
									<div id="DIV_IMG_ATCH"></div>
								</td>
							</tr>
						</c:if>
						
						<tr>
						<th><span class="reqArea">파일 첨부</span></th>
						<td class="upload_area">
							<div class="file_upload_box no_img_box fileWrap">
								<table>	
									<colgroup>
										<col style="width: 60%">
										<col style="width: 10%">
										<col style="width: 20%">
										<col style="width: 10%">
									</colgroup>
									<thead>
										<tr>
										<th>파일명</th>
										<th>크기</th>
										<th>등록일시</th>
										<th>삭제</th>
										</tr>
									</thead>
								</table>
							</div>
							<div class="fileWrap fileAfter file_list_div">
								<table>
									<colgroup>
										<col style="width: 60%">
										<col style="width: 10%">
										<col style="width: 20%">
										<col style="width: 10%">
									</colgroup>
									<thead>
										<tr>
											<th>파일명</th>
											<th>크기</th>
											<th>등록일시</th>
											<th>삭제</th>
										</tr>
									</thead>
									<tbody id="tbody_fiielist">
										<c:forEach var="fileList" items="${fileList}" varStatus="status">
		                        			<tr class="item_${fileList.atchFileId}_${fileList.fileSn} uploaded_obj">
												<input type="hidden" name="fileSize" class="item_file_size" value="${fileList.fileMg}">
												<td class="file_name">
													<img src="/direct/img/upload_hwp_img.png" alt="" />
													<span class="file_name_text">${fileList.orignlFileNm}</span>
												</td>
												<td>
													<span class="file_size_text" value="<c:out value="${fileList.fileMg}"/>"></span>
													
												</td>
												<td>
													<c:out value="${fileList.creatDt}"/>
												</td>
												<td>
													<input type="button" class="delBtn" onclick="delAtchFile('${fileList.atchFileId}', '${fileList.fileSn}'); return false;">
												</td>
											</tr>
		                        		</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="fileInfo file_list_div">
								<ul class="inline">
									<li>
										<p>최대 <span class="c_e40000 fwBold limitcount_li">1</span>개 ｜ <span class="c_e40000 fwBold upload_number">50MB</span>제한</p>
									</li>
									<li>
										<p><span class="c_456ded fwBold totalfileCount">1</span>개 ｜ <span class="c_456ded fwBold totalfileSize">72.01KB</span></p>
									</li>
								</ul>
							</div>
						</td>
					</tr>
				
					
					</c:if>
						
					<!-- 공지 여부  -->
					<c:choose>
						<c:when test="${bdMstr.noticeYn == 'Y'}">
							<c:set var="title">공지여부 </c:set>
							<tr>
								<th>
									<label for="noticeAt">${title}</label>
								</th>
								<td>
									<form:checkbox path="noticeAt" class="cb1" value="Y" />
									<form:errors path="noticeAt" cssClass="error" />
								</td>
							</tr>
						</c:when>
						<c:otherwise>
							<form:hidden path="noticeAt" value="N" />
						</c:otherwise>
					</c:choose>
					<!-- 공지 여부  -->

					<!-- 공개/비공개 여부 -->
					<c:choose>
						<c:when test="${bdMstr.openYn == 'Y' && bdMstr.bbsTyCode != 'BBST02' && bdMstr.bbsTyCode != 'BBST03'}">
							<c:set var="title">비공개여부</c:set>
							<tr>
								<th>
									<label for="secretAt">${title}</label>
								</th>
								<td>
									<form:checkbox path="secretAt" class="cb1" value="Y" />
									<form:errors path="secretAt" cssClass="error" />
								</td>
							</tr>
						</c:when>
						<c:otherwise>
							<form:hidden path="secretAt" value="N" />
						</c:otherwise>
					</c:choose>
					<!-- 공개/비공개 여부 -->
					</tbody>
				</table>

				<!-- 버튼 시작(상세지정 style로 div에 지정) -->
				<div class="btnWrap">
					<input type="button" class="btnType2" value="미리보기" onclick="javascript:fn_egov_regist_preview(); return false;">
					<input type="button" class="btnType2" value="목 록" onclick="javascript:goList(); return false;">
					<input type="button" class="btnType1" value="저 장" onclick="javascript:fn_egov_regist_notice(); return false;">
					<input type="button" class="btnType1" value="취 소" onclick="javascript:history.go(-1); return false;">
				</div>
				<!-- 버튼 끝 -->
			</form:form>
			
		</div>
	</div>
</body>
</html>

