mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
- AVM Web Script Sample (browse stores, folders, content)
- Fix Web Script issue where urls contained ; (due to tomcat) - Allow AVMScriptStore to be passed through script converters (add serializable) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6071 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -323,6 +323,86 @@
|
||||
</view:properties>
|
||||
<view:associations></view:associations>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:avmstores.get.desc.xml">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:description></cm:description>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/avmstores.get.desc.xml|mimetype=text/xml|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title>avmstores.get.desc.xml</cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>avmstores.get.desc.xml</cm:name>
|
||||
</view:properties>
|
||||
<view:associations></view:associations>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:avmstores.get.html.ftl">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:description></cm:description>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/avmstores.get.html.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title>avmstores.get.html.ftl</cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>avmstores.get.html.ftl</cm:name>
|
||||
</view:properties>
|
||||
<view:associations></view:associations>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:avmbrowse.get.js">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
<cm:author></cm:author>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:description></cm:description>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/avmbrowse.get.js|mimetype=application/x-javascript|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title>avmbrowse.get.js</cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>avmbrowse.get.js</cm:name>
|
||||
</view:properties>
|
||||
<view:associations></view:associations>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:avmbrowse.get.desc.xml">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:description></cm:description>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/avmbrowse.get.desc.xml|mimetype=text/xml|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title>avmbrowse.get.desc.xml</cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>avmbrowse.get.desc.xml</cm:name>
|
||||
</view:properties>
|
||||
<view:associations></view:associations>
|
||||
</cm:content>
|
||||
<cm:content view:childName="cm:avmbrowse.get.html.ftl">
|
||||
<view:aspects>
|
||||
<cm:titled></cm:titled>
|
||||
<cm:author></cm:author>
|
||||
<app:inlineeditable></app:inlineeditable>
|
||||
</view:aspects>
|
||||
<view:properties>
|
||||
<app:editInline>true</app:editInline>
|
||||
<cm:description></cm:description>
|
||||
<cm:content>contentUrl=classpath:alfresco/bootstrap/webscripts/avmbrowse.get.html.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_</cm:content>
|
||||
<cm:title>avmbrowse.get.html.ftl</cm:title>
|
||||
<cm:author></cm:author>
|
||||
<cm:name>avmbrowse.get.html.ftl</cm:name>
|
||||
</view:properties>
|
||||
<view:associations></view:associations>
|
||||
</cm:content>
|
||||
</cm:contains>
|
||||
</view:associations>
|
||||
</cm:folder>
|
||||
|
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>AVM Browse Sample</shortname>
|
||||
<description>Sample demonstrating the listing of AVM folder contents</description>
|
||||
<url>/sample/avm/path/{storeid}/{path}</url>
|
||||
<format default="html">argument</format>
|
||||
<authentication>guest</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
31
config/alfresco/bootstrap/webscripts/avmbrowse.get.html.ftl
Normal file
31
config/alfresco/bootstrap/webscripts/avmbrowse.get.html.ftl
Normal file
@@ -0,0 +1,31 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>AVM Folder: ${folder.displayPath}/${folder.name}</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="${url.serviceContext}/sample/avm/stores">AVM Store</a>: ${store.id}
|
||||
<br>
|
||||
<br>
|
||||
AVM Folder: ${folder.displayPath}/${folder.name}
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
<#if folder.parent?exists>
|
||||
<tr>
|
||||
<td>${folder.parent.properties.creator}<td> <td>${folder.parent.size}<td> <td>${folder.parent.properties.modified?datetime}<td> <td><td><a href="${url.serviceContext}/sample/avm/path/${store.id}<@encodepath node=folder.parent/>">..</a>
|
||||
</tr>
|
||||
</#if>
|
||||
<#list folder.children as child>
|
||||
<tr>
|
||||
<#if child.isContainer>
|
||||
<td>${child.properties.creator}<td> <td>${child.size}<td> <td>${child.properties.modified?datetime}<td> <td>><td><a href="${url.serviceContext}/sample/avm/path/${store.id}<@encodepath node=child/>">${child.name}</a>
|
||||
<#else>
|
||||
<td>${child.properties.creator}<td> <td>${child.size}<td> <td>${child.properties.modified?datetime}<td> <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>
|
36
config/alfresco/bootstrap/webscripts/avmbrowse.get.js
Normal file
36
config/alfresco/bootstrap/webscripts/avmbrowse.get.js
Normal file
@@ -0,0 +1,36 @@
|
||||
script:
|
||||
{
|
||||
// extract avm store id and path
|
||||
var fullpath = url.extension.split("/");
|
||||
if (fullpath.length == 0)
|
||||
{
|
||||
status.code = 400;
|
||||
status.message = "Store id has not been provided.";
|
||||
status.redirect = true;
|
||||
break script;
|
||||
}
|
||||
var storeid = fullpath[0];
|
||||
var path = (fullpath.length == 1 ? "/" : "/" + fullpath.slice(1).join("/"));
|
||||
|
||||
// locate avm node from path
|
||||
var store = avm.lookupStore(storeid);
|
||||
if (store == undefined)
|
||||
{
|
||||
status.code = 404;
|
||||
status.message = "Store " + storeid + " not found.";
|
||||
status.redirect = true;
|
||||
break script;
|
||||
}
|
||||
var node = avm.lookupNode(storeid + ":" + path);
|
||||
if (node == undefined)
|
||||
{
|
||||
status.code = 404;
|
||||
status.message = "Path " + path + " within store " + storeid + " not found.";
|
||||
status.redirect = true;
|
||||
break script;
|
||||
}
|
||||
|
||||
// setup model for templates
|
||||
model.store = store;
|
||||
model.folder = node;
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>AVM Stores Sample</shortname>
|
||||
<description>Sample demonstrating the listing of AVM stores</description>
|
||||
<url>/sample/avm/stores</url>
|
||||
<format default="html"/>
|
||||
<authentication>admin</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
18
config/alfresco/bootstrap/webscripts/avmstores.get.html.ftl
Normal file
18
config/alfresco/bootstrap/webscripts/avmstores.get.html.ftl
Normal file
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>AVM Stores</title>
|
||||
</head>
|
||||
<body>
|
||||
AVM Stores
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<#list avm.stores as store>
|
||||
<tr>
|
||||
<td>${store.creator}<td> <td>${store.createdDate?datetime}<td> <td><a href="${url.serviceContext}/sample/avm/path/${store.id}/">${store.id}
|
||||
</tr>
|
||||
</#list>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user