var e = entry ();
e.set ("Author", e.author);
e.set ("Modification date", new Date ());
It was simple ... but the user's login was saved in the "Author" field.
I would like to have, "Name and Surname".
login A = Name and Surname A
login B = Name and Surname B
e.t.c...
And I have a problem with that.
Will there be someone willing to help me with this problem
name - entry name
title - entry name
description - entry description
favorites - true, if the entry is in Favorites
deleted - true, if the entry is deleted (it is in the Recycle Bin)
author - the id of the user who created the entry
creationTime - date & time the entry was created
lastModifiedTime - date & time the entry was last modified
While other info could be made available in these properties, this is all the info as of now. I suggest you request it from the developer, best by using Memento.UserVoice.com.
var e = entry ();
e.set ("Autor", e.author);
e.set ("DATA", new Date ());
var e = entry();
var autor = e.field("AUTOR");
var podpis = e.field("PODPIS");
var loginA = ('Name and Surname A');
var loginB = ('Name and Surname B');
var loginC = ('Name and Surname C');
var entries = lib().entries();
for (var ent = 0; ent < entries.length; ent++) {
if (entries[ent].field("AUTOR") === autor);
{
if (autor == loginA); {
e.set("PODPIS", loginA);
cancel();
}
if (autor == loginB); {
e.set("PODPIS", loginB);
cancel();
}
if (autor == loginC); {
e.set("PODPIS", loginC);
cancel();
}
message(podpis); //debug
break;
}
}
var loginA = ('Name and Surname A');
if (entries[ent].field("AUTOR") === autor);
if (autor == loginA); {
if (autor == loginB) {
So, using a semicolon is not an error here because the script then executes the next command. I do not know why, after finding a login and a change, it does not cease to execute the script.
// Script adding information who is the author of the new entry
var e = entry ();
if (e.author == "loginA") {
e.set("AUTHOR", "userNameA");
}else if(e.author == "loginB") {
e.set("AUTHOR", "userNameB");
}else if (e.author == "loginC") {
e.set("AUTHOR", "userNameC");
} else {
cancel ();
}
// Add a hidden login.txt file in the memento directory
var e = entry();
var login = e.author;
{
var fLogin = file ("/sdcard/memento/.login.txt");
fLogin.writeLine(login);
fLogin.close();
var l = fLogin.readLines();
}
// Add the hidden file signature.txt in the memento directory
{
var fSignature = file("/sdcard/memento/.signature.txt");
{
if(login =='loginA') {
fSignature.writeLine("userNameA");
fSignature.close();
}else if(login == 'loginB ') {
fSignature.writeLine("userNameB");
fSignature.close();
}else if(login =='loginC') {
fSignature.writeLine("userNameC");
fSignature.close();
}else{
cancel();
}
// Add information: who and when modified the entry
var p = fSignature.readLines ();
e.set("SIGNATURE", p);
e.set("DATE", new Date ());
message('ENTRY ADDED'); // message about adding an entry
}
}
var e = entry ();
var fSignature = file("/sdcard/memento/.signature.txt");
var p = fSignature.readLines();
e.set("SIGNATURE", p);
e.set("DATE", new Date ());
message('UPDATED ENTRY'); // message about updating the entry
--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodatabase+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
// Add a hidden login.txt file in the memento directory
var e = entry();
var login = e.author;
{
var fLogin = file("/sdcard/memento/.login.txt");
fLogin.writeLine(login);
fLogin.close();
}