';H+="";QH("xdevices",H);deviceHeaderSet();var l=document.getElementsByClassName("DeviceCheckbox"),b=0;for(var s=0;s=0)}for(var s in deviceHeaders){QH(s,deviceHeaders[s])}for(var s in deviceHeadersTitles){Q(s).title=deviceHeadersTitles[s]}p1updateInfo();if(L==3){var M=[{x:180,y:101},{x:302,y:169},{x:454,y:255}][Q("sizeselect").selectedIndex];for(var s in multiDesktop){multiDesktop[s].xxdelete=true}for(var s in w){var u=w[s],I=u.split("/")[2],h=multiDesktop[u];if(h!=null){h.m.CanvasId.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");Q("xkvmid_"+I).appendChild(h.m.CanvasId);delete h.xxdelete;QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((h.m.State==null)?h.m.state:h.m.State)])}else{var E=getNodeFromId(u);if((desktopNode==E)&&(desktop!=null)){var a=desktop.m.CanvasId;a.setAttribute("id","kvmid_"+I);a.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+u+"')");a.removeAttribute("onmousedown");a.removeAttribute("onmouseup");a.removeAttribute("onmousemove");Q("xkvmid_"+I).appendChild(a);QH("skvmid_"+I,["Disconnected","Connecting...","Setup...","",""][((desktop.m.State==null)?desktop.m.state:desktop.m.State)]);if(desktop.m.SendCompressionLevel){desktop.m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}desktop.shortid=I;desktop.onStateChanged=onMultiDesktopStateChange;multiDesktop[u]=desktop;desktop=desktopNode=currentNode=null;QH("DeskParent",'')}else{var a=document.createElement("canvas");a.setAttribute("id","kvmid_"+I);a.setAttribute("width",640);a.setAttribute("height",200);a.setAttribute("oncontextmenu","return false");a.setAttribute("style","background-color:black;width:"+M.x+"px;height:"+M.y+"px");a.setAttribute("onclick","toggleKvmDevice('"+u+"')");try{Q("xkvmid_"+I).appendChild(a)}catch(m){}if(Q("autoConnectDesktopCheckbox").checked==true){setTimeout(function(){connectMultiDesktop(E,1)},100)}}}}for(var s in multiDesktop){if(multiDesktop[s].xxdelete==true){multiDesktop[s].Stop();delete multiDesktop[s]}}}else{disconnectAllKvmFunction();Q("autoConnectDesktopCheckbox").checked=false}}oldviewmode=L}function toggleKvmDevice(d){var c=getNodeFromId(d),a=meshes[c.meshid],b=a.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if((b&8)!=0){if(c.conn&1){connectMultiDesktop(c,1)}}}function autoConnectDesktops(){if(Q("autoConnectDesktopCheckbox").checked==true){connectAllKvmFunction()}}function connectAllKvmFunction(){for(var a in nodes){if(multiDesktop[nodes[a]._id]==null){toggleKvmDevice(nodes[a]._id)}}}function disconnectAllKvmFunction(){for(var a in multiDesktop){multiDesktop[a].Stop()}multiDesktop={}}function onMultiDesktopStateChange(a,c){try{QH("skvmid_"+a.shortid,["Disconnected","Connecting...","Setup...","",""][c])}catch(b){}}function showMultiDesktopSettings(){QV("d7amtkvm",false);QV("d7meshkvm",true);d7bitmapquality.value=multidesktopsettings.quality;d7bitmapscaling.value=multidesktopsettings.scaling;if(multidesktopsettings.framerate){d7framelimiter.value=multidesktopsettings.framerate}else{d7framelimiter.value=1000}setDialogMode(7,"Remote Desktop Settings",3,showMultiDesktopSettingsChanged)}function showMultiDesktopSettingsChanged(){multidesktopsettings.quality=d7bitmapquality.value;multidesktopsettings.scaling=d7bitmapscaling.value;multidesktopsettings.framerate=d7framelimiter.value;localStorage.setItem("multidesktopsettings",JSON.stringify(multidesktopsettings));for(var a in multiDesktop){multiDesktop[a].m.SendCompressionLevel(1,multidesktopsettings.quality,multidesktopsettings.scaling,multidesktopsettings.framerate)}}function connectMultiDesktop(c,a){var d=c._id,f=d.split("/")[2];var b=multiDesktop[d];if(b==null){if(Q("kvmid_"+f)==null){return}if(a==2){if((c.intelamt.user==null)||(c.intelamt.user=="")){return}b=CreateAmtRedirect(CreateAmtRemoteDesktop("kvmid_"+f));b.shortid=f;b.onStateChanged=onMultiDesktopStateChange;b.m.bpp=1;b.m.useZRLE=true;b.m.showmouse=true;b.Start(d,16994,"*","*",0);b.contype=2;multiDesktop[d]=b}else{if(a==1){b=CreateAgentRedirect(meshserver,CreateAgentRemoteDesktop("kvmid_"+f),serverPublicNamePort);b.shortid=f;b.attemptWebRTC=attemptWebRTC;b.onStateChanged=onMultiDesktopStateChange;b.m.CompressionLevel=multidesktopsettings.quality;b.m.ScalingLevel=multidesktopsettings.scaling;b.m.FrameRateTimer=multidesktopsettings.framerate;b.Start(d);b.contype=1;multiDesktop[d]=b}}}else{b.Stop();delete multiDesktop[d]}}function getMeshActions(a,b){if((b&4)==0){return""}var c="";if((features&1024)==0){c+=' Add CIRA'}if(a.mtype==1){if((features&1)==0){c+=' Add Local';c+=' Scan Network'}}if(a.mtype==2){c+=' Add Agent';if(features&64){c+=' Invite'}}return c}function addDeviceToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Add a new Intel® AMT device to mesh "+EscapeHtml(a.name)+".
";c+=addHtmlValue("Device Name","");c+=addHtmlValue("Hostname",'');c+=addHtmlValue("Username",'');c+=addHtmlValue("Password","");c+=addHtmlValue("Security","");setDialogMode(2,"Add Intel® AMT device",3,addDeviceToMeshEx,c,b);validateDeviceToMesh();Q("dp1devicename").focus()}function addAmtScanToMesh(a){if(xxdialogMode){return}var b="Enter a range of IP addresses to scan for Intel AMT devices.
";b+=addHtmlValue("IP Range",'');b+='';setDialogMode(2,"Scan for Intel® AMT devices",3,addAmtScanToMeshEx,b,a);QE("idx_dlgOkButton",false);QH("dp1results","
Sample IP range values 192.168.0.100 192.168.1.0/24 192.167.0.1-192.168.0.100
To add a new Intel® AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, download the following script files and use MeshCommander to run the script to configure computers.
To add a new Intel® AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, load the following certificate as trusted root within Intel AMT";if(serverinfo.mpspass){d+=" and authenticate to the server using this username and password.
"}else{d+=" and authenticate to the server using this username and any password.
To add a new Intel® AMT device to mesh "+EscapeHtml(a.name)+" with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.
"}setDialogMode(2,"Add Intel® AMT CIRA device",1,null,d)}function dlgAddCiraSelClick(){var a=Q("dlgAddCiraSel").value;QV("dlgAddCira0",a==0);QV("dlgAddCira1",a==1);QV("dlgAddCira2",a==2)}function checkEmail(c){var d=c.split("@");var b=((d.length==2)&&(d[0].length>0)&&(d[1].split(".").length>1)&&(d[1].length>2));if(b==true){var f=d[1].split(".");for(var a in f){if(f[a].length==0){b=false}}}return b}function inviteAgentToMesh(b){if(xxdialogMode){return}var a=meshes[b];var c="Invite someone to install the mesh agent. An email with be sent with the link to the mesh agent installation for "+EscapeHtml(a.name)+".
To add a new computer to mesh "+EscapeHtml(a.name)+", download the mesh agent and install it the computer to manage. This agent has server and mesh information embedded within it.
To remove a mesh agent, run the following command. Root credentials will be needed. ";f+="";f+="
";setDialogMode(2,"Add Mesh Agent",9,null,f);var d=serverinfo.name;if((d=="un-configured")||((features&2)!=0)){d=window.location.hostname}if(serverinfo.https==true){var c=(serverinfo.port==443)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget -q https://"+d+c+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh https://"+d+c+" '"+b.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget -q https://"+d+c+"/meshagents?script=1 --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}else{var c=(serverinfo.port==80)?"":(":"+serverinfo.port);Q("agins_linux_area").value="wget -q http://"+d+c+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh http://"+d+c+" '"+b.split("/")[2]+"'\r\n";Q("agins_linux_area_un").value="wget -q http://"+d+c+"/meshagents?script=1 -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo ./meshinstall.sh uninstall\r\n"}Q("aginsSelect").focus()}function addAgentToMeshClick(){var a=Q("aginsSelect").value;QV("agins_windows",a==0);QV("agins_linux",a==1);QV("agins_windows_un",a==2);QV("agins_linux_un",a==3)}function validateDeviceToMesh(){QE("idx_dlgOkButton",(Q("dp1devicename").value.length>0)&&(passwordcheck(Q("dp1password").value)))}function addDeviceToMeshEx(b,d){var a=Q("dp1username").value;if(a==""){a="admin"}var c=Q("dp1hostname").value;if(c==""){c=Q("dp1devicename").value}meshserver.send({action:"addamtdevice",meshid:d,devicename:Q("dp1devicename").value,hostname:c,amtusername:a,amtpassword:Q("dp1password").value,amttls:Q("dp1tls").value})}function deviceHeaderSet(){if(deviceHeaderId==0){deviceHeaderId=1;return}deviceHeaders["DevxHeader"+deviceHeaderId]=", "+deviceHeaderTotal+((deviceHeaderTotal==1)?" node":" nodes");deviceHeaderId++;deviceHeaderCount={};deviceHeaderTotal=0}var powerStateStrings=["",'Powered','Sleeping','Sleeping','Deep Sleep','Hibernating','Soft-Off','Present'];var powerStateStrings2=["","Device is powered","Device is in sleep state (S1)","Device is in sleep state (S2)","Device is in deep sleep state (S3)","Device is hibernating (S4)","Device is in soft-off state (S5)","Device is present, but power state cannot be determined"];var powerColorTable=["#00000000","black","blue","blue","lightblue","blueviolet","darkgreen","lightseagreen","lightseagreen"];function NodeStateStr(a){var b=[];if(a.state>0&&a.stateAgent')}if((a.conn&2)!=0){b.push('CIRA')}if((a.conn&4)!=0){b.push('Intel® AMT')}if((a.conn&8)!=0){b.push('Relay')}}if((a.pwr!=null)&&(a.pwr!=0)){b.push(powerStateStrings[a.pwr])}return b.join(", ")}function PowerStateStr(a){if(a0){QE("GroupActionButton",true);Q("SelectAllButton").value="Select None";QV("cxmgroupsplit",true);QV("cxmdesktop",true)}else{QE("GroupActionButton",false);Q("SelectAllButton").value="Select All";QV("cxmgroupsplit",false);QV("cxmdesktop",false)}}function groupActionFunction(){var a="Select an operation to perform on all selected devices. Actions will be performed only with proper rights.
";QH("p10html3",v);powerstate=PowerStateStr(n.state);if((c&1)!=0){if(powerstate.length>0){powerstate+=" "}powerstate+='Agent connected'}if((c&2)!=0){if(powerstate.length>0){powerstate+=" "}powerstate+='Intel® AMT connected'}if((c&4)!=0){if(powerstate.length>0){powerstate+=" "}powerstate+='Intel® AMT detected'}QH("MainComputerState",powerstate);Q("MainComputerImage").setAttribute("src","images/icons200-"+n.icon+"-1.png");Q("MainComputerImage").className=((!n.conn)||(n.conn==0)?"gray":"");setupTerminal();setupFiles();var d=((l&16)!=0);if(d){setupConsole()}else{if(q==15){q=10}}QV("MainDevDesktop",((k.mtype==1)||(n.agent==null)||(n.agent.caps==null)||((n.agent.caps&1)!=0))&&(l&8));QV("MainDevTerminal",((k.mtype==1)||(n.agent==null)||(n.agent.caps==null)||((n.agent.caps&2)!=0))&&(l&8));QV("MainDevFiles",((k.mtype==2)&&((n.agent==null)||(n.agent.caps==null)||((n.agent.caps&4)!=0)))&&(l&8));QV("MainDevAmt",(n.intelamt!=null)&&((n.intelamt.state==2)||(n.conn&2))&&(l&8));QV("MainDevConsole",(d&&(k.mtype==2)&&((n.agent==null)||(n.agent.caps==null)||((n.agent.caps&8)!=0)))&&(l&8));QV("p15uploadCore",(n.agent!=null)&&(n.agent.caps!=null)&&((n.agent.caps&16)!=0)&&(userinfo.siteadmin==4294967295));QH("p15coreName",((n.agent!=null)&&(n.agent.core!=null))?n.agent.core:"");var b=Q("p14iframe").contentWindow.getCurrentMeshNode();if((b!=null)&&(b._id!=currentNode._id)){Q("p14iframe").contentWindow.disconnect()}var p=((n.conn&6)!=0)?true:false;Q("p14iframe").contentWindow.setConnectionState(p);Q("p14iframe").contentWindow.setFrameHeight("650px");Q("p14iframe").contentWindow.setAuthCallback(updateAmtCredentials);QV("deskActionsBtn",(l&72)!=0);QV("termActionsBtn",(l&72)!=0);QV("filesActionsBtn",(l&72)!=0);if((powerTimelineNode!=currentNode._id)&&(powerTimelineReq!=currentNode._id)){QH("p10html2","");powerTimelineReq=currentNode._id;meshserver.send({action:"powertimeline",nodeid:currentNode._id})}QV("DeskTools",false);showDeskToolsProcesses();refreshDeviceEvents()}setupDesktop();if(!q){q=10}go(q)}function showNotes(b,a){if(xxdialogMode){return}setDialogMode(2,"Notes",2,showNotesEx,"Notes can be viewed and changed by other administrators.",a);meshserver.send({action:"getNotes",id:decodeURIComponent(a)})}function showNotesEx(a,b){meshserver.send({action:"setNotes",id:decodeURIComponent(b),notes:encodeURIComponent(Q("d2devNotes").value)})}function deviceToastFunction(){if(xxdialogMode){return}setDialogMode(2,"Device Toast",3,deviceToastFunctionEx,"")}function deviceToastFunctionEx(){meshserver.send({action:"toast",nodeids:[currentNode._id],title:"MeshCentral",msg:Q("d2devToast").value})}function deviceActionFunction(){if(xxdialogMode){return}var a=meshes[currentNode.meshid].links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;var b="Select an operation to perform on this device.
";var c="";b+=addHtmlValue("Operation",c);setDialogMode(2,"Device Action",3,deviceActionFunctionEx,b)}function deviceActionFunctionEx(){var a=Q("d2deviceop").value;if(a==100){meshserver.send({action:"wakedevices",nodeids:[currentNode._id]})}else{meshserver.send({action:"poweraction",nodeids:[currentNode._id],actiontype:a})}}function updateAmtCredentials(a){var b=getNodeFromId(currentNode._id);if((a==true)||(b.intelamt.user==null)||(b.intelamt.user=="")){editDeviceAmtSettings(currentNode._id,updateAmtCredentialsEx)}else{Q("p14iframe").contentWindow.connectButtonfunctionEx()}}function updateAmtCredentialsEx(a,b){Q("p14iframe").contentWindow.connectButtonfunctionEx()}function updateDeviceTimeline(){if((meshserver.State!=2)||(powerTimelineNode==null)||(powerTimelineUpdate==null)||(currentNode==null)){return}if((powerTimelineNode==powerTimelineReq)&&(currentNode._id==powerTimelineNode)&&(powerTimelineUpdate19)){return}var s=null,o=Date.now();if(currentNode._id==powerTimelineNode){s=powerTimeline}var f=new Date();f.setHours(0,0,0,0);f=new Date(f.getTime()-(1000*60*60*24*6));var u=f.getTime();var t=[];if(s!=null&&s.length>1){t.push([0,s[1],s[0]]);var c=s[1];for(var m=2;m(m+1)){k=s[m+1]}t.push([c,c+k,p]);c=c+k}}var A="",b=1,h=new Date();var w=Q("masthead").offsetWidth-(160+9+9+14);h.setHours(0,0,0,0);for(var m=0;m<7;m++){var g="",q=h.getTime(),l=q+(1000*60*60*24);for(var n in t){var a=t[n];if(isTimeBlockInside(q,l,a[0],a[1])==true){var y=Math.max(q,a[0]);var r=Math.min(Math.min(l,a[1]),o);var z=Math.round(((r-y)*w)/86400000);if(z>0){var v=powerStateStrings2[a[2]]+" from "+new Date(y).toLocaleTimeString()+" to "+new Date(r).toLocaleTimeString()+".";g+='"}}}A+="
"}function editDeviceAmtSettings(f,b){if(xxdialogMode){return}var g="",d=getNodeFromId(f),a=3,c=getNodeRights(f);if((c&4)==0){return}g+=addHtmlValue("Username",'');g+=addHtmlValue("Password","");g+=addHtmlValue("Security","");if((d.intelamt.user!=null)&&(d.intelamt.user!="")){a=7}setDialogMode(2,"Edit Intel® AMT credentials",a,editDeviceAmtSettingsEx,g,{node:d,func:b});if((d.intelamt.user!=null)&&(d.intelamt.user!="")){Q("dp10username").value=d.intelamt.user}else{Q("dp10username").value="admin"}Q("dp10tls").value=d.intelamt.tls;validateDeviceAmtSettings()}function validateDeviceAmtSettings(){QE("idx_dlgOkButton",passwordcheck(Q("dp10password").value))}function editDeviceAmtSettingsEx(c,d){if(c==2){meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:"",pass:""}})}else{var b=Q("dp10username").value;if(b==""){b="admin"}var a=Q("dp10password").value;if(a==""){b=""}meshserver.send({action:"changedevice",nodeid:d.node._id,intelamt:{user:b,pass:a,tls:Q("dp10tls").value}});d.node.intelamt.user=b;d.node.intelamt.tls=Q("dp10tls").value;if(d.func){setTimeout(d.func,300)}}}function p10showDeleteNodeDialog(a){if(xxdialogMode){return}var b='Are you sure you want to delete node "'+EscapeHtml(currentNode.name)+'"?
")}}}}function p15uploadCoreEx(){if(Q("d3coreMode").value==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:"*"})}else{if(Q("d3coreMode").value==2){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id})}else{if(Q("d3coreMode").value==3){p15uploadCore2()}else{if(Q("d3coreMode").value==4){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:1})}else{if(Q("d3coreMode").value==5){meshserver.send({action:"agentdisconnect",nodeid:consoleNode._id,disconnectMode:2})}}}}}}function p15uploadCore2(){if(xxdialogMode){return}Q("d3localmodeform").action="uploadmeshcorefile.ashx";Q("d3attrib").value=currentNode._id;setDialogMode(3,"Upload Mesh Agent Core",3,p15uploadCoreEx2);d3init()}function p15uploadCoreEx2(){var b=Q("d3uploadMode").value;if(b==1){Q("d3submit").click()}else{var a=d3getFileSel();if(a.length==1){meshserver.send({action:"uploadagentcore",nodeid:consoleNode._id,path:d3filetreelocation.join("/")+"/"+a[0]})}}}function account_showVerifyEmail(){if(xxdialogMode||(userinfo.emailVerified==true)||(serverinfo.emailcheck!=true)){return}var a="Click ok to send a verification mail to:
"+EscapeHtml(userinfo.email)+"
Please wait a few minute to receive the verification.";setDialogMode(2,"Email Verification",3,account_showVerifyEmailEx,a)}function account_showVerifyEmailEx(){meshserver.send({action:"verifyemail",email:userinfo.email})}function account_showChangeEmail(){if(xxdialogMode){return}var a="Change your account e-mail address here.
";a+=addHtmlValue("Email","");setDialogMode(2,"Email Address Change",3,account_changeEmail,a);if(userinfo.email!=null){Q("dp2email").value=userinfo.email}account_validateEmail();Q("dp2email").focus()}function account_validateEmail(a,b){QE("idx_dlgOkButton",validateEmail(Q("dp2email").value)&&(Q("dp2email").value!=userinfo.email));if((x==true)&&(a!=null)&&(a.keyCode==13)){dialogclose(1)}}function account_changeEmail(){meshserver.send({action:"changeemail",email:Q("dp2email").value})}function account_showDeleteAccount(){if(xxdialogMode){return}var a="To delete this account, type in the account password in both boxes below and hit ok.
";a+="";setDialogMode(2,"Delete Account",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_showChangePassword(){if(xxdialogMode){return}var a="Change your account password by entering the new password twice in the boxes below.
";a+="";setDialogMode(2,"Change Password",0,null,a);account_validateDeleteAccount();Q("apassword1").focus()}function account_createMesh(){if(xxdialogMode){return}var a="Create a new mesh computer group using the options below.
"}meshcount=b;QH("p2meshes",f);QV("p2noMeshFound",b==0)}function gotoMesh(a){currentMesh=meshes[a];p20updateMesh();go(20)}function server_showRestoreDlg(){if(xxdialogMode){return}var a="Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing.
";a+='";setDialogMode(2,"Restore Server",0,null,a);account_validateServerRestore()}function account_validateServerRestore(){QE("account_dlgOkButton",Q("account_dlgFileInput").files.length==1)}function server_showVersionDlg(){if(xxdialogMode){return}setDialogMode(2,"MeshCentral Version",1,null,"Loading...","MeshCentralServerUpdate");meshserver.send({action:"serverversion"})}function server_showVersionDlgUpdate(){QE("idx_dlgOkButton",Q("d2updateCheck").checked)}function server_showVersionDlgEx(){meshserver.send({action:"serverupdate"})}var currentMesh;function p20updateMesh(){if(currentMesh==null){return}QH("p20meshName",EscapeHtml(currentMesh.name));var f="Unknown #"+currentMesh.mtype;var d=currentMesh.links["user/"+domain+"/"+userinfo.name.toLowerCase()].rights;if(currentMesh.mtype==1){f="Intel® AMT computer group (No Agent)"}if(currentMesh.mtype==2){f="Mesh agent computer group"}var l="";l+=addHtmlValue("Name",addLinkConditional(EscapeHtml(currentMesh.name),"p20editmesh(1)",(d&1)!=0));l+=addHtmlValue("Description",addLinkConditional(((currentMesh.desc&¤tMesh.desc!="")?EscapeHtml(currentMesh.desc):"None"),"p20editmesh(2)",(d&1)!=0));l+=addHtmlValue("Type",f);l+=addHtmlValue("Identifier",currentMesh._id.split("/")[2]);l+=' ';l+="
';var a=1,j=[];for(var c in currentMesh.links){j.push({id:c,name:c.split("/")[2],rights:currentMesh.links[c].rights})}j.sort(function(m,n){if(m.name>n.name){return 1}if(m.name'}l+='
"}QH("p20info",l)}function p20showDeleteMeshDialog(){if(xxdialogMode){return}var a='Are you sure you want to delete mesh "'+EscapeHtml(currentMesh.name)+'"? Deleting the mesh will also delete all information about computers within this mesh.
';a+="Confirm";setDialogMode(2,"Delete Mesh",3,p20showDeleteMeshDialogEx,a);p20validateDeleteMeshDialog()}function p20validateDeleteMeshDialog(){QE("idx_dlgOkButton",Q("p20check").checked)}function p20showDeleteMeshDialogEx(a,b){meshserver.send({action:"deletemesh",meshid:currentMesh._id,meshname:currentMesh.name})}function p20editmesh(a){if(xxdialogMode){return}var b=addHtmlValue("Mesh Name","");b+=addHtmlValue("Description","");setDialogMode(2,"Edit Mesh",3,p20editmeshEx,b);Q("dp20meshname").value=currentMesh.name;if(currentMesh.desc){Q("dp20meshdesc").value=currentMesh.desc}p20editmeshValidate();if(a==2){Q("dp20meshdesc").focus()}else{Q("dp20meshname").focus()}}function p20editmeshEx(){meshserver.send({action:"editmesh",meshid:currentMesh._id,meshname:Q("dp20meshname").value,desc:Q("dp20meshdesc").value})}function p20editmeshValidate(){QE("idx_dlgOkButton",Q("dp20meshname").value.length>0)}function p20showAddMeshUserDialog(){if(xxdialogMode){return}var a="Allow a user to manage the mesh and computers on this mesh
"}QH("p3events",h)}function showDeleteAllEventsDialog(){if(xxdialogMode){return}var a="Delete all events in the server event log?
";a+="Confirm";setDialogMode(2,"Delete All Events",3,showDeleteAllEventsDialogEx,a);validateDeleteAllEventsDialog()}function validateDeleteAllEventsDialog(){QE("idx_dlgOkButton",Q("p3check").checked)}function showDeleteAllEventsDialogEx(a,b){meshserver.send({action:"clearevents"})}function refreshEvents(){meshserver.send({action:"events",limit:parseInt(p3limitdropdown.value)})}function updateUsers(){QV("MainMenuMyUsers",(users!=null)&&((features&4)==0));if((users==null)||((features&4)!=0)){QH("p3users","");return}var g=[],d=100,b=0;for(var c in users){g.push(c)}g.sort();var j=Q("UserSearchInput").value.toLowerCase();var k="
",a=true;for(var c in g){var h=users[g[c]],f=null;if(wssessions!=null){f=wssessions[h._id]}if((f!=null)&&(h.name.toLowerCase().indexOf(j)>=0)){if(d>0){if(a){k+="
Online Users";a=false}k+=addUserHtml(h,f);d--}else{b++}}}a=true;for(var c in g){var h=users[g[c]],f=null;if(wssessions!=null){f=wssessions[h._id]}if((f==null)&&(h.name.toLowerCase().indexOf(j)>=0)){if(d>0){if(a){k+="
";QH("p30html3",l);l="";if(a==1){l="1 active session"}else{if(a>1){l=a+" active sessions"}}QH("MainUserState",l);go(30);QH("p31events","");refreshUsersEvents()}function p30showUserEmailChangeDialog(a){if(xxdialogMode){return}var b="";b+=addHtmlValue("Email","");if(serverinfo.emailcheck){b+=addHtmlValue("Status","")}setDialogMode(2,"Change Email for "+EscapeHtml(currentUser.name),3,p30showUserEmailChangeDialogEx,b);Q("dp30email").focus();Q("dp30email").value=currentUser.email;if(serverinfo.emailcheck){Q("dp30verified").value=currentUser.emailVerified?1:0}p30validateEmail()}function p30validateEmail(){var a=Q("dp30email").value,b=a.split("@");b=(b.length==2)&&(b[0].length>0)&&(b[1].split(".").length>1)&&(b[1].length>2)&&(a.length<1024)&&((a!=userinfo.email)||((serverinfo.emailcheck==true)&&(Q("dp30verified").value!=(userinfo.emailVerified?1:0))));QE("idx_dlgOkButton",b)}function p30showUserEmailChangeDialogEx(){var a={action:"edituser",name:currentUser.name,email:Q("dp30email").value};if(serverinfo.emailcheck){a.emailVerified=(Q("dp30verified").value==1)}meshserver.send(a)}function p30showUserChangePassDialog(){if(xxdialogMode){return}var a="";a+=addHtmlValue("Password","");a+=addHtmlValue("Password","");setDialogMode(2,"Change Password for "+EscapeHtml(currentUser.name),3,p30showUserChangePassDialogEx,a);showCreateNewAccountDialogValidate();Q("p4pass1").focus()}function p30showUserChangePassDialogEx(){if(Q("p4pass1").value==Q("p4pass2").value){meshserver.send({action:"changeuserpass",user:currentUser.name,pass:Q("p4pass1").value})}}function p30showDeleteUserDialog(){if(xxdialogMode){return}setDialogMode(2,"Delete User "+EscapeHtml(currentUser.name),3,p30showDeleteUserDialogEx,"Confirm deletion of user "+EscapeHtml(currentUser.name)+"?")}function p30showDeleteUserDialogEx(){meshserver.send({action:"deleteuser",userid:currentUser._id,username:currentUser.name})}function drawUserTimeline(){var s=null,o=Date.now();s=[];var f=new Date();f.setHours(0,0,0,0);f=new Date(f.getTime()-(1000*60*60*24*6));var u=f.getTime();var t=[];if(s!=null&&s.length>1){t.push([0,s[1],s[0]]);var c=s[1];for(var m=2;m(m+1)){k=s[m+1]}t.push([c,c+k,p]);c=c+k}}var z="",b=1,h=new Date();h.setHours(0,0,0,0);for(var m=0;m<7;m++){var g="",q=h.getTime(),l=q+(1000*60*60*24);for(var n in t){var a=t[n];if(isTimeBlockInside(q,l,a[0],a[1])==true){var w=Math.max(q,a[0]);var r=Math.min(Math.min(l,a[1]),o);var y=Math.round((r-w)/112794);if(y>0){var v=powerStateStrings2[a[2]]+" from "+new Date(w).toLocaleTimeString()+" to "+new Date(r).toLocaleTimeString()+".";g+='"}}}z+="
")}var currentUserEvents=null;function userEvents_update(){var h="",a=null;for(var c in currentUserEvents){var b=currentUserEvents[c];var g=new Date(b.time);if(g.toLocaleDateString()!=a){if(a!=null){h+=""}h+="