Tuesday, July 18, 2017

Alfresco Share - How to customize Alfresco folder picker for a custom page

Alfresco 5.2 includes a new “Create Link” button in the out-of-the-box folder picker. In the custom page let’s assume that the user needs to specify a folder path and there is also a requirement to hide the new “Create Link” button in the folder picker.

To hide this Create Link button create a custom client-side JavaScript module that extends the Alfresco folder picker module. To avoid conflicts in “Alfresco” namespace it is better to place the custom client-side object in a separate namespace. In the example code below we declare a “Formtek” object. The client-side object defined in this code will live in the Formtek namespace. Next we will declare the constructor for this new client-side object. The constructor in turn calls the superclass constructor and registers the object using the Alfresco ComponentManager.

After registering the new client-side object, the actual object is defined. Formtek.module.XRefGlobalFolder object extends the Alfresco.module.DoclibGlobalFolder object using YAHOO.extend and in this example it overrides the _updateSelectedNode method to hide the Create Link button. Additional methods can be overridden to further customize the Alfresco folder picker. 

Include the above javascript client-side object in your custom page and use this new client-side 
JavaScript object from your custom page to hide the Create Link button.