From e73e4fcbf9b5dcd348d778a4e026e0cf8d2d8d36 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 20 Oct 2019 19:31:04 -0700 Subject: [PATCH 1/2] Improved localization of web app. --- views/default-mobile.handlebars | 529 +++++++++++++++++--------------- views/default.handlebars | 21 +- 2 files changed, 284 insertions(+), 266 deletions(-) diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index 73b9809a..ca89a612 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -381,7 +381,7 @@ Refresh
Processes
-
PIDName
+
PIDName
@@ -391,16 +391,16 @@
  -   - +   +
- - - + + + - +
@@ -410,7 +410,7 @@
- +
@@ -591,19 +591,19 @@ 'use strict'; // Process server-side web state - var webState = "{{{webstate}}}"; - if (webState != "") { webState = JSON.parse(decodeURIComponent(webState)); } + var webState = '{{{webstate}}}'; + if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); } for (var i in webState) { localStorage.setItem(i, webState[i]); } if (!webState.loctag) { delete localStorage.removeItem('loctag'); } var args = parseUriArgs(); var debugLevel = parseInt('{{{debuglevel}}}'); var features = parseInt('{{{features}}}'); - var sessionTime = parseInt("{{{sessiontime}}}"); - var domain = "{{{domain}}}"; - var domainUrl = "{{{domainurl}}}"; - var authCookie = "{{{authCookie}}}"; - var authRelayCookie = "{{{authRelayCookie}}}"; + var sessionTime = parseInt('{{{sessiontime}}}'); + var domain = '{{{domain}}}'; + var domainUrl = '{{{domainurl}}}'; + var authCookie = '{{{authCookie}}}'; + var authRelayCookie = '{{{authRelayCookie}}}'; var authCookieRenewTimer = null; var meshserver = null; var xdr = null; @@ -615,13 +615,13 @@ var serverinfo = null; var users = null; var nodeShortIdent = 0; - var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}"; + var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}'; var debugmode = false; var attemptWebRTC = ((features & 128) != 0); - var StatusStrs = ['Disconnected', 'Connecting...', 'Setup...', 'Connected', 'Intel® AMT Connected']; + var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"]; var files; - var passRequirements = "{{{passRequirements}}}"; - if (passRequirements != "") { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } + var passRequirements = '{{{passRequirements}}}'; + if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } var sessionActivity = Date.now(); function startup() { @@ -637,7 +637,7 @@ window.onresize = center; center(); QV('changeEmailId', (features & 0x200000) == 0); - QH('p1message', 'Connecting...'); + QH('p1message', "Connecting..."); go(1); // Connect to the mesh server @@ -657,8 +657,8 @@ // Control web socket disconnected setDialogMode(0); // Close any dialog boxes if present go(0); // Go to disconnection panel - if (errorCode == 'noauth') { QH('p0span', 'Unable to perform authentication'); return; } - if (prevState == 2) { setTimeout(serverPoll, 5000); } else { QH('p0span', 'Unable to connect web socket'); } + if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; } + if (prevState == 2) { setTimeout(serverPoll, 5000); } else { QH('p0span', "Unable to connect web socket"); } // Clean up here if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; } } else if (state == 2) { @@ -697,10 +697,10 @@ if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', ' - Reset on next login.'); } else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) { var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000); - if (seconds < 0) { QH('p2nextPasswordUpdateTime', ' - Reset on next login.'); } - else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', ' - Reset in ' + Math.floor(seconds / 60) + ' minute' + addLetterS(Math.floor(seconds / 60)) + '.'); } - else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', ' - Reset in ' + Math.floor(seconds / 3600) + ' hour' + addLetterS(Math.floor(seconds / 3600)) + '.'); } - else { QH('p2nextPasswordUpdateTime', ' - Reset in ' + Math.floor(seconds / 86400) + ' day' + addLetterS(Math.floor(seconds / 86400)) + '.'); } + if (seconds < 0) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); } + else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} minute{1}.", Math.floor(seconds / 60), addLetterS(Math.floor(seconds / 60)))); } + else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} hour{1}.", Math.floor(seconds / 3600), addLetterS(Math.floor(seconds / 3600)))); } + else { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} day{1}."), Math.floor(seconds / 86400), addLetterS(Math.floor(seconds / 86400))); } } } } @@ -792,7 +792,7 @@ var secret = message.secret; if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); } else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '
' + secret.substring(20) } - QH('d2optinfo', 'Install Google Authenticator or a compatible application, use this link or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login.

' + secret + '

Token: = 48 && event.charCode <= 57)\" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text>
'); + QH('d2optinfo', "Install Google Authenticator or a compatible application, use this link or enter the secret below. Then, enter the current 6 digit token to activate 2-Step login." + '

' + secret + '

Token: = 48 && event.charCode <= 57)\" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text>
'); QV('idx_dlgOkButton', true); QE('idx_dlgOkButton', false); Q('d2otpauthinput').focus(); @@ -812,7 +812,7 @@ case 'otpauth-getpasswords': { if (xxdialogMode) return; var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place."; - x += "
"; + x += '
'; if (message.passwords) { var j = 0; for (var i in message.passwords) { @@ -822,13 +822,13 @@ if (message.passwords[i].u === true) { x += '
' + p.substring(0, 4) + ' ' + p.substring(4); } else { x += '' + p.substring(0, 4) + ' ' + p.substring(4); + ''; } } } else { - x += '
No Active Tokens'; + x += '
' + "No Active Tokens"; } - x += "

"; - x += "
"; - x += ""; - if (message.passwords != null) { x += ""; } - x += "

"; + x += '

'; + x += '
'; + x += ''; + if (message.passwords != null) { x += ''; } + x += '

'; setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage'); break; } @@ -1149,7 +1149,7 @@ function account_addOtp() { if (xxdialogMode || (userinfo.otpsecret == 1) || ((features & 4096) == 0)) return; - setDialogMode(2, "Authenticator App", 2, function () { meshserver.send({ action: 'otpauth-setup', secret: Q('d2optsecret').attributes.secret.value, token: Q('d2otpauthinput').value }); }, "
Loading...
", 'otpauth-request'); + setDialogMode(2, "Authenticator App", 2, function () { meshserver.send({ action: 'otpauth-setup', secret: Q('d2optsecret').attributes.secret.value, token: Q('d2otpauthinput').value }); }, '
' + "Loading..." + '
', 'otpauth-request'); meshserver.send({ action: 'otpauth-request' }); } @@ -1172,7 +1172,7 @@ function account_showVerifyEmail() { if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return; - var x = "Click ok to send a verification mail to:" + '
' + EscapeHtml(userinfo.email) + "
Please wait a few minute to receive the verification."; + var x = "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, x); } @@ -1200,12 +1200,12 @@ function account_showDeleteAccount() { if (xxdialogMode) return; - var x = "
"; - x += ""; - x += ""; + var x = '
Password:
Password:
'; + x += ''; + x += ''; x += '
' + "Password:" + '
' + "Password:" + '
'; - x += ''; - x += ''; + x += ''; + x += ''; x += '

'; setDialogMode(2, "Delete Account", 0, null, x); account_validateDeleteAccount(); @@ -1216,15 +1216,15 @@ function account_showChangePassword() { if (xxdialogMode) return false; var x = ""; - x += ""; - x += ""; - x += ""; - if (features & 0x00010000) { x += ""; } + x += ''; + x += ''; + x += ''; + if (features & 0x00010000) { x += ''; } x += '
Old password:
New password:
New password:
Password hint:
' + "Old password:" + '
' + "New password:" + '
' + "New password:" + '
' + "Password hint:" + '
' if (passRequirements) { var r = [], rc = 0; for (var i in passRequirements) { if ((i != 'reset') && (i != 'hint')) { r.push(i + ':' + passRequirements[i]); rc++; } } - if (rc > 0) { x += '
Requirements: ' + r.join(', ') + '.'; } + if (rc > 0) { x += '
' + format("Requirements: {0}.", r.join(', ')) + ''; } } x += '
'; setDialogMode(2, "Change Password", 3, account_showChangePasswordEx, x); @@ -1254,9 +1254,9 @@ if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" and look at the \"Account Security\" section."); return; } // We are allowed, let's prompt to information - var x = addHtmlValue('Name', ''); - x += addHtmlValue('Type', '
'); - x += addHtmlValue('Description', '
'); + var x = addHtmlValue("Name", ''); + x += addHtmlValue("Type", '
'); + x += addHtmlValue("Description", '
'); setDialogMode(2, "Create Device Group", 3, account_createMeshEx, x); account_validateMeshCreate(); Q('dp3meshname').focus(); @@ -1285,7 +1285,7 @@ } else { // Password requirements provided, use that var passReq = checkPasswordRequirements(Q('apassword1').value, passRequirements); - if (passReq == false) { ok = false; r = 'Policy' } + if (passReq == false) { ok = false; r = '' + "Policy" + '' } } } QH('dxPassWarn', r); @@ -1328,8 +1328,8 @@ // Mesh rights var meshrights = meshes[i].links[userinfo._id].rights; - var rights = 'Partial Rights'; - if (meshrights == 0xFFFFFFFF) rights = 'Full Administrator'; else if (meshrights == 0) rights = 'No Rights'; + var rights = "Partial Rights"; + if (meshrights == 0xFFFFFFFF) rights = "Full Administrator"; else if (meshrights == 0) rights = "No Rights"; // Print the mesh information r += '
'; @@ -1350,31 +1350,6 @@ go(20); } - function server_showRestoreDlg() { - if (xxdialogMode) return; - var x = 'Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing.

'; - x += '
'; - x += ''; - x += ''; - x += ''; - x += '


'; - setDialogMode(2, "Restore Server", 0, null, x); - 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' }); } - // // MY FILES // @@ -1387,7 +1362,7 @@ function updateFiles() { QV('MainMenuMyFiles', ((features & 8) == 0)); if ((features & 8) != 0) return; // If running on a server without files, exit now. - var html1 = '', html2 = '', displayPath = 'Root', fullPath = 'Root', publicPath, filetreex = filetree, folderdepth = 1; + var html1 = '', html2 = '', displayPath = '' + "Root" + '', fullPath = 'Root', publicPath, filetreex = filetree, folderdepth = 1; // Navigate to path location, build the paths at the same time var filetreelocation2 = [], oldlinkpath = filetreelinkpath, checkedBoxes = [], checkboxes = document.getElementsByName('fc'); @@ -1414,7 +1389,7 @@ } } filetreelocation = filetreelocation2; // In case we could not go down the full path, we set the new path location here. - var publicfolder = fullPath.toLowerCase().startsWith("root / " + userinfo._id + " / public"); + var publicfolder = fullPath.toLowerCase().startsWith('root / ' + userinfo._id + ' / public'); // Sort the files var filetreexx = p5sort_files(filetreex.f); @@ -1424,7 +1399,7 @@ // Figure out the name and shortname var f = filetreexx[i], name = f.n, shortname; shortname = name; - if (name.length > 40) { shortname = '' + EscapeHtml(name.substring(0, 40)) + "..."; } else { shortname = EscapeHtml(name); } + if (name.length > 40) { shortname = EscapeHtml(name.substring(0, 40)) + "..."; } else { shortname = EscapeHtml(name); } name = EscapeHtml(name); // Figure out the date @@ -1437,14 +1412,14 @@ var h = ''; if (f.t < 3 || f.t == 4) { - var right = (f.t == 1 || f.t == 4) ? p5getQuotabar(f) : '', title = ''; - h = "
 " + right + "
" + shortname + "
"; + var right = (f.t == 1 || f.t == 4) ? p5getQuotabar(f) : ''; + h = '
 ' + right + "
' + shortname + '
'; } else { var link = shortname; var publiclink = ''; - if (publicfolder) { publiclink = ' (Link)'; } - if (f.s > 0) { link = "" + shortname + "" + publiclink; } - h = "
 " + fsize + "
" + link + "
"; + if (publicfolder) { publiclink = ' (' + "Link" + ')'; } + if (f.s > 0) { link = '' + shortname + '' + publiclink; } + h = '
 ' + fsize + '
' + link + '
'; } if (f.t < 3) { html1 += h; } else { html2 += h; } @@ -1472,8 +1447,7 @@ function p5getQuotabar(f) { while (f.t > 1 && f.t != 4) { f = f.parent; } if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return ''; - var tf = Math.floor(f.s / 1024), tq = Math.floor((f.maxbytes - f.s) / 1024); - return ' 1 ? 's' : '') + ". " + (Math.floor(f.maxbytes / 1024)) + 'k maxinum">' + ((tq < 0) ? ('Storage limit exceed') : (tq + 'k remaining')) + ' '; + return getNiceSize(tq) + ' '; } function p5showPublicLink(u) { setDialogMode(2, "Public Link", 1, null, ''); } @@ -1501,31 +1475,33 @@ QE('p5UploadButton', filetreelocation.length > 0); QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0)); QE('p5SelectAllButton', tc > 0); - Q('p5SelectAllButton').value = (cc > 0 ? 'None' : 'All'); + Q('p5SelectAllButton').value = (cc > 0 ? "None" : "All"); QE('p5CutButton', (sfc > 0) && (cc == sfc)); QE('p5CopyButton', (sfc > 0) && (cc == sfc)); QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0)); } - function getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; } + function getFileSelCount(includeDirs) { var cc = 0, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == '3'))) cc++; } return cc; } + function getFileSelDirCount() { var cc = 0, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '999')) cc++; } return cc; } function getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); return checkboxes.length; } function p5selectallfile() { var nv = (getFileSelCount() == 0), checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p5setActions(); } function setupBackPointers(x) { if (x.f != null) { var fs = 0, fc = 0; for (var i in x.f) { setupBackPointers(x.f[i]); x.f[i].parent = x; if (x.f[i].s) { fs += x.f[i].s; } if (x.f[i].c) { fc += x.f[i].c; } if (x.f[i].t == 3) { fc++; } } x.s = fs; x.c = fc; } return x; } - function getFileSizeStr(size) { if (size == 1) return "1 byte"; return "" + size + " bytes"; } - function p5folderup(x) { if (x == null) { filetreelocation.pop(); } else { while (filetreelocation.length > x) { filetreelocation.pop(); } } updateFiles(); } - function p5folderset(x) { filetreelocation.push(decodeURIComponent(x)); updateFiles(); } + function getFileSizeStr(size) { if (size == 1) return "1 byte"; return format("{0} bytes", size); } + function p5folderup(x) { if (x == null) { filetreelocation.pop(); } else { while (filetreelocation.length > x) { filetreelocation.pop(); } } updateFiles(); return false; } + function p5folderset(x) { filetreelocation.push(decodeURIComponent(x)); updateFiles(); return false; } function p5createfolder() { setDialogMode(2, "New Folder", 3, p5createfolderEx, ''); focusTextBox('p5renameinput'); p5fileNameCheck(); } function p5createfolderEx() { meshserver.send({ action: 'fileoperation', fileop: 'createfolder', path: filetreelocation, newfolder: Q('p5renameinput').value }); } - function p5deletefile() { var cc = getFileSelCount(); setDialogMode(2, "Delete", 3, p5deletefileEx, (cc > 1) ? ('Delete ' + cc + ' selected items?') : ('Delete selected item?')); } - function p5deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(checkboxes[i].value); } } meshserver.send({ action: 'fileoperation', fileop: 'delete', path: filetreelocation, delfiles: delfiles }); } + function p5deletefile() { var cc = getFileSelCount(), rec = (getFileSelDirCount() > 0) ? '


' : ''; setDialogMode(2, "Delete", 3, p5deletefileEx, (cc > 1) ? (format("Delete {0} selected items?", cc) + rec) : ("Delete selected item?" + rec)); } + function p5deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(checkboxes[i].value); } } meshserver.send({ action: 'fileoperation', fileop: 'delete', path: filetreelocation, delfiles: delfiles, rec: Q('p5recdeleteinput').checked }); } function p5renamefile() { var renamefile, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = checkboxes[i].value; } } setDialogMode(2, "Rename", 3, p5renamefileEx, '', { action: 'fileoperation', fileop: 'rename', path: filetreelocation, oldname: renamefile }); focusTextBox('p5renameinput'); p5fileNameCheck(); } function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); } - function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e.keyCode == 13)) { dialogclose(1); } } + function p5fileNameCheck(e) { var x = isFilenameValid(Q('p5renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e && e.keyCode == 13)) { dialogclose(1); } } var isFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })(); - function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, '
'); updateUploadDialogOk('p5uploadinput'); } + function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, '
'); updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); } function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = 'Confim ' + (p5clipboardCut == 0 ? 'copy' : 'move') + ' of ' + p5clipboard.length + ' entrie' + ((p5clipboard.length > 1) ? 's' : '') + ' to this location?' } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); } @@ -1573,12 +1549,12 @@ function p5fileDragLeave(e) { haltEvent(e); - if (e.target.id != "p5filetable") { + if (e.target.id != 'p5filetable') { QV('bigfail', false); QV('bigok', false); //QV('p5fileCatchAllInput', false); } else { - p5dragtimer = setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;", 200); + p5dragtimer = setTimeout('QV(\'bigfail\',false);QV(\'bigok\',false);p5dragtimer=null;', 200); } } @@ -1682,7 +1658,7 @@ if (nodes[i].meshid != current) { deviceHeaderSet(); var extra = ''; - if (meshes[nodes[i].meshid].mtype == 1) { extra = ', Intel® AMT only'; } + if (meshes[nodes[i].meshid].mtype == 1) { extra = '' + ", Intel® AMT only" + ''; } if (current != null) { if (c == 2) { r += '
'; } if (r != '') { r += ''; } } r += '
'; //r += getMeshActions(mesh2, meshrights); @@ -1707,11 +1683,11 @@ count++; var title = EscapeHtml(nodes[i].name); - if (title.length == 0) { title = 'None'; } + if (title.length == 0) { title = '' + "None" + ''; } if ((nodes[i].rname != null) && (nodes[i].rname.length > 0)) { title += " / " + EscapeHtml(nodes[i].rname); } var name = EscapeHtml(nodes[i].name); if (showRealNames == true && nodes[i].rname != null) name = EscapeHtml(nodes[i].rname); - if (name.length == 0) { name = 'None'; } + if (name.length == 0) { name = '' + "None" + ''; } // Node var icon = nodes[i].icon, nodestate = NodeStateStr(nodes[i]); @@ -1751,8 +1727,8 @@ r += '
'; //r += getMeshActions(mesh, meshrights); r += '' + EscapeHtml(mesh.name) + '
'; - if (mesh.mtype == 1) { r += '
No Intel® AMT devices in this group'; } - if (mesh.mtype == 2) { r += '
No devices in this group'; } + if (mesh.mtype == 1) { r += '
' + "No Intel® AMT devices in this group"; } + if (mesh.mtype == 2) { r += '
' + "No devices in this group"; } r += '.
'; current = mesh._id; count++; @@ -1762,7 +1738,7 @@ } if (count == 0) { - QH('xdevices', '
No devices

Use the desktop version of this website to add devices.
'); + QH('xdevices', '
' + "No devices" + '

' + "Use the desktop version of this website to add devices." + '
'); } else { QH('xdevices', r); } @@ -1772,18 +1748,18 @@ } var powerStatetable = ['', 'Powered', 'Sleep', 'Sleep', 'Sleep', 'Hibernating', 'Power off', 'Present']; - 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 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(node) { var states = []; if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]); if (node.conn) { - if ((node.conn & 1) != 0) { states.push('Agent'); } - if ((node.conn & 2) != 0) { states.push('CIRA'); } - else if ((node.conn & 4) != 0) { states.push('Intel® AMT'); } - if ((node.conn & 8) != 0) { states.push('Relay'); } - if ((node.conn & 16) != 0) { states.push('MQTT'); } + if ((node.conn & 1) != 0) { states.push('' + "Agent" + ''); } + if ((node.conn & 2) != 0) { states.push('' + "CIRA" + ''); } + else if ((node.conn & 4) != 0) { states.push('' + "Intel® AMT" + ''); } + if ((node.conn & 8) != 0) { states.push('' + "Relay" + ''); } + if ((node.conn & 16) != 0) { states.push('' + "MQTT" + ''); } } if ((node.pwr != null) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); } return states.join(', '); @@ -1796,21 +1772,21 @@ function PowerStateStr2(x) { if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x]; - return 'Unknown'; + return "Unknown"; } function onSortSelectChange(skipsave) { - sort = document.getElementById("sortselect").selectedIndex; - if (!skipsave) { putstore("sort", sort); } + sort = document.getElementById('sortselect').selectedIndex; + if (!skipsave) { putstore('sort', sort); } updateDevicesEx(); } function deviceHeaderSet() { if (deviceHeaderId == 0) { deviceHeaderId = 1; return; } - deviceHeaders["DevxHeader" + deviceHeaderId] = ', ' + deviceHeaderTotal + ((deviceHeaderTotal == 1) ? ' node' : ' nodes'); + deviceHeaders['DevxHeader' + deviceHeaderId] = ', ' + deviceHeaderTotal + ((deviceHeaderTotal == 1) ? " node" : " nodes"); var title = ''; for (var x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); } - deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title; + deviceHeadersTitles['DevxHeader' + deviceHeaderId] = title; deviceHeaderId++; deviceHeaderCount = {}; deviceHeaderTotal = 0; @@ -1860,7 +1836,7 @@ // Add node name var nname = EscapeHtml(node.name); - if (nname.length == 0) { nname = 'None'; } + if (nname.length == 0) { nname = '' + "None" + ''; } if ((meshrights & 4) != 0) { nname = '' + nname + ''; } QH('p10deviceName', nname); @@ -1868,28 +1844,28 @@ var x = ''; // Attribute: Mesh - x += addDeviceAttribute('Group', '' + EscapeHtml(meshes[node.meshid].name) + ''); + x += addDeviceAttribute('' + "Group" + '', '' + EscapeHtml(meshes[node.meshid].name) + ''); // Attribute: Name - if (node.rname != null) { x += addDeviceAttribute('Name', '' + EscapeHtml(node.rname) + ''); } + if (node.rname != null) { x += addDeviceAttribute('' + "Name" + '', '' + EscapeHtml(node.rname) + ''); } // Attribute: Host if ((mesh.mtype == 1) || (node.name != node.host)) { if ((meshrights & 4) != 0) { if (node.host) { - x += addDeviceAttribute('Hostname', '' + EscapeHtml(node.host) + ''); + x += addDeviceAttribute("Hostname", '' + EscapeHtml(node.host) + ''); } else { - x += addDeviceAttribute('Hostname', 'None'); + x += addDeviceAttribute("Hostname", 'None'); } } else { - x += addDeviceAttribute('Hostname', EscapeHtml(node.host)); + x += addDeviceAttribute("Hostname", EscapeHtml(node.host)); } } // Attribute: Description var description = node.desc ? EscapeHtml(node.desc) : '' + "None" + ''; if ((meshrights & 4) != 0) { - x += addDeviceAttribute('Description', '' + description + ''); + x += addDeviceAttribute("Description", '' + description + ''); } else { x += addDeviceAttribute("Description", description); } @@ -1906,36 +1882,36 @@ // Attribute: Intel AMT if (node.intelamt != null) { var str = ''; - var provisioningStates = { 0: 'Not Activated (Pre)', 1: 'Not Activated (In)', 2: 'Activated' }; - if (node.intelamt.ver != null && node.intelamt.state == null) { str += 'Unknown State, v' + node.intelamt.ver; } else + var provisioningStates = { 0: "Not Activated (Pre)", 1: "Not Activated (In)", 2: "Activated" }; + if (node.intelamt.ver != null && node.intelamt.state == null) { str += '' + "Unknown State" + ', v' + node.intelamt.ver; } else - if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += 'Activated'; } - else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += 'Unknown Version & State'; } + if ((node.intelamt.ver == null) && (node.intelamt.state == 2)) { str += '' + "Activated" + ''; } + else if ((node.intelamt.ver == null) || (node.intelamt.state == null)) { str += '' + "Unknown Version & State" + ''; } else { str += provisioningStates[node.intelamt.state]; - if (node.intelamt.flags) { if (node.intelamt.flags & 2) { str = ' CCM'; } else if (node.intelamt.flags & 4) { str = ' ACM'; } } + if (node.intelamt.flags) { if (node.intelamt.flags & 2) { str = ' ' + "CCM" + ''; } else if (node.intelamt.flags & 4) { str = ' ' + "ACM" + ''; } } str += (', v' + node.intelamt.ver); } - if (node.intelamt.tls == 1) { str += ', TLS'; } + if (node.intelamt.tls == 1) { str += ', ' + "TLS" + ''; } if (node.intelamt.state == 2) { if (node.intelamt.user == null || node.intelamt.user == '') { if ((meshrights & 4) != 0) { - str += ', No Credentials'; + str += ', ' + "No Credentials" + ''; } else { - str += ', No Credentials'; + str += ', ' + "No Credentials" + ''; } } str += ' '; if ((meshrights & 4) != 0) { - str += ''; + str += ''; } } - var meName = 'Intel® ME'; + var meName = "Intel® ME"; if (typeof node.intelamt.sku == 'number') { - if ((node.intelamt.sku & 8) != 0) { meName = 'Intel® AMT'; } - else if ((node.intelamt.sku & 16) != 0) { meName = 'Intel® SM'; } + if ((node.intelamt.sku & 8) != 0) { meName = "Intel® AMT"; } + else if ((node.intelamt.sku & 16) != 0) { meName = "Intel® SM"; } } x += addDeviceAttribute(meName, str); } @@ -1944,7 +1920,7 @@ if ((node.agent != null) && (node.agent.tag != null) && (node.agent.tag != 'mailto:')) { var tag = EscapeHtml(node.agent.tag); if (tag.startsWith('mailto:')) { tag = '' + tag.substring(7) + ''; } - x += addDeviceAttribute('Agent Tag', tag); + x += addDeviceAttribute("Agent Tag", tag); } // Attribute: Intel AMT @@ -1954,28 +1930,28 @@ var connectivity = node.conn; if (connectivity && connectivity > 1) { var cstate = []; - if ((node.conn & 1) != 0) cstate.push('Agent'); - if ((node.conn & 2) != 0) cstate.push('Intel® AMT CIRA'); - else if ((node.conn & 4) != 0) cstate.push('Intel® AMT'); - if ((node.conn & 8) != 0) cstate.push('Agent Relay'); - if ((node.conn & 16) != 0) cstate.push('MQTT'); - x += addDeviceAttribute('Connectivity', cstate.join(', ')); + if ((node.conn & 1) != 0) cstate.push('' + "Agent" + ''); + if ((node.conn & 2) != 0) cstate.push('' + "Intel® AMT CIRA" + ''); + else if ((node.conn & 4) != 0) cstate.push('' + "Intel® AMT" + ''); + if ((node.conn & 8) != 0) cstate.push('' + "Agent Relay" + ''); + if ((node.conn & 16) != 0) cstate.push('' + "MQTT" + ''); + x += addDeviceAttribute("Connectivity", cstate.join(', ')); } // Node tags - var groupingTags = 'None'; + var groupingTags = '' + "None" + ''; if (node.tags != null) { groupingTags = ''; for (var i in node.tags) { groupingTags += '' + node.tags[i] + ''; } } if ((meshrights & 4) != 0) { - x += addDeviceAttribute('Tags', '' + groupingTags + ''); + x += addDeviceAttribute("Tags", '' + groupingTags + ''); } else { - x += addDeviceAttribute('Tags', groupingTags); + x += addDeviceAttribute("Tags", groupingTags); } x += '

'; // Show action button, only show if we have permissions 4, 8, 64 - if ((meshrights & 76) != 0) { x += ''; } - //x += ''; - //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += ''; } + if ((meshrights & 76) != 0) { x += ''; } + //x += ''; + //if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += ''; } QH('p10html', x); // Show node last 7 days timeline @@ -1984,10 +1960,10 @@ // Show bottom buttons x = '
'; - if ((meshrights & 4) != 0) x += 'Delete Device'; + if ((meshrights & 4) != 0) x += '' + "Delete Device" + ''; x += '
'; - //if (mesh.mtype == 2) x += 'Interfaces '; - //if (xxmap != null) x += 'Location '; + //if (mesh.mtype == 2) x += 'Interfaces '; + //if (xxmap != null) x += 'Location '; x += '

' QH('p10html3', x); @@ -1995,10 +1971,10 @@ // Set the node power state var powerstate = PowerStateStr(node.state); //if (node.state == 0) { powerstate = 'Unknown State'; } - if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += 'Mesh Agent'; } - if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += 'Intel® AMT connected'; } - else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += 'Intel® AMT detected'; } - if ((connectivity & 16) != 0) { if (powerstate.length > 0) { powerstate += '
'; } powerstate += 'MQTT channel connected'; } + if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '' + "Mesh Agent" + ''; } + if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '' + "Intel® AMT connected" + ''; } + else if ((connectivity & 4) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '' + "Intel® AMT detected" + ''; } + if ((connectivity & 16) != 0) { if (powerstate.length > 0) { powerstate += '
'; } powerstate += '' + "MQTT channel connected" + ''; } QH('MainComputerState', powerstate); // Set the node icon @@ -2045,12 +2021,12 @@ function deviceActionFunction() { if (xxdialogMode) return; var meshrights = meshes[currentNode.meshid].links[userinfo._id].rights; - var x = "Select an operation to perform on this device.

"; + var x = "Select an operation to perform on this device." + '

'; var y = ''; - x += addHtmlValue('Operation', y); + x += addHtmlValue("Operation", y); setDialogMode(2, "Device Action", 3, deviceActionFunctionEx, x); } @@ -2107,10 +2083,7 @@ var ts = Math.max(start, block[0]); var te = Math.min(Math.min(end, block[1]), now); var width = Math.round(((te - ts) * totalWidth) / 86400000); - if (width > 0) { - var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.'; - datavalue += '
'; - } + if (width > 0) { datavalue += '
'; } } } x += '
 ' + printDate(date) + '
' + datavalue + '
'; @@ -2139,9 +2112,9 @@ if (xxdialogMode) return; var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid); if ((meshrights & 4) == 0) return; - x += addHtmlValue('Username', ''); - x += addHtmlValue('Password', ''); - x += addHtmlValue('Security', ''); + x += addHtmlValue("Username", ''); + x += addHtmlValue("Password", ''); + x += addHtmlValue("Security", ''); if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; } setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func }); if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; } @@ -2172,7 +2145,7 @@ function p10showDeleteNodeDialog(nodeid) { if (xxdialogMode) return; - setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, "Delete \"" + EscapeHtml(currentNode.name) + "\"?

Confirm", nodeid); + setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, format("Delete {0}?", EscapeHtml(currentNode.name)) + '

' + "Confirm", nodeid); p10validateDeleteNodeDialog(); } @@ -2206,9 +2179,9 @@ meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon }); } - var showEditNodeValueDialog_modes = ['Device Name', 'Hostname', 'Description', 'Tags']; + var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"]; var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags']; - var showEditNodeValueDialog_modes3 = ['', '', '', 'Group1, Group2, Group3']; + var showEditNodeValueDialog_modes3 = ['', '', '', "Group1, Group2, Group3"]; function showEditNodeValueDialog(mode) { if (xxdialogMode) return; var x = addHtmlValue(showEditNodeValueDialog_modes[mode], ''); @@ -2348,7 +2321,7 @@ var xstate = state; if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; } var str = StatusStrs[xstate]; - if ((desktop != null) && (desktop.webRtcActive == true)) { str += ', WebRTC'; } + if ((desktop != null) && (desktop.webRtcActive == true)) { str += ", WebRTC"; } //if (desktop.m.stopInput == true) { str += ', Loopback'; } QH('deskstatus', str); switch (state) { @@ -2590,7 +2563,7 @@ for (var pid in processes) { p.push({ p: parseInt(pid), c: processes[pid].cmd, d: processes[pid].cmd.toLowerCase(), u: processes[pid].user }); } if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); } var x = ''; - for (var i in p) { if (p[i].p != 0) { x += '
' + p[i].p + '
' + (p[i].u ? p[i].u : '') + '
' + p[i].c + '
'; } } + for (var i in p) { if (p[i].p != 0) { x += '
' + p[i].p + '
' + (p[i].u ? p[i].u : '') + '
' + p[i].c + '
'; } } QH('DeskToolsProcesses', x); } } @@ -2599,8 +2572,8 @@ function deskSaveImage() { setSessionActivity(); if (xxdialogMode || desktop == null || desktop.State != 3) return; - var d = new Date(), n = 'Desktop-' + currentNode.name + '-' + d.getFullYear() + "-" + ("0" + (d.getMonth() + 1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2); - Q("Desk")['toBlob'](function (blob) { saveAs(blob, n + ".jpg"); }); + var d = new Date(), n = 'Desktop-' + currentNode.name + '-' + d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2); + Q('Desk')['toBlob'](function (blob) { saveAs(blob, n + '.jpg'); }); } function deskDisplayInfo(sender, info, selDisplay, selItem) { @@ -2623,7 +2596,7 @@ function dmousemove(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null)) desktop.m.mousemove(e) } function dmousewheel(e) { setSessionActivity(); if ((!xxdialogMode && desktop != null) && desktop.m.mousewheel) { desktop.m.mousewheel(e); haltEvent(e); return true; } return false; } function drotate(x) { if (!xxdialogMode && desktop != null) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); } } - function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, 'Stop process #' + id + ' "' + name + '"?', id); } + function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, format("Stop process #{0} \"{1}\"?", id, name), id); return false; } function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type: 'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); } // @@ -2642,9 +2615,9 @@ function onFilesStateChange(xfiles, state) { setSessionActivity(); - p13Connect.value = (state == 0) ? 'Connect' : 'Disconnect'; + p13Connect.value = (state == 0) ? "Connect" : "Disconnect"; var str = StatusStrs[state]; - if (files.webRtcActive == true) { str += ', WebRTC'; } + if (files.webRtcActive == true) { str += ", WebRTC"; } Q('p13Status').textContent = str; switch (state) { case 0: @@ -2734,7 +2707,7 @@ } function p13updateFiles(checkedNames) { - var html1 = '', html2 = '', displayPath = 'Root', fullPath = 'Root'; + var html1 = '', html2 = '', displayPath = '' + "Root" + '', fullPath = 'Root'; // Work on parsing the file path var x = p13filetree.path.split('\\'); @@ -2751,7 +2724,7 @@ // Figure out the name and shortname var f = filetreexx[i], name = f.n, shortname; shortname = name; - if (name.length > 70) { shortname = '' + EscapeHtml(name.substring(0, 70)) + "..."; } else { shortname = EscapeHtml(name); } + if (name.length > 70) { shortname = EscapeHtml(name.substring(0, 70)) + "..."; } else { shortname = EscapeHtml(name); } name = EscapeHtml(name); // Figure out the size @@ -2760,12 +2733,12 @@ var h = ''; if (f.t < 3) { - var right = '', title = ''; - h = "
 " + right + "
" + shortname + "
"; + var right = ''; + h = '
 ' + right + '
' + shortname + '
'; } else { var link = shortname; - if (f.s > 0) { link = "" + shortname + ""; } - h = "
 " + fsize + "
" + link + "
"; + if (f.s > 0) { link = '' + shortname + ''; } + h = '
 ' + fsize + '
' + link + '
'; } if (f.t < 3) { html1 += h; } else { html2 += h; } @@ -2817,7 +2790,7 @@ QE('p13UploadButton', false); QE('p13RenameFileButton', false); QE('p13SelectAllButton', false); - Q('p13SelectAllButton').value = 'All'; + Q('p13SelectAllButton').value = "All"; QE('p13RefreshButton', false); QE('p13CutButton', false); QE('p13CopyButton', false); @@ -2830,7 +2803,7 @@ QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13SelectAllButton', tc > 0); - Q('p13SelectAllButton').value = (cc > 0 ? 'None' : 'All'); + Q('p13SelectAllButton').value = (cc > 0 ? "None" : "All"); QE('p13RefreshButton', true); QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); @@ -2838,26 +2811,66 @@ } } - function p13getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; } + function p13getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == '3'))) cc++; } return cc; } + function p13getFileSelDirCount() { var cc = 0, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '999')) cc++; } return cc; } function p13getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); return checkboxes.length; } function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); } function p13createfolder() { setDialogMode(2, "New Folder", 3, p13createfolderEx, ''); focusTextBox('p13renameinput'); p13fileNameCheck(); } function p13createfolderEx() { files.sendText({ action: 'mkdir', reqid: 1, path: p13filetreelocation.join('/') + '/' + Q('p13renameinput').value }); p13folderup(999); } - function p13deletefile() { var cc = getFileSelCount(); setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1) ? ('Delete ' + cc + ' selected items?') : ('Delete selected item?')); } - function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.sendText({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles }); p13folderup(999); } + function p13deletefile() { var cc = p13getFileSelCount(), rec = (p13getFileSelDirCount() > 0) ? '


' : ""; setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1) ? (format("Delete {0} selected items?", cc) + rec) : ("Delete selected item?" + rec)); } + function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.sendText({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles, rec: Q('p13recdeleteinput').checked }); p13folderup(999); } function p13renamefile() { var renamefile, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = p13filetree.dir[checkboxes[i].value].n; } } setDialogMode(2, "Rename", 3, p13renamefileEx, '', { action: 'rename', path: p13filetreelocation.join('/'), oldname: renamefile }); focusTextBox('p13renameinput'); p13fileNameCheck(); } function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); } function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } } function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, ''); updateUploadDialogOk('p13uploadinput'); } function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); } + function p13viewfile() { + var checkboxes = document.getElementsByName('fd'); + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked) { + if (p13filetree.dir[checkboxes[i].value].s <= 204800) { + p13downloadfile(encodeURIComponent(p13filetreelocation.join('/') + '/' + p13filetree.dir[checkboxes[i].value].n), encodeURIComponent(p13filetree.dir[checkboxes[i].value].n), p13filetree.dir[checkboxes[i].value].s, 'viewer'); + } else { messagebox("File Editor", "Only files less than 200k can be edited."); } + break; + } + } + } var p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0; - function p13copyFile(cut) { var checkboxes = document.getElementsByName('fd'); p13clipboard = []; p13clipboardCut = cut, p13clipboardFolder = p13targetpath; for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p13clipboard.push(p13filetree.dir[checkboxes[i].value].n); } } p13updateClipview(); } - function p13pasteFile() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Confim ' + (p13clipboardCut == 0 ? 'copy' : 'move') + ' of ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1) ? 's' : '') + ' to this location?' } setDialogMode(2, "Paste", 3, p13pasteFileEx, x); } + function p13copyFile(cut) { var checkboxes = document.getElementsByName('fd'); p13clipboard = []; p13clipboardCut = cut, p13clipboardFolder = p13targetpath; for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '3')) { p13clipboard.push(p13filetree.dir[checkboxes[i].value].n); } } p13updateClipview(); } + function p13pasteFile() { + var x = ''; + if ((p13clipboard != null) && (p13clipboard.length > 0)) { + if (p13clipboardCut == 0) { + if (p13clipboard.length > 1) { x = format("Confirm copy of {0} entries's to this location?", p13clipboard.length); } else { x = format("Confirm copy of 1 entrie to this location?"); } + } else { + if (p13clipboard.length > 1) { x = format("Confirm move of {0} entries's to this location?", p13clipboard.length); } else { x = format("Confirm move of 1 entrie to this location?"); } + } + } + setDialogMode(2, "Paste", 3, p13pasteFileEx, x); + } function p13pasteFileEx() { files.sendText({ action: (p13clipboardCut == 0 ? 'copy' : 'move'), reqid: 1, scpath: p13clipboardFolder, dspath: p13targetpath, names: p13clipboard }); p13folderup(999); if (p13clipboardCut == 1) { p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0; p13updateClipview(); } } - function p13updateClipview() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Holding ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1) ? 's' : '') + ' for ' + (p13clipboardCut == 0 ? 'copy' : 'move') + ', Clear.' } QH('p13bottomstatus', x); p13setActions(); } - function p13clearClip() { p13clipboard = null; p13clipboardFolder = null; p13clipboardCut = 0; p13updateClipview(); } - function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + function p13updateClipview() { + var x = ''; + if ((p13clipboard != null) && (p13clipboard.length > 0)) { + if (p13clipboardCut == 0) { + if (p13clipboard.length > 1) { + x = format("Holding {0} entries for copy" + ', ' + "Clear" + '.', p13clipboard.length); + } else { + x = format("Holding 1 entrie for copy" + ', ' + "Clear" + '.'); + } + } else { + if (p13clipboard.length > 1) { + x = format("Holding {0} entries for move" + ', ' + "Clear" + '.', p13clipboard.length); + } else { + x = format("Holding 1 entrie for move" + ', ' + "Clear" + '.'); + } + } + } + QH('p13bottomstatus', x); + p13setActions(); + } + function p13clearClip() { p13clipboard = null; p13clipboardFolder = null; p13clipboardCut = 0; p13updateClipview(); return false; } function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } function getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; } function getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); return checkboxes.length; } @@ -2975,7 +2988,7 @@ uploadFile.xpath = p13filetreelocation.join('/'); uploadFile.xfiles = files; uploadFile.xfilePtr = -1; - setDialogMode(2, "Upload File", 10, p13uploadFileCancel, '
Connecting...

'); + setDialogMode(2, "Upload File", 10, p13uploadFileCancel, '
' + "Connecting..." + '

'); p13uploadReconnect(); } @@ -3075,31 +3088,31 @@ function p20updateMesh() { if (currentMesh == null) return; QH('p20meshName', EscapeHtml(currentMesh.name)); - var meshtype = 'Unknown #' + currentMesh.mtype; + var meshtype = format("Unknown #{0}", currentMesh.mtype); var meshrights = currentMesh.links[userinfo._id].rights; - if (currentMesh.mtype == 1) meshtype = 'Intel® AMT group'; - if (currentMesh.mtype == 2) meshtype = 'Software agent group'; + if (currentMesh.mtype == 1) meshtype = "Intel® AMT only, no agent"; + if (currentMesh.mtype == 2) meshtype = "Managed using a software agent"; var x = ''; - x += addHtmlValue('Name', addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0)); - x += addHtmlValue('Description', addLinkConditional(((currentMesh.desc && currentMesh.desc != '') ? EscapeHtml(currentMesh.desc) : 'None'), 'p20editmesh(2)', (meshrights & 1) != 0)); - x += addHtmlValue('Type', meshtype); + x += addHtmlValue("Name", addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0)); + x += addHtmlValue("Description", addLinkConditional(((currentMesh.desc && currentMesh.desc != '') ? EscapeHtml(currentMesh.desc) : ('' + "None" + '')), 'p20editmesh(2)', (meshrights & 1) != 0)); + x += addHtmlValue("Type", meshtype); //x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]); - //x += '
'; + //x += '
'; x += '

'; var currentMeshLinks = currentMesh.links[userinfo._id]; - if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += ''; } + if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += ''; } /* if ((meshrights & 4) != 0) { if (currentMesh.mtype == 1) { - x += ' Install CIRA'; - x += ' Install local'; + x += ' Install CIRA'; + x += ' Install local'; } if (currentMesh.mtype == 2) { - x += ' Install'; + x += ' Install'; } } */ @@ -3109,17 +3122,17 @@ if ((meshrights & 4) == 0) return ''; var r = ''; if (mesh.mtype == 1) { - r += ' Add CIRA'; - r += ' Add Local'; + r += ' Add CIRA'; + r += ' Add Local'; } if (mesh.mtype == 2) { - r += ' Add Agent'; + r += ' Add Agent'; } return r; } */ - x += ''; + x += '
User Authorizations
'; // Sort the users for this mesh var count = 1, sortedusers = []; @@ -3128,9 +3141,9 @@ // Display all users for this mesh for (var i in sortedusers) { - var trash = '', rights = 'Partial Rights', r = sortedusers[i].rights; - if (r == 0xFFFFFFFF) rights = 'Full Administrator'; else if (r == 0) rights = 'No Rights'; - if ((i != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0)))) { trash = ''; } + var trash = '', rights = "Partial Rights", r = sortedusers[i].rights; + if (r == 0xFFFFFFFF) rights = "Full Administrator"; else if (r == 0) rights = "No Rights"; + if ((i != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0)))) { trash = ''; } x += ''; @@ -3140,18 +3153,18 @@ x += '
' + "User Authorizations" + '
'; x += '
' + trash + '
' + rights + '
 ' + EscapeHtml(decodeURIComponent(sortedusers[i].name)) + '
'; x += '
'; // If we are full administrator on this mesh, allow deletion of the mesh - if (meshrights == 0xFFFFFFFF) { x += ''; } + if (meshrights == 0xFFFFFFFF) { x += ''; } QH('p20info', x); } - function p20showDeleteMeshDialog() { - if (xxdialogMode) return; - var x = "Are you sure you want to delete mesh \"" + EscapeHtml(currentMesh.name) + "\"? Deleting the mesh will also delete all information about computers within this mesh.

"; - x += "Confirm"; - setDialogMode(2, "Delete Mesh", 3, p20showDeleteMeshDialogEx, x); + if (xxdialogMode) return false; + var x = format("Are you sure you want to delete group {0}? Deleting the device group will also delete all information about devices within this group.", EscapeHtml(currentMesh.name)) + '

'; + x += ''; + setDialogMode(2, "Delete Group", 3, p20showDeleteMeshDialogEx, x); p20validateDeleteMeshDialog(); + return false; } function p20validateDeleteMeshDialog() { @@ -3164,8 +3177,8 @@ function p20editmesh(focus) { if (xxdialogMode) return; - var x = addHtmlValue('Name', ''); - x += addHtmlValue('Description', ''); + var x = addHtmlValue("Name", ''); + x += addHtmlValue("Description", ''); setDialogMode(2, "Edit Device Group", 3, p20editmeshEx, x); Q('dp20meshname').value = currentMesh.name; if (currentMesh.desc) Q('dp20meshdesc').value = currentMesh.desc; @@ -3185,19 +3198,22 @@ if (xxdialogMode) return; var x = addHtmlValue('User', ''); x += '
'; - x += 'Full Administrator
'; - x += 'Edit Device Group
'; - x += 'Manage Device Group Users
'; - x += 'Manage Device Group Computers
'; - x += 'Remote Control
'; - x += 'Remote View Only
'; - x += 'No Terminal Access
'; - x += 'No File Access
'; - x += 'No Intel® AMT
'; - x += 'Mesh Agent Console
'; - x += 'Server Files
'; - x += 'Wake Devices
'; - x += 'Edit Device Notes
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; x += '
'; setDialogMode(2, "Add User to Mesh", 3, p20showAddMeshUserDialogEx, x); p20validateAddMeshUserDialog(); @@ -3244,30 +3260,32 @@ function p20viewuser(userid) { if (xxdialogMode) return; userid = decodeURIComponent(userid); - var r = '', cmeshrights = currentMesh.links[userinfo._id].rights, meshrights = currentMesh.links[userid].rights; - if (meshrights == 0xFFFFFFFF) r = ', Full Administrator'; else { - if ((meshrights & 1) != 0) r += ', Edit Device Group'; - if ((meshrights & 2) != 0) r += ', Manage Device Group Users'; - if ((meshrights & 4) != 0) r += ', Manage Device Group Computers'; - if ((meshrights & 8) != 0) r += ', Remote Control'; - if ((meshrights & 16) != 0) r += ', Agent Console'; - if ((meshrights & 32) != 0) r += ', Server Files'; - if ((meshrights & 64) != 0) r += ', Wake Devices'; - if ((meshrights & 128) != 0) r += ', Edit Notes'; - if ((meshrights & 256) != 0) r += ', Remote View Only'; - if ((meshrights & 512) != 0) r += ', No Terminal'; - if ((meshrights & 1024) != 0) r += ', No Files'; - if ((meshrights & 2048) != 0) r += ', No Intel® AMT'; + var r = [], cmeshrights = currentMesh.links[userinfo._id].rights, meshrights = currentMesh.links[userid].rights; + if (meshrights == 0xFFFFFFFF) r.push("Full Administrator"); else { + if ((meshrights & 1) != 0) r.push("Edit Device Group"); + if ((meshrights & 2) != 0) r.push("Manage Device Group Users"); + if ((meshrights & 4) != 0) r.push("Manage Device Group Computers"); + if ((meshrights & 8) != 0) r.push("Remote Control"); + if ((meshrights & 16) != 0) r.push("Agent Console"); + if ((meshrights & 32) != 0) r.push("Server Files"); + if ((meshrights & 64) != 0) r.push("Wake Devices"); + if ((meshrights & 128) != 0) r.push("Edit Notes"); + if ((meshrights & 256) != 0) r.push("Remote View Only"); + if ((meshrights & 512) != 0) r.push("No Terminal"); + if ((meshrights & 1024) != 0) r.push("No Files"); + if ((meshrights & 2048) != 0) r.push("No Intel® AMT"); + if (((meshrights & 8) != 0) && ((meshrights & 4096) != 0) && ((meshrights & 256) == 0)) r.push("Limited Input"); + if ((meshrights & 8192) != 0) r.push("Self Events Only"); + if ((meshrights & 16384) != 0) r.push("Chat & Notify"); } - r = r.substring(2); - if (r == '') { r = 'No Rights'; } - var buttons = 1, x = addHtmlValue('User', EscapeHtml(decodeURIComponent(userid.split('/')[2]))); - x += addHtmlValue('Permissions', r); + if (r.length == 0) { r.push("No Rights"); } + var buttons = 1, x = addHtmlValue("User", EscapeHtml(decodeURIComponent(userid.split('/')[2]))); + x += addHtmlValue("Permissions", r.join(", ")); if (((userinfo._id) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4; - setDialogMode(2, "Mesh User", buttons, p20viewuserEx, x, userid); + setDialogMode(2, "Device Group User", buttons, p20viewuserEx, x, userid); } - function p20viewuserEx(button, userid) { if (button != 2) return; setDialogMode(2, "Remote Mesh User", 3, p20viewuserEx2, "Confirm removal of user " + userid.split('/')[2] + "?", userid); } + function p20viewuserEx(button, userid) { if (button != 2) return; setDialogMode(2, "Remote Mesh User", 3, p20viewuserEx2, format("Confirm removal of user {0}?", userid.split('/')[2]), userid); } function p20deleteUser(e, userid) { haltEvent(e); p20viewuserEx(2, decodeURIComponent(userid)); } function p20viewuserEx2(button, userid) { meshserver.send({ action: 'removemeshuser', meshid: currentMesh._id, meshname: currentMesh.name, userid: userid }); } @@ -3326,7 +3344,7 @@ function putstore(name, val) { try { if ((typeof (localStorage) === 'undefined') || (localStorage.getItem(name) == val)) return; if (val == null) { localStorage.removeItem(name); } else { localStorage.setItem(name, val); } } catch (e) { } if (name[0] != '_') { var s = {}; for (var i = 0, len = localStorage.length; i < len; ++i) { var k = localStorage.key(i); if (k[0] != '_') { s[k] = localStorage.getItem(k); } } meshserver.send({ action: 'userWebState', state: JSON.stringify(s) }); } } function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } } - function center() { QS('dialog').left = ((((getDocWidth() - 300) / 2)) + "px"); deskAdjust(); deskAdjust(); /*drawDeviceTimeline();*/ } + function center() { QS('dialog').left = ((((getDocWidth() - 300) / 2)) + 'px'); deskAdjust(); deskAdjust(); /*drawDeviceTimeline();*/ } function messagebox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t, 1); } function statusbox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t); } function getDocWidth() { if (window.innerWidth) return window.innerWidth; if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; return document.getElementsByTagName('body')[0].clientWidth; } @@ -3337,10 +3355,10 @@ function getNodeFromId(id) { for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; } return null; } function addHtmlValue(t, v) { return '
' + t + '' + v + '
'; } function addHtmlValue2(t, v) { return '
' + v + '
' + t + '
'; } - function addLink(x, f) { return "♦ " + x + ""; } + function addLink(x, f) { return '♦ ' + x + ''; } function addLinkConditional(x, f, c) { if (c) return addLink(x, f); return x; } function passwordcheck(p) { var re = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/; return re.test(p); } - function getFileSizeStr(size) { if (size == 1) return "1 byte"; return "" + size + " bytes"; } + function getFileSizeStr(size) { if (size == 1) return "1 byte"; return format('{0} bytes', size); } function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); } function focusTextBox(x) { setTimeout(function () { Q(x).selectionStart = Q(x).selectionEnd = 65535; Q(x).focus(); }, 0); } var isFilenameValid = (function () { var x1 = /^[^\\/:\*\?"<>\|]+$/, x2 = /^\./, x3 = /^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname) { return x1.test(fname) && !x2.test(fname) && !x3.test(fname) && (fname[0] != '.'); } })(); @@ -3348,6 +3366,7 @@ function printDate(d) { return d.toLocaleDateString(args.locale); } function printTime(d) { return d.toLocaleTimeString(args.locale); } function printDateTime(d) { return d.toLocaleString(args.locale); } + function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; diff --git a/views/default.handlebars b/views/default.handlebars index fd145d84..28404821 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -4586,7 +4586,7 @@ var te = Math.min(Math.min(end, block[1]), now); var width = Math.round(((te - ts) * totalWidth) / 86400000); if (width > 0) { - var title = powerStateStrings2[block[2]] + ' from ' + printTime(new Date(ts)) + ' to ' + printTime(new Date(te)) + '.'; + var title = format('{0} from {1} to {2}.', powerStateStrings2[block[2]], printTime(new Date(ts)), printTime(new Date(te))); datavalue += '
'; } } @@ -4693,8 +4693,7 @@ function p10showDeleteNodeDialog(nodeid) { if (xxdialogMode) return false; - var x = format("Are you sure you want to delete node {0}?", EscapeHtml(currentNode.name)) + '

'; - x += ''; + var x = format("Are you sure you want to delete node {0}?", EscapeHtml(currentNode.name)) + '

'; setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid); p10validateDeleteNodeDialog(); return false; @@ -5971,7 +5970,7 @@ } function p13updateFiles(checkedNames) { - var html1 = '', html2 = '', displayPath = 'Root', fullPath = 'Root'; + var html1 = '', html2 = '', displayPath = '' + "Root" + '', fullPath = 'Root'; // Work on parsing the file path var x = p13filetree.path.split('\\'); @@ -6880,15 +6879,15 @@ x += '

'; //x += "
"; x += ''; - x += ''; - x += ''; - x += ''; + x += ''; + x += ''; + x += ''; if (features & 0x00010000) { x += ''; } x += '
Old password:
New password:
New password:
' + "Old password:" + '
' + "New password:" + '
' + "New password:" + '
' + "Password hint:" + '
' if (passRequirements) { var r = [], rc = 0; for (var i in passRequirements) { if ((i != 'reset') && (i != 'hint')) { r.push(i + ':' + passRequirements[i]); rc++; } } - if (rc > 0) { x += '
Requirements: ' + r.join(', ') + '.'; } + if (rc > 0) { x += '
' + "Requirements: " + r.join(', ') + '.'; } } x += '
'; //x += '
'; @@ -7175,7 +7174,7 @@ for (var i in sortedusers) { var trash = '', rights = "Partial Rights", r = sortedusers[i].rights; if (r == 0xFFFFFFFF) rights = "Full Administrator"; else if (r == 0) rights = "No Rights"; - if ((sortedusers[i].id != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0)))) { trash = ''; } + if ((sortedusers[i].id != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0)))) { trash = ''; } x += '
 ' + EscapeHtml(decodeURIComponent(sortedusers[i].name)) + '
' + trash + '
' + rights + '
'; ++count; } @@ -7548,7 +7547,7 @@ var buttons = 1, x = addHtmlValue("User Name", EscapeHtml(decodeURIComponent(uname))); if (xuserid.split('/')[2] != uname) { x += addHtmlValue("User Identifier", EscapeHtml(xuserid.split('/')[2])); } - x += addHtmlValue("Permissions", r); + x += addHtmlValue("Permissions", r.join(", ")); if (((userinfo._id) != xuserid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4; setDialogMode(2, "Device Group User", buttons, p20viewuserEx, x, xuserid); } @@ -7597,7 +7596,7 @@ function updateFiles() { QV('MainMenuMyFiles', ((features & 8) == 0)); if ((features & 8) != 0) return; // If running on a server without files, exit now. - var html1 = '', html2 = '', displayPath = 'Root', fullPath = 'Root', publicPath, filetreex = filetree, folderdepth = 1; + var html1 = '', html2 = '', displayPath = '' + "Root" + '', fullPath = 'Root', publicPath, filetreex = filetree, folderdepth = 1; // Navigate to path location, build the paths at the same time var filetreelocation2 = [], oldlinkpath = filetreelinkpath, checkedBoxes = [], checkboxes = document.getElementsByName('fc'); From 15fdb15a99874ff1dee340bc780d99e3dafc10ad Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 20 Oct 2019 22:04:03 -0700 Subject: [PATCH 2/2] More multi-language improvements. --- views/default-mobile.handlebars | 25 ++++++++++++------------- views/default.handlebars | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index ca89a612..a8b6328e 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -677,7 +677,7 @@ xdr = null; try { xdr = new XDomainRequest(); } catch (e) { } if (!xdr) xdr = new XMLHttpRequest(); - xdr.open("HEAD", window.location.href); + xdr.open('HEAD', window.location.href); xdr.timeout = 15000; xdr.onload = function () { reload(); }; xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); }; @@ -694,7 +694,7 @@ QV('p3createMeshLink2', false); if (typeof userinfo.passchange == 'number') { - if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', ' - Reset on next login.'); } + if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); } else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) { var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000); if (seconds < 0) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); } @@ -1215,7 +1215,7 @@ function account_showChangePassword() { if (xxdialogMode) return false; - var x = ""; + var x = '
'; x += ''; x += ''; x += ''; @@ -1413,7 +1413,7 @@ var h = ''; if (f.t < 3 || f.t == 4) { var right = (f.t == 1 || f.t == 4) ? p5getQuotabar(f) : ''; - h = '
 ' + right + "
' + shortname + '
'; + h = '
 ' + right + '
' + shortname + '
'; } else { var link = shortname; var publiclink = ''; @@ -1501,13 +1501,12 @@ function p5uploadFileEx() { Q('p5loginSubmit').click(); } function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } - var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; - function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); } - function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = 'Confim ' + (p5clipboardCut == 0 ? 'copy' : 'move') + ' of ' + p5clipboard.length + ' entrie' + ((p5clipboard.length > 1) ? 's' : '') + ' to this location?' } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); } + function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == '3')) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); } + function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confim {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0 ? 'copy' : 'move'), p5clipboard.length, ((p5clipboard.length > 1) ? 's' : '')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); } function p5pasteFileEx() { meshserver.send({ action: 'fileoperation', fileop: (p5clipboardCut == 0 ? 'copy' : 'move'), scpath: p5clipboardFolder, path: filetreelocation, names: p5clipboard }); p5folderup(999); if (p5clipboardCut == 1) { p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; p5updateClipview(); } } - function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = 'Holding ' + p5clipboard.length + ' entrie' + ((p5clipboard.length > 1) ? 's' : '') + ' for ' + (p5clipboardCut == 0 ? 'copy' : 'move') + ', Clear.' } QH('p5bottomstatus', x); p5setActions(); } - function p5clearClip() { p5clipboard = null; p5clipboardFolder = null; p5clipboardCut = 0; p5updateClipview(); } + function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Holding {0} entrie{1} for {2}", p5clipboard.length, ((p5clipboard.length > 1) ? 's' : ''), (p5clipboardCut == 0 ? "copy" : "move")) + ', ' + "Clear" + '.' } QH('p5bottomstatus', x); p5setActions(); } + function p5clearClip() { p5clipboard = null; p5clipboardFolder = null; p5clipboardCut = 0; p5updateClipview(); return false; } function p5fileDragDrop(e) { haltEvent(e); @@ -1747,7 +1746,7 @@ for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; } } - var powerStatetable = ['', 'Powered', 'Sleep', 'Sleep', 'Sleep', 'Hibernating', 'Power off', 'Present']; + var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"]; 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']; @@ -1855,7 +1854,7 @@ if (node.host) { x += addDeviceAttribute("Hostname", '' + EscapeHtml(node.host) + ''); } else { - x += addDeviceAttribute("Hostname", 'None'); + x += addDeviceAttribute("Hostname", '' + "None" + ''); } } else { x += addDeviceAttribute("Hostname", EscapeHtml(node.host)); @@ -1871,12 +1870,12 @@ } // Attribute: Mesh Agent - var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", 'Windows 32bit service', 'Windows 64bit service', 'Linux 32bit', 'Linux 64bit', 'MIPS', 'XENx86', 'Android ARM', 'Linux ARM', 'MacOS 32bit', 'Android x86', 'PogoPlug ARM', 'Android APK', 'Linux Poky x86-32bit', 'MacOS 64bit', 'ChromeOS', 'Linux Poky x86-64bit', 'Linux NoKVM x86-32bit', 'Linux NoKVM x86-64bit', 'Windows MinCore console', 'Windows MinCore service', 'NodeJS', 'ARM-Linaro', 'ARMv6l / ARMv7l', 'ARMv8 64bit', 'ARMv6l / ARMv7l / NoKVM', 'Unknown', 'Unknown', 'FreeBSD x86-64']; + var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "FreeBSD x86-64"]; if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) { var str = ''; if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; } if (node.agent.ver != 0) { str += ' v' + node.agent.ver; } - x += addDeviceAttribute('Agent', str); + x += addDeviceAttribute("Agent", str); } // Attribute: Intel AMT diff --git a/views/default.handlebars b/views/default.handlebars index 28404821..976db200 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -7800,7 +7800,7 @@ p5PerformUpload(1, files); } else { // Otherwise, prompt for confirmation - setDialogMode(2, "Upload File", 3, p5PerformUpload, format('Upload will overwrite {0} file{1}. Continue?', overWriteCount, addLetterS(overWriteCount)), files); + setDialogMode(2, "Upload File", 3, p5PerformUpload, format("Upload will overwrite {0} file{1}. Continue?", overWriteCount, addLetterS(overWriteCount)), files); } }
' + "Old password:" + '
' + "New password:" + '
' + "New password:" + '