<%-- 
  Copyright 2003 Sun Microsystems, Inc. All rights reserved 
  Use 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" %>

<%@ page session="false" %>

<%
      String provider = request.getParameter("provider");
      String containerName = request.getParameter("containerName");
      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 ( 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"/>
<%
}
%>
<%@ include file="isPageCompletelyLoaded.js" %>

<FORM ACTION="<dtpc:getDesktopURL/>"  onSubmit="return isPageCompletelyLoaded()" 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="containerName" SIZE=-1 VALUE="<%=containerName%>">
<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 ( 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>

<%@ include file="pageLoaded.js" %>
