From 3587426e4288cf2d60e630b11596231f4443d319 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 21 Sep 2013 16:08:19 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX to HEAD (4.2) 55492: MNT-9647: Merged V4.1-BUG-FIX (4.1.7) to HEAD-BUG-FIX (4.2) 55055: MNT-9446 : Share working copy nodes assume cm:original association is present - Using "cm:workingcopylink" association instead of "cm:original" git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55794 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../documentlibrary-v2/evaluator.lib.js | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js index fa404a1b83..44db7b999c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/evaluator.lib.js @@ -59,19 +59,28 @@ var Evaluator = // Working Copy? if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy")) { - var wcNode = node.assocs["cm:original"][0]; - workingCopy["isWorkingCopy"] = true; - workingCopy["sourceNodeRef"] = wcNode.nodeRef; - if (wcNode.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")) + var wcLink = node.sourceAssocs["cm:workingcopylink"]; + var isWorkingCopy = wcLink != null; + if (isWorkingCopy) { - workingCopy["workingCopyVersion"] = wcNode.properties["cm:versionLabel"]; - } + var wcNode = wcLink[0]; + workingCopy["isWorkingCopy"] = true; + workingCopy["sourceNodeRef"] = wcNode.nodeRef; + if (wcNode.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")) + { + workingCopy["workingCopyVersion"] = wcNode.properties["cm:versionLabel"]; + } - // Google Doc? - if (node.hasAspect("{http://www.alfresco.org/model/googledocs/1.0}googleResource")) + // Google Doc? + if (node.hasAspect("{http://www.alfresco.org/model/googledocs/1.0}googleResource")) + { + // Property is duplicated here for convenience + workingCopy["googleDocUrl"] = node.properties["gd:url"]; + } + } + else { - // Property is duplicated here for convenience - workingCopy["googleDocUrl"] = node.properties["gd:url"]; + logger.error("Node: " + node.nodeRef +" hasn't \"cm:workingcopylink\" association"); } } // Locked?