<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>
<%
java.util.ArrayList list = new java.util.ArrayList();
list.add(new org.apache.struts.example.LabelValueBean("Skin1", "skin1"));
list.add(new org.apache.struts.example.LabelValueBean("Skin2", "skin2"));
list.add(new org.apache.struts.example.LabelValueBean("Skin3", "skin3"));
pageContext.setAttribute("skins", list);
%>
<bean:define id="bool_action" name="registrationForm" property="action" scope="request"/>
<% String string_action; if (bool_action.equals("Create")) string_action="true"; else string_action="false"; %>
<logic:equal name="registrationForm" property="action"
scope="request" value="Edit">
<app:checkLogon/>
<bean:define id="title" value="registration.title.edit"/>
</logic:equal>
<logic:equal name="registrationForm" property="action"
scope="request" value="Create">
<bean:define id="title" value="registration.title.create"/>
</logic:equal>
<layout:html key='<%= pageContext.findAttribute("title").toString() %>' styleClass="FORM">
<font color="white" bgcolor="red"><html:errors property="org.apache.struts.action.GLOBAL_ERROR"/></font>
<layout:form action="/saveRegistration.do" styleClass="FORM" key="registration.title" reqCode="save">
<logic:equal name="registrationForm" property="action"
scope="request" value="Create">
<layout:field key="prompt.username" property="username" size="16" maxlength="16" styleClass="LABEL" isRequired="true"/>
</logic:equal>
<logic:equal name="registrationForm" property="action"
scope="request" value="Edit">
<layout:field key="prompt.username" property="username" size="16" maxlength="16" access="READSEND" styleClass="LABEL"/>
</logic:equal>
<layout:field key="prompt.password" property="password" size="16" maxlength="16" type="password" styleClass="LABEL" isRequired='<%= string_action%>'/>
<layout:field key="prompt.password2" property="password2" size="16" maxlength="16" type="password" styleClass="LABEL" isRequired="<%= string_action%>"/>
<layout:field key="prompt.fullName" property="fullName" size="50" styleClass="LABEL" isRequired="true"/>
<layout:field key="prompt.fromAddress" property="fromAddress" size="50" styleClass="LABEL" isRequired="true"/>
<logic:equal name="registrationForm" property="action" value="Edit">
<layout:field key="prompt.replyToAddress" property="replyToAddress" size="50" styleClass="LABEL" type="email">
<%------- here we add a button allowing the user to select his replyToAddress
in function of its addresses in another page, then to go back to this form
to do that we use a Dispatch Action with parameter "selectReplyTo"
we use the cancel button to be use the form is not validated
the session context is use for the form so that we get the same form when back
after the choice of the repltyToAddress
-----%>
<layout:cancel reqCode="selectReplyTo" value="..."/>
</layout:field>
</logic:equal>
<logic:equal name="registrationForm" property="action" value="Create">
<layout:field key="prompt.replyToAddress" property="replyToAddress" size="50" styleClass="LABEL" type="email"/>
</logic:equal>
<layout:select key="prompt.css" property="value" select="css" collection="skins" labelProperty="label" styleClass="LABEL"/>
<%------------------------------------ can be replace by (see registration2.jsp --------------------------------------------
<layout:radios key="prompt.css" property="css" styleClass="LABEL">
<layout:options collection="skins" property="value" labelProperty="label"/>
</layout:radios>
--%>
<layout:formActions>
<layout:submit>
<bean:message key="button.save"/>
</layout:submit>
<layout:submit reqCode="edit">
<%-- as we save the form state when we choose the replyToAddress,
we ask for a real reset by calling the edit action --%>
<bean:message key="button.reset"/>
</layout:submit>
<layout:cancel>
<bean:message key="button.cancel"/>
</layout:cancel>
</layout:formActions>
</layout:form>
<logic:equal name="registrationForm" property="action"
scope="request" value="Edit">
<layout:collection title="heading.subscriptions" property="subscriptions" name="user" styleClass="SUBSCRIPTION" width="80%">
<layout:collectionItem title="heading.host" property="host"/>
<layout:collectionItem title="heading.user" property="username"/>
<layout:collectionItem title="heading.type" property="type"/>
<layout:collectionItem title="heading.autoConnect" property="autoConnect"/>
<layout:collectionItem title="heading.action" param="host" url="editSubscription.do?action=Delete&host="><bean:message key="registration.deleteSubscription"/></layout:collectionItem>
<layout:collectionItem title="heading.action" param="host" url="editSubscription.do?action=Edit&host="><bean:message key="registration.editSubscription"/></layout:collectionItem>
</layout:collection>
<%-- <layout:collection> is replaced by <layout:list> in registration2.jsp --%>
<tr><td><app:linkUser page="/editSubscription.do?action=Create">
<bean:message key="registration.addSubscription"/>
</app:linkUser></td></tr>
>/font>
</logic:equal>
</layout:html>