1 – Setup and customization > 1.3 Viewpoint customization > Customizing navigation components > Adding a custom top link

Adding a custom top link

You can create a custom top link in Viewpoint. Top links appear in the upper-right corner of the Viewpoint page. For example, the "Log out" link is a top link.

You can create custom top links by using the <top-links> element in the navigation.xml file.

To create a custom top link

  1. First, you will need to go into MWS and create a permission for your custom link (for details, see the "Permissions" resource section of the Moab Web Services Reference Guide).
  2. Let's say, for example, that you want your link to point to a custom page. You could do the following:

    1. Specify the permission resource (for example, "customPage").
    2. Specify the action (for example, "read").
    3. Specify the type (in this case, "page").
    4. (Optional, but recommended) Specify a label (for example, "Special Custom Page"). 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 special custom page").

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

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

  3. Open the navigation.xml file in the $VIEWPOINT_HOME/hpc directory, and locate the <top-links> element.
  4. By default, you should already see the "Log out" top link listed in the element.

  5. Depending on where you want the custom top link to be (in front of or behind the "Log out" link), insert a new <top-link> element either before or after the "Log Out" top link, and do the following:
    1. Create a label attribute, and specify the display text for the link.
    2. Create a href attribute, and specify the URL to the page you want the top link to open.
    3. Create a target attribute, and specify one of the following for how the link should be opened:
    4. Value Description
      thisWindow Clicking the link exits the Viewpoint web application and displays the new page in the same window.
      newWindow Clicking the link opens the link in a new window (browser tab).
  6. Inside the <top-link> element, insert a new <permission> element so that you can control which users have access to view the top link.
  7. For example, let's say you are creating a new link under the "Administration" menu label that directs to the custom page. You want to label the link "Custom Page," and you want it to open in the same window. You also want to restrict access to this page to certain users, so you assign it the new "page.customPage.read" page permission you created in MWS (see step 1). This is how you would set up the xml:

    ...
      <top-links>
        <top-link href="logout" target="thisWindow" label="Log out"/>
        <top-link href="http://www.exampleURL.com/example" target='thisWindow' label="Custom Page" >
          <permission name="page.customPage.read"/>
        <top-link/>
      </top-links>
    ...
  8. Save the navigation.xml file.
  9. 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.

  10. 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