]> git.mxchange.org Git - addressbook-war.git/commitdiff
Rewrite (unfinished):
authorRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 16:38:26 +0000 (18:38 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 16:48:51 +0000 (18:48 +0200)
- 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)

25 files changed:
lib/jcontacts-business-core.jar
lib/jcontacts-core.jar
lib/jcontacts-lib.jar
lib/jcore-logger-lib.jar
lib/jcore.jar
lib/jcoreee.jar
lib/jcountry-core.jar
lib/jphone-core.jar
lib/juser-core.jar
lib/juser-lib.jar
src/java/org/mxchange/addressbook/beans/profile/UserProfileWebBean.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/profile/UserProfileWebController.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebBean.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/profilemode/ProfileModeWebController.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/user/UserWebBean.java
src/java/org/mxchange/addressbook/beans/user/UserWebController.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/WEB-INF/templates/generic/form_personal_data.tpl
web/WEB-INF/templates/generic/profile_mode_selection_box.tpl [new file with mode: 0644]
web/WEB-INF/templates/generic/user_profile_link.tpl [new file with mode: 0644]
web/login/login_shared_addressbooks.xhtml
web/login/login_start_sharing_addressbook.xhtml
web/user/show_addressbook.xhtml
web/user/user_list.xhtml

index c2de43d60cf9c954aee5af584e3669c569c4cc4d..3c2c675d34181336d42c69619169c25415eb9a2a 100644 (file)
Binary files a/lib/jcontacts-business-core.jar and b/lib/jcontacts-business-core.jar differ
index c86495c7e7c050e1a3601f996a49d4a280760bf4..c0b14e4478c1cdddc52d75c13e9dd45854341f2f 100644 (file)
Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ
index abcaef84108457319ee82b2cef4f98f34167a28c..b68b58118ffea01b1f5651b62d4c1b1fb13493a0 100644 (file)
Binary files a/lib/jcontacts-lib.jar and b/lib/jcontacts-lib.jar differ
index 03fd6ddec7cb6afa0e4aebdcba3f326ebaccc00b..85d46fc0c152e78c3ff46af60fb2464cfdfdb459 100644 (file)
Binary files a/lib/jcore-logger-lib.jar and b/lib/jcore-logger-lib.jar differ
index 88b7a44ddf14adc8aa4682d7fffd48ff6317d488..9e3538d91c157679bcad8ef905c8cc45c413b40c 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index d3b339c867fb1f1961023e28570976fe43fd2d0b..c39c629bf86965dffeb7a59d9a8109198fb4c0a6 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
index a4ca64879ae0c0f7d0d6c1706b65c1e6da7ff60d..7b0501d2ef370d08e325c522f0da339da564ab06 100644 (file)
Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ
index c9d5f503a7eb5b20e55e3e25fe059a49f3cf9785..018368a9653b49ef34de6147f45a8e7e76909cf6 100644 (file)
Binary files a/lib/jphone-core.jar and b/lib/jphone-core.jar differ
index 8ec885568dd80e945c627cd2a49856fc6ee1b99d..ff5b3c74e1c64d288b59fb88e1e3974250580b90 100644 (file)
Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ
index 1e1d78671130111afc6017b45dddc25771fe7dcf..d4090c07c6c9e68d9d9a618e907e727b32c0f76a 100644 (file)
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 (file)
index 0000000..f7fd28c
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+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
+ * <p>
+ * @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 (file)
index 0000000..219a7e9
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.beans.profile;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A bean interface for user profiles
+ * <p>
+ * @author Roland Haeder
+ */
+public interface UserProfileWebController extends Serializable {
+
+       /**
+        * Getter for user instance
+        * <p>
+        * @return User instance
+        */
+       public User getUser ();
+
+       /**
+        * Setter for user instance
+        * <p>
+        * @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 (file)
index 0000000..a7506ee
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+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
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@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 (file)
index 0000000..2f6a7ae
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.beans.profilemode;
+
+import java.io.Serializable;
+import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
+
+/**
+ * An interface for data beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface ProfileModeWebController extends Serializable {
+
+       /**
+        * Getter for all genders as array
+        * <p>
+        * @return All genders as array
+        */
+       ProfileMode[] getAllProfileModes ();
+}
index 446624f6c237c7dc40c4b9ce89b47cec2554117e..97cdd0a01a882eabc11bbcae9798be37b7f1ef19 100644 (file)
@@ -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());
index 1fecf4724d1a89dc8a85d1c9fbef366ca7dad7d2..a0bf8d597192c487208536443b4ee178017204ec 100644 (file)
@@ -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
         * <p>
-        * @return User public profile flag
+        * @return User profile mode
         */
-       Boolean getUserProfilePublic ();
+       ProfileMode getUserProfileMode ();
 
        /**
-        * Setter for user public profile flag
+        * Setter for user profile mode
         * <p>
-        * @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
index 0623ee56fb8ec0301b06ac5265f9a835b7964ade..edeadb2a4ff06162124edee77d952223fc2020ba 100644 (file)
@@ -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.
index 6b104835e0d30c574c210b6cd2ab6087b3314eff..65a5a3536cbaf47c00336fe2298ba74fbab8c1bf 100644 (file)
@@ -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.
index ad7e4133b78fd579b6e83edae20244dddabf409d..2b714b80e78f2473ca34b771dcb0bac39444f0ce 100644 (file)
                                </div>
 
                                <div class="table_right">
-                                       <h:selectOneMenu class="select" id="publicUserProfileFlag" value="#{userController.userProfilePublic}" required="true" requiredMessage="#{msg.PUBLIC_USER_PROFILE_NOT_CHOOSEN_MESSAGE}">
-                                               <f:selectItem class="option" itemValue="true" itemLabel="#{msg.PUBLIC_PROFILE_ENABLED}" />
-                                               <f:selectItem class="option" itemValue="false" itemLabel="#{msg.PUBLIC_PROFILE_DISABLED}" />
-                                               <!-- <f:converter for="publicUserProfileFlag" converterId="trueFalse" /> //-->
-                                               <f:validator for="publicUserProfileFlag" validatorId="UserProfileVisibilityValidator" />
-                                       </h:selectOneMenu>
+                                       <ui:include src="/WEB-INF/templates/generic/profile_mode_selection_box.tpl" />
                                </div>
 
                                <div class="clear"></div>
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 (file)
index 0000000..9779bdb
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:f="http://java.sun.com/jsf/core"
+       xmlns:h="http://java.sun.com/jsf/html"
+       xmlns:ui="http://java.sun.com/jsf/facelets">
+
+       <h:selectOneMenu class="select" id="profileMode" value="#{userController.userProfileMode}">
+               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
+               <f:selectItems value="#{profileMode.allProfileModes}" var="m" itemValue="#{m}" itemLabel="#{msg[m.messageKey]}" />
+       </h:selectOneMenu>
+</ui:composition>
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 (file)
index 0000000..faadd59
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:f="http://java.sun.com/jsf/core"
+       xmlns:h="http://java.sun.com/jsf/html"
+       xmlns:ui="http://java.sun.com/jsf/facelets"
+       xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+
+       <ui:param id="user" name="user" value="#{profileController.user}" />
+
+       <c:choose>
+               <c:when test="#{profileController.isProfileLinkVisible()}">
+                       <h:link id="userProfileLink" outcome="user_profile" title="#{msg.LINK_USER_PROFILE_TITLE}">
+                               <h:outputText id="userName" value="#{user.userName}" />
+                               <f:param name="userId" value="#{user.userId}" />
+                       </h:link>
+               </c:when>
+
+               <c:otherwise>
+                       #{msg.USER_PROFILE_NOT_PUBLICLY_VISIBLE}
+               </c:otherwise>
+       </c:choose>
+</ui:composition>
index c6b56daad284f5b20a18ce1ccb5bae21b74bfec4..f63cf62200818d749dd636f5ad0006a62111c64b 100644 (file)
 
                                                <h:column>
                                                        <f:facet name="header">#{msg.SHAREE_USER_NAME}</f:facet>
-                                                       <h:link outcome="user_profile" title="#{msg.LINK_USER_PROFILE_TITLE}">
-                                                               <h:outputText id="shareeUserName" value="#{share.shareUserSharee.userName}" title="#{msg.SHAREEE_USER_NAME_TITLE}" />
-                                                               <f:param name="userId" value="#{share.shareUserSharee.userId}" />
-                                                       </h:link>
+                                                       <ui:include id="userProfileLink" src="/WEB-INF/templates/generic/user_profile_link.tpl">
+                                                               <ui:param name="user" value="#{share.shareUserSharee}" />
+                                                       </ui:include>
                                                </h:column>
 
                                                <h:column>
index d16ac9fff26d23b75c05148e8f988bf9d27c4042..cd9f4ac2e934b580485d69222a2ebfdaf3c63e09 100644 (file)
@@ -24,9 +24,9 @@
                                        <h:dataTable id="userList" headerClass="table_header_column" var="user" value="#{addressbookController.allUsersNotSharing()}">
                                                <h:column>
                                                        <f:facet name="header">#{msg.USER_ID}</f:facet>
-                                                       <h:link outcome="user_profile" title="#{msg.LINK_USER_PROFILE_TITLE}" value="#{msg.LINK_USER_PROFILE}" target="_blank">
-                                                               <f:param id="userId" name="userId" value="#{user.userId}" />
-                                                       </h:link>
+                                                       <ui:include id="userProfileLink" src="/WEB-INF/templates/generic/user_profile_link.tpl">
+                                                               <ui:param name="user" value="#{user}" />
+                                                       </ui:include>
                                                </h:column>
 
                                                <h:column>
index 8e46e559e8c8f58214e2c605903f5de58ba99356..ba477df524cb49f41919135e698be9b737017759 100644 (file)
@@ -33,7 +33,9 @@
                                        <h:outputText id="addressbookName" value="#{addressbookController.addressbookName}" />
 
                                        <h:outputLabel for="addressbookUser" class="table_label">#{msg.ADDRESSBOOK_OWNER}</h:outputLabel>
-                                       <h:link id="addressbookUser" outcome="user_profile" value="#{addressbookController.addressbookUser.userName}" />
+                                       <ui:include id="userProfileLink" src="/WEB-INF/templates/generic/user_profile_link.tpl">
+                                               <ui:param name="user" value="#{addressbookController.addressbookUser}" />
+                                       </ui:include>
 
                                        <h:outputLabel for="addressbookCreated" class="table_label">#{msg.ADDRESSBOOK_CREATED}</h:outputLabel>
                                        <h:outputFormat id="addressbookCreated" value="#{addressbookController.addressbook.addressbookCreated.time}" title="#{msg.ADDRESSBOOK_CREATED_TITLE}">
index a10bcb503c4edd5a020d1d514c5882dedb121ff0..9b32294a82d12fc690e177853a40026348b2c215 100644 (file)
                                <h:dataTable id="userList" var="user" value="#{userController.allPublicUsers()}" headerClass="table_header_column25" summary="#{msg.TABLE_SUMMARY_USER_LIST}" rendered="#{userController.isPublicUserRegistered()}">
                                        <h:column>
                                                <f:facet name="header">#{msg.USER_ID}</f:facet>
-                                               <h:link outcome="user_profile" value="#{user.userId}">
-                                                       <f:param name="userId" value="#{user.userId}" />
-                                               </h:link>
+                                               <ui:include id="userProfileLink" src="/WEB-INF/templates/generic/user_profile_link.tpl">
+                                                       <ui:param name="user" value="#{user}" />
+                                               </ui:include>
                                        </h:column>
 
                                        <h:column>
                                                <f:facet name="header">#{msg.USER_NAME}</f:facet>
-                                               <h:link outcome="user_profile" value="#{user.userName}">
-                                                       <f:param name="userId" value="#{user.userId}" />
-                                               </h:link>
+                                               <ui:include id="userProfileLink" src="/WEB-INF/templates/generic/user_profile_link.tpl">
+                                                       <ui:param name="user" value="#{user}" />
+                                               </ui:include>
                                        </h:column>
 
                                        <h:column>