Alfresco share is very good introduction from Alfresco which provides Interface for accessing repository and also provides full fledge Collaboration platform created on top of Alfresco repository.
There has been lot of talk around its promising features like reduction in development time. Ease of customization, powerful rich user interface but issue was that it was still in its primitive stage during introduction and was going through lot of transformation so it was making difficult for developers to do customization and understand underlying architecture. Even their standard practices of development have many issues like maintenance. But recent developments of Alfresco share architecture is a real game changer. I had already introduced you regarding those developments in some of my previous articles.
Here we are going to use that extensibility feature will try to insert our piece of code within alfresco share existing page.
Steps for achieving that are as follow.
Identify page on which you want to introduce your content, Login and navigate to that page. Here we will add content to Repository home page.
Enable surf-bug through this page http://localhost:8080/share/service/index.
Refresh page under which you want to insert the content. You will see all components of pages will be delimited by red lines.
SurfBug is described in more detail in the SurfBug tutorial.
Click on component after which you want to insert your content and make a note of the Component Details, in particular the region-id, source-id and scope values. This is the information that you will need when defining a new Sub-Component to that existing Component.
Create a webscript which will render your content. For details on creation of script please refer this post. Output of this webscript will be simply some html content. Refer these posts for more details on webscript.
Create a new extension file called customization-test.xml that contains the following:
<extension> <modules> <module> <id>New Custom Content</id> <components> <component> <region-id> toolbar</region-id> <source-id> repository</source-id> <scope> template</scope> <sub-components> <sub-component id= "Custom_Content" index= "25" > <url>/custom/test/new-content</url> </sub-component> </sub-components> </component> </components> </module> </modules> </extension>
And place it here
Restart server and Deploy Extension module
The extension module needs to be deployed before it will be visible. Module deployment is a new feature in Alfresco 4.0 that is achieved through a web script found at: http://localhost:8080/share/service/modules/deploy. Navigate to this page to view a list of Available Modules and a list of Deployed Modules. Initially you will see the following two modules available: Alfresco Portlet Extension, and New Custom Content
For more details on deployment modules you can refer this post.
Navigate to page where you wanted your new content to be visible and you will be able to see that.
Summary : This is very basic but important lesson related to alfresco customization with this approach you can customize alfresco share page to great extend and give it a whole new look.
Alfresco document, Alfresco wiki