]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Mon, 19 Oct 2015 10:53:52 +0000 (12:53 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 19 Oct 2015 10:53:52 +0000 (12:53 +0200)
- renamed isNotInvisible() to isInvisible()
- added message on case if the user is invisible
- rewrote ui:fragment-abuse to c:choose, still a bit abusive to JSF, but better than ui:fragment
- added missing i18n strings
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/addressbook/beans/login/UserLoginWebSessionBean.java
src/java/org/mxchange/addressbook/beans/login/UserLoginWebSessionController.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
web/login/login_start_sharing_addressbook.xhtml
web/user/show_addressbook.xhtml

index 8854311ace7dfbece806f1475c8f882eb5b6dfc2..ca8874f70791ae913d70335c1ef7717f0d1af09d 100644 (file)
@@ -174,8 +174,14 @@ public class UserLoginWebSessionBean implements UserLoginWebSessionController {
        }
 
        @Override
-       public boolean isNotInvisible () {
+       public boolean isInvisible () {
+               // Check on login
+               if (!this.isUserLoggedIn()) {
+                       // Not logged in!
+                       throw new IllegalStateException("isInvisible() was called for guest."); //NOI18N
+               }
+
                // Check logged-in first, then invisibility
-               return ((this.isUserLoggedIn()) && (!Objects.equals(this.getLoggedInUser().getUserProfileMode(), ProfileMode.INVISIBLE)));
+               return ((Objects.equals(this.getLoggedInUser().getUserProfileMode(), ProfileMode.INVISIBLE)));
        }
 }
index 680cdf2ef3b71b32842c2a748d9fafcf989c1782..89ae8d2ee478edd6d694710dfd4f12d3c78da126 100644 (file)
@@ -76,9 +76,9 @@ public interface UserLoginWebSessionController extends Serializable {
        boolean isGuest ();
 
        /**
-        * Whether the currently logged-in user is not invisible
+        * Whether the currently logged-in user is invisible
         * <p>
-        * @return Whether the currently logged-in user is not invisible
+        * @return Whether the currently logged-in user is invisible
         */
-       boolean isNotInvisible ();
+       boolean isInvisible ();
 }
index 303ee87843c6bb3df60d388585b408e319ec59d1..e5935a8fc59dc8c9010b653f8ddad1755c43af9e 100644 (file)
@@ -263,3 +263,5 @@ USER_PROFILE_MODE_SELECTION_NOTICE2=Stellen Sie auf "Nur Mitglieder", koennen an
 USER_PROFILE_MODE_SELECTION_NOTICE3=Stellen Sie auf "Alle", ist Ihr Profil im gesamten Internet sichtbar, auch Bots.
 LOGIN_NO_PASSWORD_MESSAGE=Sie haben kein Passwort eingegeben.
 LOGIN_NO_USER_NAME_MESSAGE=Sie haben keinen Benutzernamen eingegeben.
+USER_NOT_LOGGED_IN=Sie sind nicht angemeldet.
+LOGIN_OWN_PROFILE_INVISIBLE=Ihr Profil ist auf "durchsichtig" gestellt.
index 366ec33f0bf495c7ec1e11b8a8b26d2d1f89f9ed..1bbe0411ea10e22b68be7932cda03dbb68964f2f 100644 (file)
@@ -258,3 +258,5 @@ USER_PROFILE_MODE_SELECTION_NOTICE2=If you choose "Only members", other users ca
 USER_PROFILE_MODE_SELECTION_NOTICE3=If you choose "All" the whole Internet can view your profile, including bots.
 LOGIN_NO_PASSWORD_MESSAGE=You have entered no password.
 LOGIN_NO_USER_NAME_MESSAGE=You have entered no user name.
+USER_NOT_LOGGED_IN=You are not signed in.
+LOGIN_OWN_PROFILE_INVISIBLE=Your profile is set to "invisible".
index ec61e50db1c0cc4f963f79b06cc42e7d36d11d7b..d9c930b2f01f88ccff0077e55588927e25f91726 100644 (file)
@@ -4,7 +4,8 @@
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://xmlns.jcp.org/jsf/core"
-         >
+
+         xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
 
        <ui:composition template="/WEB-INF/templates/#{loginController.templateType}/#{loginController.templateType}_base.tpl">
                <ui:define name="login_title">#{msg.PAGE_TITLE_LOGIN_START_SHARING_ADDRESSBOOK}</ui:define>
                                </div>
 
                                <div class="para">
-                                       <h:dataTable id="userList" headerClass="table_header_column" var="user" value="#{addressbookController.allUsersNotSharing()}" rendered="#{loginController.isNotInvisible()}">
-                                               <h:column>
-                                                       <f:facet name="header">#{msg.USER_ID}</f:facet>
-                                                       <h:outputText value="#{user.userId}" />
-                                               </h:column>
-
-                                               <h:column>
-                                                       <f:facet name="header">#{msg.USER_NAME}</f:facet>
-                                                       <ui:include 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.LOGIN_START_SHARING_TITLE}</f:facet>
-                                                       <h:form acceptcharset="utf-8" id="startSharing" rendered="#{profileController.isProfileLinkVisible(user)}">
-                                                               <h:commandButton class="submit" id="submit" value="#{msg.LOGIN_START_SHARING_BUTTON}" action="#{shareController.startSharing(user, addressbookController.addressbook)}" title="#{msg.LOGIN_START_SHARING_BUTTON_TITLE}" />
-                                                       </h:form>
-                                               </h:column>
-                                       </h:dataTable>
+                                       <c:choose>
+                                               <c:when test="#{loginController.isUserLoggedIn() and not loginController.isInvisible()}">
+                                                       <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:outputText value="#{user.userId}" />
+                                                               </h:column>
+
+                                                               <h:column>
+                                                                       <f:facet name="header">#{msg.USER_NAME}</f:facet>
+                                                                       <ui:include 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.LOGIN_START_SHARING_TITLE}</f:facet>
+                                                                       <h:form acceptcharset="utf-8" id="startSharing" rendered="#{profileController.isProfileLinkVisible(user)}">
+                                                                               <h:commandButton class="submit" id="submit" value="#{msg.LOGIN_START_SHARING_BUTTON}" action="#{shareController.startSharing(user, addressbookController.addressbook)}" title="#{msg.LOGIN_START_SHARING_BUTTON_TITLE}" />
+                                                                       </h:form>
+                                                               </h:column>
+                                                       </h:dataTable>
+                                               </c:when>
+                                               <c:when test="#{not loginController.isUserLoggedIn()}">
+                                                               <h:outputText id="ownProfileInvible" class="notice" value="#{msg.USER_NOT_LOGGED_IN}" />
+                                               </c:when>
+                                               <c:otherwise>
+                                                       <h:outputText id="ownProfileInvible" class="notice" value="#{msg.LOGIN_OWN_PROFILE_INVISIBLE}" />
+                                               </c:otherwise>
+                                       </c:choose>
                                </div>
 
                                <div class="table_footer">
index 8c2115fe9c7f74401d3d16ab039e2dea470abc09..15c3b5a327d55ee7118b5b3d4e7cc8375fe8ac9f 100644 (file)
@@ -4,7 +4,7 @@
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://xmlns.jcp.org/jsf/html"
          xmlns:f="http://xmlns.jcp.org/jsf/core"
-         >
+         xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
 
        <f:metadata>
                <f:viewParam id="addressbookId" name="addressbookId" value="#{addressbookController.addressbookId}" required="true" requiredMessage="#{msg.PARAMETER_ADDRESSBOOK_ID_MISSING}" converterMessage="#{msg.PARAMETER_ADDRESSBOOK_ID_INVALID}" validatorMessage="#{msg.PARAMETER_ADDRESSBOOK_ID_NOT_FOUND}">
                                <h:outputText id="addressbookStatus" value="#{msg[addressbookController.addressbook.addressbookStatus.messageKey]}" title="#{msg.ADDRESSBOOK_STATUS_TITLE}" />
 
                                <f:facet name="footer">
-                                       <ui:fragment rendered="#{loginController.isUserLoggedIn()}">
-                                               <ui:fragment rendered="#{addressbookController.isOwnAddressbook()}">
-                                                       <h:link id="startSharing" outcome="login_start_sharing_addressbook" value="#{msg.LINK_LOGIN_START_SHARING_ADDRESSBOOK}" title="#{msg.LINK_LOGIN_START_SHARING_ADDRESSBOOK_TITLE}" />
-                                               </ui:fragment>
-
-                                               <ui:fragment rendered="#{addressbookController.isOtherAddressbook()}">
-                                                       Bla bla
-                                               </ui:fragment>
-                                       </ui:fragment>
+                                       <c:choose>
+                                               <c:when test="#{loginController.isUserLoggedIn() and not loginController.isInvisible()}">
+                                                       <c:choose>
+                                                               <c:when test="#{addressbookController.isOwnAddressbook()}">
+                                                                       <h:link id="startSharing" outcome="login_start_sharing_addressbook" value="#{msg.LINK_LOGIN_START_SHARING_ADDRESSBOOK}" title="#{msg.LINK_LOGIN_START_SHARING_ADDRESSBOOK_TITLE}" />
+                                                               </c:when>
+
+                                                               <c:when test="#{addressbookController.isOtherAddressbook()}">
+                                                                       Bla bla
+                                                               </c:when>
+                                                       </c:choose>
+                                               </c:when>
+                                               <c:when test="#{not loginController.isUserLoggedIn()}">
+                                                       <h:outputText id="ownProfileInvible" class="notice" value="#{msg.USER_NOT_LOGGED_IN}" />
+                                               </c:when>
+                                               <c:otherwise>
+                                                       <h:outputText id="ownProfileInvible" class="notice" value="#{msg.LOGIN_OWN_PROFILE_INVISIBLE}" />
+                                               </c:otherwise>
+                                       </c:choose>
                                </f:facet>
                        </h:panelGrid>
                </ui:define>