From: Roland Häder Date: Tue, 25 Apr 2017 11:21:53 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca68d31b7db1f790c52fe45614bc4b6a0eabfe27;p=addressbook-war.git Please cherry-pick: - WARNING: You have to update project name, maybe one day this will be moved out to properties file? - updated templates as they are long out-dated - added missing templates, a lot new has been added Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java b/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java deleted file mode 100644 index f9576c05..00000000 --- a/src/java/org/mxchange/addressbook/converter/cellphone/AddressbookCellphoneConverter.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package org.mxchange.addressbook.converter.cellphone; - -import java.text.MessageFormat; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; -import javax.faces.convert.FacesConverter; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; -import org.mxchange.jphone.phonenumbers.DialableNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; -import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; - -/** - * Converter for cellphone id <-> valid cellphone instance - *

- * @author Roland Häder - */ -@FacesConverter (value = "CellphoneConverter") -public class AddressbookCellphoneConverter implements Converter { - - /** - * Phone EJB - */ - private PhoneSessionBeanRemote phoneBean; - - /** - * Initialization of this converter - */ - public AddressbookCellphoneConverter () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // ... and user controller - this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N - } - } - - @Override - public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the value null or empty? - if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { - // Warning message - // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N - - // Return null - return null; - } - - // Init instance - DialableMobileNumber mobile = null; - - try { - // Try to parse the value as long - Long mobileId = Long.valueOf(submittedValue); - - // Try to get mobile instance from it - mobile = this.phoneBean.findMobileNumberById(mobileId); - } catch (final NumberFormatException ex) { - // Throw again - throw new ConverterException(ex); - } catch (final PhoneEntityNotFoundException ex) { - // Debug message - // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N - } - - // Return it - return mobile; - } - - @Override - public String getAsString (final FacesContext context, final UIComponent component, final Object value) { - // Is the object null? - if ((null == value) || ((String.valueOf(value)).isEmpty())) { - // Is null - return ""; //NOI18N - } else if (!(value instanceof DialableNumber)) { - // Not same interface - throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N - } - - // Return category id - return String.valueOf(((DialableNumber) value).getPhoneId()); - } - -} diff --git a/src/java/org/mxchange/addressbook/converter/mobile/AddressbookMobileNumberConverter.java b/src/java/org/mxchange/addressbook/converter/mobile/AddressbookMobileNumberConverter.java new file mode 100644 index 00000000..32119bff --- /dev/null +++ b/src/java/org/mxchange/addressbook/converter/mobile/AddressbookMobileNumberConverter.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2016 Roland Häder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.converter.mobile; + +import java.text.MessageFormat; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.ConverterException; +import javax.faces.convert.FacesConverter; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException; +import org.mxchange.jphone.phonenumbers.DialableNumber; +import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; +import org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote; + +/** + * Converter for mobile id <-> valid mobile instance + *

+ * @author Roland Häder + */ +@FacesConverter (value = "MobileNumbnerConverter") +public class AddressbookMobileNumberConverter implements Converter { + + /** + * Phone EJB + */ + private PhoneSessionBeanRemote phoneBean; + + /** + * Initialization of this converter + */ + public AddressbookMobileNumberConverter () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // ... and user controller + this.phoneBean = (PhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/phone!org.mxchange.jphone.phonenumbers.phone.PhoneSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new ConverterException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + } + } + + @Override + public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + // Is the value null or empty? + if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { + // Warning message + // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N + + // Return null + return null; + } + + // Init instance + DialableMobileNumber mobile = null; + + try { + // Try to parse the value as long + Long mobileId = Long.valueOf(submittedValue); + + // Try to get mobile instance from it + mobile = this.phoneBean.findMobileNumberById(mobileId); + } catch (final NumberFormatException ex) { + // Throw again + throw new ConverterException(ex); + } catch (final PhoneEntityNotFoundException ex) { + // Debug message + // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N + } + + // Return it + return mobile; + } + + @Override + public String getAsString (final FacesContext context, final UIComponent component, final Object value) { + // Is the object null? + if ((null == value) || ((String.valueOf(value)).isEmpty())) { + // Is null + return ""; //NOI18N + } else if (!(value instanceof DialableNumber)) { + // Not same interface + throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement DialableNumber.", value)); //NOI18N + } + + // Return category id + return String.valueOf(((DialableNumber) value).getPhoneId()); + } + +} diff --git a/web/WEB-INF/templates/admin/admin_base.tpl b/web/WEB-INF/templates/admin/admin_base.tpl index 029bfc66..92dc3d0a 100644 --- a/web/WEB-INF/templates/admin/admin_base.tpl +++ b/web/WEB-INF/templates/admin/admin_base.tpl @@ -1,3 +1,7 @@ + + Administration - Default admin title - - diff --git a/web/WEB-INF/templates/admin/admin_footer.tpl b/web/WEB-INF/templates/admin/admin_footer.tpl index 6aa4abef..e8c6756d 100644 --- a/web/WEB-INF/templates/admin/admin_footer.tpl +++ b/web/WEB-INF/templates/admin/admin_footer.tpl @@ -3,6 +3,7 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> +

diff --git a/web/WEB-INF/templates/guest/guest_menu.tpl b/web/WEB-INF/templates/guest/guest_menu.tpl index 13cd78a3..a2ab5b59 100644 --- a/web/WEB-INF/templates/guest/guest_menu.tpl +++ b/web/WEB-INF/templates/guest/guest_menu.tpl @@ -15,9 +15,15 @@
  • + + + +
    • - +
    diff --git a/web/WEB-INF/templates/guest/guest_privacy_terms.tpl b/web/WEB-INF/templates/guest/guest_privacy_terms.tpl index fe656323..a3807770 100644 --- a/web/WEB-INF/templates/guest/guest_privacy_terms.tpl +++ b/web/WEB-INF/templates/guest/guest_privacy_terms.tpl @@ -23,8 +23,7 @@ - - + #{msg.GUEST_AGREE_READ_PRIVACY_STATEMENT_2}
    @@ -46,8 +45,7 @@ - - + #{msg.GUEST_AGREE_READ_TERMS_CONDITIONS_2}
    diff --git a/web/WEB-INF/templates/input_fields/fax_input_fields.tpl b/web/WEB-INF/templates/input_fields/fax_input_fields.tpl new file mode 100644 index 00000000..12552ce7 --- /dev/null +++ b/web/WEB-INF/templates/input_fields/fax_input_fields.tpl @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/WEB-INF/templates/input_fields/landline_input_fields.tpl b/web/WEB-INF/templates/input_fields/landline_input_fields.tpl new file mode 100644 index 00000000..536bfecc --- /dev/null +++ b/web/WEB-INF/templates/input_fields/landline_input_fields.tpl @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/WEB-INF/templates/input_fields/mobile_input_fields.tpl b/web/WEB-INF/templates/input_fields/mobile_input_fields.tpl new file mode 100644 index 00000000..4ed66357 --- /dev/null +++ b/web/WEB-INF/templates/input_fields/mobile_input_fields.tpl @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/WEB-INF/templates/login/user/user_base.tpl b/web/WEB-INF/templates/login/user/user_base.tpl index 12ea9db4..f31190a0 100644 --- a/web/WEB-INF/templates/login/user/user_base.tpl +++ b/web/WEB-INF/templates/login/user/user_base.tpl @@ -13,7 +13,6 @@ - diff --git a/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl b/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl index 72a423da..f138ece7 100644 --- a/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl +++ b/web/WEB-INF/templates/login/user/user_change_email_address_repeat_fields.tpl @@ -18,6 +18,10 @@
    + + + +
    @@ -30,13 +34,9 @@
    - - -
    - -
    -
    - + + +
    diff --git a/web/WEB-INF/templates/login/user/user_enter_current_password.tpl b/web/WEB-INF/templates/login/user/user_enter_current_password.tpl index 06ce59b3..15dda796 100644 --- a/web/WEB-INF/templates/login/user/user_enter_current_password.tpl +++ b/web/WEB-INF/templates/login/user/user_enter_current_password.tpl @@ -5,29 +5,29 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> -
    -
    - - - +
    +
    + + + -
    -
    - -
    +
    +
    + +
    -
    - - - -
    +
    + + + +
    -
    +
    -
    - + + +
    -
    -
    -
    +
    +
    diff --git a/web/WEB-INF/templates/login/user/user_footer.tpl b/web/WEB-INF/templates/login/user/user_footer.tpl index 73d6d5e7..f5299b62 100644 --- a/web/WEB-INF/templates/login/user/user_footer.tpl +++ b/web/WEB-INF/templates/login/user/user_footer.tpl @@ -4,6 +4,7 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + diff --git a/web/WEB-INF/templates/login/user/user_menu.tpl b/web/WEB-INF/templates/login/user/user_menu.tpl index c07943f6..e37eafa7 100644 --- a/web/WEB-INF/templates/login/user/user_menu.tpl +++ b/web/WEB-INF/templates/login/user/user_menu.tpl @@ -8,7 +8,7 @@