<%-- 
  Copyright 2001 Sun Microsystems, Inc.  All rights reserved. 
  PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms. 
--%> 
<%-- edit.jsp  --%>

<%@ page import="com.sun.portal.providers.containers.jsp.single.JSPSingleContainerProvider" %>
<%@ taglib uri="/tld/desktop.tld" prefix="dt" %>
<%@ taglib uri="/tld/jx.tld" prefix="jx" %>
<%@ taglib uri="/tld/desktopContainerProviderContext.tld" prefix="dtcpc" %>
<%@ taglib uri="/tld/desktopProviderContext.tld" prefix="dtpc" %>
<%@ taglib uri="/tld/desktopTheme.tld" prefix="dttheme" %>

<%@ page session="false" %>

<%
      String provider = request.getParameter("provider");
      String targetChannel = request.getParameter("targetprovider");
      pageContext.setAttribute( "targetChannel", targetChannel );
      JSPSingleContainerProvider scp = (JSPSingleContainerProvider)pageContext.getAttribute("JSPProvider");
      String parentContainer = scp.getProviderContext().getDefaultChannelName();
      String parentContainerProvider = scp.getProviderContext().getProviderName(parentContainer);
      String errorMsg = scp.getProviderContext().decodeURLParameter(request.getParameter("error"));
      StringBuffer args = new StringBuffer(64);
          args.append("?")
                  .append(request.getQueryString());
          String editArgs = args.toString(); 
%>

<dt:obtainContainer container="$JSPProvider">
  <dtcpc:containerProviderContext>
    <dtcpc:obtainChannelFromContainer channel="$targetChannel">

      <dtpc:providerContext>
        <dt:getEditType id="edittype"/>

        <jx:choose>
          <jx:when test="$edittype == 4">
            <dt:getEdit/>
          </jx:when>
          <jx:otherwise>
<%
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"/>
<%
}
%>

<FORM ACTION="dt" TARGET="_parent" NAME="edit_form" METHOD=POST ENCTYPE="application/x-www-form-urlencoded">
<INPUT TYPE=HIDDEN NAME="action" SIZE=-1 VALUE="process">
<INPUT TYPE=HIDDEN NAME="provider" SIZE=-1 VALUE="<%=provider%>">
<INPUT TYPE=HIDDEN NAME="targetprovider" SIZE=-1 VALUE="<%=targetChannel%>">
<INPUT TYPE=HIDDEN NAME="editArgs" SIZE=-1 VALUE="<%=editArgs%>">
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=3 WIDTH="100%">

<%
if (errorMsg != null) {
%>
<TR><TD WIDTH="100%" VALIGN=TOP>
<CENTER>
    <font size="+0" color="red">
    <hr>
    <b>
<%=errorMsg%>
    </b>
    <hr>
    <br>
  </font>
<BR>
</TD>
</TR>
<%
}
%>

<TR>
<TD WIDTH="100%" VALIGN=TOP>
<CENTER>
<FONT SIZE="+2" FACE="sans-serif">
             <dt:getEdit/>
</CENTER>
</TD>
</TR>
</TABLE>
<BR>
<CENTER>
<FONT SIZE=+0 FACE="sans-serif">
<INPUT TYPE=SUBMIT NAME="Submit" VALUE="Finished" CLASS="button">
<INPUT TYPE=BUTTON OnClick="top.document.location.href='<dtpc:getDesktopURL/>'" VALUE="Cancel" CLASS="button">
</font>
</CENTER>
<br>
<P>
</FORM>
<BR>

<%
if ( parentContainer.equals("FrameTabContainer") ) {
%>
<jsp:include page="framePreferenceMenubar.jsp" flush="true"/>
<%
} else if ( parentContainerProvider.equals("JSPTabContainerProvider") ) { 
%>
<jsp:include page="tabPreferenceMenubar.jsp" flush="true"/>
<%
} else if (parentContainerProvider.equals("JSPTableContainerProvider") ){
%>
<jsp:include page="tablePreferenceMenubar.jsp" flush="true"/>
<%
} else if (parentContainerProvider.equals("JSPSingleContainerProvider") ) {
%>
<jsp:include page="singlePreferenceMenubar.jsp" flush="true"/>
<% 
} else {
%>
<jsp:include page="defaultMenubar.jsp" flush="true"/>
<%
}
%>
<%@ include file="footer.html" %>
          </jx:otherwise>
        </jx:choose>
      </dtpc:providerContext>
    </dtcpc:obtainChannelFromContainer>
  </dtcpc:containerProviderContext>
</dt:obtainContainer>
