02-13-2018 04:57 AM
I am trying to customize the node-header of document list page in alfresco.what I am doing is checking for the presence of pdffolder aspect that compresses all the files inside a folder and if the aspect is present,then compressed label is added,otherwise original label is added.for this I have added the following code in node-header.get.html.ftl
<#if !isContainer>
<#assign nodeType = node.type?replace(":","_") + ".title">
<#assign fileExtIndex = item.fileName?last_index_of(".")>
<#if fileExtIndex gt -1>
<#assign fileExt = item.fileName?substring(fileExtIndex + 1)?lower_case>
<#elseif node.mimetype?? && mimetypes.getExtension(node.mimetype)??><#-- Mimetype may be null if it is not known in the repository -->
<#assign fileExt = mimetypes.getExtension(node.mimetype)>
<#else>
<#assign fileExt = "generic">
</#if>
<#if node.hasAspect("evdffolder")>
<#assign viewType = "Compressed">
<#else>
<#assign viewType = "Original">
</#if>
</#if>
but it is showing the exception "FreeMarker template error:
The following has evaluated to null or missing:
==> node.hasAspect [in template "org/alfresco/components/node-details/node-header.get.html.ftl""
02-13-2018 05:43 AM
You are trying to use the repository api on share freemarker script.On share side you will not be able to use hasAspect method.Infact, I think the node object itself is not available on share side.Its just an json object.You need to override the get.js file and call repository webscript to check this.You can make ajax call as well to custom webscript for making check of aspects.
You can check more details of hasaspect method of freemarker on below page.
02-14-2018 07:06 AM
thanks krutik,
can u tell me if there is any out of the box webscript which checks for the presence of aspect in alfresco
Explore our Alfresco products with the links below. Use labels to filter content by product module.