XML elements and attributes for defining context menus
Understand the different XML elements and attributes that define context menu items.
Sample menu item definition
The following example shows the format of an XML file that defines a menu item. Elements are highlighted in bold for clarity.
<ncp_menu id="mytools" label="My Tools" key="key">
<context>
<!-- This section of the xml file is a context filter. -->
<!-- Context filters specify the device and view conditions -->
<!-- under which this menu is displayed. -->
</context>
<security>
<!-- This section of the xml file is a security filter. -->
<!-- Security filters specify the users, roles and groups -->
<!-- authorized to display this menu. -->
</security>
<definition>
<tool id="ncp_dns"/>
<separator/>
<menu id="ncp_cisco"/>
<menu id="ncp_juniper"/>
</definition>
</ncp_menu>
XML elements and attributes
The following table describes the elements and attributes used to define context menus, with reference to the above example.
Element or attribute | Type | Description |
---|---|---|
ncp_menu |
Element | Introduces the definition of a menu. |
context |
Element | Defines the views and devices that the menu items is available from. Use the reference information about defining context filters to define this attribute. |
security |
Element | Defines the users, groups and roles that are allowed to view the menu item. Use the reference information about defining user access filters to define this attribute. |
id |
Attribute | Contains an alphanumeric identifier for this menu. |
label |
Attribute | Contains the actual text of the menu option that appears in the context menu. |
key |
Attribute | Used as a lookup into the $NMGUI_HOME/profile/etc/tnm/locale/ |
tool |
Element | Inserts a tool with the specified id into the menu. In this example, a tool with the id ncp_dns is inserted into the menu. The associated menu text for this tool is DNS Lookup. The ncp_dns tool is defined in a separate XML file stored in $NMGUI_HOME/profile/etc/tnm/tools/. |
separator |
Element | Inserts a separator into the menu. |
menu |
Element | Inserts a submenu with the specified In this example, two submenus are defined:
Each of these submenus is defined in a separate . |