<%@ page session="false" contentType="text/html;charset=UTF-8" %> 
<%@ page import="oracle.portal.provider.v2.*" %>
<%@ page import="oracle.portal.provider.v2.http.*" %>
<%@ page import="oracle.portal.provider.v2.render.*" %>
<%@ page import="oracle.portal.provider.v2.personalize.NameValuePersonalizationObject" %>


<%-- 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 --%>

<%
    PortletRenderRequest portletRequest = (PortletRenderRequest)
        request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    String title = request.getParameter("lotto_title");
    String sTitle = request.getParameter("lotto_short_title");
    String actionParam = PortletRendererUtil.getEditFormParameter(portletRequest);
    String action = request.getParameter(actionParam);
    NameValuePersonalizationObject data = (NameValuePersonalizationObject)PortletRendererUtil.getEditData(portletRequest);

    // Cancel automatically redirects to the page -- so will only receive 'OK' or 'APPLY'
    if (action != null) {
        data.setPortletTitle(title);
        data.setPortletShortTitle(sTitle);
        PortletRendererUtil.submitEditData(portletRequest, data);
        return;
    }

    // otherwise just render the form
    title = data.getPortletTitle();
    sTitle = data.getPortletShortTitle();
%>

<TABLE BORDER="0">
    <TR>
        <TD WIDTH="20%">
            <P ALIGN="RIGHT">Title:
        </TD>
        <TD WIDTH="80%">
            <INPUT TYPE="TEXT" NAME="lotto_title" VALUE="<%= title %>" SIZE="20">
        </TD>
    </TR>
    <TR>
        <TD WIDTH="20%">
            <P ALIGN="RIGHT">Short Title:
        </TD>
        <TD WIDTH="80%">
            <INPUT TYPE="TEXT" NAME="lotto_short_title" VALUE="<%= sTitle %>" SIZE="20" MAXLENGTH="20">
        </TD>
    </TR>
</TABLE>
