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.
-
Access the plug-in: JSP version or ASP .NET version.
-
Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.
-
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.
-
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.
-
Click on Context Menus to expand the list of context menus used in MicroStrategy Web.
-
Right-click on any context menu node under Context Menus and select New Shortcut-List-Set.
-
Enter customContextMenu in the text field and click OK. This launches the Shortcut List Set and Attributes editor.
-
Right-click customContextMenu and select New Shortcut-List.
-
Enter default in the text field and click OK. This launches the Shortcut List and Attributes editor.
-
Right-click default and select New Shortcut.
-
Enter sub1 in the text field and click OK. This launches the Shortcut Attributes editor.
-
Enter Menu item without a submenu in the Descriptor text field.
-
Click the Advanced Properties tab at the bottom of the Shortcut Attributes editor for sub1.
-
Enter alert('You clicked a menu item without a submenu'); in the text field for Onclick.
-
Right-click default and select New Shortcut.
-
Enter group1 in the text field and click OK. This launches the Shortcut Attributes editor for group1.
-
Enter - in the Descriptor text field.
-
Save your changes. group1 will be a horizontal line separator.
-
Right-click default and select New Shortcut.
-
Enter sub in the text field and click OK. This launches the Shortcut Attributes editor for sub.
-
Enter Menu item with a submenu in the Descriptor text field.
-
Save your changes.
-
Right-click sub and select New Shortcut.
-
Enter history in the text field and click OK. This launches the Shortcut Attributes editor for history.
-
Enter History List in the Descriptor text field.
-
Click Modify next to the text field for Descriptor ID.
-
Select mstrWeb.4 and click OK.
-
Click Modify next to text field for Display this item only if the following feature(s) is(are) available.
-
Select history-list and click >>.
-
Click OK.
-
Click the Advanced Properties tab at the bottom of the Shortcut Attributes editor for history.
-
Click Add Event in the Events section.
-
To select the event enumeration class, click Browse and enter EnumServletEvents.
-
Select EnumServletEvents from your project and click OK.
-
Select WebEventOpenHistoryList from the drop-down menu for Event to trigger when menu element is selected.
-
Click OK.
-
Save your changes.
-
Navigate to Styles->FolderStyleCreateReport.
-
Double-click FolderStyleCreateReport to launch the Style Properties editor.
-
Click the Style Parameters tab at the bottom of the editor.
-
Click Add.
-
Select contextMenus and click >>.
-
Click OK.
-
Select contextMenus and enter /plugins/pluginName/WEB-INF/xml/config/customContextMenu.xml in the Value text field.
-
Launch MicroStrategy Web to view the customization.
See Also
-
Scenarios: Customizing Existing Functionality: Adding or Removing Context Menu Items
-
Scenarios: Customizing Existing Functionality: Removing Context Menus
-
Scenarios: Customizing Existing Functionality: Displaying Objects Selected in a Report
-
Scenarios: Extending Existing or Adding New Functionality: Disabling or Removing Context Menu Items for a Specific Object
-
Scenarios: Extending Existing or Adding New Functionality: Adding Context Menu Items that Display Information about the Object
-
Scenarios: Extending Existing or Adding New Functionality: Adding Context Menu Items Not Implemented by Default