AnsweredAssumed Answered

Listing aspect property values

Question asked by danw on Feb 6, 2010
Latest reply on Feb 9, 2010 by unknown-user
The situation is this… A user uploads a file from a jsr 168 portlet to an Alfresco space.  The next action of the portlet is to prompt the user to enter metadata about that file.  Ideally the metadata would be fetched "on the fly" as in I'd like to be able to poll Alfresco for all properties and values on a file, produce an empty (for the initial upload, filled in for metadata/file updates later on) form to enter in this metadata, and let the user submit that to Alfresco to associate it with the file.  After an exhaustive search I have come to the conclusion that this isn't possible.. at least the polling for all properties and values part isn't.  Fortunately for the current situation all uploaded files will have the same associated metadata with them.  Ok, so that means the names of the properties can be hardcoded and their values pulled out in the Javascript, then a table can be populated in Freemarker from that data.  I attempted this but I get an error: "freemarker.core.InvalidReferenceException - Expression prop is undefined on line 3, column 90 in org/alfresco/sample/updateMeta.get.html.ftl."

I've included the source code for the .ftl and .js… 

<table>
<#list props as prop>
<tr><td>${names[prop_index]}:<td><input type='text' name='${names[prop_index]}' value='${prop}'>
</#list>
<tr><td><td><input type='submit' name='submit'>  
</table>

var dProps = new Array(6);
var propNames = new Array(6);
var p = url.extension.split("/");
var node = search.findNode("node",p);

dProps[0] = node.properties["dy:Source"];
dProps[1] = node.properties["dy:CJNumber"];
dProps[2] = node.properties["dy:RequestNumber"];
dProps[3] = node.properties["dy:OrderNumber"];
dProps[4] = node.properties["dy:CID"];
dProps[5] = node.properties["dy:AL"];

propNames[0] = "Source";
propNames[1] = "CJNumber";
propNames[2] = "RequestNumber";
propNames[3] = "OrderNumber";
propNames[4] = "CID";
propNames[5] = "AL";

model.node = node;
model.props = dProps;
model.names = propNames;

Any help is MUCH appreciated.  I've been beating my head against a wall with this Aspect/metadata stuff for a couple days now.

Edit:  I should be clear… the nodeRef, storeRef, and id are all correct.  The file has the Aspect associated with it and the fields are not empty, I've filled them with garbage data for now.

Outcomes