cancel
Showing results for 
Search instead for 
Did you mean: 

Display content type

robby
Champ in-the-making
Champ in-the-making
Hi all,
it's possible displaying the content type of a file in a freemarker template??
Smthing like:
<#list space.children as child>
   <#if child.isDocument>
         ${child.properties.type}
   </#if>      
</#list>

In a list of documents it's useful show the type of a document.

Best regards
Robert.
6 REPLIES 6

robby
Champ in-the-making
Champ in-the-making
with:
${document.type}
it return smthing like:
{myNameSpaseURI}typeName

Show this information isn't useful for the user…
It's possible show the title associated to type???


Robert

dhalupa
Champ on-the-rise
Champ on-the-rise
I do not think this is possible out of the box, but if you have basic java knowledge it is relatively easy to extend javascript api with your own utility class which will provide such functionality

http://wiki.alfresco.com/wiki/JavaScript_API#Adding_Custom_Script_APIs

Kind regards,

Denis

mabayona
Champ on-the-rise
Champ on-the-rise
I had such problem and, since the API does not provide with the possibility to show the title (this should be a JIRA feature request):

I added a little extra code (if .. then .. elseif…else) in the template that does the conversion between type: mymodel:invoice and the types title: Invoice.

It is a litle bit ugly but it does the trick and it is esay and quick.

robby
Champ in-the-making
Champ in-the-making
Print your code plz..

Regards

Robert

sacco
Champ in-the-making
Champ in-the-making
It's not quite clear to me what is the exact problem here:  is the MIME
type of  the content not sufficient? e.g.:

<table ><tbody >
<#list space.children as child>
<#if child.isDocument>
<tr >
<td >${child.name}</td>
<td >${child.mimetype}</td>
</tr>
</#if>
</#list>
</tbody></table>

N.B. make sure you wrap code like this with enough checks for
existence and non-null values to keep Freemarker happy — I've left them
out for clarity.


Is it that you want to display a more 'friendly' name for the type, e.g.
"PDF document"?

dhalupa
Champ on-the-rise
Champ on-the-rise
It is alfresco object type title which is needed, not mime type
Getting started

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.