This recipe will guide you through the process of removing gadgets from the dashboard.
Here are the steps to follow for removing a gadget:
If you remove a gadget imported on a user page, the user will see automatically this advice:
When you click on the X button, an event listener of the UIDashboard
container, the org.exoplatform.dashboard.webui.component.UIDashboardContainer .DeleteGadgetActionListener
, is activated. It queries the JCR Repository and verifies if there is a child in the UIDashboardContainer
; if yes it deletes it.
When the user enters the portal for the first time and goes to the dashboard page, a set of pages is created in this JCR path: portal-system/production/mop:workspace/mop:usersites/mop:root/mop:rootpage/mop:children/mop:pages/mop:children/mop:Tab_Default
.
The mop:Tab_Default
node represents the dashboard page. If you go inside mop:Tab_Default/mop:rootcomponent
through webdav, (see R for webdav) you will note that a node named with UUID containing three other nodes is also named with the UUID. Those represent the three spaces of the dashboard page where the gadgets can be inserted.
One of these three spaces will contain the ID of the gadget inside the property mop:contentid
of the mop:customization
node. When you click on the X button, the information in the space will be removed.
Here are the properties of the mop:customization
created while importing the YouTube gadget:
------------------------------------------------------ jcr:primaryType - mop:workspaceclone ------------------------------------------------------ jcr:uuid - 648e567dc0a8b21c00e159111e665b63 ------------------------------------------------------ mop:contentid - gadget-1270571586 ------------------------------------------------------
Here is an example of a pre-installed gadget in the portal, for example the Calculator gadget:
------------------------------------------------------ jcr:primaryType - mop:workspaceclone ------------------------------------------------------ jcr:uuid - 5ccdfaeac0a8b21c2658e94580d1467d ------------------------------------------------------ mop:contentid - Calculator ------------------------------------------------------ mop:mimetype - application/gadget
Though it is different from the YouTube gadget, the mop:contentid
is predefined because it is taken from the name field of gadget.xml
:
<gadget name="Calculator"> <path>/gadgets/Calculator/Calculator.xml</path> </gadget>
In the YouTube gadget, this value is auto generated. You will see how to create this file in the next recipe: Creating gadgets.
When you remove a gadget from the Application Registry, a delete event is sent to the org.exoplatform.applicationregistry.webui.component.UIGadgetManagement. RemoveGadgetActionListener
. This listener works in two phases:
3.15.206.25