

<div class="detailCon">
	<div class="hsHelp"></div>
	<div class="stateDiv">
		<label class="statLabel">{%label.phState%}{%label.colon%}</label>
		<label id="connectStat" class="statLabel">{%statusStr.disconcted%}</label>
	</div>
	<div class="actionBarDiv">
		<div class="actionTitleDiv">
			<label class="actionTitle">{%label.basicSet%}</label>
		</div>
		<!-- 模式选择 -->
		<div class="configDiv">
			<ul class="line lineL">
				<li class="line lineI">
					<label class="des desA">{%label.mode%}</label>
					<span class="selCon">
						<span id="wanMode" class="select">
							<span class="value hsValueA"></span>
							<i class="arrow"></i>
						</span>
					</span>
				</li>
				<li class="line lineI">
					<label class="des desA">{%label.ipAddr%}</label>
					<input id="ip" class="text textA1"/><i class="tip"></i>
				</li>
				<li class="line lineI">
					<label class="des desA">{%label.mask%}</label>
					<input id="mask" class="text textA1"/><i class="tip"></i>
				</li>
				<li class="line lineI gatewayWrap">
					<label class="des desA">{%label.gateway%}</label>
					<input id="gateway" class="text textA1"/><i class="tip"></i>
				</li>
				<li class="line lineI dnsWrap">
					<label class="des desA">{%label.dns0%}</label>
					<input id="dns0" class="text textA1"/><i class="tip"></i>
				</li>
				<li class="line lineI dnsWrap">
					<label class="des desA">{%label.dns1%}</label>
					<input id="dns1" class="text textA1"/><i class="tip"></i>
				</li>
			</ul>
		</div>
	</div>
	<div class="actionBarDiv">
		<div class="actionTitleDiv">
			<label class="actionTitle">{%label.highSet%}</label>
		</div>
		<div class="configDiv">
			<ul class="line">
				<li class="line lineC">
					<label class="des desA">{%label.mtu%}</label>
					<input id="mtu" class="text textA1" maxLength="4" />
				</li>
				<li class="line lineC autoIp hideSelf">
					<label class="des desA">{%label.autoIp%}</label>
					<div id="autoIpSwitch" class="switchCon">
						<i class="switchBg"></i>
						<i class="switchBall"></i>
					</div>
					<label class="des desH">ON</label>
				</li>
				<!-- 4G IPC 有线上网 -->
				<li class="line lineC" id="lteWiredWrap">
					<label class="des desA">{%label.internetWired%}</label>
					<span class="selCon IEPZD">
						<span id="internetWiredSel" class="select">
							<span class="value hsValueA"></span>
							<i class="arrow"></i>
						</span>
					</span>
				</li>
			</ul>
		</div>
	</div>

	<div class="funcBtnCon">
		<input id="save" type="button" value="{%btn.save%}" class="subBtn btnA" />
	</div>
</div>
<script type="text/javascript">function init(){function I(a){var b="";switch(a){case ENONE:return!1;case IPCSYSRPARAERR:b=errStr.ipcSysRparaErr;break;case IPCSYSRCONFERR:b=errStr.ipcSysRconfErr;break;case IPCUBUSCONNFAIL:b=errStr.ipcUbusConnFail;break;case IPCUBUSCALLERR:b=errStr.ipcUbusCallErr;break;case IPCUMGUESTNAUTH:b=errStr.invPermissionDenied;break;case IPCFILEOPENERR:b=errStr.ipcFileOpenErr;break;case IPCDIRMKERR:b=errStr.ipcDirMkErr;break;case IPCDATESETERR:b=errStr.ipcDateSetErr;break;case IPCFUNCPARAEXPT:b=errStr.ipcFuncParaExpt;
break;case IPCUCCONVERR:b=errStr.ipcUcConvErr;break;default:b=errStr.unknown}closeToast();showAlert(b);return!0}function e(a,b){var c="";switch(a){case ENONE:return!1;case EINVNET:c=errStr.ipAddrNetErr;break;case EINVIP:c=errStr.ipAddrErr;break;case EINVIPFMT:c=errStr.ipAddrFmtErr;break;case EINVGROUPIP:c=errStr.ipAddrGroupErr;break;case EINVLOOPIP:c=errStr.ipAddrLoopErr;break;case EINVMASK:c=errStr.maskErr;break;case EINVNETID:c=errStr.ipAddrNetIdErr;break;case EINVHOSTID:c=errStr.ipAddrHostIdErr;
break;case EINVIPMASKPAIR:c=errStr.ipAddrMaskNotMatch;break;case ECOMFLICTNET:c=errStr.ipAddrLanWanConflict;break;case EINVGTW:c=errStr.gatewayErr;break;case EINVMTU:c=errStr.stcMtuErr;break;case EINVFDNSVR:c=errStr.primDnsErr;break;case EINVSDNSVR:c=errStr.seDnsErr;break;default:c=errStr.unknown+a}showNote(b,c);closeToast();return!0}function J(a){return""==a||"0.0.0.0"==a?EINVFDNSVR:ENONE!=checkIp(a)?EINVFDNSVR:ENONE}function K(a){return""==a||"0.0.0.0"==a?(id("dns1").value="0.0.0.0",ENONE):ENONE!=
checkIp(a)?EINVSDNSVR:ENONE}function L(a){a=a[uciNetwork.fileName][uciNetwork.dynData.wanStatus];if(a[uciNetwork.optName.proto]!=uciProto.optValue.proto.staticIp)clearTimeout(s);else{if(parseInt(a[uciNetwork.optName.phyStatus])==LINK_UP)switch(parseInt(a[uciNetwork.optName.linkStatus])){case LINK_DOWN:n=A;h.innerHTML=statusStr.disconcted;$(h).addClass("connectStatDis");break;case LINK_UP:n=ba;h.innerHTML=statusStr.concted;$(h).removeClass("connectStatDis");break;default:n=A}else n=A;clearTimeout(s);
s=$.setTimeout(B,n)}}function B(){var a={};a[uciNetwork.fileName]={};a[uciNetwork.fileName][KEY_NAME]=[uciNetwork.dynData.wanStatus];$.queryP(a,L)}function M(){var a="";t!=DEF_PORT&&(a=":"+t);window.location.href="http://"+u+a}function q(){var a=id("ip").value,b=id("mask").value,c=id("gateway").value,l=id("dns0").value,k=id("dns1").value,m=id("mtu").value;e(checkIp(a),"ip");e(checkMask(b),"mask");e(checkIpMask(a,b),"mask");r||(e(ENONE!=checkIp(c)?EINVGTW:ENONE,"gateway"),e(J(l),"dns0"),e(K(k),"dns1"));
e(checkMtu(m),"mtu")}function C(a){ipVal=id("ip").value;maskVal=id("mask").value;showToast("loading");$.modify(a,function(a){!1==I(a[ERR_CODE])&&(showToast("success"),u=ipVal,N==O?(showToast("other",{noteStr:label.navigateToIp}),$.changeDomain(u+":"+t),lanDetecting(M)):P!=u||Q!=maskVal?(showToast("other",{noteStr:label.navigateToIp}),$.changeDomain(u+":"+t),lanDetecting(M)):(D(),closeToast()))})}function ca(a){!1===a?(p="off",D()):C(R)}function S(a,b,c,e,k,m){var f="1",g={},f={},d={},h={};g[x]=f;
f[T]=h;f[E]=d;d[y]=a;d[F]=b;d[G]=c;d[U]=e;r||(d[G]=c,d[V]=k,d[W]=m);z&&(a=id("internetWiredSel").value,g[uciLteManager.fileName]={},g[uciLteManager.fileName][uciLteManager.secName.infoData]={},g[uciLteManager.fileName][uciLteManager.secName.infoData][uciLteManager.optName.internetWiredEn]=a);h[da]=uciProto.optValue.proto.staticIp;!0==X?(f=p!=v?"1":"2",h[uciProto.optName.operatorInfo]=f,d[uciProto.optName.autoIp]=p,d[uciProto.optName.operatorInfo]=f,p!=v&&"on"==p?(R=g,showConfirm(label.autoIpRebootWarning,
ca)):(p="off",C(g))):C(g)}function ea(a){p=1==a?"on":"off"}function fa(a){if(!0!=I(a[ERR_CODE])){var b=a[x][E];$("#ip").val(b[y]);$("#mask").val(b[F]);$("#gateway").val(b[G]);$("#mtu").val(b[U]);$("#dns0").val(b[V]);$("#dns1").val(b[W]);N=a[uciNetwork.fileName][uciNetwork.dynData.wanStatus][uciNetwork.optName.proto];P=b[y];Q=b[F];t=a[H][Y.main][ga.listenHttpPort];statusStr.disconcted==h.innerHTML?$(h).addClass("connectStatDis"):$(h).removeClass("connectStatDis");void 0!=$.moduleSpec.auto_ip_configurable&&
(X=!0,v=b[uciProto.optName.autoIp],$(".autoIp").removeClass("hideSelf"),!0==Z?(Z=!1,aa=new Switch("autoIpSwitch","on"==v?1:0,ea)):aa.setState("on"==v?1:0));z?(r=a[uciLteManager.fileName][uciLteManager.secName.infoData][uciLteManager.optName.internetWiredEn]==uciLteManager.optValue.enableVal.off?!0:!1)?(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.off),$(".gatewayWrap").hide(),$(".dnsWrap").hide()):(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.on),$(".gatewayWrap").show(),
$(".dnsWrap").show()):ha&&(r=!0,$(".gatewayWrap").hide(),$(".dnsWrap").hide());L(a);showDetailCon()}}function D(){var a={};a[x]={};a[x][KEY_NAME]=[T,E];a[uciNetwork.fileName]={};a[uciNetwork.fileName][KEY_NAME]=[uciNetwork.dynData.wanStatus];a[H]={};a[H][NAME]=[Y.main];z&&(a[uciLteManager.fileName]={},a[uciLteManager.fileName][KEY_NAME]=[uciLteManager.secName.infoData]);$.query(a,fa)}function ia(a){(r="off"==a?!0:!1)?(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.off),$(".gatewayWrap").hide(),
$(".dnsWrap").hide()):(id("internetWiredSel").resetSel(uciLteManager.optValue.enableVal.on),$(".gatewayWrap").show(),$(".dnsWrap").show())}var x=uciProto.fileName,T=uciProto.secName.wan,E=uciProto.secName.sta,y=uciProto.optName.ip,F=uciProto.optName.netmask,G=uciProto.optName.gateway,V=uciProto.optName.priDns,W=uciProto.optName.sndDns,U=uciProto.optName.mtu,da=uciProto.optName.type,s,h=id("connectStat"),aa,ja=uciNetwork.fileName,ka=uciNetwork.action.checkIpConflict,A=4E3,ba=2E4,n=4E3,H=uciUhttpd.fileName,
Y=uciUhttpd.secName,ga=uciUhttpd.optName,w=uciProto.optValue,O=DEF_WAN_T=w.proto.dynIp,la=w.proto.staticIp,u,P,Q,N,t=DEF_PORT=80,p="on",v="on",X=!1,Z=!0,R={},r=!1,ha=1==parseInt($.moduleSpec.lte)?!0:!1,z=1==parseInt($.moduleSpec.lte)&&$.lteCapability&&1==parseInt($.lteCapability[uciLteCapability.optName.internetWiredSupport]);id("ip").onblur=q;id("mask").onblur=q;id("gateway").onblur=q;id("dns0").onblur=q;id("dns1").onblur=q;id("mtu").onblur=q;id("ip").onfocus=closeNoteAll;id("mask").onfocus=closeNoteAll;
id("gateway").onfocus=closeNoteAll;id("dns0").onfocus=closeNoteAll;id("dns1").onfocus=closeNoteAll;id("mtu").onfocus=closeNoteAll;selectInit("wanMode",[{str:label.smartIp,value:w.proto.dynIp},{str:label.staticIp,value:w.proto.staticIp}],w.proto.staticIp,function(a){a==O?loadPage("DynamicIp.htm","wanCon"):a==la&&loadPage("StaticIp.htm","wanCon")});z?selectInit("internetWiredSel",[{str:label.internetWiredOff,value:"off"},{str:label.internetWiredOn,value:"on"}],"off",ia):$("#lteWiredWrap").hide();id("save").onclick=
function(){var a={},b={},c={};a[ja]=b;b[ka]=c;var l=id("ip").value,k=id("mask").value,m=id("gateway").value,f=id("dns0").value,g=id("dns1").value,d=id("mtu").value;e(checkIp(l),"ip")||e(checkMask(k),"mask")||e(checkIpMask(l,k),"mask")||e(checkMtu(d),"mtu")||!r&&(e(ENONE!=checkIp(m)?EINVGTW:ENONE,"gateway")||e(J(f),"dns0")||e(K(g),"dns1"))||(l=hideLeadingZeros(l),id("ip").value=l,k=hideLeadingZeros(k),id("mask").value=k,m=hideLeadingZeros(m),id("gateway").value=m,f=hideLeadingZeros(f),id("dns0").value=
f,g=hideLeadingZeros(g),id("dns1").value=g,d=hideLeadingZeros(d),id("mtu").value=d,c[y]=l,h.innerHTML=statusStr.connting,$(h).removeClass("connectStatDis"),showDetailCon(),showToast("loading"),$.action(a,function(a){EIPCONFLICT==a[ERR_CODE]?(closeToast(),showConfirm(label.ipConflictConfirm,function(a){!0==a&&S(l,k,m,d,f,g)})):ENONE==a[ERR_CODE]&&(closeToast(),S(l,k,m,d,f,g))}),s=$.setTimeout(B,n))};D();s=$.setTimeout(B,n)}init();
</script><style type="text/css">ul.line li.lineI,ul.line li.lineC{display:block}ul.lineL{margin-bottom:25px}</style>