cancel
Showing results for 
Search instead for 
Did you mean: 

Issue preventing component rendering with extension module

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hi guys,

I'm trying to prevent rendering the "title" ("title" region) within any site's "documentlibrary" page. After following the tutorials in the official documentation (http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/tasks/tu-40-hide-content.html and http://docs.alfresco.com/4.1/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Ftu-40-hide-con...)  and some blog post of Dave Drapper I got this extension definition:

<extension>
   <modules>
      <module>
         <id>Customization applied to sites' document library.</id>
         <auto-deploy>true</auto-deploy>
         <components>
            <component>
               <scope>template</scope>
               <region-id>title</region-id>
               <source-id>site/{site}/documentlibrary</source-id>
               <sub-components>
                  <sub-component id="default">
                     <evaluations>
                        <evaluation id="guaranteedToHide">
                           <render>false</render>
                        </evaluation>
                     </evaluations>
                  </sub-component>
               </sub-components>
            </component>
         </components>
      </module>
   </modules>
</extension>

If I change the <source-id> value to the dashboard page (site/{site}/dashboard) and the <scope> value to "page", it works. I presume the problem is related to the "template" scope, which I got after using SurfBug. I also tried with other scopes unsuccessfully. May be the reason that "template" scoped regions cannot be managed by extensions? May be I'm doing anything wrong?

Thanks in advance.

Regards.
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

the source ID for the documentlibrary template is simply "documentlibrary", not the ID of the full page. If you use this for a template-scoped sub-component you should find it in working order.

Regards
Axel

alejandrogarcia
Champ in-the-making
Champ in-the-making
Hello,

the source ID for the documentlibrary template is simply "documentlibrary", not the ID of the full page. If you use this for a template-scoped sub-component you should find it in working order.

Regards
Axel

Hi Axel,

You are right, following your indication it works like a charm  Smiley Very Happy

If it's helpful for others, this is the extension module I have created to hide the title bar in the document library page for every site:

<extension>
   <modules>
      <module>
         <id>Customizations applied to sites' document library.</id>
         <auto-deploy>true</auto-deploy>
         <components>
            <component>
               <scope>template</scope>
               <region-id>title</region-id>
               <source-id>documentlibrary</source-id>
               <sub-components>
                  <sub-component id="default">
                     <evaluations>
                        <evaluation id="guaranteedToHide">
                           <render>false</render>
                        </evaluation>
                     </evaluations>
                  </sub-component>
               </sub-components>
            </component>
         </components>
      </module>
   </modules>
</extension>

Now Axel, could you please answer the next question? Why in the examples I have taken as model (http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/tasks/tu-40-hide-content.html for instance) the value of <source-id> is defined with the ID of the full page rather than simply as you have said? The only difference I appreciate between the documentation tutorial and my scenario is the scope. The question would be actually, when should be used the full source id and when not and why?

Many thanks.

afaust
Legendary Innovator
Legendary Innovator
Hello,

Why in the examples I have taken as model […]the value of <source-id> is defined with the ID of the full page rather than simply as you have said? The only difference I appreciate between the documentation tutorial and my scenario is the scope. The question would be actually, when should be used the full source id and when not and why?

The source ID is always relative to the scope you use for mapping components. There actually isn't such a thing as a full (or short) source ID - there only is a unique source ID.

The source ID depends on the name and path of a Surf descriptor file that defines the scope.
For example, if you have a scope "page", you need to use the path and name of the page XML descriptor to get your source ID. E.g. the user dashboard XML descriptor is located in the user/<userName> folder (within the Alfresco Repository) and named dashboard.xml - this results in the source ID "user/{userId}/dashboard".
If you have a scope "template", you need to use the template XML descriptor, which is usually located in a flat list in Alfresco without a folder structure. Thus if you have documentlibrary.xml as your template XML descriptor, the resulting source ID is "documentlibrary".

The difference between the dashboard and documentlibrary is, that the dashboard is a user specific page that needs to be adaptable on a per-instance basis. This is why Alfresco uses the page scope for the title and navigation regions / components. The document library on the other hand is a generic feature and does not need to its component defined on a per-instance basis, which is why Alfresco uses the coarser template scope for the regions / components in this instance.

Regards
Axel

alejandrogarcia
Champ in-the-making
Champ in-the-making
That's more than I expected as an answer to my question. Completely understood, and what you have said also answers other questions I had in my mind.

Thanks a million!

Regards.