Create script for app:project type now sets email alias value to project name for Email Archive space

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7597 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-12-07 22:07:53 +00:00
parent 6038c7403e
commit 3a43e6dfec
4 changed files with 22 additions and 3 deletions

View File

@@ -1 +1,19 @@
// add onCreateNode policy code for app:projectfolder here
// 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)
{
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!");
}
function normalise(s)
{
// email alias has strict constraint
return new String(s).toLowerCase().replace(/[^a-z^0-9^.]/g, "-");
}