<%@ page import="oracle.portal.provider.v1.*,oracle.portal.provider.v1.http.*" session="false" %>

<%-- This page both displays the customization form and processes it.
     We display the form if there isn't a submitted title parameter,
     else we apply the changes --%>

<%
    response.setContentType("text/html;charset=UTF-8"); 
    PortletRenderRequest portletRequest = (PortletRenderRequest)
        request.getAttribute(HttpProvider.PORTLET_RENDER_REQUEST);
    String title = request.getParameter("mTitle");
    String action = request.getParameter("mAction");
    BaseCustomization data = null;

    // Cancel automatically redirects to the page -- so will only receive 'OK' or 'APPLY'
    if (action != null) {
        data = (BaseCustomization) PortletRendererUtil.getEditData(portletRequest);
        data.setTitle(title);
        PortletRendererUtil.submitEditData(portletRequest, data);
        if (action.equalsIgnoreCase("OK")) {
            response.sendRedirect(portletRequest.getBackURL());
            return;
        } else if (action.equalsIgnoreCase("APPLY")) {
            response.sendRedirect(portletRequest.getPageURL());
            return;
        }
    }

    // otherwise just render the form


    data = (BaseCustomization) PortletRendererUtil.getEditData(portletRequest);
    title = data.getTitle();
%>

<% PortletRendererUtil.renderCustomizeFormHeader(portletRequest, out, null, "mAction", null, null); %>

<p> Title:  <INPUT TYPE="text" NAME="mTitle" VALUE="<%= title %>" />
<% PortletRendererUtil.renderCustomizeFormFooter(portletRequest, out); %>

</FORM>
 