The channel menu for the Enterprise Sample can be customized to add new menu items or remove menu items. Customizing the channel menu requires modification of JSP files shipped in the JSPTableContainerProvider located, by default, in the PortalServer-DataDir/portal/portal-ID/desktop/enterprise_sample/JSPTableContainerProvider directory. The menu for channels displayed in the desktop is created in channelMenubar.jsp file. The menu for the channels in the popup window state is created in popupChannelMenubar.jsp file. Any modifications to the channel menu should be made in both the above files so that the changes are reflected in regular desktop channels as well as in the popup channels.
To create a new pull down menu from a JSP file
window.<%=channelName% >= new Menu(); |
The variable, channelName, is a String that contains the unique name of the channel. This is required so that each channel menu has a unique identifier. Menu items can be added using the addMenuItem(String name, String action) method.
To add items which are not links
window.<%=channelName%>. addMenuItem("— Channel Menu —"); |
To add menu items with an associated action
window.<%=channelName%>.addMenuItem("Update Channel", "location=’<dtpc:getDesktopURL pathinfo="$pathInfo"/>’"); |
The above line shows how to add a menu item that redirects the browser to a different location when clicked.
To add a menu item that will open a popup window when clicked
window.<%=channelName%>.addMenuItem("Attach Channel",onClick="openUrlInParent(<dtpc:getDesktopURL/>?action=process&provider=<%=containerName%>&<%=containerName%>channelAction=attach&<%=containerName%>.targetProvider=<%=leafChannel%>’, true); windowClosed(window.name); window.close();"); |
Similar Javascript actions can be associated with each menu item. Actions are invoked when you click on the menu item. Here are some examples.
To add menu item separators use addMenuSeparator() method. For example:
window.<%=channelName%>.addMenuSeparator(); |
To modify the appearance and operations, customize the following properties:
window.<%=channelName%>.fontColorHilite = "#FFFFFF"; window.<%=channelName%>.menuHiliteBgColor = "#F68947"; window.<%=channelName%>.disableDrag = true; |
To invoke the menu:
<a href="javascript://" onClick="showMenu(window.<%=channelName%>);" title=" Click to view or modify channel options"><img src="<dt:scontent/>/enterprise/images/channel-button.gif" ></a> |
In the above example, when you click an image, the pull down menu displays. You may have to delete the compiled JSP class cache under PortalServer-DataDir/portal/portal-ID/desktop/compiled directory to force recompilation of the changed JSPs.