This client-side API enables you to implement interaction of your custom Module Gallery with Ajax Page Builder (APB).
The JavaScript GalleryModule object represents a module in the Module Gallery and contains the following fields:
templateID: the ID of the module template, such as com.sap.workspaces.LinkList
name: the name of the module, such as Link List
iconURL: the URL of the icon associated with the module, such as /irj/portalapps/tc~spaces.apps~linklist/images/moduleIcon.png
providerID: the ID of the content provider of this module, such as WorkspaceContentProvider
The pb_openGallery client-side event is raised when an empty page is loaded. To open your custom Module Gallery at this point, subscribe to this event:
EPCM.subscribeEventReliable("urn:com.sap.portal.ajaxpagebuilder", "pb_openGallery", openGalleryCallback); function openGalleryCallback () { //Open the gallery }
The pb_maximize client-side event is raised when a module is maximized. To close your custom Module Gallery or disable its buttons at this point, subscribe to this event:
EPCM.subscribeEventReliable("urn:com.sap.portal.ajaxpagebuilder", "pb_maximize", moduleMaximizedCallback); function moduleMaximizedCallback (data) { var moduleID = data.ID; }
The pb_restore client-side event is raised when a module is restored to its original size. To reopen your Module Gallery at this point, subscribe to this event:
EPCM.subscribeEventReliable("urn:com.sap.portal.ajaxpagebuilder", "pb_restore", moduleRestoredCallback); function moduleRestoredCallback(data) { var moduleID = data.ID; }
Notifies the page builder that the user is dragging a module from the Module Gallery onto the current page.
Parameters:
A GalleryModule object representing the module.
pb_addModule(galleryModule)Notifies the page builder that the user has chosen the Add button to add a module from the Module Gallery to the current page.
Parameters:
A GalleryModule object representing the module.
APB listens to the following events from the Module Gallery:
pb_expandGallery raised when the gallery is expanded
pb_collapseGallery raised when the gallery is collapsed.
These events help control the display of layout containers on the page.
You can raise these events in your custom implementation as follows:
//When the gallery expands EPCM.raiseEvent("urn:com.sap.portal.ajaxpagebuilder", "pb_expandGallery", ""); //When the gallery collapses EPCM.raiseEvent("urn:com.sap.portal.ajaxpagebuilder", "pb_collapseGallery", "");