Hello,I've got a bunch of information stored in Alfresco Share datalists (out-of-the-box 'Event' type datalists as it happens) which I want to use to populate some web page fragments managed by Web Quickstart.I'm currently using the following method to get data out of the datalists,which works fine but I feel like I'm missing a trick - datalists are integralenough to the demonstration websites provided with WCQMS that it feels like thereshould be a more direct method of accessing them.Anyway, what I'm doing is this:Datalists are just nodes within the repository so I can access them using CMIS. The service at /cmis/p/Sites/{siteName}/dataLists/children lists all the datalists,and I can use a different instantiation of the same service, /cmis/p/Sites/{siteName}/dataLists/{name}/children to get me the entries in anindividual data list. This service only provides atom responses by default, so Iuse the following ftl template to return a (incomplete but sufficent) JSON responseinstead, as this is easier to work with in Javascript webscripts:
<#escape x as jsonUtils.encodeJSONString(x)>
{
children: [
<#list results as node>
{
author: "${node.properties.creator!""}",
id: "${node.id}",
name: "${node.name}",
created: "${xmldate(node.properties.created)}",
title: "${node.properties['cm:title']!""}",
updated: "${xmldate(node.properties.modified)}",
nodeDetails: "${node}",
eventLocation: "${node.properties['dl:eventLocation']!""}",
eventStartDate: "${xmldate(node.properties['dl:eventStartDate'])!""}",
description: "${node.properties['cm:description']!""}"
}
<#if node_has_next>,</#if>
</#list>
]
}
</#escape>
The last complication is that datalist names are actually system-generated UUIDs. The human-readable bit is the title, so we need to look up the UUID from the title inorder to reach our target datascript.A simplified version of the server-side javascript I'm using in wcmqs, therefore, is:
function getEventListName(title) {
var conn = remote.connect("alfresco-webscripts");
var uri = "/cmis/p/Sites/webcontent/dataLists/children?format=json";
var responseText=conn.get(uri).response;
var allLists=(eval('(' + responseText + ')')).children;
for (var i=0; i < allLists.length; i++) {
if (allLists[i].title==title) {
return allLists[i].name;
}
}
throw "No list with the ID: "+list+" could be found";
}
function getEventList(name) {
var conn = remote.connect("alfresco-webscripts");
var uri = "/cmis/p/Sites/webcontent/dataLists/"+name+"/children?format=json";
var events=(eval('(' + conn.get(uri).response + ')')).children;
return events;
}
model.events=getEventList(getEventListName(args.eventListTitle));
As I say, the above works fine and pushes the relevant events details into the freemarker model forrendition, but it feels very overworked.Is there some simple API call that I'm missing here?Thanks in advance,Simon