diff --git a/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.desc.xml new file mode 100644 index 0000000000..97aada2978 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.desc.xml @@ -0,0 +1,8 @@ + + Content Metadata Retrieval Service + Content Metadata Retrieval Service + /webframework/content/metadata + argument + admin + required + diff --git a/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.html.ftl new file mode 100644 index 0000000000..9677c4e8d5 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.html.ftl @@ -0,0 +1,53 @@ +{ + "isContainer" : ${object.isContainer?string} + , + "isDocument" : ${object.isDocument?string} + , + "url" : "${object.url}" + , + "downloadUrl" : "${object.downloadUrl}" + , + "mimetype" : "${mimetype}" + , + "size" : "${object.size}" + , + "displayPath" : "${object.displayPath}" + , + "qnamePath" : "${object.qnamePath}" + , + "icon16" : "${object.icon16}" + , + "icon32" : "${object.icon32}" + , + "isLocked" : ${object.isLocked?string} + , + "id" : ${object.id} + , + "nodeRef" : "${object.nodeRef}" + , + "name" : "${object.name}" + , + "type" : "${object.type}" + , + "isCategory" : ${object.isCategory?string} + +<#if properties?exists> + , + "properties" : + { + <#assign first = false> + <#list properties?keys as key> + <#assign val = properties[key]> + <#if val?exists> + <#if first == true> + , + + "${key}" : "${val}" + <#assign first = true> + + + + } + + +} \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.js b/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.js new file mode 100644 index 0000000000..6bc208f4e4 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/webframework/metadata.get.js @@ -0,0 +1,33 @@ +var object = null; + +// allow for content to be loaded from id +if(args["id"] != null) +{ + var id = args["id"]; + object = search.findNode(id); +} + +// if not by id, then allow for user id +if(object == null && args["user"] != null) +{ + var userId = args["user"]; + object = people.getPerson(userId); +} + +// load content by relative path +if(object == null) +{ + var path = args["path"]; + if(path == null || path == "" || path == "/") + path = "/Company Home"; + else + path = "/Company Home" + path; + + // look up the content by path + object = roothome.childByNamePath(path); +} + +// store onto model +model.object = object; +model.mimetype = object.mimetype; +model.properties = object.properties;