Added personal notes.

This commit is contained in:
Ylian Saint-Hilaire 2021-03-25 13:28:33 -07:00
parent 4a83318393
commit a53b030345
11 changed files with 1635 additions and 1540 deletions

View File

@ -553,7 +553,7 @@
<Content Include="translate\translate.json" />
<Content Include="views\agentinvite.handlebars" />
<Content Include="views\default-mobile.handlebars" />
<Content Include="views\default.handlebars" />
<Content Include="views\default2.handlebars" />
<Content Include="views\desktop.handlebars" />
<Content Include="views\download.handlebars" />
<Content Include="views\download2.handlebars" />

Binary file not shown.

Binary file not shown.

View File

@ -1782,9 +1782,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
}
db.Remove('ws' + deluser._id); // Remove user web state
db.Remove('nt' + deluser._id); // Remove notes for this user
db.Remove('im' + deluser._id); // Remove image for this user
db.Remove('ws' + deluser._id); // Remove user web state
db.Remove('nt' + deluser._id); // Remove notes for this user
db.Remove('ntp' + deluser._id); // Remove personal notes for this user
db.Remove('im' + deluser._id); // Remove image for this user
// Delete all files on the server for this account
try {
@ -4289,7 +4290,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var splitid = command.id.split('/');
if ((splitid.length != 3) || (splitid[1] != domain.id)) return; // Invalid domain, operation only valid for current domain
var idtype = splitid[0];
if ((idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return;
if ((idtype != 'puser') && (idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return;
if (idtype == 'node') {
// Get the node and the rights for this node
@ -4328,6 +4329,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if ((user.groups != null) && (user.groups.length > 0) && ((chguser.groups == null) || (findOne(chguser.groups, user.groups) == false))) break;
db.Set({ _id: 'nt' + command.id, type: 'note', value: command.notes }); // Set the note for this user
}
} else if (idtype == 'puser') {
// Set the user's personal note, starts with 'ntp' + userid.
if (common.validateString(command.notes, 1) == false) {
db.Remove('ntp' + user._id); // Delete the note for this node
} else {
db.Set({ _id: 'ntp' + user._id, type: 'note', value: command.notes }); // Set the note for this user
}
}
break;
@ -4761,7 +4769,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var splitid = command.id.split('/');
if ((splitid.length != 3) || (splitid[1] != domain.id)) return; // Invalid domain, operation only valid for current domain
var idtype = splitid[0];
if ((idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return;
if ((idtype != 'puser') && (idtype != 'user') && (idtype != 'mesh') && (idtype != 'node')) return;
if (idtype == 'node') {
// Get the node and the rights for this node
@ -4799,6 +4807,14 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
} catch (ex) { }
});
} else if (idtype == 'puser') {
// Get personal note, starts with 'ntp' + userid
db.Get('ntp' + user._id, function (err, notes) {
try {
if ((notes == null) || (notes.length != 1)) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
} catch (ex) { }
});
}
break;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -2995,6 +2995,13 @@ a {
width: 28px;
}
.uiSelector6 {
margin: 2px;
background: url(../images/views.png) -392px 0px;
height: 28px;
width: 28px;
}
.backButton {
width: 32px;
height: 32px;

View File

@ -357,22 +357,27 @@ function startEx(argv) {
if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
if (outname.endsWith('.js')) { inFile = '<script>' + inFile + '</script>'; }
var minifiedOut = minify(inFile, {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false, // This is not good.
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeOptionalTags: true,
removeEmptyAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeTagWhitespace: true,
preserveLineBreaks: false,
useShortDoctype: true
});
var minifiedOut = null;
try {
minifiedOut = minify(inFile, {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false, // This is not good.
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeOptionalTags: true,
removeEmptyAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeTagWhitespace: true,
preserveLineBreaks: false,
useShortDoctype: true
});
} catch (ex) {
console.log(ex);
}
// Perform minification post-processing
if (outname.endsWith('.js')) { minifiedOut = minifiedOut.substring(8, minifiedOut.length - 9); }

File diff suppressed because it is too large Load Diff

View File

@ -707,6 +707,7 @@
<div style="margin-top:5px"><a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><span id="p2nextPasswordUpdateTime"></span></div>
<div style="margin-top:5px"><a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a></div>
<div style="margin-top:5px"><a onclick="toggleNightMode()" style="cursor:pointer">Set dark mode</a></div>
<div style="margin-top:5px"><a onclick="showNotes(false,encodeURIComponentEx('p'+userinfo._id))" style="cursor:pointer">Personal notes</a></div>
</div>
<br style=clear:both />
</div>

View File

@ -146,11 +146,20 @@
<div tabindex=0 id=uiMenuButton title="User interface selection" onclick="showUserInterfaceSelectMenu()" onkeypress="if (event.key == 'Enter') showUserInterfaceSelectMenu()">
&diams;
<div id=uiMenu style="display:none">
<div tabindex=0 id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(1)"><div class="uiSelector1"></div></div>
<div tabindex=0 id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(2)"><div class="uiSelector2"></div></div>
<div tabindex=0 id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(3)"><div class="uiSelector3"></div></div>
<div tabindex=0 id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode" onkeypress="if (event.key == 'Enter') toggleNightMode()"><div class="uiSelector4"></div></div>
<div tabindex=0 id=uiViewButton5 class=uiSelector onclick=toggleFooterBarMode() title="Toggle footer bar" onkeypress="if (event.key == 'Enter') toggleFooterBarMode()"><div class="uiSelector5"></div></div>
<table>
<tr>
<td>
<div tabindex=0 id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(1)"><div class="uiSelector1"></div></div>
<div tabindex=0 id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(2)"><div class="uiSelector2"></div></div>
<div tabindex=0 id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface" onkeypress="if (event.key == 'Enter') userInterfaceSelectMenu(3)"><div class="uiSelector3"></div></div>
</td>
<td>
<div tabindex=0 id=uiViewButton6 class=uiSelector onclick="showNotes(false,encodeURIComponentEx('p'+userinfo._id))" title="Personal Notes" onkeypress="if (event.key == 'Enter') showNotes(false,'p'+encodeURIComponentEx(userinfo._id))"><div class="uiSelector6"></div></div>
<div tabindex=0 id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode" onkeypress="if (event.key == 'Enter') toggleNightMode()"><div class="uiSelector4"></div></div>
<div tabindex=0 id=uiViewButton5 class=uiSelector onclick=toggleFooterBarMode() title="Toggle footer bar" onkeypress="if (event.key == 'Enter') toggleFooterBarMode()"><div class="uiSelector5"></div></div>
</td>
</tr>
</table>
</div>
</div>
<table id=MainMenuSpan cellpadding=0 cellspacing=0 class=style1>

View File

@ -1976,9 +1976,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
}
}
obj.db.Remove('ws' + deluser._id); // Remove user web state
obj.db.Remove('nt' + deluser._id); // Remove notes for this user
obj.db.Remove('im' + deluser._id); // Remove image for this user
obj.db.Remove('ws' + deluser._id); // Remove user web state
obj.db.Remove('nt' + deluser._id); // Remove notes for this user
obj.db.Remove('ntp' + deluser._id); // Remove personal notes for this user
obj.db.Remove('im' + deluser._id); // Remove image for this user
// Remove the user
obj.db.Remove(deluser._id);