mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
DocLib webscript and UI support for accessing Document Library container
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18969 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -176,26 +176,31 @@ var Common =
|
||||
qnamePaths = node.qnamePath.split("/"),
|
||||
displayPaths = node.displayPath.split("/");
|
||||
|
||||
if (node.isContainer)
|
||||
if (libraryRoot)
|
||||
{
|
||||
if (node.isContainer && String(node.nodeRef) != String(libraryRoot.nodeRef))
|
||||
{
|
||||
// We want the path to include the parent folder name
|
||||
displayPaths = displayPaths.concat([node.name]);
|
||||
}
|
||||
|
||||
if (libraryRoot)
|
||||
{
|
||||
// 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("/"),
|
||||
file: node.name
|
||||
path: "/" + displayPaths.slice(libraryRoot.displayPath.split("/").length + 1, displayPaths.length).join("/")
|
||||
};
|
||||
}
|
||||
else if ((qnamePaths.length > 4) && (qnamePaths[2] == TYPE_SITES))
|
||||
{
|
||||
if (node.isContainer)
|
||||
{
|
||||
// We want the path to include the parent folder name
|
||||
displayPaths = displayPaths.concat([node.name]);
|
||||
}
|
||||
|
||||
var siteId = displayPaths[3],
|
||||
siteNode = Common.getSite(siteId),
|
||||
containerId = qnamePaths[4].substr(3);
|
||||
@@ -221,8 +226,7 @@ var Common =
|
||||
site: null,
|
||||
siteTitle: null,
|
||||
container: null,
|
||||
path: "/" + displayPaths.slice(2, displayPaths.length).join("/"),
|
||||
file: node.name
|
||||
path: "/" + displayPaths.slice(2, displayPaths.length).join("/")
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -84,8 +84,7 @@ function getDoclist()
|
||||
nodes = nodes.slice(startIndex, pagePos * pageSize);
|
||||
|
||||
// Common or variable parent container?
|
||||
var parent = null,
|
||||
defaultLocation = {};
|
||||
var parent = null;
|
||||
|
||||
if (!filterParams.variablePath)
|
||||
{
|
||||
@@ -95,9 +94,6 @@ function getDoclist()
|
||||
node: parsedArgs.pathNode,
|
||||
userAccess: Evaluator.run(parsedArgs.pathNode).actionPermissions
|
||||
};
|
||||
|
||||
// Store a default location to save repeated calculations
|
||||
defaultLocation = Common.getLocation(parsedArgs.pathNode, parsedArgs.libraryRoot);
|
||||
}
|
||||
|
||||
var isThumbnailNameRegistered = thumbnailService.isThumbnailNameRegistered(THUMBNAIL_NAME),
|
||||
@@ -122,10 +118,10 @@ function getDoclist()
|
||||
{
|
||||
location =
|
||||
{
|
||||
site: defaultLocation.site,
|
||||
siteTitle: defaultLocation.siteTitle,
|
||||
container: defaultLocation.container,
|
||||
path: defaultLocation.path,
|
||||
site: parsedArgs.location.site,
|
||||
siteTitle: parsedArgs.location.siteTitle,
|
||||
container: parsedArgs.location.container,
|
||||
path: parsedArgs.location.path,
|
||||
file: node.name
|
||||
};
|
||||
}
|
||||
|
@@ -168,9 +168,8 @@ var Filters =
|
||||
break;
|
||||
|
||||
case "node":
|
||||
parsedArgs.pathNode = parsedArgs.rootNode.parent;
|
||||
filterParams.variablePath = false;
|
||||
filterParams.query = "+ID:\"" + parsedArgs.rootNode.nodeRef + "\"";
|
||||
filterParams.query = "+ID:\"" + parsedArgs.nodeRef + "\"";
|
||||
break;
|
||||
|
||||
case "tag":
|
||||
|
@@ -2,4 +2,81 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.js">
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/parse-args.lib.js">
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/common.lib.js">
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/doclist.get.js">
|
||||
|
||||
/**
|
||||
* Main entry point: Return single document or folder given it's nodeRef
|
||||
*
|
||||
* @method getDoclist
|
||||
*/
|
||||
function getDoclist()
|
||||
{
|
||||
// Use helper function to get the arguments
|
||||
var parsedArgs = ParseArgs.getParsedArgs();
|
||||
if (parsedArgs === null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var filter = args.filter,
|
||||
items = [];
|
||||
|
||||
var favourites = Common.getFavourites(),
|
||||
node = parsedArgs.rootNode,
|
||||
parent =
|
||||
{
|
||||
node: node.parent,
|
||||
userAccess: Evaluator.run(node.parent).actionPermissions
|
||||
};
|
||||
|
||||
var isThumbnailNameRegistered = thumbnailService.isThumbnailNameRegistered(THUMBNAIL_NAME),
|
||||
thumbnail = null,
|
||||
item = Evaluator.run(node);
|
||||
|
||||
item.isFavourite = (favourites[node.nodeRef] === true);
|
||||
|
||||
item.location =
|
||||
{
|
||||
site: parsedArgs.location.site,
|
||||
siteTitle: parsedArgs.location.siteTitle,
|
||||
container: parsedArgs.location.container,
|
||||
path: parsedArgs.location.path,
|
||||
file: node.name
|
||||
};
|
||||
|
||||
// Special case for container and libraryRoot nodes
|
||||
if ((parsedArgs.location.containerNode && String(parsedArgs.location.containerNode.nodeRef) == String(node.nodeRef)) ||
|
||||
(String(parsedArgs.libraryRoot.nodeRef) == String(node.nodeRef)))
|
||||
{
|
||||
item.location.file = "";
|
||||
}
|
||||
else if (node.isContainer)
|
||||
{
|
||||
// Strip off the extra path that will have been added by default
|
||||
var paths = item.location.path.split("/");
|
||||
item.location.path = "/" + paths.slice(1, paths.length - 1).join("/");
|
||||
}
|
||||
|
||||
// Is our thumbnail type registered?
|
||||
if (isThumbnailNameRegistered)
|
||||
{
|
||||
// Make sure we have a thumbnail.
|
||||
thumbnail = node.getThumbnail(THUMBNAIL_NAME);
|
||||
if (thumbnail === null)
|
||||
{
|
||||
// No thumbnail, so queue creation
|
||||
node.createThumbnail(THUMBNAIL_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
{
|
||||
parent: parent,
|
||||
onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"),
|
||||
items: [item]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Document List Component: doclist
|
||||
*/
|
||||
model.doclist = getDoclist();
|
Reference in New Issue
Block a user