David Caruana 3f107708f8 - 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
2007-06-22 16:39:43 +00:00

36 lines
977 B
JavaScript

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;
}