From f2735513b39f2050d35322fa2b3f099f4c9d4009 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Fri, 13 May 2016 11:11:18 +0200
Subject: [PATCH] Continued generally: - moved email address (with repeat) to
 own templates, one for registration, one for login (change email address) -
 added validator for above data - some other fixes, e.g. wrong controller
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Signed-off-by: Roland Häder <roland@mxchange.org>
---
 web/WEB-INF/templates/generic/message_box.tpl |  6 ++--
 .../generic/profile_mode_selection_box.tpl    |  2 +-
 .../guest_email_address_repeat_fields.tpl     | 32 +++++++++++++++++++
 .../register/guest_form_register_page1.tpl    | 24 +-------------
 .../register/guest_form_register_single.tpl   | 24 +-------------
 ...ser_change_email_address_repeat_fields.tpl | 32 +++++++++++++++++++
 web/user/login_change_email_address.xhtml     | 26 ++-------------
 7 files changed, 71 insertions(+), 75 deletions(-)
 create mode 100644 web/WEB-INF/templates/guest/guest_email_address_repeat_fields.tpl
 create mode 100644 web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl

diff --git a/web/WEB-INF/templates/generic/message_box.tpl b/web/WEB-INF/templates/generic/message_box.tpl
index de486b63..1bfa9469 100644
--- a/web/WEB-INF/templates/generic/message_box.tpl
+++ b/web/WEB-INF/templates/generic/message_box.tpl
@@ -1,7 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
-	lang="#{localizationController.language}" xml:lang="#{localizationController.language}"
+<ui:composition
 	xmlns="http://www.w3.org/1999/xhtml"
 	  xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
 	  xmlns:h="http://xmlns.jcp.org/jsf/html"
@@ -25,4 +23,4 @@
 			</div>
 		</ui:fragment>
 	</div>
-</html>
+</ui:composition>
diff --git a/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl b/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl
index 30799916..680c63eb 100644
--- a/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl
+++ b/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl
@@ -6,6 +6,6 @@
 	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 
 	<h:selectOneMenu styleClass="select" id="profileMode" value="#{userController.userProfileMode}">
-		<f:selectItems value="#{profileModeController.allProfileModes}" var="m" itemValue="#{m}" itemLabel="#{msg[m.messageKey]}" />
+		<f:selectItems value="#{profileModeController.allProfileModes}" var="mode" itemValue="#{mode}" itemLabel="#{msg[mode.messageKey]}" />
 	</h:selectOneMenu>
 </ui:composition>
diff --git a/web/WEB-INF/templates/guest/guest_email_address_repeat_fields.tpl b/web/WEB-INF/templates/guest/guest_email_address_repeat_fields.tpl
new file mode 100644
index 00000000..a3a69c0c
--- /dev/null
+++ b/web/WEB-INF/templates/guest/guest_email_address_repeat_fields.tpl
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+	xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+	xmlns:h="http://xmlns.jcp.org/jsf/html"
+	xmlns:f="http://xmlns.jcp.org/jsf/core"
+	>
+
+	<div class="table_row">
+		<div class="table_left">
+			<h:outputLabel for="emailAddress" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL}" />
+		</div>
+
+		<div class="table_right">
+			<h:inputText styleClass="input" id="emailAddress" size="20" maxlength="255" value="#{contactController.emailAddress}" required="true" validator="EmailAddressValidator" />
+		</div>
+
+		<div class="clear"></div>
+	</div>
+
+	<div class="table_row">
+		<div class="table_left">
+			<h:outputLabel for="emailAddressRepeat" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL_REPEAT}" />
+		</div>
+
+		<div class="table_right">
+			<h:inputText styleClass="input" id="emailAddressRepeat" size="20" maxlength="255" value="#{contactController.emailAddressRepeat}" required="true" validator="EmailAddressValidator" />
+		</div>
+
+		<div class="clear"></div>
+	</div>
+</ui:composition>
diff --git a/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl b/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl
index a1c7223d..b8106fdf 100644
--- a/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl
+++ b/web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl
@@ -30,29 +30,7 @@
 						</div>
 					</ui:fragment>
 
-					<div class="table_row">
-						<div class="table_left">
-							<h:outputLabel for="emailAddress" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL}" />
-						</div>
-
-						<div class="table_right">
-							<h:inputText styleClass="input" id="emailAddress" size="20" maxlength="255" value="#{contactController.emailAddress}" required="true" />
-						</div>
-
-						<div class="clear"></div>
-					</div>
-
-					<div class="table_row">
-						<div class="table_left">
-							<h:outputLabel for="emailAddressRepeat" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL_REPEAT}" />
-						</div>
-
-						<div class="table_right">
-							<h:inputText styleClass="input" id="emailAddressRepeat" size="20" maxlength="255" value="#{contactController.emailAddressRepeat}" required="true" />
-						</div>
-
-						<div class="clear"></div>
-					</div>
+					<ui:include src="/WEB-INF/templates/guest/guest_email_address_repeat_fields.tpl" />
 
 					<ui:fragment rendered="#{userController.isUserNameRequired()}">
 						<div class="para"></div>
diff --git a/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl b/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl
index d4e1e9d8..043babe7 100644
--- a/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl
+++ b/web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl
@@ -31,29 +31,7 @@
 						</div>
 					</ui:fragment>
 
-					<div class="table_row">
-						<div class="table_left">
-							<h:outputLabel for="emailAddress" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL}" />
-						</div>
-
-						<div class="table_right">
-							<h:inputText styleClass="input" id="emailAddress" size="20" maxlength="255" value="#{contactController.emailAddress}" required="true" />
-						</div>
-
-						<div class="clear"></div>
-					</div>
-
-					<div class="table_row">
-						<div class="table_left">
-							<h:outputLabel for="emailAddressRepeat" value="#{msg.GUEST_REGISTRATION_ENTER_EMAIL_REPEAT}" />
-						</div>
-
-						<div class="table_right">
-							<h:inputText styleClass="input" id="emailAddressRepeat" size="20" maxlength="255" value="#{contactController.emailAddressRepeat}" required="true" />
-						</div>
-
-						<div class="clear"></div>
-					</div>
+					<ui:include src="/WEB-INF/templates/guest/guest_email_address_repeat_fields.tpl" />
 
 					<ui:fragment rendered="#{userController.isUserNameRequired()}">
 						<div class="para"></div>
diff --git a/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl b/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl
new file mode 100644
index 00000000..3ca9f128
--- /dev/null
+++ b/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+	xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+	xmlns:h="http://xmlns.jcp.org/jsf/html"
+	xmlns:f="http://xmlns.jcp.org/jsf/core"
+	>
+
+	<div class="table_row">
+		<div class="table_left">
+			<h:outputLabel for="emailAddress" value="#{msg.LOGIN_CHANGE_EMAIL_ENTER_EMAIL}" />
+		</div>
+
+		<div class="table_right">
+			<h:inputText class="input" id="emailAddress" size="20" maxlength="255" value="#{emailChangeController.emailAddress}" required="true" validator="EmailAddressValidator" />
+		</div>
+
+		<div class="clear"></div>
+	</div>
+
+	<div class="table_row">
+		<div class="table_left">
+			<h:outputLabel for="emailAddressRepeat" value="#{msg.LOGIN_CHANGE_EMAIL_ENTER_EMAIL_REPEAT}" />
+		</div>
+
+		<div class="table_right">
+			<h:inputText class="input" id="emailAddressRepeat" size="20" maxlength="255" value="#{emailChangeController.emailAddressRepeat}" required="true" validator="EmailAddressValidator" />
+		</div>
+
+		<div class="clear"></div>
+	</div>
+</ui:composition>
diff --git a/web/user/login_change_email_address.xhtml b/web/user/login_change_email_address.xhtml
index 3cfd020c..ed55ac8b 100644
--- a/web/user/login_change_email_address.xhtml
+++ b/web/user/login_change_email_address.xhtml
@@ -33,35 +33,13 @@
 									</div>
 
 									<div class="table_right">
-										#{userController.emailAddress}
+										#{contactController.emailAddress}
 									</div>
 
 									<div class="clear"></div>
 								</div>
 
-								<div class="table_row">
-									<div class="table_left">
-										<h:outputLabel for="emailAddress1" value="#{msg.LOGIN_CHANGE_EMAIL_ENTER_EMAIL1}" />
-									</div>
-
-									<div class="table_right">
-										<h:inputText class="input" id="emailAddress" size="20" maxlength="255" value="#{emailChangeController.emailAddress}" required="true" />
-									</div>
-
-									<div class="clear"></div>
-								</div>
-
-								<div class="table_row">
-									<div class="table_left">
-										<h:outputLabel for="emailAddress2" value="#{msg.LOGIN_CHANGE_EMAIL_ENTER_EMAIL2}" />
-									</div>
-
-									<div class="table_right">
-										<h:inputText class="input" id="emailAddressRepeat" size="20" maxlength="255" value="#{emailChangeController.emailAddressRepeat}" required="true" />
-									</div>
-
-									<div class="clear"></div>
-								</div>
+								<ui:include src="/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl" />
 							</fieldset>
 						</div>
 
-- 
2.39.5