From: Roland Haeder Date: Fri, 16 Oct 2015 16:38:26 +0000 (+0200) Subject: Rewrite (unfinished): X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6aad7fca4bd1ef6aab41340091dae5eda8b5e9af;p=jfinancials-war.git Rewrite (unfinished): - added beans for profile and profile modes - added new template user_profile_link.xhtml for easy inclusion of profile links. Just handle over the whole User instance - added new template profile_mode_selection_box.tpl for easy profile mode selection - updated jar(s) --- diff --git a/lib/jcontacts-business-core.jar b/lib/jcontacts-business-core.jar index c2de43d6..3c2c675d 100644 Binary files a/lib/jcontacts-business-core.jar and b/lib/jcontacts-business-core.jar differ diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index c86495c7..c0b14e44 100644 Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ diff --git a/lib/jcontacts-lib.jar b/lib/jcontacts-lib.jar index abcaef84..b68b5811 100644 Binary files a/lib/jcontacts-lib.jar and b/lib/jcontacts-lib.jar differ diff --git a/lib/jcore-logger-lib.jar b/lib/jcore-logger-lib.jar index 03fd6dde..85d46fc0 100644 Binary files a/lib/jcore-logger-lib.jar and b/lib/jcore-logger-lib.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar index 88b7a44d..9e3538d9 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index d3b339c8..c39c629b 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/lib/jcountry-core.jar b/lib/jcountry-core.jar index a4ca6487..7b0501d2 100644 Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ diff --git a/lib/jphone-core.jar b/lib/jphone-core.jar index c9d5f503..018368a9 100644 Binary files a/lib/jphone-core.jar and b/lib/jphone-core.jar differ diff --git a/lib/juser-core.jar b/lib/juser-core.jar index 8ec88556..ff5b3c74 100644 Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ diff --git a/lib/juser-lib.jar b/lib/juser-lib.jar index 1e1d7867..d4090c07 100644 Binary files a/lib/juser-lib.jar and b/lib/juser-lib.jar differ diff --git a/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebBean.java b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebBean.java new file mode 100644 index 00000000..f7fd28c7 --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebBean.java @@ -0,0 +1,59 @@ +/* + * 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.beans.profile; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; +import org.mxchange.addressbook.beans.login.UserLoginWebController; +import org.mxchange.jusercore.model.user.User; + +/** + * A web request bean for user profiles + *

+ * @author Roland Haeder + */ +@Named (value = "profileController") +@RequestScoped +public class UserProfileWebBean implements UserProfileWebController { + + /** + * Serial number + */ + private static final long serialVersionUID = 187_687_145_286_710L; + + /** + * Login controller + */ + @Inject + private UserLoginWebController loginController; + + /** + * User instance + */ + private User user; + + @Override + public User getUser () { + return this.user; + } + + @Override + public void setUser (final User user) { + this.user = user; + } +} diff --git a/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebController.java b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebController.java new file mode 100644 index 00000000..219a7e9b --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/profile/UserProfileWebController.java @@ -0,0 +1,42 @@ +/* + * 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.beans.profile; + +import java.io.Serializable; +import org.mxchange.jusercore.model.user.User; + +/** + * A bean interface for user profiles + *

+ * @author Roland Haeder + */ +public interface UserProfileWebController extends Serializable { + + /** + * Getter for user instance + *

+ * @return User instance + */ + public User getUser (); + + /** + * Setter for user instance + *

+ * @param user User instance + */ + public void setUser (final User user); +} diff --git a/src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebBean.java b/src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebBean.java new file mode 100644 index 00000000..a7506ee5 --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebBean.java @@ -0,0 +1,48 @@ +/* + * 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.beans.profilemode; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Named; +import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; + +/** + * A profile mode bean + *

+ * @author Roland Haeder + */ +@Named ("profileMode") +@ApplicationScoped +public class ProfileModeWebBean implements ProfileModeWebController { + + /** + * Serial number + */ + private static final long serialVersionUID = 835_482_364_189L; + + /** + * Default constructor + */ + public ProfileModeWebBean () { + } + + @Override + public ProfileMode[] getAllProfileModes () { + // Return it + return ProfileMode.values(); + } +} diff --git a/src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebController.java b/src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebController.java new file mode 100644 index 00000000..2f6a7ae5 --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebController.java @@ -0,0 +1,35 @@ +/* + * 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.beans.profilemode; + +import java.io.Serializable; +import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; + +/** + * An interface for data beans + *

+ * @author Roland Haeder + */ +public interface ProfileModeWebController extends Serializable { + + /** + * Getter for all genders as array + *

+ * @return All genders as array + */ + ProfileMode[] getAllProfileModes (); +} diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java b/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java index 446624f6..97cdd0a0 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebBean.java @@ -45,6 +45,7 @@ import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; +import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; /** * A user bean (controller) @@ -199,7 +200,7 @@ public class UserWebBean implements UserWebController { /** * Whether the user wants a public profile */ - private Boolean userProfilePublic; + private ProfileMode userProfileMode; /** * ZIP code @@ -265,7 +266,7 @@ public class UserWebBean implements UserWebController { this.setUserId(registeredUser.getUserId()); // Is the account public? - if (registeredUser.getUserPublicProfile()) { + if (registeredUser.getUserProfileMode().equals(ProfileMode.PUBLIC)) { // Also add it to this list this.publicUserList.add(registeredUser); } @@ -291,7 +292,7 @@ public class UserWebBean implements UserWebController { // Create new user instance User user = new LoginUser(); user.setUserName(this.getUserName()); - user.setUserPublicProfile(this.getUserProfilePublic()); + user.setUserProfileMode(this.getUserProfileMode()); user.setUserCreated(new GregorianCalendar()); // Generate phone number @@ -612,13 +613,13 @@ public class UserWebBean implements UserWebController { } @Override - public Boolean getUserProfilePublic () { - return this.userProfilePublic; + public ProfileMode getUserProfileMode () { + return this.userProfileMode; } @Override - public void setUserProfilePublic (final Boolean userProfilePublic) { - this.userProfilePublic = userProfilePublic; + public void setUserProfileMode (final ProfileMode userProfileMode) { + this.userProfileMode = userProfileMode; } @Override @@ -656,7 +657,7 @@ public class UserWebBean implements UserWebController { @Override public boolean isRequiredPersonalDataSet () { return ((this.getUserName() != null) && - (this.getUserProfilePublic() != null) && + (this.getUserProfileMode() != null) && (this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) && @@ -716,8 +717,8 @@ public class UserWebBean implements UserWebController { // Clear all data // - personal data this.setUserId(null); - this.setUserProfilePublic(null); this.setGender(Gender.UNKNOWN); + this.setUserProfileMode(null); this.setFirstName(null); this.setFamilyName(null); this.setStreet(null); @@ -750,7 +751,7 @@ public class UserWebBean implements UserWebController { // Copy all fields: // - base data this.setUserId(user.getUserId()); - this.setUserProfilePublic(user.getUserPublicProfile()); + this.setUserProfileMode(user.getUserProfileMode()); this.setGender(user.getUserContact().getContactGender()); this.setFirstName(user.getUserContact().getContactFirstName()); this.setFamilyName(user.getUserContact().getContactFamilyName()); diff --git a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java index 1fecf472..a0bf8d59 100644 --- a/src/java/org/mxchange/addressbook/beans/user/UserWebController.java +++ b/src/java/org/mxchange/addressbook/beans/user/UserWebController.java @@ -24,6 +24,7 @@ import org.mxchange.jcountry.data.Country; import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider; import org.mxchange.jusercore.events.registration.UserRegisteredEvent; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; /** * An interface for user beans @@ -383,18 +384,18 @@ public interface UserWebController extends Serializable { void setZipCode (final Integer zipCode); /** - * Getter for user public profile flag + * Getter for user profile mode *

- * @return User public profile flag + * @return User profile mode */ - Boolean getUserProfilePublic (); + ProfileMode getUserProfileMode (); /** - * Setter for user public profile flag + * Setter for user profile mode *

- * @param userProfilePublic User public profile flag + * @param userProfileMode User profile mode */ - void setUserProfilePublic (final Boolean userProfilePublic); + void setUserProfileMode (final ProfileMode userProfileMode); /** * Checks whether user instance's email address is used diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 0623ee56..edeadb2a 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -247,3 +247,4 @@ SHAREE_USER_NAME_TITLE=Mit wem Sie Ihr Adressbuch teilen ADDRESSBOOK_OWNER=Besitzer: ADDRESSBOOK_STATUS=Status: PAGE_TITLE_INDEX_SHOW_ADDRESSBOOK=\u00d6ffentlicher Teil des Adressbuchs anzeigen +USER_PROFILE_NOT_PUBLICLY_VISIBLE=Das Benutzerprofil ist privat. diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 6b104835..65a5a353 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -247,3 +247,4 @@ SHAREE_USER_NAME_TITLE=With who you shared your address book ADDRESSBOOK_OWNER=Owner: ADDRESSBOOK_STATUS=Status: PAGE_TITLE_INDEX_SHOW_ADDRESSBOOK=Show public part of address book +USER_PROFILE_NOT_PUBLICLY_VISIBLE=The user profile is private. diff --git a/web/WEB-INF/templates/generic/form_personal_data.tpl b/web/WEB-INF/templates/generic/form_personal_data.tpl index ad7e4133..2b714b80 100644 --- a/web/WEB-INF/templates/generic/form_personal_data.tpl +++ b/web/WEB-INF/templates/generic/form_personal_data.tpl @@ -201,12 +201,7 @@

- - - - - - +
diff --git a/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl b/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl new file mode 100644 index 00000000..9779bdb5 --- /dev/null +++ b/web/WEB-INF/templates/generic/profile_mode_selection_box.tpl @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/web/WEB-INF/templates/generic/user_profile_link.tpl b/web/WEB-INF/templates/generic/user_profile_link.tpl new file mode 100644 index 00000000..faadd593 --- /dev/null +++ b/web/WEB-INF/templates/generic/user_profile_link.tpl @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + #{msg.USER_PROFILE_NOT_PUBLICLY_VISIBLE} + + + diff --git a/web/login/login_shared_addressbooks.xhtml b/web/login/login_shared_addressbooks.xhtml index c6b56daa..f63cf622 100644 --- a/web/login/login_shared_addressbooks.xhtml +++ b/web/login/login_shared_addressbooks.xhtml @@ -32,10 +32,9 @@ #{msg.SHAREE_USER_NAME} - - - - + + + diff --git a/web/login/login_start_sharing_addressbook.xhtml b/web/login/login_start_sharing_addressbook.xhtml index d16ac9ff..cd9f4ac2 100644 --- a/web/login/login_start_sharing_addressbook.xhtml +++ b/web/login/login_start_sharing_addressbook.xhtml @@ -24,9 +24,9 @@ #{msg.USER_ID} - - - + + + diff --git a/web/user/show_addressbook.xhtml b/web/user/show_addressbook.xhtml index 8e46e559..ba477df5 100644 --- a/web/user/show_addressbook.xhtml +++ b/web/user/show_addressbook.xhtml @@ -33,7 +33,9 @@ #{msg.ADDRESSBOOK_OWNER} - + + + #{msg.ADDRESSBOOK_CREATED} diff --git a/web/user/user_list.xhtml b/web/user/user_list.xhtml index a10bcb50..9b32294a 100644 --- a/web/user/user_list.xhtml +++ b/web/user/user_list.xhtml @@ -22,16 +22,16 @@ #{msg.USER_ID} - - - + + + #{msg.USER_NAME} - - - + + +