cancel
Showing results for 
Search instead for 
Did you mean: 

Hint of the day : Apply a template to ALL users on a space

zomurn
Champ in-the-making
Champ in-the-making
Hi,

Just a simple javascript to apply a template for all user :

function applyTemplates()
{
   var usersHome = companyhome.childByNamePath(USERS_ROOT_FOLDER);
   usersHome.addAspect("cm:templatable");
   query = "PATH:\"app:company_home/app:dictionary/app:content_templates/cm:" + TEMPLATE_BANNETTES + "\"";
   var templateRef = search.luceneSearch(query);
   usersHome.properties["cm:template"]=templateRef[0];
   templateRef[0].setPermission("Consumer");
   templateRef[0].save();
   usersHome.save();
}

We just need to allow READ access to the template.

PS : from the problem quoted here : http://forums.alfresco.com/en/viewtopic.php?f=36&t=11255
1 REPLY 1

rafaelscg
Champ on-the-rise
Champ on-the-rise

var template = companyhome.childByNamePath("Data Dictionary/Presentation Templates/viewer.ftl");
document.properties["cm:template"]=template;
document.save();