<%--
  Class Name : EgovPopupRegist.jsp
  Description : 팝업창관리 등록 페이지
  Modification Information

      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.09.16    장동한          최초 생성

    author   : 공통서비스 개발팀 장동한
    since    : 2009.09.16

    Copyright (C) 2009 by MOPAS  All right reserved.
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ 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" %>
<%@ taglib prefix="ckeditor" uri="http://ckeditor.com" %>
<%@ taglib prefix="double-submit" uri="http://www.egovframe.go.kr/tags/double-submit/jsp" %>
<c:set var="ImgUrl" value="${pageContext.request.contextPath}/images/egovframework/com/cmm/" />
<c:set var="CssUrl" value="${pageContext.request.contextPath}/css/egovframework/com/" />
<!DOCTYPE html>
<html lang="ko">
<head>
<title>팝업창관리 관리</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="<c:url value="/validator.do"/>"></script>
<script type="text/javascript" src="<c:url value='/js/EgovCalPopup.js' />"></script>
<validator:javascript formName="popupManageVO" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javaScript" language="javascript">
/* ********************************************************
 * 저장처리화면
 ******************************************************** */
function fn_egov_save_PopupManage(){
	var varFrom = document.popupManageVO;
	
	/* 에디터값 체크 */
	/* if(CKEDITOR.instances.nttCn.getData()==""){
	 	alert("내용은 필수입력값입니다.");
	 	return;
	} */
	
	CKEDITOR.instances.nttCn.updateElement();
	
	if(confirm("<spring:message code="common.save.msg" />")){
		varFrom.action =  "<c:url value='/uss/ion/pwm/egovPopupRegist.do' />";
		if(!validatePopupManageVO(varFrom)){
			return;
		}else{
			var ntceBgndeYYYMMDD = document.getElementById('ntceBgndeYYYMMDD').value;
			var ntceEnddeYYYMMDD = document.getElementById('ntceEnddeYYYMMDD').value;

			var iChkBeginDe = Number( ntceBgndeYYYMMDD.replaceAll("-","") );
			var iChkEndDe = Number( ntceEnddeYYYMMDD.replaceAll("-","") );

			if(iChkBeginDe > iChkEndDe || iChkEndDe < iChkBeginDe ){
				alert("게시시작일자는 게시종료일자 보다 클수 없고,\n게시종료일자는 게시시작일자 보다 작을수 없습니다. ");
				return;
			}

			varFrom.ntceBgnde.value = ntceBgndeYYYMMDD.replaceAll('-','') + fn_egov_SelectBoxValue('ntceBgndeHH') +  fn_egov_SelectBoxValue('ntceBgndeMM');
			varFrom.ntceEndde.value = ntceEnddeYYYMMDD.replaceAll('-','') + fn_egov_SelectBoxValue('ntceEnddeHH') +  fn_egov_SelectBoxValue('ntceEnddeMM');

			varFrom.submit();
		}
	}
}

/* ********************************************************
* RADIO BOX VALUE FUNCTION
******************************************************** */
function fn_egov_RadioBoxValue(sbName)
{
	var FLength = document.getElementsByName(sbName).length;
	var FValue = "";
	for(var i=0; i < FLength; i++)
	{
		if(document.getElementsByName(sbName)[i].checked == true){
			FValue = document.getElementsByName(sbName)[i].value;
		}
	}
	return FValue;
}
/* ********************************************************
* SELECT BOX VALUE FUNCTION
******************************************************** */
function fn_egov_SelectBoxValue(sbName)
{
	var FValue = "";
	for(var i=0; i < document.getElementById(sbName).length; i++)
	{
		if(document.getElementById(sbName).options[i].selected == true){

			FValue=document.getElementById(sbName).options[i].value;
		}
	}

	return  FValue;
}
/* ********************************************************
* PROTOTYPE JS FUNCTION
******************************************************** */
String.prototype.trim = function(){
	return this.replace(/^\s+|\s+$/g, "");
}

String.prototype.replaceAll = function(src, repl){
	 var str = this;
	 if(src == repl){return str;}
	 while(str.indexOf(src) != -1) {
	 	str = str.replace(src, repl);
	 }
	 return str;
}

function fnList() {
	document.searchForm.submit(); 
}
</script>
<style>
.date_format{width:91px !important;}
.main1_table input{
		width: unset;
	}
</style>
</head>
<body>

<form:form commandName="popupManageVO" name="popupManageVO" action="${pageContext.request.contextPath}/uss/ion/pwm/egovPopupRegist.do" method="post">
<double-submit:preventer tokenKey="someKey" />
	<form:hidden path="ntceBgnde" />
	<form:hidden path="ntceEndde" />
	<input name="cmd" type="hidden" value="<c:out value='save'/>"/>
					
	<div class="ad_content">
	<div class="ad_con_head">
		<div class="ad_head_text">
			<p class="today_txt">팝업 등록</p>
			<div class="ad_head_ment">
				<p class="today_last_txt"><span id="cnt_cate_list"></span></p>
			</div>
		</div>
	</div>
	<div class="ad_subcon">
		<div class="main1_div2">
		<table class="main1_table">
				<tr>
					<th class="td_title1"><span class="star_t">*</span>팝업타입</th>
					<td colspan="3">
						<input type="radio" name="popupType" value="W" checked >윈도우&nbsp&nbsp
						<input type="radio" name="popupType" value="L" >레이어&nbsp&nbsp
				    	<!-- <input type="radio" name="popupType" value="Z" >팝업존&nbsp&nbsp -->
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t">*</span>팝업명</th>
					<td colspan="3">
						<form:input path="popupTitleNm" size="73" cssClass="txaIpt" maxlength="255"/>
      					<form:errors path="popupTitleNm" cssClass="error"/>
					</td>
				</tr>
				
				<tr>
					<th class="td_title1"><span class="star_t"></span>기간</th>
					<td colspan="3">
						<input type="hidden" name="cal_url" id="cal_url" value="<c:url value='/sym/cmm/EgovNormalCalPopup.do'/>" >
					    <input type="text" class="date_format" name="ntceBgndeYYYMMDD" id="ntceBgndeYYYMMDD" size="10" maxlength="10" class="readOnlyClass" readonly>
					    <a href="#" onClick="javascript:fn_egov_NormalCalendar(document.forms.popupManageVO, document.forms.popupManageVO.ntceBgndeYYYMMDD);">
					    <img src="<c:url value='/images/egovframework/com/cmm/icon/bu_icon_carlendar.gif' />"  align="middle" style="border:0px" alt="달력창팝업버튼이미지">
					    </a>
					    <form:select path="ntceBgndeHH" class="date_format">
					        <form:options items="${ntceBgndeHH}" itemValue="code" itemLabel="codeNm"/>
					    </form:select>시
					    <form:select path="ntceBgndeMM" class="date_format">
					        <form:options items="${ntceBgndeMM}" itemValue="code" itemLabel="codeNm"/>
					    </form:select>분
					    &nbsp&nbsp~&nbsp&nbsp<br/>
					    <input type="text" class="date_format" name="ntceEnddeYYYMMDD" id="ntceEnddeYYYMMDD" size="10" maxlength="10" class="readOnlyClass" readonly>
					    <a href="#" onClick="javascript:fn_egov_NormalCalendar(document.forms.popupManageVO, document.forms.popupManageVO.ntceEnddeYYYMMDD);">
					    <img src="<c:url value='/images/egovframework/com/cmm/icon/bu_icon_carlendar.gif' />" align="middle" style="border:0px" alt="달력창팝업버튼이미지">
					    </a>
					    <form:select path="ntceEnddeHH" class="date_format">
					        <form:options items="${ntceEnddeHH}" itemValue="code" itemLabel="codeNm"/>
					    </form:select>시
					    <form:select path="ntceEnddeMM" class="date_format">
					        <form:options items="${ntceEnddeMM}" itemValue="code" itemLabel="codeNm"/>
					    </form:select>분
					</td>
				</tr>
				
				<tr>
					<th class="td_title1"><span class="star_t"></span>링크 URL</th>
					<td colspan="3">
						<form:input path="fileUrl" size="73" cssClass="txaIpt" maxlength="255"/>
      					<form:errors path="fileUrl" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>팝업사이즈</th>
					<td colspan="3">
						     가로<form:input path="popupWSize" size="5" maxlength="10"/>px  세로<form:input path="popupHSize" size="5" maxlength="10"/>px
						  <form:errors path="popupWSize" cssClass="error"/>
						  <form:errors path="popupHSize" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>위치</th>
					<td colspan="3">
						왼쪽 <form:input path="popupWlc" size="5" maxlength="10"/>px  상단<form:input path="popupHlc" size="5" maxlength="10"/>px
						  <form:errors path="popupWlc" cssClass="error"/>
						  <form:errors path="popupHlc" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>스크롤</th>
					<td colspan="3">
						<input type="radio" name="scrollType" value="A" checked >자동&nbsp&nbsp
						<input type="radio" name="scrollType" value="Y">예&nbsp&nbsp
				    	<input type="radio" name="scrollType" value="N">아니요&nbsp&nbsp
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>내용</th>
					<td colspan="3">
						<form:textarea path="nttCn" title="${title} ${inputTxt}" cols="300" rows="20" /> 
						<ckeditor:replace replace="nttCn" basePath="${pageContext.request.contextPath}/html/egovframework/com/cmm/utl/ckeditor/" />
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>정렬 순서</th>
					<td colspan="3">
						 <form:input path="sortNum" size="73" cssClass="txaIpt" maxlength="255"/>
      					 <form:errors path="sortNum" cssClass="error"/>
      				</td> 
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>게시 상태</th>
					<td colspan="3">
						 <input type="radio" name="ntceAt" value="Y" checked>Y&nbsp&nbsp
						 <input type="radio" name="ntceAt" value="N">N
      				</td> 
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t"></span>그만보기 설정 여부</th>
					<td colspan="3">
						 <input type="radio" name="stopVewAt" value="Y" checked>Y&nbsp&nbsp
						 <input type="radio" name="stopVewAt" value="N">N
      				</td> 
				</tr>
			</table>
		</div>
		<div class="main1_btn_div">
			<button class="main1_btn" onclick="fnList(); return false;" >목 록</button>
			<button class="main1_btn main1_save_btn" id="main1_save_btn" onclick="fn_egov_save_PopupManage(); return false;" >저 장 </button>
		</div>					
 	</div>
	</div>
</form:form>
<form name="searchForm" id="searchForm" method="get" action="<c:url value='/uss/ion/pwm/listPopup.do'/>" ></form>
</body>
</html>
