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

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

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

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
Highlighted
Senior Member II

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

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 

Highlighted
Active Member II

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

thanks krutik,

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