You are here: 1 – Setup > 1.4 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 homepage.xml file and pointing it to the custom gadget URL. These steps explain how this is to be done.

The configuration for Homepage gadgets does not follow Google Gadgets API, but you can embed inline frames into the Homepage. Because the Google Gadget API permits the use of HTML iframes, Gadgets that are configured for Homepage can be altered to work in any Gadget API-compatible dashboard (such as the WS02 Gadget Server).

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 (for example, "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.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 Modifying an existing role.

  3. Open the homepage.xml file in the $VIEWPOINT_HOME directory, and locate the <gadgets> 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 positioning so that the custom gadget appears where you want it to on the Home page. (For more information, see Customizing Homepage gadget layout.)
  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 column="3" priority="30" height="200" />
      <params>
        <param name="speed" value="fast" />
      </params>					
      <permission name="gadget.customGadget.read"/>
    </gadget>
  12. Save the homepage.xml file.
  13. Your changes will update automatically. No restart of Tomcat or of Viewpoint is necessary.

  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 

© 2015 Adaptive Computing