MicroStrategy ONE

Adding Custom Context Menus

This customization scenario illustrates how to add custom context menus to a MicroStrategy Web page. In this example, you create a custom context menu for the Create Report page, which does not display context menus by default. If you right-click an object on this page before you perform the customization, only the browser context menu is displayed. After the customization, the custom context menu is displayed, and it  has two context menu items. If you click the first context menu item, a message box opens. If you click the second context menu item, a sub-menu item appears with one sub-menu item that opens the History List page.

For simplicity, descriptive labels are used for the context menu items in this scenario. However, you can add other menu items that either execute JavaScript (see Adding or Removing Context Menu Items) or use an already existing generic event (see Adding or Removing Context Menu Items).

Before customization:

After customization:

This customization can be accomplished using either of the following methods:

Deploying the plug-in provided with MicroStrategy SDK

MicroStrategy SDK provides a plug-in (ZIP file) that can simply be extracted to the plugins folder to view the customization in MicroStrategy Web. The following steps guide you in locating the plug-in and deploying it. 

  1. Access the plug-in: JSP version or ASP .NET version

  2. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.   

  3. Launch MicroStrategy Web to view the customization.

Using the Web Customization Editor to create a plug-in

MicroStrategy SDK provides a Web Customization Editor that can be used to create a customization plug-in. The following steps guide you in creating the plug-in and deploying it. 

  1. Launch the Web Customization Editor

  2. Click on MicroStrategy Web Configuration inside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations. 

  3. Click on Context Menus to expand the list of context menus used in MicroStrategy Web. 

  4. Right-click on any context menu node under Context Menus and select New Shortcut-List-Set

  5. Enter customContextMenu in the text field and click OK. This launches the Shortcut List Set and Attributes editor. 

  6. Right-click customContextMenu and select New Shortcut-List

  7. Enter default in the text field and click OK. This launches the Shortcut List and Attributes editor. 

  8. Right-click default and select New Shortcut

  9. Enter sub1 in the text field and click OK. This launches the Shortcut Attributes editor. 

  10. Enter Menu item without a submenu in the Descriptor text field. 

  11. Click the Advanced Properties tab at the bottom of the Shortcut Attributes editor for sub1

  12. Enter alert('You clicked a menu item without a submenu');  in the text field for Onclick

  13. Right-click default and select New Shortcut

  14. Enter group1 in the text field and click OK. This launches the Shortcut Attributes editor for group1

  15. Enter - in the Descriptor text field. 

  16. Save your changes. group1 will be a horizontal line separator. 

  17. Right-click default and select New Shortcut

  18. Enter sub in the text field and click OK. This launches the Shortcut Attributes editor for sub

  19. Enter Menu item with a submenu in the Descriptor text field. 

  20. Save your changes. 

  21. Right-click sub and select New Shortcut

  22. Enter history in the text field and click OK. This launches the Shortcut Attributes editor for history

  23. Enter History List in the Descriptor text field. 

  24. Click Modify next to the text field for Descriptor ID

  25. Select mstrWeb.4 and click OK

  26. Click Modify next to text field for Display this item only if the following feature(s) is(are) available

  27. Select history-list and click >>

  28. Click OK

  29. Click the Advanced Properties tab at the bottom of the Shortcut Attributes editor for history

  30. Click Add Event in the Events section. 

  31. To select the event enumeration class, click Browse and enter EnumServletEvents

  32. Select EnumServletEvents from your project and click OK

  33. Select  WebEventOpenHistoryList from the drop-down menu for Event to trigger when menu element is selected

  34. Click OK

  35. Save your changes. 

  36. Navigate to Styles->FolderStyleCreateReport

  37. Double-click FolderStyleCreateReport to launch the Style Properties editor. 

  38. Click the Style Parameters tab at the bottom of the editor. 

  39. Click Add

  40. Select contextMenus and click >>

  41. Click OK.

  42. Select contextMenus and enter /plugins/pluginName/WEB-INF/xml/config/customContextMenu.xml in the Value text field. 

  43. Launch MicroStrategy Web to view the customization.

See Also