--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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);
+}
--- /dev/null
+/*
+ * 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();
+ }
+}
--- /dev/null
+/*
+ * 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 ();
+}
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)
/**
* Whether the user wants a public profile
*/
- private Boolean userProfilePublic;
+ private ProfileMode userProfileMode;
/**
* ZIP code
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);
}
// 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
}
@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
@Override
public boolean isRequiredPersonalDataSet () {
return ((this.getUserName() != null) &&
- (this.getUserProfilePublic() != null) &&
+ (this.getUserProfileMode() != null) &&
(this.getGender() != null) &&
(this.getFirstName() != null) &&
(this.getFamilyName() != null) &&
// 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);
// 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());
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
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
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.
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.
</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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
<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>
<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>
<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}">
<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>