mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
DocLib single and multi-asset Copy To action. DocLib RSS Feed link. Various bug fixes and CSS tweaks to DocLib components and data webscripts.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,7 +42,8 @@ function getDocs(siteId, filter)
|
||||
|
||||
var query = "+TYPE:\"{http://www.alfresco.org/model/content/1.0}content\" +PATH:\"" +
|
||||
path + "\" +@cm\\:modified:[" + fromQuery + "T00\\:00\\:00 TO " +
|
||||
toQuery + "T23\\:59\\:59]";
|
||||
toQuery + "T23\\:59\\:59]" +
|
||||
"-TYPE:\"{http://www.alfresco.org/model/content/1.0}thumbnail\"";
|
||||
|
||||
if (logger.isLoggingEnabled())
|
||||
logger.log("docsummary query = " + query);
|
||||
|
@@ -2,7 +2,8 @@ function getActionSet(asset, obj)
|
||||
{
|
||||
var actionSet = "empty";
|
||||
var itemStatus = obj.itemStatus.toString();
|
||||
var isItemOwner = (obj.itemOwner == person.properties.userName);
|
||||
var isItemOwner = null;
|
||||
isItemOwner == (obj.itemOwner && obj.itemOwner.properties.userName == person.properties.userName);
|
||||
|
||||
// Only 1 action set for folders
|
||||
if (asset.isContainer)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<#macro resultsJSON results>
|
||||
{
|
||||
"totalResults": ${results?size},
|
||||
"overallSuccess": ${overallSuccess?string},
|
||||
"results":
|
||||
[
|
||||
<#list results as r>
|
||||
|
@@ -1,11 +1,13 @@
|
||||
/**
|
||||
* Document List Component: action
|
||||
*
|
||||
* Parameters are either supplied as JSON object literal in content body,
|
||||
* or on request URI (e.g. HTTP DELETE methods must use URI)
|
||||
* For a single-asset action, template paramters address the asset.
|
||||
* For multi-asset actions, template parameters address the source or destination node,
|
||||
* and a JSON body addresses the assets involved in the action.
|
||||
* (note: HTTP DELETE methods must use URI)
|
||||
*
|
||||
* @param uri {string} /{siteId}/{containerId}/{filepath} : full path to file or folder name involved in the action
|
||||
* @param content {json} /{siteId}/{containerId}/{filepath} : full path to file or folder name involved in the action
|
||||
* @param uri {string} site/{siteId}/{containerId}/{filepath} : full path to file or folder name involved in the action
|
||||
* @param uri {string} node/{store_type}/{store_id}/{id}/{filepath} : full path to file or folder name involved in the action
|
||||
*/
|
||||
|
||||
/* Bootstrap action script */
|
||||
@@ -36,17 +38,29 @@ function main()
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get the root node if templateArg parameters passed-in
|
||||
if (params.hasRootNode)
|
||||
// Resolve path if available
|
||||
var path = url.templateArgs.path;
|
||||
// Path might be null for the root folder
|
||||
if (!path)
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
// Remove any leading or trailing "/" from the path
|
||||
// Fix-up parent path to have no leading or trailing slashes
|
||||
if (path.length > 0)
|
||||
{
|
||||
rootNode = getRootNode(params);
|
||||
if (typeof node == "string")
|
||||
var aPaths = path.split("/");
|
||||
while (aPaths[0] === "")
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, node);
|
||||
return;
|
||||
aPaths.shift();
|
||||
}
|
||||
params.rootNode = rootNode;
|
||||
while (aPaths[aPaths.length-1] === "")
|
||||
{
|
||||
aPaths.pop();
|
||||
}
|
||||
path = aPaths.join("/");
|
||||
}
|
||||
params.path = path;
|
||||
|
||||
// Multiple input files in the JSON body?
|
||||
files = getMultipleInputFiles();
|
||||
@@ -81,6 +95,19 @@ function main()
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* NOTE: Webscripts run within one transaction only.
|
||||
* If a single operation fails, the transaction is marked for rollback and all
|
||||
* previous (successful) operations are also therefore rolled back.
|
||||
* We therefore need to scan the results for a failed operation and mark the entire
|
||||
* set of operations as failed.
|
||||
*/
|
||||
var overallSuccess = true;
|
||||
for (var i = 0, j = results.length; i < j; i++)
|
||||
{
|
||||
overallSuccess = overallSuccess && results[i].success;
|
||||
}
|
||||
model.overallSuccess = overallSuccess;
|
||||
model.results = results;
|
||||
}
|
||||
}
|
||||
@@ -103,48 +130,44 @@ function getSiteInputParams()
|
||||
// First try to get the parameters from the URI
|
||||
var siteId = url.templateArgs.site;
|
||||
var containerId = url.templateArgs.container;
|
||||
var filePath = url.templateArgs.path;
|
||||
|
||||
// SiteId
|
||||
if ((siteId === null) || (siteId.length === 0))
|
||||
{
|
||||
return "'site' parameter is missing.";
|
||||
}
|
||||
|
||||
// containerId
|
||||
// Find the site
|
||||
var siteNode = siteService.getSite(siteId);
|
||||
if (siteNode === null)
|
||||
{
|
||||
return "Site '" + siteId + "' not found.";
|
||||
}
|
||||
|
||||
// ContainerId
|
||||
if ((containerId === null) || (containerId.length === 0))
|
||||
{
|
||||
return "'container' parameter is missing.";
|
||||
}
|
||||
|
||||
// filePath might be null for the root folder
|
||||
if (filePath === null)
|
||||
{
|
||||
filePath = "";
|
||||
}
|
||||
// Remove any leading or trailing "/" from the path
|
||||
// Fix-up parent path to have no leading or trailing slashes
|
||||
if (filePath.length > 0)
|
||||
{
|
||||
var aPaths = filePath.split("/");
|
||||
while (aPaths[0] === "")
|
||||
{
|
||||
aPaths.shift();
|
||||
}
|
||||
while (aPaths[aPaths.length-1] === "")
|
||||
{
|
||||
aPaths.pop();
|
||||
}
|
||||
filePath = aPaths.join("/");
|
||||
}
|
||||
|
||||
// Find the component container
|
||||
var rootNode = siteNode.getContainer(containerId);
|
||||
if (rootNode === null)
|
||||
{
|
||||
rootNode = siteNode.createContainer(containerId);
|
||||
if (rootNode === null)
|
||||
{
|
||||
return "Component container '" + containerId + "' not found in '" + siteId + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
// Populate the return object
|
||||
params =
|
||||
{
|
||||
containerId: containerId,
|
||||
siteId: siteId,
|
||||
filePath: filePath,
|
||||
usingNodeRef: false,
|
||||
hasRootNode: true
|
||||
siteId: siteId,
|
||||
containerId: containerId,
|
||||
rootNode: rootNode
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
@@ -174,39 +197,33 @@ function getNodeRefInputParams()
|
||||
var storeId = url.templateArgs.store_id;
|
||||
var id = url.templateArgs.id;
|
||||
|
||||
// Was a JSON parameter list supplied?
|
||||
// TODO: Also handle multiple files
|
||||
if (typeof json == "object")
|
||||
{
|
||||
if (!json.isNull("store_type"))
|
||||
{
|
||||
storeType = json.get("store_type");
|
||||
}
|
||||
if (!json.isNull("store_id"))
|
||||
{
|
||||
storeId = json.get("store_id");
|
||||
}
|
||||
if (!json.isNull("id"))
|
||||
{
|
||||
id = json.get("id");
|
||||
}
|
||||
}
|
||||
|
||||
var nodeRef = storeType + "://" + storeId + "/" + id;
|
||||
var node = search.findNode(nodeRef);
|
||||
var rootNode = null;
|
||||
|
||||
if (node === null)
|
||||
{
|
||||
return "'" + nodeRef + "' is not valid.";
|
||||
if (nodeRef == "alfresco://company/home")
|
||||
{
|
||||
rootNode = companyhome;
|
||||
}
|
||||
else if (nodeRef == "alfresco://user/home")
|
||||
{
|
||||
rootNode = userhome;
|
||||
}
|
||||
else
|
||||
{
|
||||
rootNode = search.findNode(nodeRef);
|
||||
|
||||
if (rootNode === null)
|
||||
{
|
||||
return "'" + nodeRef + "' is not a valid nodeRef.";
|
||||
}
|
||||
}
|
||||
|
||||
// Populate the return object
|
||||
params =
|
||||
{
|
||||
nodeRef: nodeRef,
|
||||
node: node,
|
||||
usingNodeRef: true,
|
||||
hasRootNode: true
|
||||
nodeRef: nodeRef,
|
||||
rootNode: rootNode
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
@@ -255,53 +272,6 @@ function getMultipleInputFiles()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the root node for the given site and component
|
||||
*
|
||||
* @method getRootNode
|
||||
* @param p_params {object} Object literal containing mandatory parameters
|
||||
* @return {object|string} valid repository node or string error
|
||||
*/
|
||||
function getRootNode(p_params)
|
||||
{
|
||||
var rootNode = null;
|
||||
var error = null;
|
||||
|
||||
if (p_params.usingNodeRef)
|
||||
{
|
||||
return p_params.node;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Find the site
|
||||
var siteNode = siteService.getSite(p_params.siteId);
|
||||
if (siteNode === null)
|
||||
{
|
||||
return "Site '" + p_params.siteId + "' not found.";
|
||||
}
|
||||
|
||||
// Find the component container
|
||||
rootNode = siteNode.getContainer(p_params.containerId);
|
||||
if (rootNode === null)
|
||||
{
|
||||
rootNode = siteNode.createContainer(p_params.containerId);
|
||||
if (rootNode === null)
|
||||
{
|
||||
return "Component container '" + p_params.containerId + "' not found in '" + p_params.siteId + "'.";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
error = e.toString();
|
||||
}
|
||||
|
||||
// Return the node object, or the error string if it was set
|
||||
return (error !== null ? error : rootNode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the asset node for the given rootNode and filepath
|
||||
*
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* Entrypoint required by action.lib.js
|
||||
*
|
||||
* @method runAction
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, filePath
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path
|
||||
* @return {object|null} object representation of action result
|
||||
*/
|
||||
function runAction(p_params)
|
||||
@@ -19,12 +19,12 @@ function runAction(p_params)
|
||||
|
||||
try
|
||||
{
|
||||
var assetNode = getAssetNode(p_params.rootNode, p_params.filePath);
|
||||
var assetNode = getAssetNode(p_params.rootNode, p_params.path);
|
||||
|
||||
// Must have assetNode by this point
|
||||
if (typeof assetNode == "string")
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function runAction(p_params)
|
||||
var originalDoc = assetNode.cancelCheckout();
|
||||
if (originalDoc === null)
|
||||
{
|
||||
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not cancel checkout: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not cancel checkout: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* Entrypoint required by action.lib.js
|
||||
*
|
||||
* @method runAction
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, filePath
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path
|
||||
* @return {object|null} object representation of action result
|
||||
*/
|
||||
function runAction(p_params)
|
||||
@@ -19,12 +19,12 @@ function runAction(p_params)
|
||||
|
||||
try
|
||||
{
|
||||
var assetNode = p_params.node || getAssetNode(p_params.rootNode, p_params.filePath);
|
||||
var assetNode = p_params.node || getAssetNode(p_params.rootNode, p_params.path);
|
||||
|
||||
// Must have assetNode by this point
|
||||
if (typeof assetNode == "string")
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function runAction(p_params)
|
||||
var originalDoc = assetNode.checkin();
|
||||
if (originalDoc === null)
|
||||
{
|
||||
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not checkin: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not checkin: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* Entrypoint required by action.lib.js
|
||||
*
|
||||
* @method runAction
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, filePath
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path
|
||||
* @return {object|null} object representation of action result
|
||||
*/
|
||||
function runAction(p_params)
|
||||
@@ -20,12 +20,12 @@ function runAction(p_params)
|
||||
|
||||
try
|
||||
{
|
||||
var assetNode = p_params.node || getAssetNode(p_params.rootNode, p_params.filePath);
|
||||
var assetNode = p_params.node || getAssetNode(p_params.rootNode, p_params.path);
|
||||
|
||||
// Must have assetNode by this point
|
||||
if (typeof assetNode == "string")
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function runAction(p_params)
|
||||
var workingCopy = assetNode.checkout();
|
||||
if (workingCopy === null)
|
||||
{
|
||||
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not checkout: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not checkout: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
<webscript>
|
||||
<shortname>copy-to</shortname>
|
||||
<description>Document List Action - Copy multiple files</description>
|
||||
<url>/slingshot/doclib/action/copy-to/site/{site}/{container}/{path}</url>
|
||||
<url>/slingshot/doclib/action/copy-to/site/{site}/{container}</url>
|
||||
<url>/slingshot/doclib/action/copy-to/node/{store_type}/{store_id}/{id}/{path}</url>
|
||||
<url>/slingshot/doclib/action/copy-to/node/{store_type}/{store_id}/{id}</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1,77 @@
|
||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
|
||||
|
||||
/**
|
||||
* Copy multiple files action
|
||||
* @method POST
|
||||
*/
|
||||
|
||||
/**
|
||||
* Entrypoint required by action.lib.js
|
||||
*
|
||||
* @method runAction
|
||||
* @param p_params {object} Object literal containing files array
|
||||
* @return {object|null} object representation of action results
|
||||
*/
|
||||
function runAction(p_params)
|
||||
{
|
||||
var results = [];
|
||||
var files = p_params.files;
|
||||
var file, fileNode, result, nodeRef;
|
||||
|
||||
// Find destination node
|
||||
var destNode = p_params.node || getAssetNode(p_params.rootNode, p_params.path);
|
||||
|
||||
// Must have destNode by this point
|
||||
if (typeof assetNode == "string")
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
// Must have array of files
|
||||
if (!files || files.length == 0)
|
||||
{
|
||||
status.setCode(status.STATUS_BAD_REQUEST, "No files.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (file in files)
|
||||
{
|
||||
nodeRef = files[file];
|
||||
result =
|
||||
{
|
||||
nodeRef: nodeRef,
|
||||
action: "copyFile",
|
||||
success: false
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
fileNode = search.findNode(nodeRef);
|
||||
if (fileNode === null)
|
||||
{
|
||||
result.id = file;
|
||||
result.nodeRef = nodeRef;
|
||||
result.success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.id = fileNode.name;
|
||||
result.type = fileNode.isContainer ? "folder" : "document";
|
||||
// copy the node (deep copy)
|
||||
result.nodeRef = fileNode.copy(destNode, true);
|
||||
result.success = (result.nodeRef !== null);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
result.id = file;
|
||||
result.nodeRef = nodeRef;
|
||||
result.success = false;
|
||||
}
|
||||
|
||||
results.push(result);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
<#import "action.lib.ftl" as actionLib />
|
||||
<@actionLib.resultsJSON results=results />
|
@@ -10,7 +10,7 @@
|
||||
* Entrypoint required by action.lib.js
|
||||
*
|
||||
* @method runAction
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, filePath
|
||||
* @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path
|
||||
* @return {object|null} object representation of action result
|
||||
*/
|
||||
function runAction(p_params)
|
||||
@@ -19,7 +19,7 @@ function runAction(p_params)
|
||||
|
||||
try
|
||||
{
|
||||
var assetNode = p_params.node || getAssetNode(p_params.rootNode, p_params.filePath);
|
||||
var assetNode = p_params.node || getAssetNode(p_params.rootNode, p_params.path);
|
||||
|
||||
// Must have assetNode by this point
|
||||
if (typeof assetNode == "string")
|
||||
|
@@ -30,7 +30,7 @@ function runAction(p_params)
|
||||
}
|
||||
var folderName = json.get("name");
|
||||
|
||||
var parentPath = p_params.filePath;
|
||||
var parentPath = p_params.path;
|
||||
var folderPath = parentPath + "/" + folderName;
|
||||
|
||||
// Check folder doesn't already exist
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<webscript>
|
||||
<shortname>files</shortname>
|
||||
<shortname>move-to</shortname>
|
||||
<description>Document List Action - Move multiple files</description>
|
||||
<url>/slingshot/doclib/action/move-to/site/{site}/{container}/{path}</url>
|
||||
<url>/slingshot/doclib/action/move-to/site/{site}/{container}</url>
|
||||
<url>/slingshot/doclib/action/move-to/node/{store_type}/{store_id}/{id}/{path}</url>
|
||||
<url>/slingshot/doclib/action/move-to/node/{store_type}/{store_id}/{id}</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
|
@@ -19,12 +19,12 @@ function runAction(p_params)
|
||||
var file, fileNode, result, nodeRef;
|
||||
|
||||
// Find destination node
|
||||
var destNode = p_params.node || getAssetNode(p_params.rootNode, p_params.filePath);
|
||||
var destNode = p_params.node || getAssetNode(p_params.rootNode, p_params.path);
|
||||
|
||||
// Must have destNode by this point
|
||||
if (typeof assetNode == "string")
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.filePath);
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not found: " + p_params.path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -49,27 +49,29 @@ function getDocList(filter)
|
||||
}
|
||||
|
||||
// Locked/working copy status defines action set
|
||||
var itemStatus, itemOwner, actionSet, thumbnail;
|
||||
var itemStatus, itemOwner, actionSet, thumbnail, createdBy, modifiedBy;
|
||||
|
||||
for each(asset in assets)
|
||||
{
|
||||
itemStatus = [];
|
||||
itemOwner = "";
|
||||
itemOwner = null;
|
||||
createdBy = null;
|
||||
modifiedBy = null;
|
||||
|
||||
if ((asset.isContainer && showFolders) || (asset.isDocument && showDocs))
|
||||
{
|
||||
if (asset.isLocked)
|
||||
{
|
||||
itemStatus.push("locked");
|
||||
itemOwner = asset.properties["cm:lockOwner"];
|
||||
itemOwner = people.getPerson(asset.properties["cm:lockOwner"]);
|
||||
}
|
||||
if (asset.hasAspect("cm:workingcopy"))
|
||||
{
|
||||
itemStatus.push("workingCopy");
|
||||
itemOwner = asset.properties["cm:workingCopyOwner"];
|
||||
itemOwner = people.getPerson(asset.properties["cm:workingCopyOwner"]);
|
||||
}
|
||||
// Is this user the item owner?
|
||||
if (itemOwner == person.properties.userName)
|
||||
if (itemOwner && (itemOwner.properties.userName == person.properties.userName))
|
||||
{
|
||||
itemStatus.push("lockedBySelf");
|
||||
}
|
||||
@@ -85,6 +87,10 @@ function getDocList(filter)
|
||||
}
|
||||
}
|
||||
|
||||
// Get users
|
||||
createdBy = people.getPerson(asset.properties["cm:creator"]);
|
||||
modifiedBy = people.getPerson(asset.properties["cm:modifier"]);
|
||||
|
||||
// Get relevant actions set
|
||||
actionSet = getActionSet(asset,
|
||||
{
|
||||
@@ -97,6 +103,8 @@ function getDocList(filter)
|
||||
asset: asset,
|
||||
status: itemStatus,
|
||||
owner: itemOwner,
|
||||
createdBy: createdBy,
|
||||
modifiedBy: modifiedBy,
|
||||
actionSet: actionSet
|
||||
});
|
||||
}
|
||||
|
@@ -9,6 +9,24 @@
|
||||
<#assign d = item.asset>
|
||||
<#assign version = "1.0">
|
||||
<#if d.hasAspect("cm:versionable")><#assign version = d.versionHistory?sort_by("versionLabel")?reverse[0].versionLabel></#if>
|
||||
<#if item.owner?exists>
|
||||
<#assign lockedBy = (item.owner.properties.firstName + " " + item.owner.properties.lastName)?trim>
|
||||
<#assign lockedByUser = item.owner.properties.userName>
|
||||
<#else>
|
||||
<#assign lockedBy="" lockedByUser="">
|
||||
</#if>
|
||||
<#if item.createdBy?exists>
|
||||
<#assign createdBy = (item.createdBy.properties.firstName + " " + item.createdBy.properties.lastName)?trim>
|
||||
<#assign createdByUser = item.createdBy.properties.userName>
|
||||
<#else>
|
||||
<#assign createdBy="" createdByUser="">
|
||||
</#if>
|
||||
<#if item.modifiedBy?exists>
|
||||
<#assign modifiedBy = (item.modifiedBy.properties.firstName + " " + item.modifiedBy.properties.lastName)?trim>
|
||||
<#assign modifiedByUser = item.modifiedBy.properties.userName>
|
||||
<#else>
|
||||
<#assign modifiedBy="" modifiedByUser="">
|
||||
</#if>
|
||||
{
|
||||
"index": ${item_index},
|
||||
"nodeRef": "${d.nodeRef}",
|
||||
@@ -18,13 +36,16 @@
|
||||
"fileName": "${d.name?html}",
|
||||
"displayName": "${d.name?replace(workingCopyLabel, "")?html}",
|
||||
"status": "<#list item.status as s>${s}<#if s_has_next>,</#if></#list>",
|
||||
"lockedBy": "${item.owner}",
|
||||
"lockedBy": "${lockedBy}",
|
||||
"lockedByUser": "${lockedByUser}",
|
||||
"title": "${(d.properties.title!"")?html}",
|
||||
"description": "${(d.properties.description!"")?html}",
|
||||
"createdOn": "${d.properties.created?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
|
||||
"createdBy": "${d.properties.creator}",
|
||||
"createdBy": "${createdBy}",
|
||||
"createdByUser": "${createdByUser}",
|
||||
"modifiedOn": "${d.properties.modified?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
|
||||
"modifiedBy": "${d.properties.modifier}",
|
||||
"modifiedBy": "${modifiedBy}",
|
||||
"modifiedByUser": "${modifiedByUser}",
|
||||
"size": "${d.size}",
|
||||
"version": "${version}",
|
||||
"contentUrl": "api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}",
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<generator>Alfresco ${server.edition} v${server.version}</generator>
|
||||
<image>
|
||||
<title>Alfresco - My Documents</title>
|
||||
<url>${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/images/logo/AlfrescoLogo200.png</url>
|
||||
<url>${absurl(url.context)?replace("alfresco", "share/proxy/alfresco")}/images/logo/AlfrescoLogo200.png</url>
|
||||
</image>
|
||||
<#list doclist.items as item>
|
||||
<#assign d = item.asset>
|
||||
@@ -19,12 +19,12 @@
|
||||
<item>
|
||||
<title>${d.name?html}</title>
|
||||
<#assign navurl='/navigate/showDocDetails/' + d.nodeRef.storeRef.protocol + '/' + d.nodeRef.storeRef.identifier + '/' + d.nodeRef.id>
|
||||
<link>${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}</link>
|
||||
<link>${absurl(url.context)?replace("alfresco", "share/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}</link>
|
||||
<#if isMP3>
|
||||
<enclosure url="api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}" length="${d.size?string?replace(",","")}" type="audio/mpeg"/>
|
||||
</#if>
|
||||
<description>
|
||||
<#if isImage || true><img src="${absurl(url.context)?replace("alfresco", "slingshot/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}"><br/></#if>
|
||||
<#if isImage || true><img src="${absurl(url.context)?replace("alfresco", "share/proxy/alfresco")}/api/node/content/${d.storeType}/${d.storeId}/${d.id}/${d.name?url}"><br/></#if>
|
||||
<#if d.properties.description?exists>${d.properties.description?html}</#if>
|
||||
</description>
|
||||
<pubDate>${xmldate(d.properties.modified)}</pubDate>
|
||||
|
@@ -10,12 +10,24 @@ function getParsedArgs()
|
||||
var storeId = url.templateArgs.store_id;
|
||||
var id = url.templateArgs.id;
|
||||
var nodeRef = storeType + "://" + storeId + "/" + id;
|
||||
rootNode = search.findNode(nodeRef);
|
||||
if (rootNode === null)
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nodeRef == "alfresco://company/home")
|
||||
{
|
||||
rootNode = companyhome;
|
||||
}
|
||||
else if (nodeRef == "alfresco://user/home")
|
||||
{
|
||||
rootNode = userhome;
|
||||
}
|
||||
else
|
||||
{
|
||||
rootNode = search.findNode(nodeRef);
|
||||
if (rootNode === null)
|
||||
{
|
||||
status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user