10-02-2012 11:43 AM
<webscript><shortname>List tags</shortname><description>Tags Alfresco</description><url>/list_tags</url><format default="csv"></format><authentication>user</authentication></webscript>
const filename = "output.csv";
function main()
{
var file = createFile(filename);
var content = "";
var categoryResults = classification.getRootCategories("cm:taggable");
categoryResults.sort(sortByName);
var i = 0;
for each (var result in categoryResults)
{
var query = '@cm\\:taggable:"' + result.getNodeRef() + '"';
var nodes = search.luceneSearch(query);
var message = ++i + ';"' + result.name + '";' + nodes.length;
content += message + '\n';
logger.warn(message);
}
file.content += content;
return 1;
}
/* Sort the results by case-insensitive name */
function sortByName(a, b)
{
return (b.properties.name.toLowerCase() > a.properties.name.toLowerCase() ? -1 : 1);
}
function createFile(name)
{
var file = companyhome.childByNamePath(name);
if (file == null)
file = companyhome.createFile(name);
if (file == null)
throw new Error("Cannot create " + name);
file.content = "";
return file;
}
main();
10-02-2012 01:21 PM
10-02-2012 11:27 PM
10-03-2012 03:57 AM
10-04-2012 03:49 AM
<!– Add mimetype text/csv –>
<bean parent="webscripts.formatmap">
<property name="formats">
<props>
<prop key="csv">text/csv</prop>
</props>
</property>
</bean>
http://wiki.alfresco.com/wiki/3.0_Web_Scripts_Framework#HTTP_Response_Formats<format default="csv" />
10-04-2012 04:46 AM
<format default="csv" />
10-04-2012 04:52 AM
model.maVariable = "test";
model.monTableau = ["val1", "val2"];
${maVariable}
<#list monTableau as val>
${val}
<#if val_has_next>,</#if>
</#list>
10-10-2012 06:27 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.