

<div class="detailCon">
	<ul class="line lineL">
		<li class="line lineE">
			<label class="des desA">{%label.sysTime%}</label>
			<span id="sysTimeClock" class="text textA"></span>
		</li>
		<li class="line lineE">
			<label class="des desA" for="eptSerial">{%label.synTimeMethod%}</label>
			<span class="selCon">
				<span id="synTimeSel" class="select">
					<span class="value hsValueA"></span>
					<i class="arrow"></i>
				</span>
			</span>
		</li>
		<a id="manualA">
			<li class="line lineE">
				<label class="des desA">{%label.setTime%}</label>
				<input id="date" type="text" value="" class="text textA2 textCalender" readonly="true" />
			</li>
			<li class="line lineE">
				<label class="des desA"></label>
				<input id="time" type="text" value="" class="text textA2 textClock" readonly="true" />
			</li>
			<li class="line lineE">
				<label class="des desA"></label>
				<input id="synTimeCpBtn" class="subBtn btnA" type="button" value="{%label.synTimeComputer%}" />
			</li>
		</a>
		<a id="ntpA">
			<li class="line lineE">
				<label class="des desA">{%label.srvAddr%}</label>
				<input id="srvAddr" type="text" class="text textA1" />
			</li>
		</a>
	</ul>
	<div class="funcBtnCon">
		<input id="save" type="button" class="subBtn btnA" value="{%btn.save%}" />
	</div>
</div>

<script type="text/javascript">function init(){function g(a,b){switch(parseInt(a)){case ENONE:return!0;case IPCSYSNPORTERR:showStr=errStr.sysNtpPortErr;break;case IPCSYSNSERVERERR:showStr=errStr.sysNtpServerErr;break;case IPCVICSTGMANUALTIMEERR:showStr=errStr.ipcViCSTGManualTimeErr;break;case IPCUMGUESTNAUTH:showStr=errStr.invPermissionDenied;break;case EINVIP:showStr=errStr.ipAddrErr;break;case EINVGROUPIP:showStr=errStr.ipAddrGroupErr;break;case EINVIPFMT:showStr=errStr.ipAddrFmtErr;break;case EINVLOOPIP:showStr=errStr.ipAddrLoopErr;
break;case EINVNET:showStr=errStr.ipAddrNetErr;break;case EINDOMAIN:showStr=errStr.domainErr;break;default:showStr=errStr.invRequestFail}closeToast();showAlert(showStr,b);return!1}function M(){var a;clearTimeout(q);clearTimeout(u);clearTimeout(v);!0==h&&(a=z(),A.innerHTML=a,B(a),v=$.setTimeout(arguments.callee,1E3))}function C(){h=!0;r=m=!1;M()}function w(a){d=a;a==e.ntp?(D.style.display="none",E.style.display="block"):(D.style.display="block",E.style.display="none");k()}function B(a){a=a.split(" ");
n.value=a[0];p.value=a[1].replace(/\:/g," : ")}function c(a){10>a&&(a="0"+a);return a}function z(a){a=void 0==a?new Date:new Date(a);return a.getFullYear()+"-"+c(a.getMonth()+1)+"-"+c(a.getDate())+" "+c(a.getHours())+":"+c(a.getMinutes())+":"+c(a.getSeconds())}function F(a){clearTimeout(q);var b=z(1E3*a);A.innerHTML=b;d==e.manual&&!1==m&&B(b);q=$.setTimeout(function(){F(++a)},1E3)}function k(){var a={};clearTimeout(q);clearTimeout(v);clearTimeout(u);a[f]={};a[f][NAME]=G;$.queryP(a,function(a){!0==
g(a[ERR_CODE])&&!1==h&&F(parseInt(a[f][G][x]));u=$.setTimeout(k,1E4)})}function N(){var a={},b=a[f]={},l=H.value;!1==r&&C();if(d==e.ntp)if(/[^\d.]/g.test(l.toString())){if(O<l.length){showAlert(errStr.domainLengthErr);return}if(!1==g(checkDomain(l)))return}else{var c=checkIp(l);if(0!=c&&"0.0.0.0"!=l){g(c);return}}b[s]={};b[s][I]=d;showToast();$.modify(a,function(c){if(!0==g(c[ERR_CODE]))if(a={},b=a[f]={},m=h=!1,d==e.ntp)b[t]={},b[t][J]=l,$.modify(a,function(a){!0==g(a[ERR_CODE])&&(showToast("setNTPSuccess"),
k())});else{b[y]={};if(!0==h)b[y][x]=Math.round((new Date).getTime()/1E3);else{if(0==p.value.length||0==n.value.length){closeToast();showAlert(errStr.setDateTimeNull);return}b[y][x]=P()}$.action(a,function(a){!0==g(a[ERR_CODE])&&(showToast("success"),k())})}})}function P(){var a=new Date,b=n.value.split("-"),c=p.value.split(":");a.setFullYear(b[0],parseInt(b[1],10)-1,b[2]);a.setHours(parseInt(c[0],10));a.setMinutes(parseInt(c[1],10));a.setSeconds(parseInt(c[2],10));return parseInt(a.getTime()/1E3,
10)}var f=uciSystem.fileName,s=uciSystem.secName.basic,t=uciSystem.secName.ntp,e=uciSystem.optValue.timeMode,I=uciSystem.optName.timingMode,J=uciSystem.optName.server,G=uciSystem.secName.clockStatus,x=uciSystem.optName.seconds,y=uciSystem.optName.setDate,A=id("sysTimeClock"),D=id("manualA"),E=id("ntpA"),H=id("srvAddr"),K=[{str:label.synTimeNTP,value:e.ntp},{str:label.synTimeManual,value:e.manual}],L,d,h=!1,m=!1,r=!0,v,u,q,p=id("time"),n=id("date"),O=67;(function(){var a={};(a[f]={})[NAME]=[s,t];$.query(a,
function(a){!0==g(a[ERR_CODE])&&(!0==$.local?(selectInit("synTimeSel",K,e.manual,w),d=e.manual):(H.value=a[f][t][J],L=a[f][s],d=L[I],selectInit("synTimeSel",K,d,w)),w(d),showDetailCon())});id("synTimeCpBtn").onclick=C;id("save").onclick=N;n.onkeydown=function(a){a=a||window.event;eventPreventDefault(a)};p.onkeydown=function(a){a=a||window.event;eventPreventDefault(a)};laydate({elem:"#date"});timePickerInit("time");attachEvnt(n,"click",function(){h=!1;r=m=!0;k()});attachEvnt(p,"click",function(){h=
!1;r=m=!0;k()});k()})()}init();
</script><style type="text/css">#manualA{display:none}#ntpA{display:none}input.textClock{background:url(../web-static/images/clock.png) no-repeat 160px 5px #fff;cursor:pointer;text-align:left;text-indent:10px}input.textCalender{background:url(../web-static/images/calender.png) no-repeat 160px 5px #fff;cursor:pointer;text-align:left;text-indent:10px}li.line input.btnA{width:190px;*padding:2px 12px 1px}</style>