<%--
  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"%>
<%
	pageContext.setAttribute("crlf", "\r\n");
%>
<head>
<script src="<c:url value='/js/EgovMultiFile.js'/>"></script>
<script src="<c:url value="/validator.do"/>"></script>
<validator:javascript formName="board" staticJavascript="false" xhtml="true" cdata="false" />
<script>
	function fn_egov_regist_notice() {
		<%-- 현재 사용안함. 추후 사용 가능성 있음
		/* 폴라스토리 */
		<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000153'}">
		if ($("#userTyCd").val() == "") {
			$("#userTyCd").focus();
        	alert("사용자구분은(는) 필수 입력값입니다."); return;
		}
        if ($("#userTyCd").val() != "BBSU03" && $("#userPosition").val() == "") {
        	$("#userPosition").focus();
        	alert("소속은(는) 필수 입력값입니다."); return;
        }
        </c:if>
         --%>

		/* 다언다청대통 */
		<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000221'}">
		if ($("#ddTyCd").val() == "") {
			$("#ddTyCd").focus();
        	alert("구분은(는) 필수 입력값입니다."); return;
		}
        </c:if>

        /* 클린신고센터 */
        <c:if test="${brdMstrVO.bbsTyCode == 'BBST03' && brdMstrVO.bbsId == 'BBSMSTR_000000000151'}">
		if ($("#reportTyCd").val() == "") {
			$("#reportTyCd").focus();
        	alert("신고유형은(는) 필수 입력값입니다."); return;
		}
        </c:if>
        
		if (!validateBoard(document.board)) return;
        
		if (confirm('<spring:message code="common.regist.msg" />')) {
			$("#nttCn").val($("#nttCn").val().replace(/<(\/a|a)([^>]*)>/gi,""));
			//특수문자 치환
			//$("#nttCn").val($("#nttCn").val().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/\'/g,"&#39;").replace(/\n/g,"<br />"));
			
			document.board.action = "<c:url value='/web/cop/bbs/insertBoardArticle.do'/>";
			document.board.submit();
		}
	}

	function fn_egov_select_noticeList() {
		document.searchForm.action = "<c:url value='/web/cop/bbs/selectBoardList.do'/>";
		document.searchForm.submit();
	}
	
	//  다언다청대통. 게시판 구분 선택 시 비공개 항목 변경 처리
	function ddTyCdSelect(obj) {
		/* $("[name='secretAt'] option:not(:selected)").prop('disabled', true); */
		
		if (obj.value == 'DDTY01') { // 칭찬
			$("[name='secretAt']").attr('disabled', false);
			$("[name='secretAt']").val("N");
		} else if (obj.value == 'DDTY02') { // 불편
			$("[name='secretAt']").attr('disabled', false);
			$("[name='secretAt']").val("Y");
		} else if (obj.value == 'DDTY03') { // 라이브폴라
			$("[name='secretAt']").attr('disabled', true);
			$("[name='secretAt']").val("N");
		}
	}
	
	// 폴라스토리. 사용자 구분
	function userTyCdSelect(obj) {
		if (obj.value == 'BBSU03' || obj.value == "") {
			$("#userPosition").attr( 'disabled', true );
			$("#userPosition").css( 'display', "none" );
			$("#userPosition").val("");
		} else {
			$("#userPosition").attr( 'disabled', false );
			$("#userPosition").css( 'display', "" );
		}
	}
</script>
</head>

<body>
	<section class="sub">
		<div class="s_visual s_visual_img0${fn:substring(brdMstrVO.firstDeptMenuNo,1,2)}">
			<div class="textbar">
				<h2 class="s_tit">${brdMstrVO.bbsNm}</h2>
				<div class="sub_navi">
					<ul>
						<c:if test="${not empty brdMstrVO.menuCours}">
							<li class="home"><img alt="HOME" src="/img/s_navi_home.png">&ensp;&gt;</li>
							<li>${brdMstrVO.menuCours}</li>
						</c:if>
					</ul>
				</div>
			</div>
		</div>

		<!-- 게시판 정보 -->
		<c:if test="${not empty brdMstrVO.bbsDc}">
		<div>
			<c:out value="${fn:replace(brdMstrVO.bbsDc, crlf , '<br/>')}" escapeXml="false" />
		</div>
		</c:if>

		<!-- 내용s -->
		<form:form commandName="searchForm" name="searchForm" method="get" action="">
		<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='${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='${brdMstrVO.bbsId}'/>" />
		
		<div id="container" class="board_wrap">
			<div class="write_wrap">
				<h2>
					<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000151' || brdMstrVO.bbsId eq 'BBSMSTR_000000000540' || brdMstrVO.bbsId eq 'BBSMSTR_000000000541' || brdMstrVO.bbsId eq 'BBSMSTR_000000000570'}">
						글쓰기
					</c:if>
				</h2>
				<!-- <div class="bo_w_info">
					<ul>
						<li><label class="sound_only" for="wr_name">이름<strong>필수</strong></label><input name="wr_name" type="text" placeholder="이름" value=""></li>
						<li><label class="sound_only" for="wr_password">비밀번호<strong>필수</strong></label><input name="wr_password" type="password" placeholder="비밀번호"></li>
						<li><label class="sound_only" for="wr_email">이메일</label><input name="wr_email" type="text" placeholder="이메일" value=""></li>
						<li><label class="sound_only" for="wr_homepage">홈페이지</label><input name="wr_homepage" type="text" size="50" placeholder="홈페이지" value=""></li>
					</ul>
				</div> -->
				<%-- <div class="bo_w_info">
					<ul>
						<li><!-- <label class="sound_only" for="wr_name">사용자 구분<strong>필수</strong></label> -->
							<!-- <input name="wr_name" type="text" placeholder="사용자구분" value=""> -->
							<form:radiobuttons path="bbsTyCode" title="사용자 구분" items="${userTypeList}" itemValue="code" itemLabel="codeNm" />
							<strong>사용자 구분</strong>
							<form:select path="bbsTyCode" title="사용자구분">
								<form:option value="" label="-선택해주세요-" />
								<form:options items="${userTypeList}" itemValue="code" itemLabel="codeNm" />
							</form:select>
						</li>
						<!-- <li><label class="sound_only" for="wr_password">비밀번호<strong>필수</strong></label><input name="wr_password" type="password" placeholder="비밀번호"></li> -->
						<li><label class="sound_only" for="wr_email">소속</label><input name="userPosition" id="userPosition" type="text" placeholder="소속" value=""></li>
						<!-- <li><label class="sound_only" for="wr_homepage">홈페이지</label><input name="wr_homepage" type="text" size="50" placeholder="홈페이지" value=""></li> -->
					</ul>
				</div> --%>
				<spring:message code="cop.nttSj" var="msgNttSj" />
				<c:set var ="var1" value=""/>
				<c:set var ="var2" value=""/>
				<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000510' || brdMstrVO.bbsId eq 'BBSMSTR_000000000520'}">
					<c:set var ="var1" value="명칭"/>
					<c:set var ="var2" value="2-1. 2-2. 내용을 기입해주세요"/>
				</c:if>
				<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000151' || brdMstrVO.bbsId eq 'BBSMSTR_000000000540' || brdMstrVO.bbsId eq 'BBSMSTR_000000000541' || brdMstrVO.bbsId eq 'BBSMSTR_000000000570'}">
					<c:set var ="var1" value="${msgNttSj}"/>
					<c:set var ="var2" value="내용"/>
				</c:if>
				<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000221' || brdMstrVO.bbsId eq 'BBSMSTR_000000000049'}">
					<c:set var ="var1" value="제목"/>
				</c:if>
				<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000510' || brdMstrVO.bbsId eq 'BBSMSTR_000000000520'}">
					<p style="color:blue;">질문 1</p> 활용(이용)한 공공데이터의 명칭은 무엇입니까?
				</c:if>
				<form:label path="nttSj">${var1}입력</form:label>
				<form:input path="nttSj" cssClass="wr_subject" size="50"  placeholder="${var1}"/> <%-- placeholder="${msgNttSj}" 다시 추가 --%>
				<form:errors path="nttSj" />
				<br>
				<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000510' || brdMstrVO.bbsId eq 'BBSMSTR_000000000520'}">
					<p style="color:blue;">질문 2</p>2-1. 공공데이터 품질에 만족하십니까?(매우만족, 만족, 보통, 불만, 매우불만 중 기입해주세요.)<br>
					2-2. 만족/불만족 부분, 차후 개방을 원하는 분야, 데이터오류 신고, 활용 후기 등 공공데이터 개방관련 의견 및 후기를 자유롭게 기술해 주시기 바랍니다.
				</c:if>
				<form:label path="nttCn">내용입력</form:label>
				<form:textarea path="nttCn" cols="75" rows="20" cssStyle="width: 99.5%; height: 300px;" placeholder="${var2}"/><!-- placeholder="내용" 다시 추가-->
				<form:errors path="nttCn" />
				<c:if test="${brdMstrVO.bbsId eq 'BBSMSTR_000000000151' || brdMstrVO.bbsId eq 'BBSMSTR_000000000540' || brdMstrVO.bbsId eq 'BBSMSTR_000000000541' || brdMstrVO.bbsId eq 'BBSMSTR_000000000570'}">
				  * 게시글에 욕설이나 비속어 등록 시 해당 게시글은 삭제 조치 될 수 있습니다.<br><br>
			 	 </c:if>
				
				<style>
					.selectbb {
					    border: 1px solid #ccc;
					    background: #fff;
					    color: #000;
					    vertical-align: middle;
					    border-radius: 3px;
					    padding: 5px;
					    -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
					    -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
					}
				</style>
				
				<!-- 폴라스토리 사용자 구분 -->
				<%-- 
				<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000153'}">
				<div style="padding-top: 7px;">
					<strong>사용자 구분</strong>
					<form:select path="userTyCd" title="사용자구분" cssClass="selectbb" onchange="userTyCdSelect(this);">
						<form:option value="" label="선택해주세요" />
						<form:options items="${userTypeList}" itemValue="code" itemLabel="codeNm" />
					</form:select>
					<input name="userPosition" id="userPosition" type="text" placeholder="소속" value="" disabled="disabled" style="display: none;">
				</div>
				</c:if>
				 --%>
				 
				<!-- 다언다청대통 게시판 구분 -->
				<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000221'}">
				<div style="padding-top: 7px;">
					<strong>구 분</strong>
					<label for="ddTyCd">구분선택</label>
					<form:select path="ddTyCd" cssClass="selectbb" onchange="ddTyCdSelect(this); return false;">
						<form:option value="" label="선택해주세요" />
						<form:options items="${ddTypeList}" itemValue="code" itemLabel="codeNm" />
					</form:select>
				</div>
				</c:if>
				 
				<!-- 비공개 여부 -->
				<c:if test="${brdMstrVO.openYn == 'Y' && brdMstrVO.bbsTyCode != 'BBST02' && brdMstrVO.bbsTyCode != 'BBST03'}">
				<div style="padding-top: 7px;">
					<strong>비공개 여부</strong> 
					<label for="secretAt">비공개여부 선택</label>
					<select name="secretAt" class="selectbb" id="secretAt">
						<option value="N" selected="selected">공개</option>
						<option value="Y">비공개</option>
					</select>
				</div>
				</c:if>
				
				<c:if test="${brdMstrVO.bbsTyCode == 'BBST03' && brdMstrVO.bbsId == 'BBSMSTR_000000000151'}">
				<!-- 클린신고센터 -->
				<div style="padding-top: 7px;">
					<strong>신고유형</strong>
					<label for="reportTyCd">신고유형 선택</label>
					<form:select path="reportTyCd" cssClass="selectbb" onchange="">
						<form:option value="" label="선택해주세요" />
						<form:options items="${reportTyList}" itemValue="code" itemLabel="codeNm" />
					</form:select>
				</div>
				</c:if>
				
				<c:if test="${brdMstrVO.fileAtchPosblAt == 'Y'}">
					<div class="bo_w_download">
						<i class="fa fa-download" aria-hidden="true"></i> <strong>첨부파일</strong>
						<br/>파일 사이즈 최대용량은 <span style="color:red;">${brdMstrVO.posblAtchFileSize}mb</span>입니다.
						<!-- <label for="egovfile_0">첨부파일 선택</label> -->
						<label for="egovComFileUploader">첨부파일 선택</label>
						<input name="file_1"  id="egovComFileUploader" type="file" />
						<div id="egovComFileList"></div>
					</div>
					<c:set  var="isImgView" value="false" />
					<c:set  var="isImgBbs" value="false" />
					<c:if test="${brdMstrVO.bbsTyCode == 'BBST05' || brdMstrVO.bbsTyCode == 'BBST06'}">
						<c:set  var="isImgBbs" value="true" />
					</c:if>
					<script>
						$("#egovComFileUploader").keydown(function(key) {
							if (key.keyCode == 13) {
								alert("첨부파일을 등록하시려면 스페이스바를 눌러주세요.");
							}
						});
						var maxFileNum = "<c:out value='${brdMstrVO.posblAtchFileNumber}'/>";
						var maxFileSize = "<c:out value='${brdMstrVO.posblAtchFileSize}'/>";
						if(maxFileNum==null || maxFileNum==""){
							maxFileNum = 0;
						} 
						var multi_selector = new MultiSelector( document.getElementById( 'egovComFileList' ), maxFileNum, null, <c:out value="${isImgView}" />, maxFileSize, <c:out value="${isImgBbs}" /> );
						multi_selector.addElement( document.getElementById( 'egovComFileUploader' ) );         
					</script>
				</c:if>
			</div>
			<div class="btn_bo_write">
				<ul>
					<li><button type="button" class="btn_cancel btn" onclick="javascript:fn_egov_select_noticeList(); return false;">
							<img alt="취소" src="/img/cancelIcon.png" style="width:18px; padding-right:5px;"> 취소
						</button></li>
					<li><button type="button" class="btn_blue btn" onclick="javascript:fn_egov_regist_notice(); return false;">
							<img alt="작성완료" src="/img/penIcon.png" style="width:18px; padding-right:5px;"> 작성완료
						</button></li>
				</ul>
			</div>

		</div>
		</form:form>
		<!-- 내용e -->

	</section>
</body>

