+

Search Tips   |   Advanced Search

sideNav.jspf

 

<%-- Licensed Materials - Property of IBM, 5724-E76, (C) Copyright IBM Corp. 2001, 2004, 2006 - All Rights reserved.

	NOTE: 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.
--%>

<%--
    The navigation attributes can be overidden by the page meta data.
    Instead of using the themePolicy directly, use EL variables initialized to the page meta-data values with the
    theme policy values as a default in case the attributes aren't specified in the page meta-data.    
--%>
<portal-logic:pageMetaData varname="pageMetaData">
    <c:set var="renderSideNavigation">
        <c:out value='${pageMetaData["com.ibm.portal.themepolicy.renderSideNavigation"]}' default="${themePolicy.renderSideNavigation}"/>
    </c:set>
    <c:set var="sideNavigationStartLevel">
        <c:out value='${pageMetaData["com.ibm.portal.themepolicy.sideNavigationStartLevel"]}' default="${themePolicy.sideNavigationStartLevel}"/>
    </c:set>
</portal-logic:pageMetaData>

<c-rt:if test = "${renderSideNavigation}">
<portal-logic:if navigationAvailable="yes" screen="Home,LoggedIn,LoggedOut">
<portal-navigation:navigation  startLevel="${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 ? "wptheme-sideNavItem wptheme-sideNavSelected" : "wptheme-sideNavItem";
	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();
%>
<c:set var="sideNavItemTitle"><portal-fmt:title/></c:set>
<%--  ******************  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="wptheme-sideNav"<%}%> >
<%} %></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="wptheme_ContextMenuUtils.sideNavPageMenu.showAffordance(); return false;" onmouseout="wptheme_ContextMenuUtils.sideNavPageMenu.hideAffordance(); 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="wptheme-sideNavIcon" 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="wptheme-sideNavIcon" src="<portal-logic:urlFindInTheme file='<%=isRTL ? "images/sideNav/plus_rtl.gif" : "images/sideNav/plus.gif" %>' />"></a>
</c-rt:when>
<c-rt:otherwise>
	<img alt="" class="wptheme-sideNavIcon" src="<%=wpsBaseURL%>/images/dot.gif" />
</c-rt:otherwise>
</c-rt:choose>

<%--  ******************  render node  ******************  --%>
<c-rt:choose>
<c-rt:when test="<%=isLabel%>">
	<span class="wptheme-sideNavLabel wptheme-sideNavLevel<%=wpsNavLevel%>"><c:out value='${sideNavItemTitle}' escapeXml='true' /></span>
</c-rt:when>
<c-rt:otherwise>
		<a class="<%=rowCssClass%> wptheme-sideNavLevel<%=wpsNavLevel%>" href='<portal-navigation:navigationUrl type="launch"/>' <% if (isNodeSelected) { %>onfocus="wptheme_ContextMenuUtils.sideNavPageMenu.showAffordance();" <% } %> >
			<c:out value='${sideNavItemTitle}' escapeXml='true' />
		</a>
  	  	<c-rt:if test = "${themePolicy.renderContextMenus}">
		<% if(isNodeSelected){%>	  
			<a id="wptheme_selected_page_menu" href="javascript:void(0);" 
			   onclick="javascript:wptheme_ContextMenuUtils.sideNavPageMenu.show(); return false;"
			   onkeypress="javascript:wptheme_ContextMenuUtils.sideNavPageMenu.show(event); return true;"
			   style="cursor: default;"
			   >
			<img id="wptheme_selected_page_menu_img" class="wptheme-sideNavMenuLink" src='<portal-logic:urlFindInTheme file="colors/${colorPalette}/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 type="text/javascript">
			//Register the context menu so that the menu can easily be enabled/disabled.
			javascriptEventController.register( "wptheme_selected_page_menu" );
			//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="wptheme-sideNavMenuLink" 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>