- added ability to link any contact with user and/or customer accounts (later is unfinished)
- to make thism working, a controller method selectableContacts() is needed (cached)
- also the event for administrators adding users (customers missing!) must be observed to remove contact from selectable list
- because of the above, the HTML form can no longer validate required="true", it must be done by the controller (ugly exceptions for now)
- some beans/controllers loaded/injected
- added missing i18n strings
- fixed some exception messages
- ignored strings for i18n
- changed CSS class in admin area pages from small to medium (needs more space)
- removed double underscore (one removed)
Signed-off-by: Roland Häder <roland@mxchange.org>
ADMIN_ADD_CUSTOMER_TITLE=Neuen Kunden anlegen
ADMIN_CUSTOMER_PERSONAL_DATA_MINIMUM_NOTICE=Die Kundennummer wird automatisch vergeben. Bitte mindestens Anrede, Vor- und Nachname eingeben.
PAGE_TITLE_LOGIN_AREA=Benutzerbereich
+ADMIN_SELECT_USER_CONTACT_LEGEND=Kontakt f\u00fcr neues Benutzeraccount ausw\u00e4hlen:
+ADMIN_SELECT_USER_CONTACT_LEGEND_TITLE=W\u00e4hlen Sie entweder einen Kontakt aus, der mit dem neuen Benutzeraccount verkn\u00fcpft werden soll ...
+ADMIN_SELECT_USER_CONTACT=Kontakt zum Verkn\u00fcpfen ausw\u00e4hlen:
+ADMIN_ADD_OR_ENTER_CONTACT_DATA=... oder geben Sie mindestens Vorname, Nachname und Anrede ein (Benutzername und Email-Adresse nicht vergessen):
+ADMIN_SELECT_CUSTOMER_CONTACT_LEGEND=Kontakt f\u00fcr neuen Kunden ausw\u00e4hlen:
+ADMIN_SELECT_CUSTOMER_CONTACT_LEGEND_TITLE=W\u00e4hlen Sie entweder einen Kontakt aus, der mit dem neuen Kunden verkn\u00fcpft werden soll ...
+ADMIN_SELECT_CUSTOMER_CONTACT=Kontakt zum Verkn\u00fcpfen ausw\u00e4hlen:
BUTTON_ADMIN_ADD_CUSTOMER=Add customer
ADMIN_ADD_CUSTOMER_TITLE=Create new customer
ADMIN_CUSTOMER_PERSONAL_DATA_MINIMUM_NOTICE=The customer number is being created automatically. Please enter at least gender, first name and family name.
+ADMIN_SELECT_USER_CONTACT_LEGEND=Select contact for new user account:
+ADMIN_SELECT_USER_CONTACT_LEGEND_TITLE=Whether choose a contact that should be linked with the new user account or ...
+ADMIN_SELECT_USER_CONTACT=Select contact for linking:
+ADMIN_ADD_OR_ENTER_CONTACT_DATA=or enter gender, first name and family name (don't forget to enter user name and email address):
+ADMIN_SELECT_CUSTOMER_CONTACT_LEGEND=Select contact for new customer account:
+ADMIN_SELECT_CUSTOMER_CONTACT_LEGEND_TITLE=Whether choose a contact that should be linked with the new customer account or ...
+ADMIN_SELECT_CUSTOMER_CONTACT=Select contact for linking:
throw new NullPointerException("event is null"); //NOI18N
} else if (event.getUpdatedContact()== null) {
// Throw NPE again
- throw new NullPointerException("event.user is null"); //NOI18N
+ throw new NullPointerException("event.updatedUser is null"); //NOI18N
} else if (event.getUpdatedContact().getContactId() == null) {
// userId is null
- throw new NullPointerException("event.user.userId is null"); //NOI18N
+ throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N
} else if (event.getUpdatedContact().getContactId() < 1) {
// Not avalid id
- throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
}
// Get iterator from list
@Override
public String addUser () {
// Create new user instance
- User localUser = new LoginUser();
+ User user = new LoginUser();
+
+ // As the form cannot validate the data (required="true"), check it here
+ if (this.getUserName() == null) {
+ // Throw NPE
+ throw new NullPointerException("userName is null"); //NOI18N
+ } else if (this.getUserName().isEmpty()) {
+ // Is empty
+ throw new IllegalArgumentException("userName is null"); //NOI18N
+ } else if (this.adminHelper.getContact() == null) {
+ // No contact instance set, so test required fields: gender, first name and family name
+ if (this.contactController.getGender() == null) {
+ // Throw NPE again
+ throw new NullPointerException("contactController.gender is null"); //NOI18N
+ } else if (this.contactController.getFirstName() == null) {
+ // ... and again
+ throw new NullPointerException("contactController.firstName is null"); //NOI18N //NOI18N
+ } else if (this.contactController.getFirstName().isEmpty()) {
+ // ... and again
+ throw new IllegalArgumentException("contactController.firstName is empty");
+ } else if (this.contactController.getFamilyName() == null) {
+ // ... and again
+ throw new NullPointerException("contactController.familyName is null"); //NOI18N
+ } else if (this.contactController.getFamilyName().isEmpty()) {
+ // ... and again
+ throw new IllegalArgumentException("contactController.familyName is empty"); //NOI18N //NOI18N
+ } else if (this.contactController.getEmailAddress()== null) {
+ // ... and again
+ throw new NullPointerException("contactController.emailAddress is null");
+ } else if (this.contactController.getEmailAddress().isEmpty()) {
+ // ... and again
+ throw new IllegalArgumentException("contactController.emailAddress is empty"); //NOI18N //NOI18N
+ } else if (this.contactController.getEmailAddressRepeat()== null) {
+ // ... and again
+ throw new NullPointerException("contactController.emailAddressRepeat is null");
+ } else if (this.contactController.getEmailAddressRepeat().isEmpty()) {
+ // ... and again
+ throw new IllegalArgumentException("contactController.emailAddressRepeat is empty"); //NOI18N //NOI18N
+ } else if (!Objects.equals(this.contactController.getEmailAddress(), this.contactController.getEmailAddressRepeat())) {
+ // Is not same email address
+ throw new IllegalArgumentException("Both entered email addresses don't match.");
+ }
+ }
// Set user name, CONFIRMED and INVISIBLE
- localUser.setUserName(this.getUserName());
- localUser.setUserAccountStatus(UserAccountStatus.CONFIRMED);
- localUser.setUserProfileMode(ProfileMode.INVISIBLE);
+ user.setUserName(this.getUserName());
+ user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
+ user.setUserProfileMode(ProfileMode.INVISIBLE);
- // Create contact instance
- Contact contact = this.contactController.createContactInstance();
+ // Init instance
+ Contact contact;
+
+ // Is a contact instance in helper set?
+ if (this.adminHelper.getContact() instanceof Contact) {
+ // Then use it for contact linking
+ contact = this.adminHelper.getContact();
+ } else {
+ // Create contact instance
+ contact = this.contactController.createContactInstance();
+ }
// Set contact in user
- localUser.setUserContact(contact);
+ user.setUserContact(contact);
// Init variable for password
String password = null;
// Is the user name or email address used already?
// @TODO Add password length check
- if (this.userController.isUserNameRegistered(localUser)) {
+ if (this.userController.isUserNameRegistered(user)) {
// User name is already used
- throw new FaceletException(new UserNameAlreadyRegisteredException(localUser));
- } else if (this.contactController.isEmailAddressRegistered(localUser.getUserContact())) {
+ throw new FaceletException(new UserNameAlreadyRegisteredException(user));
+ } else if ((this.adminHelper.getContact() == null) && (this.contactController.isEmailAddressRegistered(user.getUserContact()))) {
// Email address is already used
- throw new FaceletException(new EmailAddressAlreadyRegisteredException(localUser));
+ throw new FaceletException(new EmailAddressAlreadyRegisteredException(user));
} else if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) {
// Empty password entered, then generate one
password = UserUtils.createRandomPassword(PizzaUserWebSessionController.MINIMUM_PASSWORD_LENGTH);
} else if (!this.isSamePasswordEntered()) {
// Both passwords don't match
- throw new FaceletException(new UserPasswordRepeatMismatchException(localUser));
+ throw new FaceletException(new UserPasswordRepeatMismatchException(user));
} else {
// Both match, so get it from this bean
password = this.getUserPassword();
assert (password.length() >= PizzaUserWebSessionController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N
// Encrypt password and set it
- localUser.setUserEncryptedPassword(UserUtils.encryptPassword(password));
+ user.setUserEncryptedPassword(UserUtils.encryptPassword(password));
// Init updated user instance
User updatedUser = null;
try {
// Now, that all is set, call EJB
- updatedUser = this.userBean.addUser(localUser);
- } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
+ if (this.adminHelper.getContact() instanceof Contact) {
+ // Link contact with this user
+ updatedUser = this.userBean.linkUser(user);
+ } else {
+ // Add new contact
+ updatedUser = this.userBean.addUser(user);
+ }
+ } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
// Throw again
throw new FaceletException(ex);
}
throw new NullPointerException("adminHelper.user.userId is null"); //NOI18N //NOI18N
} else if (user.getUserId() < 1) {
// Invalid id
- throw new IllegalStateException(MessageFormat.format("adminHelper.user.userId={0} is invalid", user.getUserId()));
+ throw new IllegalStateException(MessageFormat.format("adminHelper.user.userId={0} is invalid", user.getUserId())); //NOI18N //NOI18N
} else if (this.getUserName() == null) {
// Not all required fields are set
throw new NullPointerException("this.userName is null"); //NOI18N
*/
package org.mxchange.pizzaapplication.beans.user;
+import de.chotime.jratecalc.beans.contact.RateCalcContactWebSessionController;
+import de.chotime.jratecalc.beans.login.RateCalcUserLoginWebSessionController;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.Iterator;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
+import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
import org.mxchange.jusercore.events.user.update.UserUpdatedPersonalDataEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
*/
private static final long serialVersionUID = 542_145_347_916L;
+ /**
+ * Administrative user controller
+ */
+ @Inject
+ private RateCalcAdminUserWebRequestController adminController;
+
+ /**
+ * Remote user bean
+ */
+ private final ContactSessionBeanRemote contactBean;
+
/**
* General contact controller
*/
@Inject
private PizzaUserLoginWebSessionController loginController;
+ /**
+ * A list of all selectable contacts
+ */
+ private List<Contact> selectableContacts;
+
/**
* Event being fired when user updated personal data
*/
// Try to lookup
this.userBean = (UserSessionBeanRemote) context.lookup("java:global/PizzaService-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+
+ // Try to lookup
+ this.contactBean = (ContactSessionBeanRemote) context.lookup("java:global/PizzaService-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N
} catch (final NamingException e) {
// Throw again
throw new FaceletException(e);
System.out.println("UserWebBean:afterRegistration: EXIT!"); //NOI18N
}
+ @Override
+ public void afterAdminAddedUserEvent (@Observes final AdminAddedUserEvent event) {
+ // Trace message
+ System.out.println(MessageFormat.format("ContactWebBean:afterAdminAddedUserEvent: event={0} - CALLED!", event)); //NOI18N
+
+ // The event must be valid
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getAddedUser() == null) {
+ // Throw NPE again
+ throw new NullPointerException("event.addedUser is null"); //NOI18N
+ } else if (event.getAddedUser().getUserId() == null) {
+ // userId is null
+ throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
+ } else if (event.getAddedUser().getUserId() < 1) {
+ // Not avalid id
+ throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
+ } else if (event.getAddedUser().getUserContact() == null) {
+ // userId is null
+ throw new NullPointerException("event.addedUser.userContact is null"); //NOI18N
+ } else if (event.getAddedUser().getUserContact().getContactId() == null) {
+ // userId is null
+ throw new NullPointerException("event.addedUser.userContact.contactId is null"); //NOI18N
+ } else if (event.getAddedUser().getUserContact().getContactId() < 1) {
+ // userId is null
+ throw new IllegalArgumentException(MessageFormat.format("event.addedUser.userContact.contactId={0} is not valid", event.getAddedUser().getUserContact().getContactId())); //NOI18N
+ }
+
+ // Remove this contact from selectable list
+ assert(this.selectableContacts.remove(event.getAddedUser().getUserContact())) : "contact was not removed"; //NOI18N
+ }
+
@Override
public void afterUserLogin (final @Observes UserLoggedInEvent event) {
// Trace message
this.contactController.updateContactDataFromController(user.getUserContact());
// It should be there, so run some tests on it
- assert (user instanceof User) : "Instance loginController.loggedInUser is null";
- assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null";
- assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId());
- assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null";
- assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null";
- assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId());
+ assert (user instanceof User) : "Instance loginController.loggedInUser is null"; //NOI18N
+ assert (user.getUserId() instanceof Long) : "Instance loginController.loggedInUser.userId is null"; //NOI18N
+ assert (user.getUserId() > 0) : MessageFormat.format("loginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
+ assert (user.getUserContact() instanceof Contact) : "Instance loginController.loggedInUser.userContact is null"; //NOI18N
+ assert (user.getUserContact().getContactId() instanceof Long) : "Instance loginController.userContact.contactId is null"; //NOI18N
+ assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
// Update all fields
user.setUserProfileMode(this.getUserProfileMode());
// Initialize user list
this.visibleUserList = this.userBean.allPublicUsers();
}
+
+ // Get all users
+ List<User> allUsers = this.adminController.allUsers();
+
+ // Get all contacts
+ List<Contact> allContacts = this.contactBean.getAllContacts();
+
+ // Get iterator
+ Iterator<Contact> iterator = allContacts.iterator();
+
+ // Loop through it
+ while (iterator.hasNext()) {
+ // Get next element
+ Contact next = iterator.next();
+
+ // Get iterator
+ Iterator<User> userIterator = allUsers.iterator();
+
+ // Loop through all users
+ while (userIterator.hasNext()) {
+ // Get user instance
+ User nextUser = userIterator.next();
+
+ // Is contact same?
+ if (Objects.equals(next, nextUser.getUserContact())) {
+ // Found same
+ iterator.remove();
+ break;
+ }
+ }
+ }
+
+ // Set contact list
+ this.selectableContacts = allContacts;
}
@Override
return localUser;
}
+ @Override
+ public List<Contact> selectableContacts () {
+ return Collections.unmodifiableList(this.selectableContacts);
+ }
+
/**
* Adds user's name and email address to bean's internal list. It also
* updates the public user list if the user has decided to ha }
import java.io.Serializable;
import java.util.List;
+import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jusercore.events.login.UserLoggedInEvent;
import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
+import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
import org.mxchange.jusercore.exceptions.UserNotFoundException;
import org.mxchange.jusercore.model.user.User;
import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
*/
public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+ /**
+ * Returns a list of all selectable contacts for user creation. Contacts
+ * from already existing users are excluded in this list.
+ * <p>
+ * @return A list of all selectable contacts
+ */
+ List<Contact> selectableContacts ();
+
/**
* Tries to lookup user by given id number. If the user is not found or the
* account status is not CONFIRMED proper exceptions are thrown.
*/
User lookupUserById (final Long userId) throws UserNotFoundException;
+ /**
+ * Event observer for newly added users by an administrator
+ * <p>
+ * @param event Event being fired
+ */
+ void afterAdminAddedUserEvent(final AdminAddedUserEvent event);
+
/**
* Event observer for new user registrations
* <p>
<legend title="#{msg.ADMIN_CONTACT_PERSONAL_DATA_LEGEND_TITLE}">#{msg.ADMIN_CONTACT_PERSONAL_DATA_LEGEND}</legend>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="gender" value="#{msg.ADMIN_PERSONAL_DATA_GENDER}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<ui:include src="/WEB-INF/templates/generic/gender_selection_box.tpl">
<ui:param name="targetController" value="#{adminContactController}" />
</ui:include>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="firstName" value="#{msg.ADMIN_PERSONAL_DATA_FIRST_NAME}" />
</div>
- <div class="table_right">
- <h:inputText class="input" id="firstName" size="10" maxlength="255" value="#{adminContactController.firstName}" required="true">
- <f:validator for="firstName" validatorId="NameValidator" />
- </h:inputText>
+ <div class="table_right_medium">
+ <h:inputText class="input" id="firstName" size="10" maxlength="255" value="#{adminContactController.firstName}" />
</div>
<div class="clear"></div>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="familyName" value="#{msg.ADMIN_PERSONAL_DATA_FAMILY_NAME}" />
</div>
- <div class="table_right">
- <h:inputText class="input" id="familyName" size="10" maxlength="255" value="#{adminContactController.familyName}" required="true">
- <f:validator for="familyName" validatorId="NameValidator" />
- </h:inputText>
+ <div class="table_right_medium">
+ <h:inputText class="input" id="familyName" size="10" maxlength="255" value="#{adminContactController.familyName}" />
</div>
<div class="clear"></div>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="street" value="#{msg.ADMIN_PERSONAL_DATA_STREET}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:inputText class="input" id="street" size="20" maxlength="255" value="#{adminContactController.street}" />
</div>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="houseNumber" value="#{msg.ADMIN_PERSONAL_DATA_HOUSE_NUMBER}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:inputText class="input" id="houseNumber" size="3" maxlength="5" value="#{adminContactController.houseNumber}" validatorMessage="#{msg.ENTERED_HOUSE_NUMBER_INVALID}">
<f:validateLongRange for="houseNumber" minimum="1" maximum="500" />
</h:inputText>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="zipCode" value="#{msg.ADMIN_PERSONAL_DATA_ZIP_CODE}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:inputText class="input" id="zipCode" size="5" maxlength="6" value="#{adminContactController.zipCode}" validatorMessage="#{msg.ENTERED_ZIP_CODE_INVALID}">
<f:validateLongRange for="zipCode" minimum="1" maximum="99999" />
</h:inputText>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="city" value="#{msg.ADMIN_PERSONAL_DATA_CITY}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:inputText class="input" id="city" size="10" maxlength="255" value="#{adminContactController.city}" />
</div>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="country" value="#{msg.ADMIN_PERSONAL_DATA_COUNTRY_CODE}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:selectOneMenu class="select" id="country" value="#{adminContactController.country}" converter="country">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryCode} (#{msg[c.countryI18nkey]})" />
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel value="#{msg.ADMIN_PERSONAL_DATA_PHONE_NUMBER}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:selectOneMenu class="select" id="countryPhoneCode" value="#{adminContactController.phoneCountry}" converter="country">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryAbroadDialPrefix}#{c.countryPhoneCode}" />
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="faxNumber" value="#{msg.ADMIN_PERSONAL_DATA_FAX_NUMBER}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:selectOneMenu class="select" id="faxCountryCode" value="#{adminContactController.faxCountry}" converter="country">
<f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
<f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryAbroadDialPrefix}#{c.countryPhoneCode}" />
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="cellphoneNumber" value="#{msg.ADMIN_PERSONAL_DATA_CELLPHONE_NUMBER}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<ui:include src="/WEB-INF/templates/generic/mobile_selection_box.tpl">
<ui:param name="targetController" value="#{adminContactController}" />
</ui:include>
<legend title="#{msg.ADMIN_USER_DATA_EMAIL_LEGEND_TITLE}">#{msg.ADMIN_USER_DATA_EMAIL_LEGEND}</legend>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="userName" value="#{msg.ADMIN_USER_DATA_ENTER_USER_NAME}" />
</div>
- <div class="table_right">
- <h:inputText class="input" id="userName" size="20" maxlength="255" value="#{adminUserController.userName}" required="true" />
+ <div class="table_right_medium">
+ <h:inputText class="input" id="userName" size="20" maxlength="255" value="#{adminUserController.userName}" />
</div>
<div class="clear"></div>
<ui:fragment rendered="#{mode == 'add'}">
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="emailAddress" value="#{msg.ADMIN_USER_DATA_ENTER_EMAIL}" />
</div>
- <div class="table_right">
- <h:inputText class="input" id="emailAddress" size="20" maxlength="255" value="#{adminContactController.emailAddress}" required="true" />
+ <div class="table_right_medium">
+ <h:inputText class="input" id="emailAddress" size="20" maxlength="255" value="#{adminContactController.emailAddress}" />
</div>
<div class="clear"></div>
</ui:fragment>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="password1" value="#{msg.ADMIN_USER_DATA_ENTER_PASSWORD1}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:inputSecret class="input" id="password1" size="10" maxlength="255" value="#{adminUserController.userPassword}" />
</div>
</div>
<div class="table_row">
- <div class="table_left">
+ <div class="table_left_medium">
<h:outputLabel for="password2" value="#{msg.ADMIN_USER_DATA_ENTER_PASSWORD2}" />
</div>
- <div class="table_right">
+ <div class="table_right_medium">
<h:inputSecret class="input" id="password2" size="10" maxlength="255" value="#{adminUserController.userPasswordRepeat}" />
</div>
<ui:define name="content">
<h:dataTable id="table_list_customers" var="customer" value="#{adminCustomerController.allCustomers()}" styleClass="table_big" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CUSTOMER}" rendered="#{adminCustomerController.hasCustomers()}">
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_ID}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_ID}</f:facet>
<h:link outcome="admin_show_customer" title="#{msg.ADMIN_LINK_SHOW__CUSTOMER_TITLE}" value="#{customer.customerId}">
<f:param name="customerId" value="#{customer.customerId}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_NUMBER}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_NUMBER}</f:facet>
<h:outputText value="#{customer.customerNumber}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_GENDER}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_GENDER}</f:facet>
<h:outputText value="#{msg[customer.customerContact.contactGender.messageKey]}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_FIRST_NAME}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_FIRST_NAME}</f:facet>
<h:outputText value="#{customer.customerContact.contactFirstName}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_FAMILY_NAME}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_FAMILY_NAME}</f:facet>
<h:outputText value="#{customer.customerContact.contactFamilyName}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_ACCOUNT_STATUS}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_ACCOUNT_STATUS}</f:facet>
<h:outputText styleClass="#{customer.customerAccountStatus.styleClass}" value="#{msg[customer.customerAccountStatus.messageKey]}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_PROFILE_MODE}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_PROFILE_MODE}</f:facet>
<h:outputText value="#{msg[customer.customerProfileMode.messageKey]}" />
</h:column>
<h:column>
- <f:facet name="header">#{msg.ADMIN_LIST__CUSTOMER_CREATED}</f:facet>
+ <f:facet name="header">#{msg.ADMIN_LIST_CUSTOMER_CREATED}</f:facet>
<h:outputText id="customerCreated" value="#{customer.customerCreated.time}">
<f:convertDateTime for="customerCreated" type="both" timeStyle="short" dateStyle="short" />
</h:column>
</h:dataTable>
- <div class="table">
+ <div class="table_medium">
<h:form id="admin_add_customer">
<div class="table_header">
#{msg.ADMIN_ADD_CUSTOMER_TITLE}
</div>
+ <div class="para">
+ <fieldset id="customer_contact">
+ <legend title="#{msg.ADMIN_SELECT_CUSTOMER_CONTACT_LEGEND_TITLE}">#{msg.ADMIN_SELECT_CUSTOMER_CONTACT_LEGEND}</legend>
+
+ <div class="table_row">
+ <div class="table_left_medium">
+ <h:outputLabel for="customerContact" value="#{msg.ADMIN_SELECT_CUSTOMER_CONTACT}" />
+ </div>
+
+ <div class="table_right_medium">
+ <h:selectOneMenu class="select" id="customerContact" value="#{adminHelper.contact}" converter="ContactConverter">
+ <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
+ <f:selectItems value="#{customerController.selectableContacts()}" var="contact" itemValue="#{contact}" itemLabel="#{contact}" />
+ </h:selectOneMenu>
+ </div>
+
+ <div class="clear"></div>
+ </div>
+ </fieldset>
+ </div>
+
+ <div class="para">
+ <h:outputText value="#{msg.ADMIN_ADD_OR_ENTER_CONTACT_DATA}" />
+ </div>
+
<ui:include src="/WEB-INF/templates/admin/customer/admin_form_customer_personal_data.tpl" />
<div class="table_footer">
</h:column>
</h:dataTable>
- <div class="table">
+ <div class="table_medium">
<h:form id="admin_add_user">
<div class="table_header">
#{msg.ADMIN_ADD_USER_TITLE}
</div>
+ <div class="para">
+ <fieldset id="user_contact">
+ <legend title="#{msg.ADMIN_SELECT_USER_CONTACT_LEGEND_TITLE}">#{msg.ADMIN_SELECT_USER_CONTACT_LEGEND}</legend>
+
+ <div class="table_row">
+ <div class="table_left_medium">
+ <h:outputLabel for="userContact" value="#{msg.ADMIN_SELECT_USER_CONTACT}" />
+ </div>
+
+ <div class="table_right_medium">
+ <h:selectOneMenu class="select" id="userContact" value="#{adminHelper.contact}" converter="ContactConverter">
+ <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
+ <f:selectItems value="#{userController.selectableContacts()}" var="contact" itemValue="#{contact}" itemLabel="#{contact.contactId}: #{msg[contact.contactGender.messageKey]} #{contact.contactFirstName} #{contact.contactFamilyName}" />
+ </h:selectOneMenu>
+ </div>
+
+ <div class="clear"></div>
+ </div>
+ </fieldset>
+ </div>
+
+ <div class="para">
+ <h:outputText value="#{msg.ADMIN_ADD_OR_ENTER_CONTACT_DATA}" />
+ </div>
+
<ui:include src="/WEB-INF/templates/admin/user/admin_form_user_personal_data.tpl" />
<div class="table_footer">
}
.table_right_medium {
- width: 250px;
+ width: 300px;
min-height: 20px;
float: right;
}