(function(f){var m=new function(){this.SystemSettings=function(){this.category="Software";this.name="Sys.Settings";this.subnavigationicon="sec-nav-sys-settings.png";var c=void 0;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("TIME_Property_SNTP_Server",!0);c.addParameter("TIME_Property_SNTP_Refresh",!0);c.addParameter("TIME_Property_Seconds",!1);c.addParameter("TIME_Property_Textual_DateTime_presentation",
!0);c.addParameter("TIME_Property_Timezone",!0);c.addParameter("TIME_Property_Timezones_Len",!1);c.addParameter("DisplayDevice_Property_DeviceName",!1);c.addParameter("DisplayDevice_Settings_Property_IDxActiveDisplayMode",!0);c.addParameter("DisplayDevice_Modes_Property_Len",!1);c.setOnInitStaticPage(m);c.setOnDisplayValues(n);c.setOnWriteFailed(t);c.setOnWriteResult(u);return!0};var m=function(b){var a="";if(0<b[0].values.length&&b[1].getHasValues()){a+='<table style="margin-bottom: 5px"><tr><td class="td_trans"><h3>SNTP Server</h3></td>';
a+='<td class="td_Action_trans">'+(new ControlLib.SmallButton).Create("btnTurnOffSNTP","power","Turn Off SNTP Server")+(new ControlLib.SmallButton).Create("btnWriteSNTPSettings","save","Activate SNTP Settings")+(new ControlLib.SmallButton).Create("btnWriteSNTPSettings_Cancel","delete")+"</td>";a+="</tr></table>";a+="<table>";if(0<b[0].values.length&&b[1].getHasValues())var a=a+('<tr><td class="td_FirstColumn">Servername</td><td>'+(new ControlLib.Textbox).Create(b[0].parameterName)+"</td></tr> "),
d=Helper.getSNTPRefreshDurationsArr(),a=a+('<tr><td class="td_FirstColumn">Refresh Rate</td><td>'+(new ControlLib.Combobox).Create(b[1].parameterName,d)+"</td></tr> ");a+="</table>";a+="<br>"}b[3].getHasValues()&&(a+='<table style="margin-bottom: 5px"><tr>',a+='<td class="td_trans"><h3>Local Date/Time</h3></td>',a+='<td class="td_Action_trans">'+(new ControlLib.SmallButton).Create("btnWriteTimeSettings","save","Save Local Date/Time")+(new ControlLib.SmallButton).Create("btnWriteTimeSettings_Cancel",
"delete")+"</td>",a+="</tr></table>",a+="<table>",b[3].getHasValues()&&(a+='<tr><td class="td_FirstColumn">Date (dd.MM.yyyy)</td><td>'+(new ControlLib.Textbox).Create(b[3].parameterName+"_date")+"</td></tr>",a+='<tr><td class="td_FirstColumn">Time (HH:mm:ss)</td><td>'+(new ControlLib.Textbox).Create(b[3].parameterName+"_time")+"</td></tr>"),a+="</table>",a+="<br>");if(b[4].getHasValues()&&b[5].getHasValues()){var a=a+'<table style="margin-bottom: 5px"><tr>',a=a+'<td class="td_trans"><h3>Timezone</h3></td>',
a=a+('<td class="td_Action_trans">'+(new ControlLib.SmallButton).Create("btnWriteTimezoneSettings","save","Save Timezone")+(new ControlLib.SmallButton).Create("btnWriteTimezoneSettings_Cancel","delete")+"</td>"),a=a+"</tr></table>",a=a+"<table>",e=[];try{for(d=0;d<b[5].values[0].length;d++)e.push(b[5].values[0][d].data);a+='<tr><td class="td_FirstColumn">Timezone</td><td>'+(new ControlLib.Combobox).Create(b[4].parameterName,e,"100%")+"</td></tr>"}catch(m){e=[]}a+="</table>";a+="<br>"}if(b[6].getHasValues()&&
b[7].getHasValues()&&b[8].getHasValues()){a+='<table style="margin-bottom: 5px"><tr>';a+='<td class="td_trans"><h3>Display Device</h3></td>';a+='<td class="td_Action_trans">'+(new ControlLib.SmallButton).Create("btnWriteDisplayDeviceSettings","save","Save Display Resolution")+(new ControlLib.SmallButton).Create("btnWriteDisplayDeviceSettings_Cancel","delete")+"</td>";a+="</tr></table>";a+="<table>";a+="<tr><th>Name</th><th>Display Resolution</th></tr>";for(d=0;d<b[6].moduleCount;d++){var a=a+"<tr>",
a=a+('<td class="td_FirstColumn"><div id="'+b[6].parameterName+d+'"></div></td>'),e=[],k=[];e.push("");k.push(-1);try{for(var l=0;l<b[8].values[d].length;l++)e.push(b[8].values[d][l].data),k.push(l)}catch(n){e=[],k=[]}a+="<td>";0<e.length&&(a+=(new ControlLib.Combobox).CreateMap(b[8].parameterName+d,e,k,"100%"));a+="</td>";a+="</tr>"}a+="</table>";a+="<br>"}a+='<div id="status"></div>';c.writeActivePage(a);0<b[0].values.length&&b[1].getHasValues()&&(c.addLockListener(b[0].parameterName),c.addLockListener(b[1].parameterName),
c.setElementOnClick("btnTurnOffSNTP",function(a){return function(){var a=[],b=[],d=[];a.push("TIME_Property_SNTP_Server");b.push(0);d.push("NoSync");c.Write(a,b,d);Helper.ShowLoading()}}(0)),c.setElementOnClick("btnWriteSNTPSettings",function(a){return function(){var a=[],b=[],d=[];c.isLocked("TIME_Property_SNTP_Server")&&(a.push("TIME_Property_SNTP_Server"),b.push(0),d.push(c.getElementValue("TIME_Property_SNTP_Server")));var e=!0;3970302213==c.getRequestParamIDs()[0].values[0].error&&(e=!1);if(c.isLocked("TIME_Property_SNTP_Refresh")||
c.isLocked("TIME_Property_SNTP_Server")&&!e)a.push("TIME_Property_SNTP_Refresh"),b.push(0),d.push(Helper.getSNTPRefreshDurationInSec(c.getElementValue("TIME_Property_SNTP_Refresh")));0<a.length&&(c.Write(a,b,d),Helper.ShowLoading())}}(0)),c.setElementOnClick("btnWriteSNTPSettings_Cancel",function(a){return function(){p(a)}}(0)));b[3].getHasValues()&&(c.addLockListener(b[3].parameterName+"_date"),c.addLockListener(b[3].parameterName+"_time"),c.setElementOnClick("btnWriteTimeSettings",function(a){return function(){var b=
[],d=[],e=[];if(c.isLocked("TIME_Property_Textual_DateTime_presentation_date")||c.isLocked("TIME_Property_Textual_DateTime_presentation_time")){var g=new Helper.TextualDateTime_ISO8601(c.getRequestParamIDs()[3].values[0].data);if(g.isValidDate()){var v=c.getElementValue("TIME_Property_Textual_DateTime_presentation_date"),h=c.getElementValue("TIME_Property_Textual_DateTime_presentation_time");g.setDateTime(v,h)?(g=g.getISO8601String(),""!=g.length&&(b.push("TIME_Property_Textual_DateTime_presentation"),
d.push(a),e.push(g))):f.DevMan.getErrorQueue().AddError(2147811376)}}0<b.length&&(c.Write(b,d,e),Helper.ShowLoading())}}(0)),c.setElementOnClick("btnWriteTimeSettings_Cancel",function(a){return function(){q(a)}}(0)));b[4].getHasValues()&&b[5].getHasValues()&&(c.addLockListener(b[4].parameterName),c.setElementOnClick("btnWriteTimezoneSettings",function(a){return function(){var b=[],d=[],e=[];c.isLocked("TIME_Property_Timezone")&&(b.push("TIME_Property_Timezone"),d.push(a),e.push(c.getElementValue("TIME_Property_Timezone")));
0<b.length&&(c.Write(b,d,e),Helper.ShowLoading())}}(0)),c.setElementOnClick("btnWriteTimezoneSettings_Cancel",function(a){return function(){r(a)}}(0)));if(b[6].getHasValues()&&b[7].getHasValues()&&b[8].getHasValues()){for(d=0;d<b[7].moduleCount;d++)c.addLockListener(b[8].parameterName+d);c.setElementOnClick("btnWriteDisplayDeviceSettings",function(a){return function(){for(var a=[],b=[],d=[],e=c.getRequestParamIDs()[7].moduleCount,f=0;f<e;f++)if(c.isLocked("DisplayDevice_Modes_Property_Len"+f)){var h=
c.getElementValue("DisplayDevice_Modes_Property_Len"+f);h++;0<h&&(a.push("DisplayDevice_Settings_Property_IDxActiveDisplayMode"),b.push(f),d.push(h))}0<a.length&&(c.Write(a,b,d),Helper.ShowLoading())}}(0));c.setElementOnClick("btnWriteDisplayDeviceSettings_Cancel",function(a){return function(){s(a)}}(0))}return!0},n=function(b){if(0<b[0].values.length&&b[1].getHasValues()){c.setElementValue(b[0].parameterName,b[0].values[0].data);c.setElementValue(b[1].parameterName,Helper.getSNTPRefreshDurationIndex(b[1].values[0].data));
var a=!0;3970302213==b[0].values[0].error?a=!1:3970306048==b[0].values[0].error&&(a=!1);c.setElementDisabled(b[1].parameterName,!a)}b[2].getHasValues();b[3].getHasValues()&&(a=new Helper.TextualDateTime_ISO8601(b[3].values[0].data),a.isValidDate()&&(c.setElementValue(b[3].parameterName+"_date",a.getDateString()),c.setElementValue(b[3].parameterName+"_time",a.getTimeString())));b[4].getHasValues()&&b[5].getHasValues()&&c.setElementValue(b[4].parameterName,b[4].values[0].data);if(b[6].getHasValues()&&
b[7].getHasValues()&&b[8].getHasValues())for(a=0;a<b[7].moduleCount;a++){c.writeElement(b[6].parameterName+a,b[6].values[a].data);var d=b[7].values[a].data;d--;0<=d?c.setElementValue(b[8].parameterName+a,d):c.setElementValue(b[8].parameterName+a,-1)}},t=function(b){Helper.HideLoading();f.DevMan.getErrorQueue().AddError(b.requestStatus,b.requestStatusText);c.clearLocks()},u=function(b,a){Helper.HideLoading();for(var d=0;d<b.length;d++)0<a[d]&&f.DevMan.getErrorQueue().AddError(a[d]);for(d=0;d<b.length;d++)Helper.StringStartsWith(b[d].name,
"TIME_Property_SNTP")?p():Helper.StringStartsWith(b[d].name,"TIME_Property_Textual_DateTime_presentation")?q():Helper.StringStartsWith(b[d].name,"TIME_Property_Timezone")?r():Helper.StringStartsWith(b[d].name,"DisplayDevice_")&&s();for(d=0;d<b.length;d++)if(0==a[d]&&(Helper.StringStartsWith(b[d].name,"DisplayDevice_")||"TIME_Property_Timezone"==b[d].name)&&!winxp){if(confirm("You must restart your computer to apply these changes.\nDo you really want to reboot the computer?")){var d=c.getCommunicationObj().getServiceTransferParameterSize("MISC_Function_Reboot"),
e=[];e.push(d);e.push(0);Helper.RebootActive();c.executeCommand("MISC_Function_Reboot",0,e)}break}},p=function(b){c.removeLock("TIME_Property_SNTP_Server");c.removeLock("TIME_Property_SNTP_Refresh")},q=function(b){c.removeLock("TIME_Property_Textual_DateTime_presentation_date");c.removeLock("TIME_Property_Textual_DateTime_presentation_time")},r=function(b){c.removeLock("TIME_Property_Timezone")},s=function(b){b=c.getRequestParamIDs()[7].moduleCount;for(var a=0;a<b;a++)c.removeLock("DisplayDevice_Modes_Property_Len"+
a)}};this.SystemSettings.prototype=new f.Page_Template.Template};f.DevMan.RegisterModule(new m.SystemSettings,f.DevMan.ModuleType.Website)})(window);
