diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js index 843c8f88a2..3fc445448f 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js @@ -248,7 +248,11 @@ var Filters = constructPathQuery: function constructPathQuery(parsedArgs) { var pathQuery = ""; - if (parsedArgs.nodeRef != "alfresco://company/home") + if (parsedArgs.libraryRoot != companyhome) + { + pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; + } + else if (parsedArgs.nodeRef != "alfresco://company/home") { pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; } diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js index 48c2bf8aef..92628ee65c 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js @@ -243,7 +243,7 @@ var Filters = var pathQuery = ""; if (parsedArgs.nodeRef != "alfresco://company/home") { - pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"'; + pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"'; } return pathQuery; } diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js index 5951dad640..b118fd793a 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js @@ -180,6 +180,27 @@ var Common = return favourites; }, + /** + * Returns the number of nested levels at which two paths match. This is used when there are two + * parents to a node and is used to determine the correct one. + * + * @param count + * @param firstNode An array of Strings that are the elements in a path to a node. + * @param secondNode An array of Strings that are the elements in a path to a different node. + */ + getDeepOfPath: function Common_getDeepOfPath(count, firstNode, secondNode) + { + var i = 0; + for (var i = 0; i < count; i++) + { + if (!firstNode[i].equals(secondNode[i])) + { + break; + } + } + return i; + }, + /** * Generates a location object literal for a given node. * Location is Site-relative unless a libraryRoot node is passed in. @@ -202,16 +223,27 @@ var Common = if (libraryRoot) { + var libraryRootDisplayPath = libraryRoot.displayPath.split("/"); + var deepLibraryRoot = libraryRootDisplayPath.length; + var deepNode = displayPaths.length; + + var count = (deepNode > deepLibraryRoot) ? Common.getDeepOfPath(deepNode, displayPaths, libraryRootDisplayPath): Common.getDeepOfPath(deepLibraryRoot, libraryRootDisplayPath, displayPaths); + + if (node.qnamePath.contains(libraryRoot.qnamePath)) + { + count++; + } + // Generate the path from the supplied library root location = { site: null, siteTitle: null, container: null, - path: "/" + displayPaths.slice(libraryRoot.displayPath.split("/").length + 1, displayPaths.length).join("/"), + path: "/" + displayPaths.slice(count, deepNode).join("/"), file: node.name }; - } + } else if ((qnamePaths.length > 4) && (qnamePaths[2] == TYPE_SITES)) { var siteId = displayPaths[3],