More device rights fixes.

Ylian Saint-Hilaire committed Mar 30, 2020 at 13:29 UTC 27ad66831e066f6c69cb62845b7c97bfe1672043
3 files changed +22 -21
translate/translate.json
+5 -7
@@ -217,10 +217,7 @@
217 "nl": " Gebruiker toevoegen",
218 "pt": " Adicionar usuário",
219 "ru": " Добавить пользователя",
220 - "zh-chs": " 添加用戶",
221 - "xloc": [
222 - "default-mobile.handlebars->9->284"
223 - ]
220 + "zh-chs": " 添加用戶"
221 },
222 {
223 "cs": " Je možné zadat i nápovědu pro heslo, ale nedoporučuje se to.",
@@ -2423,6 +2420,7 @@
2420 "ru": "Добавить пользователя",
2421 "zh-chs": "添加用戶",
2422 "xloc": [
2423 + "default-mobile.handlebars->9->284",
2424 "default.handlebars->27->531"
2425 ]
2426 },
@@ -24822,8 +24820,8 @@
24820 ]
24821 },
24822 {
24825 - "en": "User Permissions"
24826 - "en": "Gebruikersrechten"
24823 + "en": "User Permissions",
24824 + "nl": "Gebruikersrechten"
24825 },
24826 {
24827 "cs": "PowerShell uživatele",
@@ -27786,4 +27784,4 @@
27784 ]
27785 }
27786 ]
27789 -}
27787 +}
\ No newline at end of file
views/default-mobile.handlebars
+10 -8
@@ -797,7 +797,7 @@
797 for (var n in message.nodes[m]) {
798 message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
799 if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; }
800 - if (meshes[m]) { message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase(); }
800 + message.nodes[m][n].meshnamel = meshes[m]?meshes[m].name.toLowerCase():'*';
801 message.nodes[m][n].meshid = m;
802 message.nodes[m][n].state = (message.nodes[m][n].state) ? (message.nodes[m][n].state) : 0;
803 message.nodes[m][n].desc = message.nodes[m][n].desc;
@@ -1029,7 +1029,7 @@
1029 if (getNodeFromId(node._id) != null) break; // This node is already known.
1030 node.namel = node.name.toLowerCase();
1031 if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1032 - node.meshnamel = meshes[node.meshid].name.toLowerCase();
1032 + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*';
1033 node.state = 0;
1034 if (!node.icon) node.icon = 1;
1035 node.ident = ++nodeShortIdent;
@@ -1121,7 +1121,7 @@
1121 } else {
1122 // We see the new mesh, move this device
1123 node.meshid = message.event.newMeshId;
1124 - node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase();
1124 + node.meshnamel = meshes[message.event.newMeshId]?meshes[message.event.newMeshId].name.toLowerCase():'*';
1125 }
1126 updateDevices();
1127 refreshDevice(message.event.nodeid);
@@ -1131,7 +1131,7 @@
1131 if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages.
1132 node.namel = node.name.toLowerCase();
1133 if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
1134 - node.meshnamel = meshes[node.meshid].name.toLowerCase();
1134 + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*';
1135 node.state = 0;
1136 if (!node.icon) node.icon = 1;
1137 node.ident = ++nodeShortIdent;
@@ -1751,7 +1751,8 @@
1751 if (sort == 0) {
1752 // Mesh header
1753 nodes.sort(meshSort);
1754 - if (nodes[i].meshid != current) {
1754 + //if (nodes[i].meshid != current) {
1755 + if (((meshes[nodes[i].meshid]?nodes[i].meshid:'*') != current)) {
1756 deviceHeaderSet();
1757 var extra = '';
1758 if ((meshes[nodes[i].meshid] != null) && (meshes[nodes[i].meshid].mtype == 1)) { extra = '<span style=color:lightgray>' + ", Intel&reg; AMT only" + '</span>'; }
@@ -1761,11 +1762,12 @@
1762
1763 if (meshes[nodes[i].meshid]) {
1764 r += '</span><span id=MxMESH style=cursor:pointer onclick=goForward("' + nodes[i].meshid + '")>' + EscapeHtml(meshes[nodes[i].meshid].name) + '</span>' + extra + '<span id=DevxHeader' + deviceHeaderId + ' style=color:lightgray></span></div>';
1765 + current = nodes[i].meshid;
1766 } else {
1765 - r += '</span><span id=MxMESH style=cursor:pointer>' + "Indivitual Devices" + '</span>' + extra + '<span id=DevxHeader' + deviceHeaderId + ' style=color:lightgray></span></div>';
1767 + r += '</span><span id=MxMESH style=cursor:pointer><i>' + "Indivitual Devices" + '</i></span>' + extra + '<span id=DevxHeader' + deviceHeaderId + ' style=color:lightgray></span></div>';
1768 + current = '*';
1769 }
1770
1768 - current = nodes[i].meshid;
1771 displayedMeshes[current] = 1;
1772 c = 0;
1773 }
@@ -3196,7 +3198,7 @@
3198
3199 x += '<br style=clear:both><br>';
3200 var currentMeshLinks = currentMesh.links[userinfo._id];
3199 - if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12>' + " Add User" + '</a></div>'; }
3201 + if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> ' + "Add User" + '</a></div>'; }
3202
3203 /*
3204 if ((meshrights & 4) != 0) {
views/default.handlebars
+7 -6
@@ -1818,7 +1818,7 @@
1818 if (message.nodes[m][n]._id == null) { console.log('Invalid node (' + n + '): ' + JSON.stringify(message.nodes)); continue; }
1819 message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
1820 if (message.nodes[m][n].rname) { message.nodes[m][n].rnamel = message.nodes[m][n].rname.toLowerCase(); } else { message.nodes[m][n].rnamel = message.nodes[m][n].namel; }
1821 - if (meshes[m]) { message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase(); }
1821 + message.nodes[m][n].meshnamel = meshes[m]?meshes[m].name.toLowerCase():'*';
1822 message.nodes[m][n].meshid = m;
1823 message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0;
1824 if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
@@ -2377,7 +2377,7 @@
2377 if (getNodeFromId(node._id) != null) break; // This node is already known.
2378 node.namel = node.name.toLowerCase();
2379 if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
2380 - node.meshnamel = meshes[node.meshid].name.toLowerCase();
2380 + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*';
2381 node.state = 0;
2382 if (!node.icon) node.icon = 1;
2383 node.ident = ++nodeShortIdent;
@@ -2475,7 +2475,7 @@
2475 } else {
2476 // We see the new mesh, move this device
2477 node.meshid = message.event.newMeshId;
2478 - node.meshnamel = meshes[message.event.newMeshId].name.toLowerCase();
2478 + node.meshnamel = meshes[message.event.newMeshId]?meshes[message.event.newMeshId].name.toLowerCase():'*';
2479 masterUpdate(1 | 2 | 4);
2480 }
2481 refreshDevice(message.event.nodeid);
@@ -2485,7 +2485,7 @@
2485 if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages.
2486 node.namel = node.name.toLowerCase();
2487 if (node.rname) { node.rnamel = node.rname.toLowerCase(); } else { node.rnamel = node.namel; }
2488 - node.meshnamel = meshes[node.meshid].name.toLowerCase();
2488 + node.meshnamel = meshes[node.meshid]?meshes[node.meshid].name.toLowerCase():'*';
2489 node.state = 0;
2490 if (!node.icon) node.icon = 1;
2491 node.ident = ++nodeShortIdent;
@@ -2975,7 +2975,7 @@
2975 var meshrights = GetNodeRights(node);
2976 if (sort == 0) {
2977 // Mesh header
2978 - if (node.meshid != current) {
2978 + if (((meshes[node.meshid]?node.meshid:'*') != current)) {
2979 if (((view == 1) || (view == 3)) && (current != null)) { r += '</div>'; } // Close collapse div
2980 deviceHeaderSet();
2981 var extra = '';
@@ -2992,11 +2992,12 @@
2992 }
2993 if (meshes[node.meshid]) {
2994 r += '<span id=MxMESH cmenu=meshContextMenu tabindex=0 style=cursor:pointer onclick=gotoMesh("' + node.meshid + '") onkeypress="if (event.key==\'Enter\') gotoMesh(\'' + node.meshid + '\')">' + EscapeHtml(meshes[node.meshid].name) + '</span>' + getMeshActions(mesh2, meshrights) + '</div>';
2995 + current = node.meshid;
2996 } else {
2997 r += '<span id=MxMESH cmenu=meshContextMenu tabindex=0 style=cursor:pointer><i>' + "Indivitual Devices" + '</i></span></div>';
2998 + current = '*';
2999 }
3000 if (view == 2) { r += '</div>'; }
2999 - current = node.meshid;
3001 displayedMeshes[current] = 1;
3002 c = 0;
3003 if ((view == 1) || (view == 3)) { r += '<div id=DevxCol' + deviceHeaderId + ((collapsed === true)?' style=display:none':'') + '>'; } // Open collapse div