<%-- 
 Copyright 2003 Sun Microsystems, Inc. All rights reserved
 Use is subject to license terms.
--%> 
<%-- dynamicSingle.jsp  --%>

<%@ page import="com.sun.portal.providers.containers.jsp.single.JSPSingleContainerProvider" %>
<%@ page import="com.sun.portal.providers.context.ProviderContext" %>
<%@ taglib uri="/tld/desktop.tld" prefix="dt" %>
<%@ taglib uri="/tld/desktopSingle.tld" prefix="dtsingle" %>
<%@ taglib uri="/tld/desktopProviderContext.tld" prefix="dtpc" %>
<%@ taglib uri="/tld/jx.tld" prefix="jx" %>


<%@ page session="false" %>
<%
      JSPSingleContainerProvider scp =
      (JSPSingleContainerProvider)pageContext.getAttribute("JSPProvider");
      String parentContainer = scp.getProviderContext().getDefaultChannelName();
      String parentContainerProvider = scp.getProviderContext().getProviderName(parentContainer);
ProviderContext pc  = scp.getProviderContext();
Boolean isAuthless = new Boolean(true);
if (!pc.isAuthless(request)) {
    isAuthless = new Boolean(false);
}
Boolean isCommunity = new Boolean(false);
Boolean isHome = new Boolean(false);
String selectedChannel = null;
try {
    if (scp.getSelectedChannel(request) != null) {
        selectedChannel = (String)scp.getSelectedChannel(request);
        if (selectedChannel.equals("CommunityHomeContainer")) {
            isHome = new Boolean(true);
        } else {
            isCommunity = new Boolean(true);
        }
    }
} catch (Exception e) {
    if (isAuthless.booleanValue()) {
        selectedChannel = "CommunityAnonymousContainer";
    } else {
        selectedChannel = "CommunityHomeContainer";
        isHome = new Boolean(true);
    }
}
pageContext.setAttribute("selectedChannel", selectedChannel);
pageContext.setAttribute("isAuthless", isAuthless, PageContext.REQUEST_SCOPE);
pageContext.setAttribute("isHome", isHome, PageContext.REQUEST_SCOPE);
pageContext.setAttribute("isCommunity", isCommunity, PageContext.REQUEST_SCOPE);
%>
<dt:obtainContainer container="$JSPProvider">

<%
if ( parentContainer.equals("FrameTabContainer") ) {
%>
<jsp:include page="framePreferenceHeader.jsp" flush="true"/>
<%
} else if ( parentContainerProvider.equals("JSPTabContainerProvider") ) { 
%>
<jsp:include page="tabPreferenceHeader.jsp" flush="true"/>
<%
} else if (parentContainerProvider.equals("JSPTableContainerProvider") ){
%>
<jsp:include page="tablePreferenceHeader.jsp" flush="true"/>
<%
} else if (parentContainerProvider.equals("JSPSingleContainerProvider") ) {
%>
<jsp:include page="singlePreferenceHeader.jsp" flush="true"/>
<% 
} else {
%>
<jsp:include page="defaultHeader.jsp" flush="true"/>
<%
}
%>
<div id="container">
  <dtsingle:singleContainerProvider>
      <dtsingle:obtainSelectedChannelFromRequest>
        <div id="title"><dt:getTitle/></div>
        <dt:getContent/>
      </dtsingle:obtainSelectedChannelFromRequest>
  </dtsingle:singleContainerProvider>
</dt:obtainContainer>
<%@ include file="footer.html" %>
</div><!-- end container -->       
