1 – Setup and customization > 1.3 Viewpoint customization > Configuring Homepage gadgets > Adding a custom Homepage gadget

Adding a custom Homepage gadget

You can add a custom gadget to the Viewpoint Homepage by creating a new gadget entry in the gadgets.xml file and pointing it to the custom gadget URL. These steps explain how this is to be done.

To add a custom gadget to the Homepage

  1. First, you will need to go into MWS and create a permission for your custom gadget (for details, see the "Permissions" resource section of the Moab Web Services Reference Guide).
  2. You could do the following:

    1. Specify the permission resource in this format: <company ID>.<permission name> (for example, "acme.customGadget").
    2. Specify the action (for example, "read").
    3. Specify the type (in this case, "gadget").
    4. (Optional, but recommended) Specify a label (for example, "Custom Gadget"). This will be the name of the permission that appears on the Role Management page.
    5. (Optional) Specify a description (for example, "The permission to access the custom gadget").

    When you create a permission like this, the actual permission name will be in this format: <type>.<resource>.<action> (or in this case, gadget.acme.customGadget.read).

    Any new gadget permission you create in MWS will appear in the Gadget Permissions when creating or editing roles. If you want to include the gadget permission in an existing role, you will have to edit the role and select the new custom gadget permission. For more information, see Editing an existing role.

  3. Open the gadgets.xml file in the $VIEWPOINT_HOME/hpc directory, and locate the <gadget-list> element.
  4. Insert a new <gadget> element, and specify the unique title and id attributes with the values you want to give the custom gadget. For example:
  5. <gadget title="Custom Gadget" id="custom1">
  6. Insert a new <content> element. Do the following:
    1. Specify the type to be "url".
    2. Set href to contain the full URL of your custom gadget. For example:
    3. <content type="url" href="http://www.example.com/customgadget" />
  7. Set the size, order, and auto-refresh time for the custom gadget. (For more information, see Customizing Homepage gadgets.)
  8. Set any custom parameters you want in a <params> element, using name/value pairs. For example:
  9. <params>
      <param name="speed" value="fast" />
    </params>

    Any name/value pairs you specify will be sent in the URL. For example: http://www.example.com/customgadget&speed=fast

  10. Insert a new <permission> element so that you can control which users have access to view the custom gadget.
  11. For example, let's say you are creating a new custom gadget, and you want it to use custom parameters ("speed/fast" in this example). You also want to restrict which users will see the gadget on the Homepage, so you assign it the new "gadget.customGadget.read" permission you created in MWS (see step 1). This is how you would set up the xml:

    <gadget title="Custom Gadget" id="custom1">
      <content type="url" href="http://www.example.com/customgadget" />
      <positioning priority="30" height="1" width="2" />
      <params>
        <param name="InternalRefresh" value="3600" />
        <!-- Required for jQuery Data Load -->
        <param name="speed" value="fast" />
      </params>					
      <permission name="gadget.acme.customGadget.read" desc="Custom Gadget" />
    </gadget>
  12. Save the gadgets.xml file.
  13. Your changes will update automatically. No restart of Tomcat or of Viewpoint is necessary. However, you must log out of Viewpoint and log back in.

  14. Go to the Role Management page and add the permission to a new or existing role. For more information, see About role management.

Related topics