if(!document.hasAspect("fm:discussable")) { document.addAspect("fm:discussable"); }
if(!document.hasAspect("fm:commentsRollup")) { document.addAspect("fm:commentsRollup"); }
var forums = document.childAssocs["fm:discussion"];
var forum;
var nom2 = "Discussion" + Math.random();
if(forums.length === 0) {
forum = document.createNode(nom2, "fm:forum", "fm:discussion");
}
else {
forum = forums[0];
}
var topics = forum.childAssocs["cm:contains"];
var topic;
if(topics.length === 0) {
topic = forum.createNode("Comments", "fm:topic", "cm:Comments");
}
else {
topic = topics[0];
}
var props = new Array(1);
props["cm:content"] = "";
var nom = "comment-" + Math.random();
//var nom = "Comment"
var mypost = topic.createNode(nom,"fm:post",props);
mypost.content = "<p><b>==== NEW COMMENT===== </b></p>";
Bonjour,
pour préciser les choses : parlez-vous de "commentaires" ou de "discussions" (au sens des objets Alfresco) ?
Bonjour,
avez-vous essayé de débugguer votre script ?
Exemple ici :
http://alfresco-france.blogspot.fr/2012/01/debug-series-les-sources-javascript.html
if(!document.hasAspect("fm:discussable")) { document.addAspect("fm:discussable"); }
if(!document.hasAspect("fm:commentsRollup")) { document.addAspect("fm:commentsRollup"); }
var forums = document.childAssocs["fm:discussion"];
var forum;
var nom2 = "Discussion" + Math.random();
if (forums == null) {
forum = document.createNode(nom2, "fm:forum","cm:contains");
}
else
{
forum = forums[0];
}
var topics = forum.childAssocs["cm:contains"];
var topic;
var nom3 = "Comments-" + Math.random();
if (topics == null) {
topic = forum.createNode(nom3, "fm:topic", "cm:contains");
}
else
{
topic=topics[0];
}
var props = new Array(1);
props["cm:content"] = "";
props["cm:mimetype"] = "";
var nom = "comment-" + Math.random();
var mypost = topic.createNode(nom,"fm:post",props,"cm:contains",nom);
mypost.mimetype = "text/html";
mypost.content = "<p><b>=================== CAB REJECTED =====================</b></p>";
if(!mypost.hasAspect("cm:titled")) { mypost.addAspect("cm:titled"); }
if(!document.hasAspect("fm:discussable")) { document.addAspect("fm:discussable"); }
if(!document.hasAspect("fm:commentsRollup")) { document.addAspect("fm:commentsRollup"); }
var forums = document.childAssocs["fm:discussion"];
var forum = forums[0];
var topics = forum.childAssocs["cm:contains"];
var topic;
var nom3 = "Comments"
if (topics == null) {
topic = forum.createNode(nom3, "fm:topic", "cm:contains");
}
else
{
topic=topics[0];
}
var props = new Array(1);
props["cm:content"] = "";
props["cm:mimetype"] = "";
var nom = "comment-" + Math.random();
var mypost = topic.createNode(nom,"fm:post",props,"cm:contains",nom);
mypost.mimetype = "text/html";
mypost.content = "<p><b>=================== CAB REJECTED =====================</b></p>";
if(!mypost.hasAspect("cm:titled")) { mypost.addAspect("cm:titled"); }
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.