mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Added "site" property to 'pickeritems' data webscript, if present provides the site short name the item is within. This is used by the workflow packageitems form control to determine which document details page to go to.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21691 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -16,7 +16,7 @@ function main()
|
|||||||
// convert the JSONArray object into a native JavaScript array
|
// convert the JSONArray object into a native JavaScript array
|
||||||
var jsonItems = json.get("items"),
|
var jsonItems = json.get("items"),
|
||||||
numItems = jsonItems.length(),
|
numItems = jsonItems.length(),
|
||||||
item, result, resultObj;
|
item, result;
|
||||||
|
|
||||||
for (count = 0; count < numItems; count++)
|
for (count = 0; count < numItems; count++)
|
||||||
{
|
{
|
||||||
@@ -35,6 +35,10 @@ function main()
|
|||||||
{
|
{
|
||||||
result = createGroupResult(result);
|
result = createGroupResult(result);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = createNodeResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
results.push(
|
results.push(
|
||||||
{
|
{
|
||||||
|
@@ -11,8 +11,9 @@
|
|||||||
${indent}"name": "${node.properties.name!""}",
|
${indent}"name": "${node.properties.name!""}",
|
||||||
${indent}"title": "${node.properties.title!""}",
|
${indent}"title": "${node.properties.title!""}",
|
||||||
${indent}"description": "${node.properties.description!""}",
|
${indent}"description": "${node.properties.description!""}",
|
||||||
<#if node.properties.modified??>${indent}"modified": "${node.properties.modified?string("dd MMMM yyyy HH:mm")}",</#if>
|
<#if node.properties.modified??>${indent}"modified": "${xmldate(node.properties.modified)}",</#if>
|
||||||
<#if node.properties.modifier??>${indent}"modifier": "${node.properties.modifier}",</#if>
|
<#if node.properties.modifier??>${indent}"modifier": "${node.properties.modifier}",</#if>
|
||||||
|
<#if node.site??>${indent}"site": "${node.site}",</#if>
|
||||||
${indent}"displayPath": "${node.displayPath!""}",
|
${indent}"displayPath": "${node.displayPath!""}",
|
||||||
${indent}"nodeRef": "${node.nodeRef}"
|
${indent}"nodeRef": "${node.nodeRef}"
|
||||||
${indent}},
|
${indent}},
|
||||||
@@ -37,8 +38,9 @@
|
|||||||
"name": "${row.item.properties.name!""}",
|
"name": "${row.item.properties.name!""}",
|
||||||
"title": "${row.item.properties.title!""}",
|
"title": "${row.item.properties.title!""}",
|
||||||
"description": "${row.item.properties.description!""}",
|
"description": "${row.item.properties.description!""}",
|
||||||
<#if row.item.properties.modified??>"modified": "${row.item.properties.modified?string("dd MMMM yyyy HH:mm")}",</#if>
|
<#if row.item.properties.modified??>"modified": "${xmldate(row.item.properties.modified)}",</#if>
|
||||||
<#if row.item.properties.modifier??>"modifier": "${row.item.properties.modifier}",</#if>
|
<#if row.item.properties.modifier??>"modifier": "${row.item.properties.modifier}",</#if>
|
||||||
|
<#if row.item.site??>"site": "${row.item.site}",</#if>
|
||||||
"displayPath": "${row.item.displayPath!""}",
|
"displayPath": "${row.item.displayPath!""}",
|
||||||
"nodeRef": "${row.item.nodeRef}"<#if row.selectable?exists>,
|
"nodeRef": "${row.item.nodeRef}"<#if row.selectable?exists>,
|
||||||
"selectable" : ${row.selectable?string}</#if>
|
"selectable" : ${row.selectable?string}</#if>
|
||||||
|
@@ -1,3 +1,61 @@
|
|||||||
|
/**
|
||||||
|
* Creates an Object representing the given node.
|
||||||
|
*
|
||||||
|
* Also determines whether the node is located within a site, if it
|
||||||
|
* is a "site" property is provided where the value is the site short
|
||||||
|
* name.
|
||||||
|
*
|
||||||
|
* @method createNodeResult
|
||||||
|
* @param node
|
||||||
|
* @return Object representing the node
|
||||||
|
*/
|
||||||
|
function createNodeResult(node)
|
||||||
|
{
|
||||||
|
var nodeObject =
|
||||||
|
{
|
||||||
|
typeShort: node.typeShort,
|
||||||
|
isContainer: node.isContainer,
|
||||||
|
children: node.children,
|
||||||
|
properties: {},
|
||||||
|
displayPath: node.displayPath,
|
||||||
|
nodeRef: "" + node.nodeRef,
|
||||||
|
}
|
||||||
|
|
||||||
|
// add required properties
|
||||||
|
nodeObject.properties.name = node.properties.name;
|
||||||
|
nodeObject.properties.title = node.properties.title;
|
||||||
|
nodeObject.properties.description = node.properties.description;
|
||||||
|
nodeObject.properties.modified = node.properties.modified;
|
||||||
|
nodeObject.properties.modifier = node.properties.modifier;
|
||||||
|
|
||||||
|
// determine if the node is in a site and if so, which one
|
||||||
|
if (node.qnamePath != null)
|
||||||
|
{
|
||||||
|
var paths = node.qnamePath.split("/");
|
||||||
|
for (var i = 0, ii = paths.length; i < ii; i++)
|
||||||
|
{
|
||||||
|
if (paths[i] == "st:sites")
|
||||||
|
{
|
||||||
|
// we now know the node is in a site, find
|
||||||
|
// the next element in the array (if there
|
||||||
|
// is one) to get the site name
|
||||||
|
|
||||||
|
if ((i+1) < paths.length)
|
||||||
|
{
|
||||||
|
var siteName = paths[i+1];
|
||||||
|
|
||||||
|
// remove the "cm:" prefix and add to result object
|
||||||
|
nodeObject.site = siteName.substring(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodeObject;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an Object representing the given person node.
|
* Creates an Object representing the given person node.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user