try{
if(!document.isContainer){
var group = people.getGroup("GROUP_" +"test");
var persons = people.getMembers(group);
for each (person in persons){
if(person.properties.userName != "admin" && person.properties.userName != "guest"){
var email = person.properties.email;
if(email)
sendMail(email);
}
}
}
}
catch(exception){
throw exception;
}
function sendMail(email){
// create mail action
var mail = actions.create("mail");
mail.parameters.to = email;
mail.parameters.subject = "Nouveau document dans l'espace " + document.parent.name + ".";
mail.parameters.from = "admin@alfresco.fr";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/notification_user_email.ftl");
mail.parameters.text = "Nouveau document"; //"some text, in case template is not found";
// execute action against a document
mail.execute(document);
}
var persons = [];
var perms = document.getPermissions();
for(var i=0 ; i<perms.length ; i++) {
var perm = perms[i].split(";");
if(perm[0] == "ALLOWED" && perm[1].lastIndexOf("GROUP_") != -1) {
var group = people.getGroup(perm[1]);
if(group)
persons.concat(persons, people.getMembers(group)); //Ne traite pas les doublons
}
}
var persons = [];
var perms = document.getPermissions();
for(var i=0 ; i<perms.length ; i++) {
var perm = perms[i].split(";");
if(perm[0] == "ALLOWED" && perm[1].lastIndexOf("GROUP_") != -1) {
var group = people.getGroup(perm[1]);
if(group)
var persons = people.getMembers(group);
for each (person in persons){
if(person.properties.userName != "admin" && person.properties.userName != "guest"){
var email = person.properties.email;
if(email)
sendMail(email);
}
}
}
}
function sendMail(email){
// Envoi mail
var mail = actions.create("mail");
mail.parameters.to = email;
mail.parameters.subject = "Document Mis a Jour";
mail.parameters.from = "admin@alfresco.fr";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/diffusion_document.ftl");
mail.parameters.text = "Nouveau document";
mail.execute(document);
}
Bonjour,
Le document '${document.name}' est disponible en consultation dans l'espace '${space.name}'
Vous pouvez retrouver directement ce document en suivant ce lien :
<#assign ref=space.nodeRef>
<#assign workspace=ref[0..ref?index_of("://")-1]>
<#assign storenode=ref[ref?index_of("://")+3..]>
http://IP_DU_SERVEUR:8080/alfresco/navigate/browse/${workspace}
Cordialement
${person.properties.firstName}<#if person.properties.lastName?exists> ${person.properties.lastName}</#if>
// Récupération de l'identifiant du document passé en parametre
// Envoi d'un mail de notification aux utilisateurs des groupes rattachés au document
// avec suppression des doublons
var nodeRef = args["noderef"];
var document = search.findNode(nodeRef);
var persons = [];
var users = new Array();
var perms = document.getPermissions();
for(var i=0 ; i<perms.length ; i++) {
var perm = perms[i].split(";");
if(perm[0] == "ALLOWED" && perm[1].lastIndexOf("GROUP_") != -1) {
var group = people.getGroup(perm[1]);
if(group){
var persons = people.getMembers(group);
for each (person in persons){
if(person.properties.userName != "admin" && person.properties.userName != "guest"){
var email = person.properties.email;
// Insertion dans la table users (suppression des doublons)
if(email) {
var exist = 0;
for(var seq=0 ; seq<users.length ; seq++) {
if (users[seq] == email) {
exist = 1;
}
}
if (exist == 0){
users[users.length] = email;
}
}
}
}
}
}
}
// Envoi mail aux utilisateurs
for (var i=0 ; i<users.length ; i++) {
sendMail(users[i]);
}
// Message de confirmation d'envoi pour l'expéditeur
var email = person.properties.email;
var mail = actions.create("mail");
mail.parameters.to = email;
mail.parameters.subject = "Document "+document.name;
mail.parameters.from = "Info@Alfresco";
mail.parameters.text = "La notification aux utilisateurs a été effectuée";
mail.execute(document);
// Retour à la page d'origine aprés exécution du script
var goBack = "<script>history.back();</script>";
goBack;
function sendMail(email){
// Envoi mail
var mail = actions.create("mail");
mail.parameters.to = email;
mail.parameters.subject = "Document Mis a Jour";
mail.parameters.from = "Info@Alfresco";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/diffusion_document.ftl");
mail.parameters.text = "Nouveau document";
mail.execute(document);
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.