01-23-2012 04:07 AM
item =
{
site: getSiteData(siteId),
container: containerId,
nodeRef: node.nodeRef.toString(),
tags: ((t = node.tags) !== null) ? t : [],
name: node.name,
displayName: node.name,
title: node.properties["cm:title"],
description: node.properties["cm:description"],
modifiedOn: node.properties["cm:modified"],
modifiedByUser: node.properties["cm:modifier"],
index: "test",
createdOn: node.properties["cm:created"],
createdByUser: node.properties["cm:creator"],
path: pathParts.join("/")
};
Warningtill I've change my model variable to simple string "test"
"items":
[
<#list data.items as item>
{
"nodeRef": "${item.nodeRef}",
"type": "${item.type}",
"name": "${item.name!''}",
"displayName": "${item.displayName!''}",
<#if item.title??>
"title": "${item.title}",
</#if>
"description": "${item.description!''}",
"modifiedOn": "<@dateFormat item.modifiedOn />",
"modifiedByUser": "${item.modifiedByUser}",
"modifiedBy": "${item.modifiedBy}",
"size": "${item.size?c}",
"index": "${item.index}",
<#if item.site??>
"site":
{
"shortName": "${item.site.shortName}",
"title": "${item.site.title}"
},
"container": "${item.container}",
</#if>
<#if item.path??>
"path": "${item.path}",
</#if>
"tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,</#if></#list>]
}<#if item_has_next>,</#if>
</#list>
]
if (oRecord.getData("modifiedBy"))
{
desc += ' ' + me.msg("message.modifiedby");
desc += ' <a href="' + Alfresco.constants.URL_PAGECONTEXT + 'user/' + encodeURI(oRecord.getData("modifiedByUser")) + '/profile">' + $html(oRecord.getData("modifiedBy")) + '</a>';
}
if (oRecord.getData("index"))
{
desc += ' ' + me.msg("index");
desc += ' ' + $html(oRecord.getData("index")) + '';
}
01-23-2012 06:47 AM
01-23-2012 07:14 AM
<#macro dateFormat date>${date?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")}</#macro>
<#escape x as jsonUtils.encodeJSONString(x)>
{
"items":
[
<#list data.items as item>
{
"nodeRef": "${item.nodeRef}",
"type": "${item.type}",
"name": "${item.name!''}",
"displayName": "${item.displayName!''}",
<#if item.title??>
"title": "${item.title}",
</#if>
"description": "${item.description!''}",
"modifiedOn": "<@dateFormat item.modifiedOn />",
"modifiedByUser": "${item.modifiedByUser}",
"modifiedBy": "${item.modifiedBy}",
"size": "${item.size?c}",
"index": "${item.index}",
<#if item.site??>
"site":
{
"shortName": "${item.site.shortName}",
"title": "${item.site.title}"
},
"container": "${item.container}",
</#if>
<#if item.path??>
"path": "${item.path}",
</#if>
"tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,</#if></#list>]
}<#if item_has_next>,</#if>
</#list>
]
}
</#escape>
01-23-2012 08:05 AM
<#if item.index??>
around it, or ${item.index!""}
if you'd prefer it to always be in the result set.01-24-2012 02:20 AM
${item.index!""}
also add
<#if item.index??>
but index -result not shown. All other default results shows.
item =
{
site: getSiteData(siteId),
container: containerId,
nodeRef: node.nodeRef.toString(),
tags: ((t = node.tags) !== null) ? t : [],
name: node.name,
displayName: node.name,
title: node.properties["cm:title"],
description: node.properties["cm:description"],
modifiedOn: node.properties["cm:modified"],
modifiedByUser: node.properties["cm:modifier"],
index: "test",
createdOn: node.properties["cm:created"],
createdByUser: node.properties["cm:creator"],
path: pathParts.join("/")
};
01-24-2012 03:22 AM
01-24-2012 04:48 AM
01-24-2012 05:06 AM
Sorry I've never working with json This is very painfull for me. How I can check JSON response? write template please.You can use Firebug for Firefox, or WebInspector for Chrome/Safari to check which webscript URL is being requested via AJAX. Then just open that same URL in your browser directly.
01-24-2012 07:17 AM
{
"items":
[
{
"nodeRef": "workspace:\/\/SpacesStore\/21dab966-48f6-4f45-833b-a3324d600568",
"type": "document",
"name": "Alfresco.txt",
"displayName": "Alfresco.txt",
"title": "Alfresco.txt",
"description": "",
"modifiedOn": "19 Oct 2011 11:14:49 GMT+0500 (AZST)",
"modifiedByUser": "hicran.valehov",
"modifiedBy": "Hicran Valehov",
"size": "14",
"index": "",
"path": "\/Company Home\/user_homes\/seadet_eliyeva\/Daxil Olan S\u0259n\u0259dl\u0259rin Qeydiyyat\u0131",
"tags": ["baki dair\u0259vi"]
}
]
}
function getDocumentItem(siteId, containerId, pathParts, node)
{
var cat = siteId + containerId, refkey = "" + node.nodeRef.toString();
if (checkProcessed(cat, refkey))
{
return null;
}
addToProcessed(cat, refkey);
var item = t = null;
if (node.qnamePath.indexOf(COMMENT_QNAMEPATH) == -1)
{
if (node.isContainer || node.isDocument)
{
item =
{
site: getSiteData(siteId),
container: containerId,
nodeRef: node.nodeRef.toString(),
tags: ((t = node.tags) !== null) ? t : [],
name: node.name,
displayName: node.name,
title: node.properties["cm:title"],
description: node.properties["cm:description"],
modifiedOn: node.properties["cm:modified"],
modifiedByUser: node.properties["cm:modifier"],
index: "test",
createdOn: node.properties["cm:created"],
createdByUser: node.properties["cm:creator"],
path: pathParts.join("/")
};
item.modifiedBy = getPersonDisplayName(item.modifiedByUser);
item.createdBy = getPersonDisplayName(item.createdByUser);
}
if (node.isContainer)
{
item.type = "folder";
item.size = -1;
}
else if (node.isDocument)
{
item.type = "document";
item.size = node.size;
}
}
return item;
}
03-05-2012 11:16 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.