cancel
Showing results for 
Search instead for 
Did you mean: 

not able to add a label in node-header in document list page

ayushi_agrahari
Confirmed Champ
Confirmed Champ

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("evSmiley Tonguedffolder")>
                    <#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""

2 REPLIES 2

krutik_jayswal
Elite Collaborator
Elite Collaborator

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.

hasAspect | Alfresco Documentation 

ayushi_agrahari
Confirmed Champ
Confirmed Champ

thanks krutik,

can u tell me if there is any out of the box webscript which checks for the presence of aspect in alfresco