]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued a lot more:
authorRoland Häder <roland@mxchange.org>
Tue, 26 Apr 2016 15:57:13 +0000 (17:57 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 27 Apr 2016 20:07:09 +0000 (22:07 +0200)
- 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>
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java
web/WEB-INF/templates/admin/contact/admin_form_contact_data.tpl
web/WEB-INF/templates/admin/user/admin_form_user_data.tpl
web/admin/customer/admin_customer_list.xhtml
web/admin/user/admin_user_list.xhtml
web/resources/css/cssLayout.css

index 47969ef9c13392e2d4529787df73cd3a09955073..5613871f9164af6196942d11fed2dcd076820f0c 100644 (file)
@@ -327,3 +327,10 @@ BUTTON_ADMIN_ADD_CUSTOMER=Kunde hinzuf\u00fcgen
 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:
index 38b852050612523920611efa2a37edda0e575c41..faaec2c5319e78c81a8af5bf9eca3a3f5520d45f 100644 (file)
@@ -328,3 +328,10 @@ ADMIN_MENU_CUSTOMER_TITLE=Customer management
 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:
index 0de36a385f6145b3eb9dc8b1f05442cc9a517981..f8542a9ca3483b29785e32f286ae5183b1d09050 100644 (file)
@@ -237,13 +237,13 @@ public class PizzaContactWebSessionBean implements PizzaContactWebSessionControl
                        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
index 6f98b9c61b65da8ff9d22d24a5172249c0a1e6a4..6000c201b65293f86e47a0b7b422109f06a6076e 100644 (file)
@@ -143,36 +143,87 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
        @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();
@@ -183,15 +234,21 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                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);
                }
@@ -253,7 +310,7 @@ public class PizzaAdminUserWebRequestBean implements PizzaAdminUserWebRequestCon
                        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
index aa114001f4653acceff049b79b8635d77206755b..42a83a3aed1049592e1da1706586333b0ee7e669 100644 (file)
@@ -16,6 +16,8 @@
  */
 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;
@@ -33,11 +35,13 @@ import javax.naming.Context;
 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;
@@ -63,6 +67,17 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
         */
        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
         */
@@ -75,6 +90,11 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
        @Inject
        private PizzaUserLoginWebSessionController loginController;
 
+       /**
+        * A list of all selectable contacts
+        */
+       private List<Contact> selectableContacts;
+
        /**
         * Event being fired when user updated personal data
         */
@@ -133,6 +153,9 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
 
                        // 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);
@@ -187,6 +210,39 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                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
@@ -271,12 +327,12 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                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());
@@ -357,6 +413,40 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                        // 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
@@ -429,6 +519,11 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                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   }
index 133ddea415c3f5a8035ad923cdc6cf853f2536d8..19fef777cf21eeb4f88d78552e12b38df2b5de42 100644 (file)
@@ -18,8 +18,10 @@ package org.mxchange.pizzaapplication.beans.user;
 
 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;
@@ -36,6 +38,14 @@ public interface PizzaUserWebSessionController extends Serializable {
         */
        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.
@@ -48,6 +58,13 @@ public interface PizzaUserWebSessionController extends Serializable {
         */
        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>
index 76e108b1974f96a4e47564f784edb913bd743de3..8baf888e7133f6185195c66bbb1f0038ae1e9465 100644 (file)
                        <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>
index 1b0c1cb82d78017aacbd84f4feb551798515dce7..0958a9fb09b08c2fdbd502a1f328c6d862acfa81 100644 (file)
                                <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>
 
index 8cd88e59b599679de6f6b18e473d5317b4c988cb..1b7cce22433d3da3769722e256dacaa5a68728aa 100644 (file)
@@ -18,7 +18,7 @@
                <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">
index de99760136709adfc5faf105022c78696f64b4d7..c0168f1d14f3667c3cfdf4c7fb2be4a9bfa5fc2c 100644 (file)
                                </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">
index 457a864641c795fb5655d7d0740d9c20edafce9a..1db8342aa8c5d8986506f8c3a6d92d3504c87ba9 100644 (file)
@@ -109,7 +109,7 @@ table, .table, .table_medium {
 }
 
 .table_right_medium {
-       width: 250px;
+       width: 300px;
        min-height: 20px;
        float: right;
 }