<%--
  Class Name : EgovNoticeUpdt.jsp
  Description : 게시물 수정 화면
  Modification Information
 
      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.03.19   이삼섭              최초 생성
     2011.08.31   JJY       경량환경 버전 생성
 
    author   : 공통서비스 개발팀 이삼섭
    since    : 2009.03.19
--%>
<%@ 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="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ 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" %>
<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_validateForm(obj){
        return true;
    }

    function fn_egov_regist_notice(){
        if (!validateBoard(document.board)) return;
        
        /*  폴라스토리 */
        <%-- 현재 사용안함. 추후 사용 가능성 있음
		<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000153'}">
        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 (confirm('<spring:message code="common.update.msg" />')) {
			$("#nttCn").val($("#nttCn").val().replace(/<(\/a|a)([^>]*)>/gi,""));
            document.board.action = "<c:url value='/web/cop/bbs/updateBoardArticle.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', "" );
		}
	}
	
	$(document).ready(function() {

		/* 다언다청대통 */
		<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000221'}">
		var ddTyCd = $("#ddTyCd").val();		
		if (ddTyCd == 'DDTY01') { // 칭찬
			$("[name='secretAt']").attr('disabled', false);
		} else if (ddTyCd == 'DDTY02') { // 불편
			$("[name='secretAt']").attr('disabled', false);
		} else if (ddTyCd == 'DDTY03') { // 라이브폴라
			$("[name='secretAt']").attr('disabled', true);
		}
		</c:if>
		
		<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000153'}">
		userTyCdSelect($("#userTyCd")[0]);		
		</c:if>
	}); 
</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" alt="home"><img src="/img/s_navi_home.png">&ensp;&gt;</li>
							<li>${brdMstrVO.menuCours}</li>
						</c:if>
					</ul>
				</div>
			</div>
		</div>

		<!--내용s-->
		<div id="container" class="board_wrap">
			<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='${board.bbsId}'/>" />
				<input type="hidden" name="nttId" value="<c:out value='${board.nttId}'/>" />
				<input type="hidden" name="atchFileCnt" value="<c:out value='${board.atchFileCnt}'/>" /><!-- 기 업로드 파일 개수 -->
				<form:hidden path="noticeAt" value="N"/><!-- valid 때문에 필요 -->
				<div class="write_wrap">
					<h2>글수정</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> -->
					<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_000000000510' || brdMstrVO.bbsId eq 'BBSMSTR_000000000520'}">
						<p style="color:blue;">질문 1</p> 활용(이용)한 공공데이터의 명칭은 무엇입니까?
					</c:if>
					<form:input path="nttSj"  title="${msgNttSj}" cssClass="wr_subject" size="50" placeholder="${var1}" />
					<form:errors path="nttSj" />
					<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:textarea path="nttCn" cols="75" rows="20" cssStyle="width: 99.5%; height: 300px;"  placeholder="${var2}"/>
					<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;">
					<%-- <form:radiobuttons path="bbsTyCode" title="사용자 구분" items="${userTypeList}" itemValue="code" itemLabel="codeNm" /> --%>
						<strong>사용자 구분</strong>
						<form:select path="userTyCd" title="사용자구분" cssClass="selectbb" onclick="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="<c:out value='${board.userPosition}'/>">
					</div>
					</c:if>
					<c:if test="${brdMstrVO.bbsId != 'BBSMSTR_000000000153'}">
						<input type="hidden" name="userTyCd" value="" />
						<input type="hidden" name="userPosition" value="" />
					</c:if>
					
					<!-- 다언다청대통 게시판 구분 -->
					<c:if test="${brdMstrVO.bbsId == 'BBSMSTR_000000000221'}">
					<div style="padding-top: 7px;">
						<strong>구 분</strong>
						<form:select path="ddTyCd" title="구분" 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: 5px;">
						<strong>비공개 여부</strong> 
						<select name="secretAt" class="selectbb">
							<option value="N" <c:if test="${board.secretAt=='N' }">selected="selected"</c:if>>공개</option>
							<option value="Y" <c:if test="${board.secretAt=='Y' }">selected="selected"</c:if>>비공개</option>
						</select>
					</div>
					</c:if>
					
					<c:if test="${brdMstrVO.bbsTyCode == 'BBST03' && brdMstrVO.bbsId == 'BBSMSTR_000000000151'}">
					<!-- 통합신고게시판 -->
					<div style="padding-top: 7px;">
						<strong>신고유형</strong>
						<form:select path="reportTyCd" title="신고유형" cssClass="selectbb" onchange="">
							<form:options items="${reportTyList}" itemValue="code" itemLabel="codeNm" />
						</form:select>
					</div>
					</c:if>
					
					<c:if test="${brdMstrVO.fileAtchPosblAt == 'Y'}">
						<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>
					<div class="bo_w_download">
						<i class="fa fa-download" aria-hidden="true"></i> <strong>첨부파일</strong>
						<c:if test="${not empty board.atchFileId}">
							<c:import url="/cmm/fms/selectBBSFileInfsForUpdate.do" charEncoding="utf-8">
								<c:param name="param_atchFileId" value="${board.atchFileId}" />
								<c:param name="nttId" value="${board.nttId}" />
								<c:param name="bbsId" value="${board.bbsId}" />
								<c:param name="updateFlag" value="Y" />
								<c:param name="isImgView" value="${isImgView}" />
							</c:import>
						</c:if>
						<label for="egovfile_0">첨부파일 선택</label>
						<input name="file_1" id="egovComFileUploader" type="file" />
						<div id="egovComFileList"></div>
					</div>
					<script>
						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' ) );
		                        
						<c:if test="${not empty board.atchFileId}">
							fn_egov_multi_selector_update_setting(multi_selector);
						</c:if>
					</script>
					</c:if>
				</div>
			</form:form>
			
			<div class="btn_bo_write">
				<ul>
					<li><button class="btn_cancel btn" onclick="javascript:fn_egov_select_noticeList(); return false;" title="취소"><i class="fa fa-close"aria-hidden="true"></i> 취소</button></li>
					<li><button class="btn_blue btn" onclick="javascript:fn_egov_regist_notice(); return false;" title="작성완료"><i class="fa fa-pencil"aria-hidden="true"></i> 작성완료</button></li>
				</ul>
			</div>

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

	</section>
</body>

