Close
Alfresco Content Services

Modifying Out-of-the-box Code Extension Point

Most of the Share UI functionality can be traced back to a web script in one place or another. Sometimes it is useful to be able to override the controller or template of one of these out-of-the-box web scripts. Same things goes for other out-of-the-box code for things like pages and dashlets.

The preferred way of modifying out-of-the-box code is by using Surf Extension Modules

Architecture Information: Share Architecture

Modifying Out-of-the-box Surf Web Scripts

The preferred way of modifying out-of-the-box Surf Web Scripts is by using Surf Extension Modules to target the Web Script that should be replaced:

<extension>
    <modules>
        <module>
            <id>Customize a Web Script</id>
            <version>1.0</version>
            <auto-deploy>true</auto-deploy>
            <customizations>
                <customization>
                    <targetPackageRoot>The path to the out-of-the-box Web Script you are overriding, such as org.alfresco.components.dashlets</targetPackageRoot>
                    <sourcePackageRoot>The path to your Web Script customizations, such as org.alfresco.tutorials.customization.webscript.controller</sourcePackageRoot>
                </customization>
            </customizations>
        </module>
    </modules>
</extension>

The Web Script files in your package should have the same names as the original ones that you are overriding. The Extension Modules section has all the details.

Out-of-the-box Surf Web Scripts used to be overridden by putting the modified files under alfresco/web-extension/site-webscripts/org/alfresco/... directory using the exact same path. This approach is no longer needed.

Modifying Out-of-the-box Surf Pages

Most of the pages in the Share web application are implemented with the Surf UI framework. In many cases it is necessary to modify these pages.

The preferred way of modifying Surf pages is by using Surf Extension Modules to target the component that should be replaced or hidden. It is also possible to add components to a page this way. The Extension Modules section has all the details.

Modifying Out-of-the-box Surf dashlets

The Share web application has a special page called Dashboard, which contains windows of content called dashlets. Currently most of these dashlets are Surf dashlets, and it is possible to modify the contents on them.

The preferred way of modifying Surf dashlets is by using Surf Extension Modules to target the component that should be replaced or hidden. It is also possible to add components to a dashlet this way. The Extension Modules section has all the details.

Modifying Out-of-the-box Surf Widgets

The Share web application pages and dashlets are built up of widgets. Sometimes it is necessary to modify these.

The preferred way of modifying Surf widgets is by using Surf Extension Modules to target the component that has the widget that should be replaced or hidden. It is also possible to add widgets to a page this way. The Extension Modules section has all the details.

Modifying Out-of-the-box Aikau Pages

The Share web application has a number of Aikau pages. These can be modified.

The preferred way of modifying Aikau pages is by using Surf Extension Modules to target the Aikau widget that should be replaced or hidden. It is also possible to add widgets to a page this way. The Extension Modules section has all the details. Now, if we want to modify an existing page we need to grab hold of it in the Web Script controller, this will look like this:

var widget = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_SEARCH_RESULTS_LIST");
if (widget && widget.config && widget.config.widgets) {
   widget.config.widgets.push( {
...   

This is all that is required to extend an existing JSON model. We’re using widgetUtils to find the FCTSRCH_SEARCH_RESULTS_LIST widget. Once we have it, we simply push widgets into it.

Modifying Out-of-the-box Aikau dashlets

The Share web application has a special page called Dashboard, which contains windows of content called dashlets. Currently most of these dashlets are Spring Surf dashlets, but they will eventually be converted to Aikau dashlets.

The preferred way of modifying Aikau dashlets is by using Surf Extension Modules to target the Aikau widget that should be replaced or hidden. It is also possible to add widgets to a dashlet this way. The Extension Modules section has all the details.

Modifying Out-of-the-box Aikau Widgets

Every Aikau menu, page, and dashlet is built up of one or more widgets. Sometimes it is necessary to modify out of the box widgets.

The preferred way of modifying Aikau widgets is by using Surf Extension Modules to target the widget that should be replaced or hidden. It is also possible to add widgets this way. The Extension Modules section has all the details.

Deployment - App Server

  • tomcat/shared/classes/alfresco/web-extension/site-data/extensions/ (Untouched by re-deployments and upgrades)

Deployment All-in-One SDK project

  • aio/share-jar/src/main/resources/alfresco/web-extension/site-data/extensions - Store extension modules here
  • aio/share-jar/src/main/resources/alfresco/web-extension/site-webscripts - Your Web Script overrides are stored here under a custom package path

More Information

Tutorials

Developer Blogs

Edit this page

Suggest an edit on Github
This website uses cookies in order to offer you the most relevant information. Please accept cookies for optimal performance. This documentation is subject to the Alfresco documentation terms.