(function(f){var l=new function(){this.Nic=function(){this.category="Hardware";this.name="NIC";this.subnavigationicon="sec-nav-network.png";var c=void 0,h=!1,g=null;this.Init=function(){c=this;if(void 0==c||null==c)return!1;c.setCycleTime(2E3);c.setCommunicationObj(f.DevMan.getCommunicationModule(f.DevMan.CommunicationType.mdp));c.addParameter("NIC_Property_Name",!1);c.addParameter("NIC_Property_MAC_Address",!1);c.addParameter("NIC_Property_IPv4_Address",!0);c.addParameter("NIC_Property_IPv4_Subnet_Mask",
!0);c.addParameter("NIC_Property_DHCP",!0);c.addParameter("NIC_Property_IPv4_Default_Gateway",!0);c.setOnInitStaticPage(l);c.setOnDisplayValues(q);c.setOnWriteFailed(r);c.setOnWriteResult(s);c.setOnServiceTransferFailed(t);c.setOnServiceTransferResult(u);return!0};var l=function(a){var b="";if(a[0].getHasValues()||a[1].getHasValues()||a[2].getHasValues()||a[3].getHasValues()||a[4].getHasValues()||a[5].getHasValues())for(var b=b+"<h3>Network Interfaces</h3><table>",b=b+'<tr><td class="td_FirstColumn_Important">Warning</td><td>Incorrect changes may corrupt the connection to a remote computer!</td></tr>',
b=b+"</table>",b=b+"<br>",e=Math.max(a[0].moduleCount,a[1].moduleCount,a[2].moduleCount,a[3].moduleCount,a[4].moduleCount,a[5].moduleCount),d=0;d<e;d++)b+='<table style="margin-bottom: 5px"><tr>',b+='<td class="td_trans"><h4><div id="'+a[0].parameterName+d+'"></div></h4></td>',b+='<td class="td_Action_trans">'+(new ControlLib.SmallButton).Create("btnRenewIP"+d,"refresh","Renew IP Address")+(new ControlLib.SmallButton).Create("btnWriteNicSettings"+d,"save","Save Network Settings")+(new ControlLib.SmallButton).Create("btnWriteNicSettings_Cancel"+
d,"delete")+"</td>",b+="</tr></table>",b+="<table>",b+='<tr><td class="td_FirstColumn">MAC Address</td><td><div id="'+a[1].parameterName+d+'"></div></td></tr> ',b+='<tr><td class="td_FirstColumn">IPv4 Address</td><td>'+(new ControlLib.Textbox).Create(a[2].parameterName+d)+"</td></tr> ",b+='<tr><td class="td_FirstColumn">IPv4 Subnet Mask</td><td>'+(new ControlLib.Textbox).Create(a[3].parameterName+d)+"</td></tr> ",b+='<tr><td class="td_FirstColumn">IPv4 Default Gateway</td><td>'+(new ControlLib.Textbox).Create(a[5].parameterName+
d)+"</td></tr> ",b+="<tr>",b+='<td class="td_FirstColumn">DHCP</td>',b+="<td>"+(new ControlLib.Combobox).Create(a[4].parameterName+d,["Disabled","Enabled"])+"</td>",b+="</tr>",b+="</table>",b+="<br/>";b+='<div id="status"></div>';c.writeActivePage(b);if(a[0].getHasValues()||a[1].getHasValues()||a[2].getHasValues()||a[3].getHasValues()||a[4].getHasValues()||a[5].getHasValues())for(e=Math.max(a[0].moduleCount,a[1].moduleCount,a[2].moduleCount,a[3].moduleCount,a[4].moduleCount,a[5].moduleCount),d=0;d<
e;d++)c.setElementOnClick("btnRenewIP"+d,function(a){return function(){n(a)}}(d)),c.setElementOnClick("btnWriteNicSettings"+d,function(a){return function(){g=-1;c.writeStatus("");var b=[],e=[],d=[],f=c.getRequestParamIDs();if(c.isLocked("NIC_Property_IPv4_Address"+a)||c.isLocked("NIC_Property_IPv4_Subnet_Mask"+a)||c.isLocked("NIC_Property_IPv4_Default_Gateway"+a)||c.isLocked("NIC_Property_DHCP"+a)){var h=c.getElementValue("NIC_Property_DHCP"+a);if(0==h){var k=c.getElementValue("NIC_Property_IPv4_Address"+
a);""==k&&(k="0.0.0.0");var m=c.getElementValue("NIC_Property_IPv4_Subnet_Mask"+a);""==m&&(m="0.0.0.0");var l=c.getElementValue("NIC_Property_IPv4_Default_Gateway"+a);""==l&&(l="0.0.0.0");k==f[2].values[a].getOutput()&&m==f[3].values[a].getOutput()&&(b.push("NIC_Property_DHCP"),e.push(a),d.push(h));b.push("NIC_Property_IPv4_Address");e.push(a);d.push(k);b.push("NIC_Property_IPv4_Subnet_Mask");e.push(a);d.push(m);b.push("NIC_Property_IPv4_Default_Gateway");e.push(a);d.push(l)}else 1==h&&(b.push("NIC_Property_DHCP"),
e.push(a),d.push(h))}0<b.length&&(g=a,c.Write(b,e,d),Helper.ShowLoading())}}(d)),c.setElementOnClick("btnWriteNicSettings_Cancel"+d,function(a){return function(){k(a)}}(d)),c.setElementOnClick(a[4].parameterName+d,function(a){return function(){if(c.isLocked("NIC_Property_DHCP"+a)){var b=c.getElementValue("NIC_Property_DHCP"+a);c.setElementDisabled("NIC_Property_IPv4_Address"+a,1==b);c.setElementDisabled("NIC_Property_IPv4_Subnet_Mask"+a,1==b);c.setElementDisabled("NIC_Property_IPv4_Default_Gateway"+
a,1==b)}}}(d)),c.addLockListener(a[2].parameterName+d),c.addLockListener(a[3].parameterName+d),c.addLockListener(a[4].parameterName+d),c.addLockListener(a[5].parameterName+d);return!0},q=function(a){h&&(h=!1,c.writeStatus("Connection has been restored!"),c.scrollToElement("status"),0<=g&&(k(g),g=-1));var b=0;a[0].getHasValues()&&(b=a[0].moduleCount);for(var e=0;e<b;e++){var d=a[0].values[e].getOutput(),f=d.lastIndexOf("[");-1<f&&(d=d.substring(0,f));c.writeElement(a[0].parameterName+e,d)}b=0;a[1].getHasValues()&&
(b=a[1].moduleCount);for(e=0;e<b;e++)c.writeElement(a[1].parameterName+e,a[1].values[e].getOutput());b=0;a[2].getHasValues()&&(b=a[2].moduleCount);for(e=0;e<b;e++)c.setElementValue(a[2].parameterName+e,a[2].values[e].getOutput());b=0;a[3].getHasValues()&&(b=a[3].moduleCount);for(e=0;e<b;e++)c.setElementValue(a[3].parameterName+e,a[3].values[e].getOutput());b=0;a[5].getHasValues()&&(b=a[5].moduleCount);for(e=0;e<b;e++)c.setElementValue(a[5].parameterName+e,a[5].values[e].getOutput());b=0;a[4].getHasValues()&&
(b=a[4].moduleCount);for(e=0;e<b;e++)d=a[4].values[e].getOutput(),c.setElementValue(a[4].parameterName+e,d),c.isLocked(a[4].parameterName+e)&&(d=c.getElementValue(a[4].parameterName+e)),c.setElementDisabled("NIC_Property_IPv4_Address"+e,1==d),c.setElementDisabled("NIC_Property_IPv4_Subnet_Mask"+e,1==d),c.setElementDisabled("NIC_Property_IPv4_Default_Gateway"+e,1==d)},r=function(a){Helper.HideLoading();c.clearLocks();2147811345==a.requestStatus?(h=!0,c.writeStatus("Attempting to reconnect. This process may take up to one minute..."),
c.scrollToElement("status"),0<=g&&p(g)):f.DevMan.getErrorQueue().AddError(a.requestStatus,a.requestStatusText)},s=function(a,b){g=-1;Helper.HideLoading();for(var c=0;c<a.length;c++)if(0<b[c]){var d="";switch(a[c].name){case "NIC_Property_IPv4_Address":d="IP Address";break;case "NIC_Property_IPv4_Subnet_Mask":d="Subnet Mask";break;case "NIC_Property_IPv4_Default_Gateway":continue}0<d.length?f.DevMan.getErrorQueue().AddError(b[c],CommunicationModule_ERROR.ErrorCodeToErrorMessage(b[c])+" ("+d+")"):f.DevMan.getErrorQueue().AddError(b[c])}winxp?
0<a.length&&k(a[0].id):0<a.length&&n(a[0].id)},k=function(a){c.removeLock("NIC_Property_IPv4_Address"+a);c.removeLock("NIC_Property_IPv4_Subnet_Mask"+a);c.removeLock("NIC_Property_IPv4_Default_Gateway"+a);c.removeLock("NIC_Property_DHCP"+a)},p=function(a){c.setElementValue("NIC_Property_IPv4_Address"+a,"0.0.0.0");c.setElementValue("NIC_Property_IPv4_Subnet_Mask"+a,"0.0.0.0");c.setElementValue("NIC_Property_IPv4_Default_Gateway"+a,"0.0.0.0")},t=function(a){Helper.HideLoading();c.clearLocks();2147811345==
a.requestStatus?(h=!0,c.writeStatus("Attempting to reconnect. This process may take up to one minute..."),c.scrollToElement("status"),0<=g&&p(g)):f.DevMan.getErrorQueue().AddError(a.requestStatus,a.requestStatusText)},u=function(a){switch(a.moduleItem.name){case "NIC_Function_IP_Release_Renew":a.isBusy||(Helper.HideLoading(),k(a.moduleItem.id),a.hasError&&f.DevMan.getErrorQueue().AddError(a.errCode,"Could not renew IP-Address."));break;default:Helper.HideLoading()}},n=function(a){var b=[];b.push(c.getCommunicationObj().getServiceTransferParameterSize("NIC_Function_IP_Release_Renew"));
winxp||(g=a);c.executeCommand("NIC_Function_IP_Release_Renew",a,b);Helper.ShowLoading()}};this.Nic.prototype=new f.Page_Template.Template};f.DevMan.RegisterModule(new l.Nic,f.DevMan.ModuleType.Website)})(window);
