+

Search Tips   |   Advanced Search

head_extras.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 file may be overwritten in themes derived from the Portal theme to add extra elements
        to the head section of the HTML document. 
--%>

<%--  ******************  Page Metadata  ******************
        load and store references to page metadata parameters needed in rendering the page
--%> 
  <portal-logic:pageMetaData varname="pageMetaData" type="aggregated">
    <c:set var="renderMode" scope="request">
      <c:out value="${pageMetaData.RenderMode}" default="CSA"/>
    </c:set>   
  </portal-logic:pageMetaData>

  <portal-logic:pageMetaData varname="pageMetaData" type="aggregated">
    <c:set var="colorPalette" scope="request">
      <c:out value="${pageMetaData.colorPalette}" default="default"/>
    </c:set>   
  </portal-logic:pageMetaData>

<%--  ******************  CSA/SSA Switching  ******************  
        set flag to control whether theme will render with Server Side Aggregation (SSA) 
        or Client Side Aggregation (CSA) 
--%>
<c:if test="${ renderMode ne 'force_ssa' }" >
<%
        Cookie [] cookies = request.getCookies();
        Cookie cookie;
        boolean found = false;
        int cookieIndex = 0;
        while ( !found && cookies != null && cookieIndex < cookies.length ) {
            cookie = cookies[cookieIndex];
            if ( cookie.getName().equalsIgnoreCase( "com.ibm.wps.web2.ssaPages" ) ) {
                found = true;
                if ( cookie.getValue().indexOf( pageOidStr ) >= 0 ) {
                    %>
                        <c:set var="renderMode" scope="request" value="force_ssa" />
                    <%
                }
            }
            cookieIndex++;
        }
%>
</c:if>

<c:if test="${ !renderMode ne 'force_ssa' }" >
<%
{ 
    final com.ibm.portal.state.service.PortalStateManagerService psms = getStateManagerService( pageContext.getRequest(), pageContext.getResponse() );
    final com.ibm.portal.state.accessors.StateAccessorFactory saf = (com.ibm.portal.state.accessors.StateAccessorFactory) psms.getAccessorFactory( com.ibm.portal.state.accessors.StateAccessorFactory.class );
    final com.ibm.portal.state.accessors.StateAccessor sa = saf.getStateAccessor();
    final com.ibm.portal.state.StateHolder state = sa.getStateHolder( (javax.servlet.http.HttpServletRequest) pageContext.getRequest() );
    
    final com.ibm.portal.state.accessors.selection.SelectionAccessorFactory selFct = (com.ibm.portal.state.accessors.selection.SelectionAccessorFactory) psms.getAccessorFactory( com.ibm.portal.state.accessors.selection.SelectionAccessorFactory.class );
    final com.ibm.portal.state.accessors.selection.SelectionAccessor selAcc = selFct.getSelectionAccessor( state );
    final java.util.Map params = selAcc.getParameters();
    final String[] renderModeParam = (String[])params.get( "renderMode" );
    if ( renderModeParam != null && renderModeParam.length > 0 && renderModeParam[0].equals( "force_ssa" ) ) {
%>
    <c:set var="renderMode" scope="request" value="force_ssa" />
<%        
    }
}    
%>
</c:if>

<c:set var="isSSA" scope="request" value="${ renderMode eq 'force_ssa' or isSafari or (browser eq 'Moz' and (browserName ne 'Firefox' and browserName ne 'Opera') )}"/>
<c:set var="isCSA" scope="request" value="${!isSSA}"/>
<c:set var="renderPlaceholdersOnly" value="${isCSA}" />
<c:set var="renderModeDisplayString" scope="request">
        <c:choose>
                <c:when test="${isSSA}"> SSA</c:when>
                <c:otherwise> CSA</c:otherwise>
        </c:choose>
</c:set>

<%
        boolean isUserLoggedIn = ( request.getRemoteUser() != null );
        String proxyRoot = com.ibm.wps.services.config.Config.URI_CONTEXT_PATH + "/proxy/";
        String portalRoot = com.ibm.wps.services.config.Config.URI_CONTEXT_PATH + com.ibm.wps.services.config.Config.URI_SERVLET_PATH_PUBLIC;
        if ( isUserLoggedIn ) {
                portalRoot = com.ibm.wps.services.config.Config.URI_CONTEXT_PATH + com.ibm.wps.services.config.Config.URI_SERVLET_PATH_PROTECTED;
        }
        
        com.ibm.portal.resolver.service.PortalPocService pocSvc = pocHome.getPortalPocService(request, response);
        String contentHandlerRoot = "";
        String contentModelBlankURL = "";
        try {
                com.ibm.portal.resolver.accessors.url.PocURLFactory urlFct = pocSvc.getURLFactory();
                com.ibm.portal.resolver.PocURL url = urlFct.newURL(Boolean.FALSE);
                java.net.URI contentHandlerURI = new java.net.URI("nm:oid:wps.portal.root");
                url.setURI( contentHandlerURI );
                url.setMode("download");
                java.io.StringWriter sw = new java.io.StringWriter();
                url.writeDispose(sw);
                String pocUrl = sw.toString();
                int endIndex = pocUrl.indexOf("?");
                contentHandlerRoot = pocUrl.substring(0, endIndex > 0 ? endIndex : pocUrl.length());
                
                com.ibm.portal.resolver.PocURL url2 = urlFct.newURL(Boolean.TRUE);
                java.net.URI contentModelURI = new java.net.URI("cm:oid:-----oid-----");
                url2.setURI( contentModelURI );
                url2.setMode("view");
                java.io.StringWriter sw2 = new java.io.StringWriter();
                url2.writeDispose(sw2);
                contentModelBlankURL = sw2.toString();
                //contentModelBlankURL = sw.toString();
        }
        finally {
                pocSvc.dispose();
        }
        
      String xMethodOverrideEnabled = Boolean.toString(com.ibm.wps.services.config.Config.getParameters().getBoolean("x-method-override.enabled", false));
%>

<script language="JavaScript" type="text/javascript">
        var djConfig = { isDebug: false, debugAtAllCosts: false, debugContainerId: "_wptheme_dojoDebugConsole", openDebugWindowOnDemand: true, preventBackButtonFix: false };
        var _dummyURL = "<portal-logic:urlFindInTheme file="xsl/topNavRender.xsl" />";
        var themeRoot = _dummyURL.substring(0, _dummyURL.length-"xsl/topNavRender.xsl".length);
        var ibmPortalConfig =   { isDebug: false,        
                                          portalURI: "<%=portalRoot%>",
                                          themeRootURI: themeRoot,
                                          proxyURL: "<%=proxyRoot%>",
                                          portalPublicURI: "<%=com.ibm.wps.services.config.Config.URI_CONTEXT_PATH + com.ibm.wps.services.config.Config.URI_SERVLET_PATH_PUBLIC%>",
                                          portalProtectedURI: "<%=com.ibm.wps.services.config.Config.URI_CONTEXT_PATH + com.ibm.wps.services.config.Config.URI_SERVLET_PATH_PROTECTED%>",
                                          contentHandlerURI: "<%=contentHandlerRoot%>",
                                          contentModelBlankURL: "<%=contentModelBlankURL%>", 
                                          logoutURL: "<portal-navigation:url command="LogoutUser"/>",
                                          isUserLoggedIn: <%=isUserLoggedIn%>,
                                          navXslt: "<portal-logic:urlFindInTheme file="xsl/navigationRoot.xsl" />",
                                          mainMenuXslt: "<portal-logic:urlFindInTheme file="xsl/mainMenu.xsl" />",
                                          topNavXslt: "<portal-logic:urlFindInTheme file="xsl/topNavRender.xsl" />", 
                                          sideNavXslt: "<portal-logic:urlFindInTheme file="xsl/sideNavRender.xsl" />", 
                                          mainContentXslt: "<portal-logic:urlFindInTheme file="xsl/mainContentRenderLayout.xsl" />", 
                                          portletTriggerXslt: "<portal-logic:urlFindInTheme file="xsl/triggerPortletsRender.xsl" />", 
                                          portletContentsXslt: "<portal-logic:urlFindInTheme file="xsl/portletContents.xsl" />",        
                                          contextMenuXslt: "<portal-logic:urlFindInTheme file="xsl/contextMenu.xsl" />",
                                          extractPortletWindowIdsXslt: "<portal-logic:urlFindInTheme file="xsl/extractPortletWindowIds.xsl" />",
                                          topLevelLinksXslt: "<portal-logic:urlFindInTheme file="xsl/topLevelLinks.xsl" />",
                                          enforceSSAOnPortletLevel: true,
                                          xMethodOverride: <%=xMethodOverrideEnabled%>,
                      disableSemanticTagging: false,
                      selectedPageSSAbehavior: false
                                        };      
                                        
                                                
        var ibmPageActionIDs = <portal-logic:if loggedIn="no">null</portal-logic:if>
<portal-logic:if loggedIn="yes">        {       createPage : "ibm.portal.Page Properties", 
                                                                editLayout : "ibm.portal.Content", 
                                                                editPageProperties : "ibm.portal.Page Properties",
                                                                assignRoles     : "ibm.portal.Resource Permissions",
                                                                editAppProperties: "ibm.portal.Template and Application Properties",
                                                                editAppLayout: "ibm.portal.Template and Application Layout",
                                                                assignAppRoles: "ibm.portal.Application Roles",
                                                                assignAppMembers: "ibm.portal.Application Membership",
                                                                showAppPolicyStatus: "ibm.portal.Policy Status"
                                                        };      </portal-logic:if>      
        
        // NOTE: selfcare has been added to this list for use by the main menu actions. This var should be renamed to be more generic.
        // actually, should be refactored into an object rather than just a global var.                         
        var ibmPageActionWindowIDs = 
<portal-logic:if loggedIn="no">
                               { "wps.Selfcare": "<%=getFirstPortletWindowID( request, response, "wps.Selfcare" )%>"};
</portal-logic:if>
<portal-logic:if loggedIn="yes">        {
                                                                "ibm.portal.Page Properties": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Page Properties" )%>",
                                                                "ibm.portal.Content": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Content" )%>",
                                                                "ibm.portal.Resource Permissions": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Resource Permissions" )%>",
                                                                "ibm.portal.Template and Application Properties": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Template and Application Properties" )%>",
                                                                "ibm.portal.Template and Application Layout": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Template and Application Layout" )%>",
                                                                "ibm.portal.Application Roles": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Application Roles" )%>",
                                                                "ibm.portal.Application Membership": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Application Membership" )%>",
                                                                "ibm.portal.Policy Status": "<%=getFirstPortletWindowID( request, response, "ibm.portal.Policy Status" )%>",
                                                                "wps.Selfcare": "<%=getFirstPortletWindowID( request, response, "wps.Selfcare" )%>"
                                                         };
</portal-logic:if>
        
        var wpsBaseUrl = "<%=wpsBaseURL%>";
function getImagePath(/*String*/relPath) {
                return "<%=wpsBaseURL%>/themes/html/"+com.ibm.portal.aggregation.PORTAL_AGGREGATOR.page.getTheme()+"/"+relPath; 
        };
        if ( typeof( ibm ) == "undefined" ) { ibm = {} }
        if ( typeof( ibm.portal ) == "undefined" ) { ibm.portal = {} }  
        ibm.portal.ThemeImages = new function( ) {
                this.dotGifPath = "<%=wpsBaseURL%>/images/dot.gif";
                this.clearPixelPath = "<portal-logic:urlFindInTheme file='icons/ClearPixel.gif' />";
                this.contextLoadingPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/context_loading.gif' />";
                this.plusGifPath = "<portal-logic:urlFindInTheme file='images/sideNav/plus.gif' />";
                this.plusGifPathRTL = "<portal-logic:urlFindInTheme file='images/sideNav/plus_rtl.gif' />";
                this.minusGifPath = "<portal-logic:urlFindInTheme file='images/sideNav/minus.gif'/>";
                this.successGifPath = "<portal-logic:urlFindInTheme file='success.gif'/>";
                this.infoGifPath = "<portal-logic:urlFindInTheme file='info.gif'/>";
                this.warningGifPath = "<portal-logic:urlFindInTheme file='warning.gif'/>";
                this.errorGifPath = "<portal-logic:urlFindInTheme file='error.gif'/>";
                this.multipleMessagesGifPath = "<portal-logic:urlFindInTheme file='attention.gif'/>";

                if(bidiSupport.isRTL){
                        this.skinHelpIconPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/help_rtl.gif'/>";
                        this.skinHelpIconHoverPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/helpHover_rtl.gif'/>";
                }else{
                        this.skinHelpIconPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/help.gif'/>";
                        this.skinHelpIconHoverPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/helpHover.gif'/>";
                }
                this.skinWindowStateIconPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/windowState.gif'/>";
                this.skinWindowStateIconHoverPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/windowStateHover.gif'/>";
                this.skinMoveIconPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/move.gif'/>";
                this.skinMoveIconHoverPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/moveHover.gif'/>";
                this.skinRefreshIconPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/refresh.gif'/>";
                this.skinRefreshIconHoverPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/refreshHover.gif'/>";
                this.pageMenuIconPath = "<portal-logic:urlFindInTheme file='colors/${colorPalette}/menu_selected_disabled.gif'/>";
                this.pageMenuIconHoverPath = { black : "<portal-logic:urlFindInTheme file='colors/${colorPalette}/menu_selected_black.gif'/>", 
                                               white : "<portal-logic:urlFindInTheme file='colors/${colorPalette}/menu_selected_white.gif'/>",
                                               def : "<portal-logic:urlFindInTheme file='colors/${colorPalette}/menu_selected.gif'/>"};
                this.getImagePath = getImagePath;
}
</script>

<script type="text/javascript" src="/portal_dojo/dojo/dojo.js"></script>
<%-- In SSA mode, we only want to include a file which contains a subset of our full javascript code --%>
<c:if test="${isSSA}">
<script type="text/javascript" src="/portal_dojo/ibm/ibmClientModel.js"></script>

<%-- In SSA mode, if we're logged in, we want to clear the session cookie that stores the client-side state so subsequent
    requests into CSA mode will not revert to an old state --%>
<portal-logic:if loggedIn="yes">
<script type="text/javascript">
(function(){
    try {
        var sessionID = dojo.cookie( "JSESSIONID" );
        var token = dojo.cookie( "LtpaToken" );
        if(token && token.length > 20) token = token.substr(0, 20);
        var key = window.location.host + sessionID + token;
        //Encode this as if it will be in a url because certain characters are unsafe.
        key = encodeURIComponent( key );
        // Delete the cookie
        var exp = dojo.isFF ? "Thu, 01-Jan-70 00:00:01 GMT" : -1;
        dojo.cookie( key, null, {expires: exp, path: "/"} );
    }
    catch(e){
        // just a precaution so we don't break the overall theme in case something odd happens
    }
})();
</script>
</portal-logic:if>  
</c:if>
<c:if test="${isCSA}">
<script type="text/javascript" src="/portal_dojo/com/ibmCSA.js"></script>
</c:if>
<script type="text/javascript" src='<portal-logic:urlFindInTheme file="./js/portletsForServerSideOnly.js"/>'></script>


<c:if test="${isCSA}">
<%-- We only want to include the DND.js if we are in CSA mode since SSA includes this file
         by using the DNDHelper tag.  In addition, we only include CSA_DND.js in CSA mode. --%>
<script type="text/javascript" src="<%=com.ibm.wps.services.config.Config.URI_CONTEXT_PATH%>/dnd/DND.js"></script>
<script type="text/javascript" src="<%=com.ibm.wps.services.config.Config.URI_CONTEXT_PATH%>/dnd/CSA_DND.js"></script>
<%-- Need to load all the policy values into a global variable for access. We use 'ibmPortalCurrentThemePolicy". --%>
<%@ include file="./head_themePolicy.jspf" %>
</c:if>

<c:if test="${isCSA}">
<script type="text/javascript">
//<![CDATA[ 


    dojo.back.init();
        
        function wptheme_publishBookmark() {
                var url = com.ibm.portal.navigation.controller.NAVIGATION_CONTROLLER.getState().createLinkToCurrentState();
                dojo.byId( "bookmarkLink" ).innerHTML = "<input style='width: 100%' type='text' value='" + url + "' />";
                dojo.byId( "bookmarkLinkArea" ).style.display = "block";
        }
        
        function wptheme_closeBookmark() { 
                dojo.byId( "bookmarkLinkArea" ).style.display = "none";
        }
        
        com.ibm.portal.EVENT_BROKER.stateChanged.register( wptheme_closeBookmark );
        
var pageLoaded = false; 

function bootstrap() {
        var currentState = null;
        var prevUrl = com.ibm.portal.aggregation.backbutton.BACK_BUTTON_HANDLER.loadUrlFrag();
        var currentUrl = top.location.href;
        if(prevUrl == currentUrl) {
            currentState = com.ibm.portal.aggregation.backbutton.BACK_BUTTON_HANDLER.loadState();
            if ( currentState ) {
                ibm.portal.debug.text( "Loaded state from back button handler: " + dojox.data.dom.innerXML( currentState ) );
            }       
        }
        
        //Set flag to indicate CSA mode is active.
        document.isCSA = true;
        
        var selPath = loadSelectionPath();
        //If there's no state here, we need to get the current state from the server side apis.
        if ( !currentState ) {
                var stateManager = new com.ibm.portal.state.StateManager( ibmPortalConfig["contentHandlerURI"] );
                                var state = dojox.data.dom.createDocument( "<portal-core:stateSerialize escapeForJavascript="true" />" );
                                stateManager.reset( state );
                com.ibm.portal.navigation.controller.NAVIGATION_CONTROLLER.sendQueryParameters = true;
                
                var selectionAcc = stateManager.newSelectionAccessor();
                selectionAcc.setSelection( selPath[ selPath.length - 1 ] );
                currentState = stateManager.getState();
        }
        
        var selModel = new com.ibm.portal.services.NavigationSelectionModel( "cm:oid:"+selPath[ selPath.length - 1 ]);
        var policy = ibmPortalCurrentThemePolicy;
        
        var topNavStartLevel = policy["topNavigationStartLevel"];
        var topNavStopLevel = policy["topNavigationStopLevel"];
        
    <%-- construct theme components --%>                
        portalAggregator = com.ibm.portal.aggregation.PORTAL_AGGREGATOR;
        
        if ( policy["renderApplicationName"] ) {
                var desiredLevel = 1;
                if ( policy["renderBreadCrumbTrail"] ) {
                        desiredLevel = policy["breadCrumbStartLevel"];
                }
                <%
                // If application/template use second level
                if (getMetaData(request, response) != null) {
                %>
                        desiredLevel = 2;
                <%
                }
                %>


                portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.ApplicationName( "wptheme-applicationName", desiredLevel ) );
        }       
        
        if ( policy["renderTopNavigation"] ) {
                portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.TopNavigation( "wptheme-topnav", topNavStartLevel ) );
                
                if ( policy["topNavigationNumRows"] == 2 ) {
                        portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.TopNavigation( "wptheme-secondaryNav", topNavStartLevel + 1, true ) );
                }       
        }
        if ( policy["renderSideNavigation"] ) { 
                portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.SideNavigation( policy["sideNavigationStartLevel"] ) );
        }       
        if ( policy["renderBreadCrumbTrail"] ) {
                portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.CrumbTrail( policy["breadCrumbStartLevel"] ) );
        }       
        if ( policy["renderMainMenu"] ) {
                portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.MainMenu( "wp_main_menu" ) );
        }       
        if ( policy["renderContentPalette"] ) {
                var urlFactory = new com.ibm.portal.aggregation.theme.PaletteURLFactory();
                wptheme_InlinePalettes.urlFactory = function (context) { return urlFactory.createURL(context); };
        }
        
        portalAggregator.navigation.addNavigationElement( new com.ibm.portal.aggregation.theme.TopLevelLinks( "topLevelLinks", 4 ) );
<%
//NOTE: the following two lines must be added to the jspInit() method in head.jspf for the below code to work
//themeListHome = (com.ibm.portal.model.ThemeListHome) ctx.lookup("portal:service/model/ThemeList");
//skinListHome = (com.ibm.portal.model.SkinListHome) ctx.lookup("portal:service/model/SkinList");
//

// Determine theme resource root for loading theme resources
if (themeListHome != null) {
  com.ibm.portal.admin.ThemeList themeList = themeListHome.getThemeListProvider().getThemeList(request);
  %>
    //get the current theme uri for the page
    var selectedThemeUri = selModel.getSelectedNodeTheme();
        com.ibm.portal.navigation.controller.NAVIGATION_CONTROLLER.currentTheme = selectedThemeUri;
  
  if(selectedThemeUri == "default"){
          portalAggregator.page.setTheme("<%=themeList.getDefault().getResourceRoot()%>");
  }
  else {
    // This holds the page's selected theme oid until we transform it to the resource root
    var selectedTheme = selectedThemeUri.split("tl:oid:")[1].split("&mode")[0];
     
  <%
    if (themeList != null){
        java.util.Iterator themeIterator = themeList.iterator();
        com.ibm.portal.admin.Theme currTheme = null;
        while (themeIterator.hasNext()){
            currTheme = (com.ibm.portal.admin.Theme) themeIterator.next();
            %>
            if(selectedTheme == "<%=identification.serialize(currTheme.getObjectID())%>"){
                portalAggregator.page.setTheme("<%=currTheme.getResourceRoot()%>");
            }
            <%
        }
    }
%>
  }
<%
}

// load Skins
%>
    var skinResourceRoot2Id = new Object();
<%                          

if (skinListHome != null) {
  com.ibm.portal.admin.SkinList skinList = skinListHome.getSkinListProvider().getSkinList(request);
    if (skinList != null){
        java.util.Iterator skinIterator = skinList.iterator();
        com.ibm.portal.admin.Skin currSkin = null;
        String currXsltPath = null;
        while (skinIterator.hasNext()){
            currSkin = (com.ibm.portal.admin.Skin) skinIterator.next();
            currXsltPath = "xsl/"+currSkin.getResourceRoot()+".xsl";
            %>
    skinResourceRoot2Id["<%=currSkin.getResourceRoot()%>"] = "sl:oid:<%=identification.serialize(currSkin.getObjectID())%>";            
            <%
        }
    }
}
%>

    portalAggregator.page.addSkin(new com.ibm.portal.aggregation.IbmSkin("IBM",skinResourceRoot2Id["IBM"],"<portal-logic:urlFindInTheme file="xsl/IBM.xsl" />"),true);
    portalAggregator.page.addSkin(new com.ibm.portal.aggregation.Skin("NoSkin",skinResourceRoot2Id["NoSkin"],"<portal-logic:urlFindInTheme file="xsl/NoSkin.xsl" />"),false);
    portalAggregator.page.addSkin(new com.ibm.portal.aggregation.Skin("ThinSkin",skinResourceRoot2Id["ThinSkin"],"<portal-logic:urlFindInTheme file="xsl/NoSkin.xsl" />"),false);

    var portalController = com.ibm.portal.navigation.controller.NAVIGATION_CONTROLLER;
    portalController.currentThemePolicy = "<%=portalThemePolicyPath%>";
    portalController.setStateDocument( currentState );
}

dojo.addOnLoad( bootstrap );

function loadSelectionPath() {
        ibm.portal.debug.entry( "loadSelectionPath" );
        var selPath = new Array();
        <% 
                if (navigationSelectionModelHome != null) {
                  com.ibm.portal.model.NavigationSelectionModelProvider provider = navigationSelectionModelHome.getNavigationSelectionModelProvider();
                  com.ibm.portal.navigation.NavigationSelectionModel model = provider.getNavigationSelectionModel(request, response);
                  java.util.Iterator iterator = model.iterator();
                  int startLevel = themePolicy.getBreadCrumbStartLevel();
                  // we limit the number of levels to render to better fit on the page
                  int maxItems = themePolicy.getBreadCrumbMaxLevels();
                  int currLevel = 0;
                  int numItems = 0;
                  while (iterator.hasNext())
                  {
                    com.ibm.portal.navigation.NavigationNode node = (NavigationNode) iterator.next(); 
                        com.ibm.portal.content.ContentNodeType nodeType = node.getContentNode().getContentNodeType();
                %> 
                
                <c-rt:if test="<%=currLevel >= startLevel %>">
                        selPath.push( "<%=identification.serialize(node.getObjectID())%>" );
                </c-rt:if> 
                <%  currLevel ++;
                  } // end while
                }
        %>
        
        
        ibm.portal.debug.exit( "loadSelectionPath", [ selPath ] );
        return selPath;
}

function getSelectedPage() {
    var state = com.ibm.portal.navigation.controller.NAVIGATION_CONTROLLER.getState();
    var currentSelectedNodeOid = null;
    
    if(state != null){
        var currentSelectedNode = state.selectionModel.getSelectedNode();
        var currentSelectedNodeOidFull = currentSelectedNode.URI;
        currentSelectedNodeOid = currentSelectedNodeOidFull.substring(7);
        
    }
    
    return currentSelectedNodeOid;
}

function goToLogin() {
        var loginPageNode = com.ibm.portal.services.NAVIGATION_MODEL.getNode("wps.Login");
        if(loginPageNode != null){
            com.ibm.portal.navigation.controller.NAVIGATION_CONTROLLER.setSelection(loginPageNode.URI, null, null, com.ibm.portal.navigation.controller.CONSTANTS.forceSsaRenderMode)
        }
        else {
            //TODO: log error
        }
}

function toggleDebugConsole(/*String?*/traceStr) {
        if ( !ibmPortalConfig.isDebug ) {
            //not currently logging
            ibmPortalConfig.isDebug = true;
            /*if ( traceStr ) {
                ibm.portal.debug.setTrace( traceStr );
            }*/    
            com.ibm.portal.debug.NewWindow.startLogging();
        }
        else {
            //already logging
            ibmPortalConfig.isDebug = false;
            //ibm.portal.debug.setTrace( null );
        }        
}
function toggleIframe() {
        if ( dojo.byId("debugForm").iframeEnabled.checked ) {
                document.getElementById('com.ibm.wps.iframe').style.visibility="visible";       
        }
        else {
                document.getElementById('com.ibm.wps.iframe').style.visibility="hidden";
        }
}   
//]]>     
</script>
</c:if>

<%@ include file="./CSAProperties.jspf" %>

<%-- login function.  It's different for client-side vs. server-side aggregation. Define it here so we do not have to duplicate banner_toolbar.jspf --%>
<c:if test="${isCSA}">
        <c:set var="loginOnClick" value="javascript:goToLogin(); return false;"/>
</c:if>
<%-- publish bookmark function.  Define it here so we do not have to duplicate banner_toolbar.jspf --%>
<c:set var="publishBookmarkOnClick" value="javascript:wptheme_publishBookmark(); return false;"/>