<%--
  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" %>
<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="cntManageVO" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javaScript" language="javascript">
var originText = "";
$( document ).ready(function() {
	originText = CKEDITOR.instances.cntCn.getData();  //원본내용
});

/* ********************************************************
 * 저장처리화면
 ******************************************************** */
function fn_egov_save_CntManage(cmd){
	var varFrom = document.cntManageVO;
	
	/* 에디터값 체크 */
	/* if(CKEDITOR.instances.nttCn.getData()==""){
	 	alert("내용은 필수입력값입니다.");
	 	return;
	} */
	
	CKEDITOR.instances.cntCn.updateElement();
	
	if(confirm("<spring:message code="common.save.msg" />")){
		varFrom.action =  "<c:url value='/uss/ion/cnt/egovCntManageRegist.do' />";
		if(!validateCntManageVO(varFrom)){
			return;
		}else{
			varFrom.cmd.value= cmd;
			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;
}

function originTextCopy(){
	CKEDITOR.instances.cntCn.setData(originText); //에디터로 원본내용 값 세팅
	$('#origin_txt').css("display" , "none"); //버튼 삭제
	$('#iframe_egov_cntDetail').contents().find('.cntDt_tr').css("background-color","#FFFFFF"); //하단 td 컬럼 색상 삭제
}


function ckeditorPriview() {
	event.preventDefault();
	var cntPriviewWin = window.open('about:blank','ckeditorPriview','scrollbars=yes,resizable=yes, width=800,height=1200');
    var vFrom = document.cntManageVO;
    vFrom.target = 'ckeditorPriview';
    vFrom.method ="post";
    vFrom.action = "/web/ckeditorPriview.do";
    vFrom.submit();
}
	
/* ********************************************************
* 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;
}




</script>
<style>
.date_format{width:91px !important;}
.main1_table input{
		width: unset;
	}
</style>
</head>
<body>
<form:form commandName="cntManageVO" name="cntManageVO" action="${pageContext.request.contextPath}/uss/ion/pwm/egovPopupRegist.do" method="post">
	<input name="cmd" type="hidden" value="<c:out value='save'/>"/>
	<input name="cntId" type="hidden" value="${cntManageVO.cntId }"/>
	<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">
						<form:input path="cntName" size="73" cssClass="txaIpt" maxlength="255"/>
      					<form:errors path="cntName" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th class="td_title1"><span class="star_t">*</span>내용</th>
					<td colspan="3">
						<form:textarea path="cntCn" cols="300" rows="20" /> 
						<ckeditor:replace replace="cntCn" basePath="${pageContext.request.contextPath}/html/egovframework/com/cmm/utl/ckeditor/" />
					</td>
				</tr>
				<c:if test="${not empty cntManageVO.cntId}">
					<tr>
						<th class="td_title1"><span class="star_t"></span>등록자</th>
						<td colspan="3">
							<form:input path="registerId" size="73" cssClass="txaIpt" maxlength="255"/>
	      					<form:errors path="registerId" cssClass="error"/>
						</td>
					</tr>
					<tr>
						<th class="td_title1"><span class="star_t"></span>등록일자</th>
						<td colspan="3">
							<form:input path="registPnttm" size="73" cssClass="txaIpt" maxlength="255"/>
	      					<form:errors path="registPnttm" cssClass="error"/>
						</td>
					</tr>
				</c:if>
				
			</table>
		</div>
		<div class="main1_btn_div">
			<button class="main1_btn" id="origin_txt" style="display:none;" onclick="originTextCopy(); return false;" >원본 내용</button>
			<!-- <button class="main1_btn" onclick="ckeditorPriview(); return false;" >미리보기</button> -->
			<button class="main1_btn" onclick="location.href='/uss/ion/cnt/contentList.do'; return false;" >목 록</button>
			<c:if test="${empty cntManageVO.cntDtId}">
				<button class="main1_btn main1_save_btn" id="main1_save_btn" onclick="fn_egov_save_CntManage('save'); return false;" >등 록 </button>
			</c:if>
			<c:if test="${!empty cntManageVO.cntDtId }">
				<button class="main1_btn main1_save_btn" id="main1_save_btn" onclick="fn_egov_save_CntManage('modi'); return false;" >등 록 </button>
			</c:if>
		</div>
		
		<iframe name="iframe_egov_cntDetail" id="iframe_egov_cntDetail" src="/uss/ion/cnt/cntDetailList.do?cntId=${cntManageVO.cntId }" 
		style="margin-top: 1px;width: 100%; height: 750px; border:none;" scrolling="no" marginheight="0" marginwidth="0"></iframe>
 	</div>
	</div>
</form:form>
</body>
</html>
