<%--
  Class Name : EgovNoticeRegist.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-Type" content="text/html; charset=utf-8">
<meta http-equiv="content-language" content="ko">
<script type="text/javascript" src="<c:url value='/js/EgovBBSMng.js' />"></script>
<script type="text/javascript" src="<c:url value='/js/EgovMultiFileItn.js'/>"></script> <!-- 파일첨부, 썸네일이미지 있으면 미리보기 -->
<%-- <script type="text/javascript" src="<c:url value='/js/EgovMultiFile.js'/>"></script> --%>
<script type="text/javascript" src="<c:url value='/js/EgovCalPopup.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">
$( document ).ready(function() {
});

function goList() {
	document.searchForm.submit(); 
}

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;
	} */
	
	<c:if test="${bdMstr.bbsId == 'BBSMSTR_000000000731' }"> 
			{
				if($('#ntceBgndeYYYMMDD').val() == ''){
					alert(" 시작일은 필수입니다.");
					return;
				}
				if($('#ntceEnddeYYYMMDD').val() == ''){
					alert(" 종료일은 필수입니다.");
					return;
				}
				
				var iChkBeginDe = Number(($('#ntceBgndeYYYMMDD').val()+$('#ntceBgndeHH').val()+$('#ntceBgndeMM').val()).replaceAll("-","")   );
				var iChkEndDe =  Number(($('#ntceEnddeYYYMMDD').val()+$('#ntceEnddeHH').val()+$('#ntceEnddeMM').val()).replaceAll("-","")   );

				if(iChkBeginDe > iChkEndDe || iChkEndDe < iChkBeginDe ){
					alert("게시시작일자는 게시종료일자 보다 클수 없고,\n게시종료일자는 게시시작일자 보다 작을수 없습니다. ");
					return;
				}
				$('#ntceBgnde').val(iChkBeginDe) ;
				$('#ntceEndde').val(iChkEndDe) ;
			}
	</c:if>
	
	if (confirm('<spring:message code="common.regist.msg" />')) {
		goSave();
	}
}

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>
<style>
.uploaded_obj{width: 100%;}
</style>
</head>
<body>
	<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="bbsId" value="<c:out value='${bdMstr.bbsId}'/>" />
	<input type="hidden" name="previewImgs" value="" />
	<input type="hidden" name="checkProhibitCn" value="" />
	<input type="hidden" name="siteId" value="<c:out value='${bdMstr.siteId}'/>"  />
	<input type="hidden" name="pageType" id="pageType" value="insert" />
	
	<input id="ntceBgnde" name="ntceBgnde" type="hidden" value="">
	<input id="ntceEndde" name="ntceEndde" type="hidden" value="">
	
	<!-- 드래그앤 드롭 파라미터 -->
	<input type="hidden" name="limitcount" value="${bdMstr.posblAtchFileNumber}" />
	<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}' />- 글 등록  (${bdMstr.menuNm})</h2>
			<p class="tType6 c_999999">게시판 글을 생성/수정 할 수 있습니다.</p>
		</div>
		<div class="pageCont">
			<table class="tbType2">
				<colgroup>
					<col style="width: 20%">
					<col style="width: 80%">
				</colgroup>
				<tbody>
					<c:if test="${Transfer}">
						<tr>
							<th>
								<label for="secretAt">임시수정</label>
							</th>
							<td>
								등록일 :
								<input style="width: 10%;" id="frstRegisterPnttm" name="frstRegisterPnttm" title="제목" type="text" value="${board.frstRegisterPnttm}">
								2000-01-05 (형식)
								<br>
								총 
								<input style="width: 10%;" id="inqireCo" name="inqireCo" title="제목" type="text" value="${board.inqireCo}">
								123 (형식)
								<br>
								등록자 : 
								<input style="width: 10%;" id="ntcrNm" name="ntcrNm" title="제목" type="text" value="${board.ntcrNm}">
								아무개 (형식)
							</td>
						</tr>
						</c:if>
					<tr>
						<th><span class="reqArea">
							<span class="reqArea">${bdMstr.bbsTyCode eq 'BBST07' ? "항목" : bdMstr.menuNo eq '9510000' ? "질문" : "제목"}</span>
							</span>
							<c:out value="${msgNttSj}" />
						</th>
						<td colspan="3">
							<form:input path="nttSj" title="${msgNttSj}" />
							<form:errors path="nttSj" />
						</td>
					</tr>
					<tr>
						<th><span class="reqArea">
							${brdMstrVO.menuNo eq '9510000' ? "답변" : "내용"}
						</span></th>
						<td colspan="3">
							<form:textarea path="nttCn" class="textarea" cols="500" rows="20" />
							<ckeditor:replace replace="nttCn" basePath="${pageContext.request.contextPath}/html/egovframework/com/cmm/utl/ckeditor/" />
							<form:errors path="nttCn" />
						</td>
					</tr>
					<c:if test="${'BBSMSTR_000000000731' eq bdMstr.bbsId }"><!-- 이벤트 게시판 -->
					<tr>
						<th><span class="reqArea">기간</span></th>
						<td colspan="3">
							<input type="hidden" name="cal_url" id="cal_url" value="/sym/cmm/EgovNormalCalPopup.do">
						    <input style="width:auto;" type="text" class="date_format" name="ntceBgndeYYYMMDD" id="ntceBgndeYYYMMDD" size="4" maxlength="4" readonly="">
						    <a href="#" onclick="javascript:fn_egov_NormalCalendar(document.forms.board, document.forms.board.ntceBgndeYYYMMDD);">
						   	 	<input type="button" class="calBtn">
					    	</a>
							<select id="ntceBgndeHH" name="ntceBgndeHH" class="date_format">
							<c:forEach var="result" items="${ntceBgndeHH}" varStatus="status">
								<option value="${result.code}">${result.codeNm}</option>	
							</c:forEach>
							</select>시
							<select id="ntceBgndeMM" name="ntceBgndeMM" class="date_format">
							<c:forEach var="result" items="${ntceBgndeMM}" varStatus="status">
								<option value="${result.code}">${result.codeNm}</option>	
							</c:forEach>
							</select>분
							&nbsp;&nbsp;~&nbsp;&nbsp;
					    	<input style="width:auto;" type="text" class="date_format" name="ntceEnddeYYYMMDD" id="ntceEnddeYYYMMDD" size="4" maxlength="4" readonly="">
						    <a href="#" onclick="javascript:fn_egov_NormalCalendar(document.forms.board, document.forms.board.ntceEnddeYYYMMDD);">
						   	 	<input type="button" class="calBtn">
					    	</a>
							<select id="ntceEnddeHH" name="ntceEnddeHH" class="date_format">
							<c:forEach var="result" items="${ntceEnddeHH}" varStatus="status">
								<option value="${result.code}">${result.codeNm}</option>	
							</c:forEach>
							</select>시
							<select id="ntceEnddeMM" name="ntceEnddeMM" class="date_format">
							<c:forEach var="result" items="${ntceEnddeMM}" varStatus="status">
								<option value="${result.code}">${result.codeNm}</option>	
							</c:forEach>
							</select>분
						</td>
					</tr>
					</c:if>
					
					<c:if test="${'BBST07' eq bdMstr.bbsTyCode }"><!-- 사전정보공표 -->
					<tr>
						<th><span class="reqArea">주기</span></th>
						<td colspan="3">
							<input id="pubPeriod" name="pubPeriod" type="text" value="">
						</td>
					</tr>
					
					<tr>
						<th><span class="reqArea">시기</span></th>
						<td colspan="3">
							<input id="pubTime" name="pubTime" type="text" value="">
						</td>
					</tr>
					
					<tr>
						<th><span class="reqArea">방법(링크)</span></th>
						<td colspan="3">
							<input id="pubLink" name="pubLink" type="text" value="">
						</td>
					</tr>
					
					<tr>
						<th><span class="reqArea">담당부서</span></th>
						<td colspan="3">
							<input id="pubLoc" name="pubLoc" type="text" value="">
						</td>
					</tr>
					
					</c:if>
					
					<c:if test="${bdMstr.fileAtchPosblAt == 'Y'}">
					<tr>
						<th>파일 첨부</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.fmsImageFile}_${fileList.fileSn} uploaded_obj">
												<input type="hidden" name="fileSize" class="item_file_size" value="${fileList.fileSize}">
												<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.fileSize}"/>"></span>
													
												</td>
												<td>
													<c:out value="${fileList.regdt}"/>
												</td>
												<td>
													<input type="button" class="delBtn" onclick="delAtchFile('${fileList.fmsImageFile}', '${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">${bdMstr.posblAtchFileNumber}</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>
							<div class="uploadBtm">
								<input type="file" id="file_temp" name="file_temp" class="uploadFile">
							</div>
						</td>
					</tr>
					</c:if>
					<c:if test="${!empty fmsFileList[0].fmsId }">
					<tr>
						<th class="td_title1"><span class="star_t"></span>첨부이미지 링크</th>
						<td colspan="3">
							<c:forEach var="result" items="${fmsFileList}" varStatus="status">
								<c:if test="${result.fileExtsn eq 'jpg' || 
									result.fileExtsn eq 'jpeg' || 
									result.fileExtsn eq 'png' || 
									result.fileExtsn eq 'bmp' || 
									result.fileExtsn eq 'gif' || 
									result.fileExtsn eq 'img' }">
									<span class="item_${result.fmsImageFile}_${result.fileSn}">
									<a href='${result.fmsLink}' target="_blank">${result.fmsLink}</a>
										  (${result.orignlFileNm})
									</br>
									</span>
								</c:if>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<th class="td_title1"><span class="star_t"></span>첨부다운로드 링크</th>
						<td colspan="3">
							<c:forEach var="result" items="${fmsFileList}" varStatus="status">
								<span class="item_${result.fmsImageFile}_${result.fileSn}">
								<a href='${result.fmsDownLink}'>${result.fmsDownLink}</a>
								<c:if test="${listExist}">(</c:if>
								${result.orignlFileNm}
								<c:if test="${listExist}">)</c:if>
								</br>
								</span>
							</c:forEach>
						</td>
					</tr>
					
										
					<tr>
						<th class="td_title1"><span class="star_t"></span>최종수정일</th>
						<td colspan="3">
							${fmsFileList[0].moddt }
						</td>
					</tr>
					<tr>
						<th class="td_title1"><span class="star_t"></span>작성자</th>
						<td colspan="3">
							${fmsFileList[0].registerId }
						</td>
					</tr>
					</c:if>
					
					<!-- 공지 여부  -->
					<c:choose>
						<c:when test="${bdMstr.noticeYn == 'Y'}">
							<c:set var="title">공지여부/공지기간 </c:set>
							<tr>
								<th>
									<label for="noticeAtTitle">${title}</label>
								</th>
								<td>
									<input type="checkbox" name="noticeAt" id="noticeAt" value="Y">
									<span  style="padding-left: 10px;">/</span> 
									
									<input type="hidden" name="cal_url" id="cal_url" value="/sym/cmm/EgovNormalCalPopup.do">
								    <input style="width:auto;margin-left: 10px;" type="text" class="date_format" name="ntceBgndeYYYMMDD" id="ntceBgndeYYYMMDD" size="4" maxlength="4" readonly="">
								    <a href="#" onclick="javascript:fn_egov_NormalCalendar(document.forms.board, document.forms.board.ntceBgndeYYYMMDD);">
								   	 	<input type="button" class="calBtn">
							    	</a>
									<select id="ntceBgndeHH" name="ntceBgndeHH" class="date_format">
									<c:forEach var="result" items="${ntceBgndeHH}" varStatus="status">
										<option value="${result.code}">${result.codeNm}</option>	
									</c:forEach>
									</select>시
									<select id="ntceBgndeMM" name="ntceBgndeMM" class="date_format">
									<c:forEach var="result" items="${ntceBgndeMM}" varStatus="status">
										<option value="${result.code}">${result.codeNm}</option>	
									</c:forEach>
									</select>분
									&nbsp;&nbsp;~&nbsp;&nbsp;
							    	<input style="width:auto;" type="text" class="date_format" name="ntceEnddeYYYMMDD" id="ntceEnddeYYYMMDD" size="4" maxlength="4" readonly="">
								    <a href="#" onclick="javascript:fn_egov_NormalCalendar(document.forms.board, document.forms.board.ntceEnddeYYYMMDD);">
								   	 	<input type="button" class="calBtn">
							    	</a>
									<select id="ntceEnddeHH" name="ntceEnddeHH" class="date_format">
									<c:forEach var="result" items="${ntceEnddeHH}" varStatus="status">
										<option value="${result.code}">${result.codeNm}</option>	
									</c:forEach>
									</select>시
									<select id="ntceEnddeMM" name="ntceEnddeMM" class="date_format">
									<c:forEach var="result" items="${ntceEnddeMM}" varStatus="status">
										<option value="${result.code}">${result.codeNm}</option>	
									</c:forEach>
									</select>분
								</td>
							</tr>
						</c:when>
						<c:otherwise>
							<form:hidden path="noticeAt" value="N" />
						</c:otherwise>
					</c:choose>
					<!-- 공지 여부  -->
					
				</tbody>
			</table>
			<div class="btnWrap">
				<input type="button" class="btnType1 bg_888888" value="목 록" onclick="goList(); return false;">
				<input type="button" class="btnType1 bg_888888" value="미리보기" onclick="fn_egov_regist_preview(); return false;">
				<c:if test="${!empty fmsFileList[0].fmsId }">
					<input type="button" class="btnType1" value="삭 제" onclick="fn_fmsfile_delete(); return false;">
					<input type="button" class="btnType1" value="수 정" onclick="goSave('fmsFile_U'); return false;">
				</c:if>
				<c:if test="${empty fmsFileList[0].fmsId }">
					<input type="button" class="btnType1" value="저 장" onclick="fn_egov_regist_notice(); return false;">
				</c:if>
			</div>
	 	</div>
	</div>
</form:form>

	<!-- //content 끝 -->
</body>
</html>

