diff --git a/package.json b/package.json index c7b427d5..ff52b66d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.6-u", + "version": "0.4.6-v", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/styles/style.css b/public/styles/style.css index ff6c103f..2b83cce7 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -600,19 +600,19 @@ body { #idx_dlgCancelButton { float: right; - width: 80px; + min-width: 80px; margin-left: 5px; } #idx_dlgOkButton { float: right; - width: 80px; + min-width: 80px; margin-left: 5px; } #idx_dlgDeleteButton { float: left; - width: 80px; + min-width: 80px; margin-left: 5px; } diff --git a/translate/translate.json b/translate/translate.json index 6da8f81f..faa406c2 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -2693,7 +2693,7 @@ "pt": "Cancelar", "ja": "キャンセル", "nl": "Annuleren", - "de": "Abbr.", + "de": "Abbrechen", "xloc": [ "default.handlebars->container->dialog->idx_dlgButtonBar", "default.handlebars->23->946", diff --git a/views/default.handlebars b/views/default.handlebars index 0c4b76df..9e980009 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1125,7 +1125,7 @@ var meshes = {}; var meshcount = 0; var nodes = null; - var usergroups = {}; + var usergroups = null; var filetree = {}; var userinfo = null; var serverinfo = null; @@ -1722,8 +1722,10 @@ break; } case 'usergroups': { + var groupCount = 0; usergroups = {}; - for (var i in message.ugroups) { usergroups[message.ugroups[i]._id] = message.ugroups[i]; } + for (var i in message.ugroups) { groupCount++; usergroups[message.ugroups[i]._id] = message.ugroups[i]; } + if (groupCount == 0) { usergroups = null; } masterUpdate(8192); break; } @@ -2218,6 +2220,7 @@ case 'createusergroup': case 'usergroupchange': { // User group changed + if (usergroups == null) { usergroups = {}; } var ugroup = usergroups[message.event.ugrpid]; if (ugroup == null) { // This is a new user group for us @@ -2233,7 +2236,13 @@ } case 'deleteusergroup': { // User group removed - if (usergroups[message.event.ugrpid] != null) { delete usergroups[message.event.ugrpid]; masterUpdate(8192); } + if ((usergroups != null) && (usergroups[message.event.ugrpid] != null)) { + delete usergroups[message.event.ugrpid]; + var c = 0; + for (var i in usergroups) { c++; } + if (c == 0) { usergroups = null; } // If user groups is empty, set it to null. + masterUpdate(8192 + 16384); + } break; } case 'createmesh': { @@ -7651,7 +7660,7 @@ x += '

'; if (meshrights & 2) { x += ' ' + "Add Users" + ''; - if ((userinfo.siteadmin & 256) != 0) { + if ((usergroups != null) && ((userinfo.siteadmin & 256) != 0)) { var userGroupCount = 0, newUserGroup = false; for (var i in usergroups) { userGroupCount++; if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { newUserGroup = true; } } if ((userGroupCount > 0) && (newUserGroup)) { x += ' ' + "Add User Group" + ''; } @@ -7682,6 +7691,7 @@ var uname = i.split('/')[2]; if (currentMesh.links[i].name) { uname = currentMesh.links[i].name; } if (i == userinfo._id) { uname = userinfo.name; } + if ((usergroups != null) && (usergroups[i] != null)) { uname = usergroups[i].name; } sortedusers.push({ id: i, name: uname, rights: currentMesh.links[i].rights }); } sortedusers.sort(function(a, b) { if (a.name > b.name) return 1; if (a.name < b.name) return -1; return 0; }); @@ -7888,7 +7898,7 @@ for (var i in meshes) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += ''; } } x += addHtmlValue("Device Group", '
'); } else if (userid === 2) { - if ((userinfo.siteadmin & 256) == 0) return; + if ((usergroups == null) || ((userinfo.siteadmin & 256) == 0)) return; var y = ''; for (var i in usergroups) { if ((currentMesh.links == null) || (currentMesh.links[i] == null)) { y += ''; } } x += addHtmlValue("User Group", '
'); @@ -9089,7 +9099,7 @@ function updateUserGroups() { // Sort the list of group names var sortedGroups = [], x = ''; - for (var i in usergroups) { sortedGroups.push(usergroups[i]); } + if (usergroups) { for (var i in usergroups) { sortedGroups.push(usergroups[i]); } } sortedGroups.sort(nameSort); if (sortedGroups.length == 0) { @@ -9124,7 +9134,7 @@ if (xxdialogMode) return; var x = '', y = ''; if (mode == 2) { - for (var i in usergroups) { y += ''; } + if (usergroups) { for (var i in usergroups) { y += ''; } } x += addHtmlValue("User Group", '
'); } x += addHtmlValue("Name", ''); @@ -9151,7 +9161,7 @@ var currentUserGroup = null; function gotoUserGroup(groupid, force) { if (xxdialogMode && !force) return; - var group = currentUserGroup = usergroups[decodeURIComponent(groupid)]; + var group = currentUserGroup = usergroups?usergroups[decodeURIComponent(groupid)]:null; if (group == null) { if (xxcurrentView == 51) { setDialogMode(0); go(50); } return; } QH('p51groupName', group.name); var usercount = 0, meshcount = 0; @@ -9570,10 +9580,11 @@ } } if (count == 1) { x += '
 ' + "No device groups in common" + '
'; } - x += '
'; + x += ''; if (usergroups != null) { count = 1; + x += '
'; if ((userinfo.siteadmin & 256) != 0) { var userGroupCount = 0, newUserGroup = false; for (var i in usergroups) { userGroupCount++; if ((currentUser.links == null) || (currentUser.links[i] == null)) { newUserGroup = true; } } @@ -9598,7 +9609,7 @@ } function p30RemoveUserGroup(button, ugrpid) { - if (xxdialogMode) return; + if (xxdialogMode || (usergroups == null)) return; var groupid = decodeURIComponent(ugrpid), group = usergroups[groupid]; var name = (group != null)?EscapeHtml(group.name):('' + "Unknown" + ''); setDialogMode(2, "Remove User", 3, p30RemoveUserGroupEx, format("Confirm removal of group {0}?", name), groupid); @@ -9609,7 +9620,7 @@ } function p30showAddUserGroupDialog() { - if (xxdialogMode) return; + if (xxdialogMode || (usergroups == null)) return; var y = ''; for (var i in usergroups) { if ((currentUser.links == null) || (currentUser.links[i] == null)) { y += ''; } } var x = addHtmlValue("User Group", '
'); diff --git a/webserver.js b/webserver.js index 51db62bd..fb9ec3fe 100644 --- a/webserver.js +++ b/webserver.js @@ -4165,7 +4165,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { function render(req, res, filename, args) { if ((obj.parent.webViewsOverridePath == null) && (obj.renderPages != null)) { // If a user set a localization, use that - if ((req.session != null) && (req.session.userid)) { + if ((req.query.lang == null) && (req.session != null) && (req.session.userid)) { var user = obj.users[req.session.userid]; if ((user != null) && (user.lang != null)) { req.query.lang = user.lang; } };