ALFCOM-2846 - "Choose from popular tags in this site" not available when tagging documents in Share

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14983 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2009-06-28 23:21:17 +00:00
parent 8e8a2dfa64
commit 06b39ef088

View File

@@ -39,12 +39,18 @@ function main()
// Set passed-in tags
if (json.has("tags"))
{
var tags = String(json.get("tags"));
if (tags !== "")
// Get the tags JSONArray and copy it to a native JavaScript array
var jsonTags = json.get("tags"),
tags = [];
for (var t = 0; t < jsonTags.length(); t++)
{
// Remove leading, trailing and multiple spaces
tags = tags.replace(/^\s+|\s+$/g, '').replace(/\s{2,}/, ' ');
node.tags = tags.split(" ");
tags.push(jsonTags.get(t));
}
if (tags.length > 0)
{
node.tags = tags;
}
else
{