10-09-2011 02:44 PM
{"modelli" : [
{"name" : "consulente.xls",
"link" : "\/alfresco\/d\/d\/workspace\/SpacesStore\/b632375f-e6a1-40e2-a2ee-dd858a4f8dc2\/consulente.xls",
}
]
}
<webscript>
<shortname>Crea da modello</shortname>
<description>Nuovo documento da modello esistente</description>
<!– one of dashlet, site-dashlet or user-dashlet –>
<family>dashlet</family>
<url>/components/dashlets/getmodel</url>
</webscript>
<div class="dashlet">
<div class="title">Nuovo documento da modello esistente</div>
<div class="body scrollableList">
<div class="detail-list-item first-item last-item">
<h5>Modelli di documento</h5>
<table>
<#list modelli as mod>
<tr>
<td><b>Name</b></td><td>${mod.name}</td>
</tr>
<tr>
<td><b>Link</b></td><td><a href="${url.context}${mod.link}?guest=true">${url.context}${mod.link}</a></td>
</tr>
</#list>
</table>
</div>
</div>
</div>
var connector = remote.connect("alfresco");
var data = connector.call("let/modelli");
if (data.status == 200) {
var result = eval('(' + data + ')');
model.modelli = result["modelli"];
}else{
model.modelli="zzzz";
}
Exception: freemarker.template.TemplateException - Expected collection or sequence. modelli evaluated instead to freemarker.template.SimpleScalar on line 7, column 32 in org/alfresco/components/dashlets/getmodel.get.html.ftl.
10-10-2011 03:31 AM
10-10-2011 03:48 AM
10-10-2011 03:52 AM
10-10-2011 04:14 AM
10-10-2011 04:18 AM
10-10-2011 05:03 AM
var data = connector.get("/let/modelli");
10-10-2011 05:14 AM
if (data.status.code == 200)
instead of if (data.status == 200)
var connector = remote.connect("alfresco");
var data = connector.call("let/modelli");
var result = eval('(' + data + ')');
model.modelli = result;
and handle the display in your html template
<#if modelli.status.code == 200>
<table>
<#list modelli.response["modelli"] as mod>
<tr>
<td><b>Name</b></td><td>${mod.name}</td>
</tr>
<tr>
<td><b>Link</b></td><td><a href="${url.context}${mod.link}?guest=true">${url.context}${mod.link}</a></td>
</tr>
</#list>
</table>
<#else>
Error ${modelli.status.code}: <br />
${modelli.status.message}
</#if>
I haven't tested it so it might be full of syntax errors but I hope you get the point.
10-10-2011 05:23 AM
10-10-2011 05:33 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.