<webscript>
<shortname>Folder Listing Sample</shortname>
<description>Sample demonstrating the listing of folder contents</description>
<url>/sample/folder/{path}</url>
<format default="html">argument</format>
<authentication>guest</authentication>
<transaction>required</transaction>
</webscript>
<html>
<head>
<title>${folder.displayPath}/${folder.name}</title>
</head>
<body>
Folder: ${folder.displayPath}/${folder.name}
<br>
<table>
<#if folder.parent.parent?exists>
<tr>
<td><td><a href="${url.serviceContext}/sample/folder<@encodepath node=folder.parent/>">..</a>
</tr>
</#if>
<#list folder.children as child>
<tr>
<#if child.isContainer>
<td>><td><a href="${url.serviceContext}/sample/folder<@encodepath node=child/>">${child.name}</a>
<#else>
<td><td><a href="${url.serviceContext}/api/node/content/${child.nodeRef.storeRef.protocol}/${child.nodeRef.storeRef.identifier}/${child.nodeRef.id}/${child.name?url}">${child.name}</a>
</#if>
</tr>
</#list>
</table>
</body>
</html>
<#macro encodepath node><#if node.parent?exists><@encodepath node=node.parent/>/${node.name?url}</#if></#macro>
// locate folder by path
var folder = roothome.childByNamePath(url.extension);
if (folder == undefined || !folder.isContainer)
{
status.code = 404;
status.message = "Folder " + url.extension + " not found.";
status.redirect = true;
}
model.folder = folder;
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<generator version="${server.version}">Alfresco (${server.edition})</generator>
<title>Folder: ${folder.displayPath}/${folder.name}</title>
<updated>${xmldate(date)}</updated>
<icon>${absurl(url.context)}/images/logo/AlfrescoLogo16.ico</icon>
<#list folder.children as child>
<entry>
<title>${child.name}</title>
<#if child.isContainer>
<link rel="alternate" href="${absurl(url.serviceContext)}/sample/folder<@encodepath node=child/>"/>
<#else>
<link rel="alternate" href="${absurl(url.serviceContext)}/api/node/content/${child.nodeRef.storeRef.protocol}/${child.nodeRef.storeRef.identifier}/${child.nodeRef.id}/${child.name?url}"/>
</#if>
<icon>${absurl(url.context)}${child.icon16}</icon>
<id>urn:uuid:${child.id}</id>
<updated>${xmldate(child.properties.modified)}</updated>
<summary>${child.properties.description!""}</summary>
<author>
<name>${child.properties.creator}</name>
</author>
</entry>
</#list>
</feed>
<#macro encodepath node><#if node.parent?exists><@encodepath node=node.parent/>/${node.name?url}</#if></#macro>
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.