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 08:25 AM
Error Message: 09100001 Failed to execute script 'classpath*:alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/getmodel.get.js': 09100000 SyntaxError: missing ] after element list (file:/C:/Alfresco/tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/getmodel.get.js#3(eval)#5)
Exception: org.mozilla.javascript.EcmaError - SyntaxError: missing ] after element list (file:/C:/Alfresco/tomcat/shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/getmodel.get.js#3(eval)#5)
var connector = remote.connect("alfresco");
var data = connector.get("/let/modelli");
var result = eval('(' + data + ')');
model.result = result;
{"modelli" : [
{"name" : "consulente.xls",
"link" : "\/alfresco\/d\/d\/workspace\/SpacesStore\/b632375f-e6a1-40e2-a2ee-dd858a4f8dc2\/consulente.xls",
}
{"name" : "doc1.doc",
"link" : "\/alfresco\/d\/d\/workspace\/SpacesStore\/1019756f-4624-4ee7-8095-c78f57209560\/doc1.doc",
}
]
}
10-10-2011 08:44 AM
{"first":1, //here is a coma
"last":2 //no coma
}
so none of your "link" attributes shouldn't end with a coma since these are the last attributes of the object.{"myArray": ["first":1,
"last":2} , //here is a coma
{"first":1,
"last":2} //no coma (last object of the array)
]
{"modelli" : [
{"name" : "consulente.xls",
"link" : "\/alfresco\/d\/d\/workspace\/SpacesStore\/b632375f-e6a1-40e2-a2ee-dd858a4f8dc2\/consulente.xls"
},
{"name" : "doc1.doc",
"link" : "\/alfresco\/d\/d\/workspace\/SpacesStore\/1019756f-4624-4ee7-8095-c78f57209560\/doc1.doc"
}
]
}
10-10-2011 09:10 AM
10-10-2011 09:24 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.