

<div id="ptzCronJobConf" class="detailCon menuLessMT">
	<ul class="line">
		<li class="line lineG">
			<label class="des desA">{%label.PTZPlan%}</label>
			<div id="PTZPlanEnableSwitch" class="switchCon">
				<i class="switchBg"></i>
				<i class="switchBall"></i>
			</div>
		</li>
	</ul>

	<div style="width:750px;position:relative;z-index:1;">
		<div id="hidebg"></div>
	</div>

	<ul class="line" id = "TimePlanHeader">
		<li class="line linePlan">
			<label class="des desA">{%label.PTZTimePlan%}</label>
			<span class="clearAll" id="cleanAll">{%label.clear%}</span>
		</li>
	</ul>

	<div id="PTZPlanSetting" class="PTZPlanSetDiv"></div>

	<ul class="line lineBottom">
		<li class="line lineG">
			<label class="des desE">{%label.PTZPlanRestoreTime%}</label>
			<input id="restoreTime" class="textInput text textA1"/>
			<span class="tip">{%label.PTZPlanTimeRage%}</span>
		</li>
	</ul>

	<div class="funcBtnCon">
		<input class="subBtn btnA" type="button" id="save" value="{%btn.save%}" />
	</div>
</div>
<script type="text/javascript">function init(){function t(b){var a="";closeNoteAll();switch(b){case ENONE:return!0;case PTZ_ERR_UNKNOWN:a=errStr.ptzUnknown;break;case PTZ_ERR_ARGUMENT_INVALID:a=errStr.ptzArgumentInvalid;break;case PTZ_ERR_REQUEST_CONFLICT:a=errStr.ptzRequestConflict;break;case PTZ_ERR_CONFIGURATION_CONFILICT:a=errStr.ptzConfigConflict;break;case PTZ_ERR_CONFIGURATION_FIXED:a=errStr.ptzConfigFixed;break;default:a=errStr.invRequestFail}closeToast();showAlert(a);return!1}function u(b){var a={};a[h]={};a[h][KEY_NAME]=
q;a[h][KEY_TABLE]=l;("undefined"!=typeof b||b)&&showToast("loading");$.query(a,function(a){if(!0==t(a[ERR_CODE])){"undefined"==typeof b&&showToast("success");r=parseInt(a[h][q][e.enable]);w=parseInt(a[h][q][e.restime]);x.setState(r);$("#restoreTime").get(0).value=w;for(var d=0;d<l.length;d++){for(var f=a[h][l[d]],c=[],g=0;g<f.length;g++)for(var k in f[g]){var s="undefined"==typeof f[g][k][e.actid]?0:parseInt(f[g][k][e.actid]),s=isNaN(s)?0:s;0<=$.inArray(f[g][k][e.acttype],n)&&c.push({startTime:parseInt(f[g][k][e.stime]),
endTime:parseInt(f[g][k][e.etime]),actType:$.inArray(f[g][k][e.acttype],n),actId:s})}"undefined"!=typeof p&&p.setWeekData(d,c)}y(r)}"undefined"!=typeof b&&b&&showDetailCon()})}function D(){var b={};b[h]={};b[h][q]={};b[h][q][e.enable]=r;b[h][q][e.restime]=z();showToast("loading");$.modify(b,function(a){!0==t(a[ERR_CODE])&&E()})}function E(){var b={};b[h]={};b[h][A]={};for(var a=0;a<l.length;a++){for(var v=p.getWeekData(a),d=[],f=0;f<v.length;f++){var m=v[f],g={},k=l[a]+"_"+(f+1);g[k]={};g[k][e.stime]=
String(m.startTime);g[k][e.etime]=String(m.endTime);g[k][e.acttype]=n[m.actType];if(n[m.actType]==c.tour||n[m.actType]==c.pattern||n[m.actType]==c.preset)g[k][e.actid]=String(m.actId);d.push(g)}b[h][A][l[a]]=d}$.action(b,function(a){!0==t(a[ERR_CODE])&&u()})}function y(b){p.enablePTZPlan(b);$("#restoreTime").attr("disabled",!b);r=b;var a=document.getElementById("hidebg");0==b?($("#hidebg").addClass("displayBlock"),a.style.height=getoffset(id("save")).top-getoffset(id("TimePlanHeader")).top+"px"):
$("#hidebg").removeClass("displayBlock")}function z(){var b=$("#restoreTime").get(0).value,a=b.match(/^\s*\d{1,3}\s*$/),c,d=-1;a?(d=parseInt(a[0]),d=d<B?B:d>C?C:d):c=0==b.length?errStr.resumeTimeNull:errStr.resumeTimeInvalid;if("string"==typeof c)closeNoteAll(),showNote("restoreTime",c);else return d}function F(){$("#save").click(function(){0<z()&&D()});$("#restoreTime").click(function(){closeNoteAll()});$("#cleanAll").click(function(){if("undefined"!=typeof p)for(var b=0;b<l.length;b++)p.setWeekData(b,
[])})}var h=uciPTZPlan.fileName,q=uciPTZPlan.secName.planconf,l=[uciPTZPlan.secType.mon,uciPTZPlan.secType.tue,uciPTZPlan.secType.wed,uciPTZPlan.secType.thu,uciPTZPlan.secType.fri,uciPTZPlan.secType.sat,uciPTZPlan.secType.sun],e=uciPTZPlan.optName,c=uciPTZPlan.optValue,A=uciPTZPlan.actionName.setplanconf,n=[],p,x,r=1,w=0,B=5,C=720;(function(){for(var b=[c.disable,c.tour,c.preset,c.autoscan,c.framescan,c.randomscan,c.pattern,c.panoramascan,c.tiltscan,c.reboot,c.adjust],a="disable tour preset auto_scan frame_scan random_scan pattern panorama_scan tilt_scan reboot adjust".split(" "),
e=$.ptzCapability.plan_support_type_list,d=0;d<a.length;d++)for(var f=0;f<e.length;f++)a[d]==e[f]&&n.push(b[d]);p=new PTZPlanSet("PTZPlanSetting",{maxItemCntEachDay:10,plan_support_type:$.ptzCapability.plan_support_type_list});x=new Switch("PTZPlanEnableSwitch",0,y);F();u(!0)})()}init();
</script><style type="text/css">.displayBlock{display:block!important}#ptzCronJobConf{width:720px}ul.line label.desF{font-size:16px;color:#a0a0a0;line-height:32px;width:85px}div.btnRight{display:inline-block;width:92px;height:32px;float:right;cursor:pointer;vertical-align:middle}ul.line li.lineG1{width:720px;padding-bottom:12px;margin:20px 0 30px;border-bottom:solid 1px #2e2e2e}#restoreTime{width:160px;margin-left:4px}ul.lineBottom{margin-bottom:20px}</style>