sideNav.jspf
<%-- Licensed Materials - Property of IBM, 5724-E76, (C) Copyright IBM Corp. 2001, 2004, 2006 - All Rights reserved. See notes in Default.jsp for information regarding editing theme JSP fragments. --%> <%-- This JSP renders the navigation bar on the left side of the page. By default, this will continue rendering the navigation where the previous navigation entity left off. --%> <c-rt:if test = "${themePolicy.renderSideNavigation}"> <portal-logic:if navigationAvailable="yes" screen="Home,LoggedIn,LoggedOut"> <portal-navigation:navigation startLevel="${themePolicy.sideNavigationStartLevel}"> <% int previousNavLevel=0;%> <portal-navigation:navigationLoop> <%-- basic logic required: if node is selected give selected style if node has children, show expand/collapse if node is unselectable(label), don't render anchor if node is external url, open in new window if navlevel changed, open/close uls as needed. --%> <% // variables boolean isNodeSelected = wpsSelectionModel.isNodeSelected(wpsNavNode); String rowCssClass = isNodeSelected ? .wpsNavItem selected" : "wpsNavItem"; boolean nodeHasChildren = wpsNavModel.hasChildren(wpsNavNode); boolean isExpanded = ((Boolean)((com.ibm.portal.state.StateModel)wpsNavModel).getState(wpsNavNode, com.ibm.portal.state.StateType.EXPANSION)).booleanValue() ; boolean openInNewWindow = com.ibm.portal.content.ContentNodeType.EXTERNALURL.equals(wpsNavNode.getContentNode().getContentNodeType()); boolean isLabel = com.ibm.portal.content.ContentNodeType.LABEL.equals(wpsNavNode.getContentNode().getContentNodeType()); int currentNavLevel = wpsNavLevel.intValue(); %> <%-- ****************** open/close nav levels ****************** --%> <c-rt:choose> <%-- new unordered list is created when current nav level is higher than previous nav level--%> <c-rt:when test="<%=currentNavLevel > previousNavLevel%>"><% for(int i = currentNavLevel; i > previousNavLevel; i--){%> <ul <% if(previousNavLevel==0){%> class="wpsSideNav"<%}%> > <%} %></c-rt:when> <%-- unordered list is closed and list item that the list is placed inside is also closed--%> <c-rt:when test="<%=currentNavLevel < previousNavLevel %>"><% for(int i = currentNavLevel; i < previousNavLevel; i++){%></ul></li><%} %></c-rt:when> </c-rt:choose> <li <%if (isNodeSelected) { %> id="portalSelectedNode" onmouseover="showPageAffordance(); return false;" onmouseout="hidePageAffordance(); return false;" <% } %> > <span class="<%=rowCssClass%>"> <%-- ****************** render expand/collapse ****************** --%> <c-rt:choose> <c-rt:when test="<%=nodeHasChildren && isExpanded %>"> <a href='<portal-navigation:navigationUrl type="collapse"/>'><img alt="<portal-fmt:text key='link.collapse' bundle='nls.engine'/>" title="<portal-fmt:text key='link.collapse' bundle='nls.engine'/>" class="wpsNavIcon" src="<portal-logic:urlFindInTheme file='images/sideNav/minus.gif' />"></a> </c-rt:when> <c-rt:when test="<%=nodeHasChildren && !isExpanded %>"> <a href='<portal-navigation:navigationUrl type="expand"/>'><img alt="<portal-fmt:text key='link.expand' bundle='nls.engine'/>" title="<portal-fmt:text key='link.expand' bundle='nls.engine'/>" class="wpsNavIcon" src="<portal-logic:urlFindInTheme file='images/sideNav/plus.gif' />"></a> </c-rt:when> <c-rt:otherwise> <img alt="" class="wpsNavIcon" src="<%=wpsBaseURL%>/images/dot.gif" /> </c-rt:otherwise> </c-rt:choose> <%-- ****************** render node ****************** --%> <c-rt:choose> <c-rt:when test="<%=isLabel%>"> <span class="wpsNavLevel<%=wpsNavLevel%>"><portal-fmt:title/></span> </c-rt:when> <c-rt:otherwise> <a class="<%=rowCssClass%> wpsNavLevel<%=wpsNavLevel%>" href="<portal-navigation:navigationUrl type="launch"/>" <% if (openInNewWindow) {%>target="_blank"<% } %> <% if (isNodeSelected) { %>onfocus="showPageAffordance()" <% } %> > <portal-fmt:title/> </a> <c-rt:if test = "${themePolicy.renderContextMenus}"> <% if(isNodeSelected){%> <a id="menu_<%=pageOidStr%>" href="javascript:void(0);" onclick="javascript:showPageMenu(this); return false;" onkeypress="javascript:accessibleShowPageMenu(event);" style="cursor: default;" > <img id="menu_<%=pageOidStr%>_img" class="menuLinkSideNav" src='<portal-logic:urlFindInTheme file="images/topNav/menu_selected_disabled.gif"/>' alt="<portal-fmt:text bundle='nls.engine' key='link.page.actions' />" title="<portal-fmt:text bundle='nls.engine' key='link.page.actions' />" /> </a> <script> //Register the context menu so that the menu can be enabled/disabled. javascriptEventController.register( "menu_<%=pageOidStr%>" ); //Register the li with the mouseover events to load the menu. javascriptEventController.register( "portalSelectedNode" ); </script> <% } %> <%-- ****************** Show icon for closing transient pages ****************** --%> <portal-dynamicui:closePage> <a href="<% closePageURL.write(escapeXmlWriter); %>" > <img class="menuLinkSideNav" src="<portal-logic:urlFindInTheme file='images/NavigationClose.gif'/>" border="0" align="absmiddle"> </a> </portal-dynamicui:closePage> </c-rt:if> </c-rt:otherwise> </c-rt:choose> </span> <%-- the list item is closed if the node does not have children or it is not expanded --%> <c-rt:if test="<%=(!nodeHasChildren || !isExpanded)%>"> </li> </c-rt:if> <%previousNavLevel = currentNavLevel;%> </portal-navigation:navigationLoop> <%-- When no more nodes are left to be processed by the nav loop, it exits but leaves the lists and list items open, there is a check to see if there is more than one level, if true, the lists and list items are closed. There is a </ul> tag after the for loop to close the initial list that is opened. This initial <ul> is created when a side nav page is created --%> <c-rt:if test="<%=previousNavLevel > 0 %>"><% for(int i = previousNavLevel; i > 1; i--){%></ul></li><%} %></ul></c-rt:if> </portal-navigation:navigation> </portal-logic:if> <portal-theme-ext:themeExtension id="com.ibm.portal.theme.plugin.VerticalPageBarItems" > <portal-theme-ext:themeExtensionLoop> <portal-theme-ext:themeExtensionRenderInclude /> </portal-theme-ext:themeExtensionLoop> </portal-theme-ext:themeExtension> </c-rt:if>