Client side framework
You can deliver a JSON feed of context content. You can read the server JSON response, apply a few modifications on the content, and generate the DOM artifacts to display the final context menu in the browser. All files are packaged with the new theme and can be edited with any supported WebDAV client.
About this task
- Applicable only to the global page actions menu and the skin actions menu. For each menu the CSS and JavaScript is the same. Only the HTML markup is used to create the different menus.
- Duplicate separators and separators at the beginning and end of the menu are cleaned up. If only a header remains between two separators, the header and one separator are cleaned out as well.
- To force the regeneration of menus, use the following JavaScript:
- i$.fireEvent('wptheme/contextMenu/invalidate/all');
- When a session timeout occurs, a full page refresh is triggered to return to the login page.
- You can control which way menus open using a CSS class.
Use these contribution types to mark up and customize context menus:
- CSS
- Defines the look-and-feel of the menu. These files are in:
- dav:fs-type1/themes/Portal8.0/css/default.css
- dav:fs-type1/themes/Portal8.0/css/contextmenuCommon.css
- dav:fs-type1/themes/Portal8.0/css/contextmenu.css
- JavaScript
- Handles all the interactions with users to load the respective feed and display the menu based on a template. The JavaScript is embedded inside of the theme.js file, which can be found at dav:fs-type1/themes/Portal8.0/js.
- HTML markup
- The HTML markup or template is used to construct the menu and with the style sheets create the final menu.
You can create as many context menus as you want in a custom theme.
The HTML markup that places a menu on the
page at a certain position looks like the following example:
<span role="button" aria-haspopup="true" class="wpthemeMenuLeft" onclick="wptheme.contextMenu.init(this,
'pageAction', {'pid':'123'});">
<span class="wpthemeUnderlineText wpthemeMenuFocus">Title of the clickable button</span>
<span class="wpthemeMenuRight">
<div class="wpthemeMenuBorder">
<div class="wpthemeMenuNotchBorder"></div>
<!-- define the menu item template inside the "ul" element. only "css-class", "description",
and "title" are handled by the theme's sample javascript. -->
<ul class="wpthemeMenuDropDown wpthemeTemplateMenu" role="menu">
<li class="${css-class}" role="wpthemeMenuitem" title="${description}">
<span class="wpthemeMenuText">${title}</span></li>
</ul>
</div>
<!-- Template for loading -->
<div class="wpthemeMenuLoading wpthemeTemplateLoading">Loading...</div>
<!-- Template for submenu -->
<div class="wpthemeAnchorSubmenu wpthemeTemplateSubmenu">
<div class="wpthemeMenuBorder wpthemeMenuSubmenu">
<ul id="${submenu-id}" class="wpthemeMenuDropDown" role="menu"></ul>
</div>
</div>
</span>
</span>