]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 20:02:36 +0000 (22:02 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 20:02:36 +0000 (22:02 +0200)
- added/implemented bean method isProfileLinkVisibleById()
- sorted members a bit
- added bean property "user"
- injected user bean (controller)
- used above writes to lookup user id in database and get a user instance back, set in the bean
- added/implemented bean method isUserIdEmpty()
- added i18n for user profile mode and notices
- you can only use converter OR validator
-
- updated jar(s)

lib/juser-core.jar
src/java/org/mxchange/addressbook/beans/profile/UserProfileWebBean.java
src/java/org/mxchange/addressbook/beans/profile/UserProfileWebController.java
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
web/user/user_profile.xhtml

index 6c0c84ec3a4aa2d7f6afaf8aa489c846041de01a..24dbe54287ff32e63ba82aa0c4093b43ed0d9e61 100644 (file)
Binary files a/lib/juser-core.jar and b/lib/juser-core.jar differ
index 6adc75d963366ef9bf4d097055b2ce18227cef0f..c9e6e3bad3d323df91ba12a0681db92ef86e6a49 100644 (file)
@@ -18,9 +18,12 @@ package org.mxchange.addressbook.beans.profile;
 
 import java.text.MessageFormat;
 import javax.enterprise.context.RequestScoped;
+import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.addressbook.beans.login.UserLoginWebController;
+import org.mxchange.addressbook.beans.user.UserWebController;
+import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 
@@ -44,6 +47,27 @@ public class UserProfileWebBean implements UserProfileWebController {
        @Inject
        private UserLoginWebController loginController;
 
+       /**
+        * User instance
+        */
+       private User user;
+
+       /**
+        * User controller
+        */
+       @Inject
+       private UserWebController userController;
+
+       @Override
+       public User getUser () {
+               return user;
+       }
+
+       @Override
+       public void setUser (final User user) {
+               this.user = user;
+       }
+
        @Override
        public boolean isProfileLinkVisible (final User user) {
                // Check on user
@@ -68,4 +92,30 @@ public class UserProfileWebBean implements UserProfileWebController {
                // TODO: Add admin role somehow?
                return ((profileMode.equals(ProfileMode.PUBLIC)) || (this.loginController.isUserLoggedIn()) && (profileMode.equals(ProfileMode.MEMBERS)));
        }
+
+       @Override
+       public boolean isProfileLinkVisibleById (final Long userId) {
+               // Init user instance
+               User u = null;
+
+               try {
+                       // Try to get it
+                       u = this.userController.lookupUserById(userId);
+               } catch (final UserNotFoundException ex) {
+                       // Throw again
+                       throw new FaceletException(ex);
+               }
+
+               // Set it here
+               this.setUser(u);
+
+               // Is it null?
+               if (null == u) {
+                       // Not found, not visible.
+                       return false;
+               }
+
+               // Ask other method
+               return this.isProfileLinkVisible(u);
+       }
 }
index a9ad631f03ed214b9491a54fab066db148ac803b..f36702e226aa9b557e9ff396cb64605fadc30db5 100644 (file)
@@ -34,4 +34,27 @@ public interface UserProfileWebController extends Serializable {
         * @return Whether the profile link is visible
         */
        boolean isProfileLinkVisible (final User user);
+
+       /**
+        * Checks if the user profile link is visible
+        * <p>
+        * @param userId User id
+        * <p>
+        * @return Whether the profile link is visible
+        */
+       boolean isProfileLinkVisibleById (final Long userId);
+
+       /**
+        * Getter for user instance
+        * <p>
+        * @return User instance
+        */
+       User getUser ();
+
+       /**
+        * Setter for user instance
+        * <p>
+        * @param user User instance
+        */
+       void setUser (final User user);
 }
index 6d45f7ce6f5677fe65bde787f308fdfdfa65221e..3759a66e6a42b3723526942cd1a77f07b39c3e58 100644 (file)
@@ -830,4 +830,9 @@ public class UserWebBean implements UserWebController {
                this.setBirthday(user.getUserContact().getContactBirthday());
                this.setComment(user.getUserContact().getContactComment());
        }
+
+       @Override
+       public boolean isUserIdEmpty () {
+               return ((this.getUserId() == null) || (this.getUserId() == 0));
+       }
 }
index dd79d6e06d4585c3e08dc0bf33da6f570a2fa281..f9644e2fc92a7d959773f410c9b9933108cf327e 100644 (file)
@@ -463,4 +463,11 @@ public interface UserWebController extends Serializable {
         * @return Whether at least one user has a public profile
         */
        boolean isVisibleUserFound ();
+
+       /**
+        * Checks if the user id is empty
+        * <p>
+        * @return Whether the user id is empty
+        */
+       boolean isUserIdEmpty ();
 }
index 16e384a7c4f3b107fab35f9e1176654e2a5e8fce..7498cb979c1727d591e42d93d0dcf5bfa5114539 100644 (file)
@@ -202,7 +202,8 @@ TABLE_HEADER_USER_LIST=Alle Benutzer auflisten
 TABLE_SUMMARY_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?
+#TODO: Fix German umlaut!
+USER_PROFILE_MODE=Wie soll Ihr Profil veroeffentlicht werden?
 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
@@ -249,3 +250,14 @@ ADDRESSBOOK_STATUS=Status:
 PAGE_TITLE_INDEX_SHOW_ADDRESSBOOK=\u00d6ffentlicher Teil des Adressbuchs anzeigen
 USER_PROFILE_NOT_PUBLICLY_VISIBLE=Das Benutzerprofil ist privat.
 PAGE_TITLE_LOGIN_USER_PROFILE=Benutzerprofil ansehen
+#TODO: Fix German umlaut!
+PUBLIC_USER_PROFILE=Oeffentliches Benutzerprofil
+USER_PROFILE_MODE_INVISIBLE=Nicht sichtbar
+USER_PROFILE_MODE_MEMBERS=Nur von Mitgliedern einsehbar
+#TODO: Please fix German umlaut!
+USER_PROFILE_MODE_PUBLIC=Fuer alle sichtbar
+#TODO: Please fix German umlaut!
+USER_PROFILE_MODE_SELECTION_NOTICE1=Stellen Sie auf "Verdeckt", kann niemand mit Ihnen Adressbuecher teilen.
+#TODO: Please fix German umlaut!
+USER_PROFILE_MODE_SELECTION_NOTICE2=Stellen Sie auf "Nur Mitglieder", koennen andere Mitglieder Ihnen Ihre Adressbuecher freigeben.
+USER_PROFILE_MODE_SELECTION_NOTICE3=Stellen Sie auf "Alle", ist Ihr Profil im gesamten Internet sichtbar, auch Bots.
index 4b7a0fe76900088ae11e646fbadec2d1f37b5f52..01d2063a6c74d172f1457e0f2a7c22b8f4e4cfc2 100644 (file)
@@ -202,7 +202,7 @@ TABLE_HEADER_USER_LIST=List all users
 TABLE_SUMMARY_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?
+USER_PROFILE_MODE=How should your profile be published?
 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
@@ -249,3 +249,10 @@ ADDRESSBOOK_STATUS=Status:
 PAGE_TITLE_INDEX_SHOW_ADDRESSBOOK=Show public part of address book
 USER_PROFILE_NOT_PUBLICLY_VISIBLE=The user profile is private.
 PAGE_TITLE_LOGIN_USER_PROFILE=View user profile
+PUBLIC_USER_PROFILE=Public user profile
+USER_PROFILE_MODE_INVISIBLE=Invisible
+USER_PROFILE_MODE_MEMBERS=Only visible to members
+USER_PROFILE_MODE_PUBLIC=Visible for all
+USER_PROFILE_MODE_SELECTION_NOTICE1=If you choose "Invisible", nobody can share address books with you.
+USER_PROFILE_MODE_SELECTION_NOTICE2=If you choose "Only members", other users can start sharing address books with you.
+USER_PROFILE_MODE_SELECTION_NOTICE3=If you choose "All" the whole Internet can view your profile, including bots.
index 2b714b80e78f2473ca34b771dcb0bac39444f0ce..164e4ef3a5fbbc62d58c39e0fff54c6eb9dce18a 100644 (file)
 
                        <div class="table_row">
                                <div class="table_left">
-                                       <h:outputLabel for="publicUserProfileFlag" value="#{msg.PUBLIC_USER_PROFILE_FLAG}" />
+                                       <h:outputLabel for="publicUserProfileFlag" value="#{msg.USER_PROFILE_MODE}" />
                                </div>
 
                                <div class="table_right">
 
                                <div class="clear"></div>
                        </div>
+
+                       <div class="table_row">
+                               <div class="para notice">
+                                       <ul>
+                                               <li>#{msg.USER_PROFILE_MODE_SELECTION_NOTICE1}</li>
+                                               <li>#{msg.USER_PROFILE_MODE_SELECTION_NOTICE2}</li>
+                                               <li>#{msg.USER_PROFILE_MODE_SELECTION_NOTICE3}</li>
+                                       </ul>
+                               </div>
+                       </div>
                </fieldset>
        </div>
 </ui:composition>
index 9779bdb530ccf51e62b0fab3e47cf367782992e3..112cd241c23dbbffa3cb4526862873f4b67f63f3 100644 (file)
@@ -6,7 +6,6 @@
        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>
index 59f8e6a837aa8989b7bb611f6ba50e8330efc8aa..6fdf9e8e2a45891b97edaab0e7a8832615d2f534 100644 (file)
@@ -10,7 +10,6 @@
                <f:viewParam id="userId" name="userId" value="#{userController.userId}" required="true" requiredMessage="#{msg.PARAMETER_USER_ID_MISSING}" converterMessage="#{msg.PARAMETER_USER_ID_INVALID}" validatorMessage="#{msg.PARAMETER_USER_ID_NOT_FOUND}">
                        <f:convertNumber for="userId" type="number" minIntegerDigits="1" maxIntegerDigits="20" />
                        <f:validator for="userId" validatorId="UserIdValidator" />
-                       <f:converter for="userId" converterId="UserConverter" />
                </f:viewParam>
        </f:metadata>
 
                                        <ui:include src="/WEB-INF/templates/generic/userid_error.tpl" />
                                </c:when>
 
-                               <c:when test="#{profileController.isProfileLinkVisible(userController.user)}">
-                                       Here goes your content.
+                               <c:when test="#{profileController.isProfileLinkVisibleById(userController.userId)}">
+                                       <div align="center">
+                                               <h:panelGrid styleClass="table" headerClass="table_header" footerClass="table_footer">
+                                                       <f:facet name="header">
+                                                               #{msg.PUBLIC_USER_PROFILE}
+                                                       </f:facet>
+                                               </h:panelGrid>
+                                       </div>
                                </c:when>
 
                                <c:otherwise>