From 7b91bb089e7f46956431b9d0fea44ac6beb42a33 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 14 Oct 2015 13:00:06 +0200 Subject: [PATCH] =?utf8?q?Continued:=20-=20added=20user=20profile=20visibi?= =?utf8?q?lity=20flag=20to=20registration=20form=20-=20moved=20all=20conve?= =?utf8?q?rter=20to=20proper=20directory=20-=20added=20missing=20strings?= =?utf8?q?=20to=20i18n=20file=20-=20renamed=20some=20for=20better=20naming?= =?utf8?q?=20convention=20-=20registered=20validator=20with=20this=20appli?= =?utf8?q?cation=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../beans/user/UserWebController.java | 4 +- .../TrueFalseToBooleanConverter.java | 41 +++++++++++++++++++ .../{ => converter}/CountryConverter.java | 3 +- .../{ => converter}/SmsProviderConverter.java | 3 +- .../localization/bundle_de_DE.properties | 6 +++ .../localization/bundle_en_US.properties | 6 +++ web/WEB-INF/faces-config.xml | 4 ++ .../templates/generic/form_personal_data.tpl | 23 +++++++++++ 8 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java rename src/java/org/mxchange/jcountry/data/{ => converter}/CountryConverter.java (97%) rename src/java/org/mxchange/jphone/phonenumbers/smsprovider/{ => converter}/SmsProviderConverter.java (97%) diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java index f5df38c9..c1352663 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java @@ -31,7 +31,9 @@ import org.mxchange.jusercore.model.user.User; public interface UserWebController extends Serializable { /** - * Adds user's name and email address to bean's internal list + * Adds user's name and email address to bean's internal list. It also + * updates the public user list if the user has decided to have a public + * profile on registration. *

* @param user User instance */ diff --git a/src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java b/src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java new file mode 100644 index 00000000..9d63a009 --- /dev/null +++ b/src/java/org/mxchange/addressbook/converter/TrueFalseToBooleanConverter.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.converter; + +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.FacesConverter; + +/** + * A converter to convert "true" to boolean true and "false" to boolean false + *

+ * @author Roland Haeder + */ +@FacesConverter(value = "trueFalse") +public class TrueFalseToBooleanConverter implements Converter { + + @Override + public Object getAsObject (final FacesContext context, final UIComponent component, final String value) { + return Boolean.valueOf(value); + } + + @Override + public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + return Boolean.toString((Boolean) value); + } +} diff --git a/src/java/org/mxchange/jcountry/data/CountryConverter.java b/src/java/org/mxchange/jcountry/data/converter/CountryConverter.java similarity index 97% rename from src/java/org/mxchange/jcountry/data/CountryConverter.java rename to src/java/org/mxchange/jcountry/data/converter/CountryConverter.java index 71b108b4..b8f516f5 100644 --- a/src/java/org/mxchange/jcountry/data/CountryConverter.java +++ b/src/java/org/mxchange/jcountry/data/converter/CountryConverter.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcountry.data; +package org.mxchange.jcountry.data.converter; import java.text.MessageFormat; import java.util.List; @@ -31,6 +31,7 @@ import javax.naming.NamingException; import org.mxchange.addressbook.beans.country.CountryWebController; import org.mxchange.jcoreeelogger.beans.local.logger.Log; import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; +import org.mxchange.jcountry.data.Country; /** * Converter for country instance diff --git a/src/java/org/mxchange/jphone/phonenumbers/smsprovider/SmsProviderConverter.java b/src/java/org/mxchange/jphone/phonenumbers/smsprovider/converter/SmsProviderConverter.java similarity index 97% rename from src/java/org/mxchange/jphone/phonenumbers/smsprovider/SmsProviderConverter.java rename to src/java/org/mxchange/jphone/phonenumbers/smsprovider/converter/SmsProviderConverter.java index 2cfeb90d..41bafe7c 100644 --- a/src/java/org/mxchange/jphone/phonenumbers/smsprovider/SmsProviderConverter.java +++ b/src/java/org/mxchange/jphone/phonenumbers/smsprovider/converter/SmsProviderConverter.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jphone.phonenumbers.smsprovider; +package org.mxchange.jphone.phonenumbers.smsprovider.converter; import java.text.MessageFormat; import java.util.List; @@ -31,6 +31,7 @@ import javax.naming.NamingException; import org.mxchange.addressbook.beans.smsprovider.SmsProviderWebController; import org.mxchange.jcoreeelogger.beans.local.logger.Log; import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; +import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider; /** * Converter for SMS provider instance diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 7b2d9d28..89344e29 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -200,3 +200,9 @@ TABLE_SUMMARY_LOGIN_SHARED_ADDRESSBOOKS=Diese Tabelle listed alle von Ihnen mit LOGIN_USER_HAS_NOT_SHARED_ADDRESSBOOKS=Derzeit teilen Sie keine Adressb\u00fccher mit anderen Benutzern. LOGIN_TABLE_HEADER_USER_LIST=Alle Benutzer auflisten TABLE_SUMMARY_LOGIN_USER_LIST=Diese Tabelle listet alle registrierten Benutzer aus, mit denen Sie Ihre Adressb\u00fccher teilen k\u00f6nnen. +USER_PROFILE_LEGEND=\u00d6ffentlich einsehbares Profil: +USER_PROFILE_LEGEND_TITLE=Machen Sie hier Einstellungen zu Ihrem im Internet \u00f6ffentlich einsehbarem Profil. +PUBLIC_USER_PROFILE_FLAG=Soll Ihr Profil im Internet einsehbar sein? +PUBLIC_USER_PROFILE_NOT_CHOOSEN_MESSAGE=Bitte w\u00e4hlen Sie aus, ob Ihr Profil im Internet sichtbar sein soll. +PUBLIC_PROFILE_ENABLED=Ist sichtbar +PUBLIC_PROFILE_DISABLED=Ist nicht sichtbar diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index d9124c03..3b49186f 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -200,3 +200,9 @@ TABLE_SUMMARY_LOGIN_SHARED_ADDRESSBOOKS=This table lists all your with other use LOGIN_USER_HAS_NOT_SHARED_ADDRESSBOOKS=Currently you don't share any address books with other users. LOGIN_TABLE_HEADER_USER_LIST=List all users TABLE_SUMMARY_LOGIN_USER_LIST=This table lists all registered users you can share your address books with. +USER_PROFILE_LEGEND=Publicly visible profile: +USER_PROFILE_LEGEND_TITLE=Do settings here for your in Internet publicly visible profile. +PUBLIC_USER_PROFILE_FLAG=Should your profile be visible in Internet? +PUBLIC_USER_PROFILE_NOT_CHOOSEN_MESSAGE=Please choose whether your profile should be visible in Internet. +PUBLIC_PROFILE_ENABLED=Is visible +PUBLIC_PROFILE_DISABLED=Is not visible diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index be48264e..e3cc2c23 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -23,6 +23,10 @@ AddressbookIdValidator org.mxchange.addressbook.validator.addressbook.AddressbookIdValidator + + UserProfileVisibilityValidator + org.mxchange.addressbook.validator.booleans.UserProfileVisibilityValidator + * diff --git a/web/WEB-INF/templates/generic/form_personal_data.tpl b/web/WEB-INF/templates/generic/form_personal_data.tpl index 6b450621..7a20d404 100644 --- a/web/WEB-INF/templates/generic/form_personal_data.tpl +++ b/web/WEB-INF/templates/generic/form_personal_data.tpl @@ -190,4 +190,27 @@ + +

+
+ #{msg.USER_PROFILE_LEGEND} + +
+
+ +
+ +
+ + + + + + +
+ +
+
+
+
-- 2.39.5