mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
onCreateNode script for app:project type now deep copies contents of Project space template when a New Project is created via the action in the Projects space
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7609 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,15 +1,35 @@
|
||||
// onCreateNode policy code for app:projectfolder
|
||||
var project = behaviour.args[0];
|
||||
var results = search.luceneSearch("+PATH:\"" + project.qnamePath + "/*\" +ASPECT:\"{http://www.alfresco.org/model/emailserver/1.0}aliasable\"");
|
||||
if (results.length == 1)
|
||||
logger.log("onCreateNode policy code for app:projectfolder");
|
||||
var project = behaviour.args[0].child;
|
||||
if (project.children.length == 0)
|
||||
{
|
||||
results[0].properties["emailserver:alias"] = normalise(project.name);
|
||||
results[0].save();
|
||||
logger.log("Applied email alias of: " + normalise(project.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.log("No email folder found!");
|
||||
// perform deep copy of Project template contents into this node
|
||||
var templates = search.luceneSearch("+PATH:\"/app:company_home/app:dictionary/app:space_templates/*\" +TYPE:\"{http://www.alfresco.org/model/application/1.0}projectfolder\"");
|
||||
if (templates.length == 0)
|
||||
{
|
||||
logger.log("No app:project templates found to copy!");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.log("Copying app:project template into new project...");
|
||||
for each (var child in templates[0].children)
|
||||
{
|
||||
child.copy(project, true);
|
||||
}
|
||||
|
||||
// search for the email archive child folder
|
||||
var results = search.luceneSearch("+PATH:\"" + project.qnamePath + "/*\" +ASPECT:\"{http://www.alfresco.org/model/emailserver/1.0}aliasable\"");
|
||||
if (results.length == 1)
|
||||
{
|
||||
results[0].properties["emailserver:alias"] = normalise(project.name);
|
||||
results[0].save();
|
||||
logger.log("Applied email alias of: " + normalise(project.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.log("No email archive folder found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function normalise(s)
|
||||
|
Reference in New Issue
Block a user