Extensibility Modules in Alfresco

We had discussed about Alfresco Share and its architecture in previous articles. We had also discussed about recent changes in Alfresco share architecture and its advantages. There I had pointed out that those changes in architecture will make developers life easy as it will be lot easier to customize user interface. In this article, I am going to explain how we can show and hide existing Alfresco share components conditionally. Other possible customizations are overriding the existing webscripts which are generating particular components. So in short this will give full freedom to developers to extend those subcomponent modules as per their needs.

For instance if we have a requirement where we want to hide certain components from particular set of users we can easily do it with the help of new module extension feature. In this case we will hide some of the components of document details page for certain groups.

Step 1

Enable surf bug (powerful tool developed by alfresco team for developers) though Alfresco share webscript page

http://localhost:8080/share/page/service/index

Step 2

Go to document detail page and click on the area which you want to hide for example version detail, workflow history on right hand side of document detail page. You will be able to see the components details from which we need to note down following

Region-id,source-id,scope

ID: The id of the Sub-Component – this is always prefixed by the parent Component id and a “#” indicates the start of Sub-Components identification

Ex..

region-id:            node-header

source-id:            document-details

Step 3

Based on details collected in step2 we need to create xml file where we will define module which we want to extend. Here I have added my custom evaluator class for that module that means version detail panel will be shown to all the users conditionally. Evaluators for modules are similar to evaluator of actions but both are not same as both of them follow different hierarchy. Module evaluator class extends

org.springframework.extensions.surf.extensibility.impl.DefaultSubComponentEvaluator class and override evaluate(RequestContext context, Map<String, String> params) method as you can see I have passed parameter to evaluator similarly you can pass as many parameters you like to make your evaluator more configurable and flexible. In this case I am passing group name for which I want this version history panel to be visible for all rest of the users it will be disable.

Create custom-moule-extension.xml

<extension>

 <modules>

     <module>

            <id>Evaluate Version Panel</id>

            <components>

                  <component>

                        <region-id>document-versions</region-id>

                        <source-id>document-details</source-id>

                        <scope>template</scope>

                        <sub-components>

                              <sub-component id="default">

                                    <evaluations>

                                          <evaluation id="HideVersionPanel">

                                          <evaluators>

                                                <evaluator type="com.company.custom.versionevaluator">

                                                            <params>

                                                <groups> ALFRESCO_ADMINISTRATORS</groups>

                                                            </params>

                                                 </evaluator>

                                                 </evaluators>

                                                <render>false</render>

                                          </evaluation>

                                    </evaluations>

                              </sub-component>

                        </sub-components>

                  </component>

            </components>

      </module>

Step 4

Restart the server and go to module deployment console

http://localhost:8080/share/page/modules/deploy

You will be able to see “Evaluate version Panel” module in available module box you need to deploy it by moving it in deployed module and click apply.
Now go to document detail page of any of the document in alfresco repository. Check with one of the non admin user you will not be able to see version history panel.

For more information on Extension module deployment and packaging you can refer this blog alfresco-share-extension-module .Hope this will give you good insight of extensibility module usage. This is really an amazing feature of alfresco share so I recommend you to explore this.

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *


2 + = 9

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>