]> git.mxchange.org Git - addressbook-war.git/commitdiff
Continued with adding features:
authorRoland Haeder <roland@mxchange.org>
Thu, 14 Apr 2016 13:36:04 +0000 (15:36 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 14 Apr 2016 14:41:59 +0000 (16:41 +0200)
- merged add_user into list_user as other admin pages are constructed same way
- introduced mobile selection "box" template with target controller to not have the same form all over again
- added both regular and administrative controller with interface for administrative functionality for mobile providers
- rewrote try-catch block: only the actual method call that throws the checked exception should be included in the try block
- return actual list and not an unmodifiable version
- added templates for list/edit/delete mobile providers (admin area)
- listing of mobile providers should be okay now ("basicly finished")
- renamed variable to make it more clear (mobile provider)
- adding new mobile providers "basicly finished", still some improvements (avoid ugly exception output) may be required
- added a lot new language strings + removed "add_user" from merger

Signed-off-by: Roland Häder <roland@mxchange.org>
19 files changed:
nbproject/faces-config.NavData
src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java
src/java/org/mxchange/addressbook/converter/mobileprovider/AddressbookMobileProviderConverter.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestController.java [new file with mode: 0644]
web/WEB-INF/faces-config.xml
web/WEB-INF/templates/admin/admin_form_mobile_provider.tpl [new file with mode: 0644]
web/WEB-INF/templates/admin/admin_form_personal_data.tpl
web/WEB-INF/templates/admin/admin_menu.tpl
web/WEB-INF/templates/generic/form_personal_data.tpl
web/WEB-INF/templates/generic/mobile_selection_box.tpl [new file with mode: 0644]
web/admin/admin_mobile_provider_delete.xhtml [new file with mode: 0644]
web/admin/admin_mobile_provider_edit.xhtml [new file with mode: 0644]
web/admin/admin_mobile_provider_list.xhtml [new file with mode: 0644]

index 8e9c103d878c24b1ff82826dab99d16307539396..d619b0a284ee7972bf3cdb97132839879522873b 100644 (file)
@@ -2,46 +2,48 @@
 <Scene Scope="Project" version="2">
     <Scope Scope="Faces Configuration Only"/>
     <Scope Scope="Project">
-        <Node id="login/login_shared_addressbooks.xhtml" x="1048" y="32" zoom="true"/>
-        <Node id="admin/admin_country_list.xhtml" x="7861" y="32" zoom="true"/>
-        <Node id="admin/admin_user_delete.xhtml" x="2763" y="32" zoom="true"/>
-        <Node id="privacy.xhtml" x="3409" y="32" zoom="true"/>
-        <Node id="login/login_change_password.xhtml" x="7439" y="32" zoom="true"/>
-        <Node id="admin/index.xhtml" x="10625" y="32" zoom="true"/>
-        <Node id="basket.xhtml" x="785" y="32" zoom="true"/>
-        <Node id="login/login_data_saved.xhtml" x="4684" y="32" zoom="true"/>
-        <Node id="exception.xhtml" x="5059" y="32" zoom="true"/>
-        <Node id="admin/admin_country_delete.xhtml" x="13542" y="32" zoom="true"/>
-        <Node id="login/login_start_sharing_addressbook.xhtml" x="8253" y="32" zoom="true"/>
-        <Node id="user/register.xhtml" x="3933" y="32" zoom="true"/>
-        <Node id="admin/admin_country_edit.xhtml" x="5342" y="32" zoom="true"/>
-        <Node id="user/resend_link.xhtml" x="7108" y="32" zoom="true"/>
-        <Node id="login/login_add_addressbook.xhtml" x="9941" y="32" zoom="true"/>
-        <Node id="login/login_index.xhtml" x="12549" y="32" zoom="true"/>
-        <Node id="login/login_own_addressbooks.xhtml" x="9510" y="32" zoom="true"/>
-        <Node id="admin/admin_user_list.xhtml" x="9140" y="32" zoom="true"/>
-        <Node id="terms.xhtml" x="6399" y="32" zoom="true"/>
-        <Node id="admin/admin_logout.xhtml" x="11116" y="32" zoom="true"/>
-        <Node id="admin/admin_user_add.xhtml" x="34" y="32" zoom="true"/>
-        <Node id="admin/admin_user_edit.xhtml" x="409" y="32" zoom="true"/>
-        <Node id="user/user_list.xhtml" x="5740" y="32" zoom="true"/>
-        <Node id="index.xhtml" x="3157" y="32" zoom="true"/>
-        <Node id="logout.xhtml" x="3673" y="32" zoom="true"/>
-        <Node id="user/register_done.xhtml" x="6050" y="32" zoom="true"/>
-        <Node id="user/user_profile.xhtml" x="13208" y="32" zoom="true"/>
-        <Node id="login/login_change_personal_data.xhtml" x="11472" y="32" zoom="true"/>
-        <Node id="admin/admin_user_unlock.xhtml" x="1982" y="32" zoom="true"/>
-        <Node id="user/show_addressbook.xhtml" x="2376" y="32" zoom="true"/>
-        <Node id="imprint.xhtml" x="10361" y="32" zoom="true"/>
-        <Node id="*" x="10924" y="32" zoom="true"/>
-        <Node id="user/login_error.xhtml" x="12881" y="32" zoom="true"/>
-        <Node id="login/login_other_addressbooks.xhtml" x="13958" y="32" zoom="true"/>
-        <Node id="user/show_addressbook_entries.xhtml" x="4240" y="32" zoom="true"/>
-        <Node id="login/login_change_email_address.xhtml" x="6654" y="32" zoom="true"/>
-        <Node id="user/lost_passwd.xhtml" x="11926" y="32" zoom="true"/>
-        <Node id="login/login_list_sharing_addressbooks.xhtml" x="1499" y="32" zoom="true"/>
-        <Node id="user/login.xhtml" x="12264" y="32" zoom="true"/>
-        <Node id="login/login_edit_user_data.xhtml" x="8741" y="32" zoom="true"/>
+        <Node id="login/login_shared_addressbooks.xhtml" x="150" y="600" zoom="true"/>
+        <Node id="admin/admin_country_list.xhtml" x="1900" y="150" zoom="true"/>
+        <Node id="admin/admin_user_delete.xhtml" x="900" y="300" zoom="true"/>
+        <Node id="login/login_change_password.xhtml" x="400" y="900" zoom="true"/>
+        <Node id="privacy.xhtml" x="1150" y="600" zoom="true"/>
+        <Node id="admin/index.xhtml" x="1400" y="150" zoom="true"/>
+        <Node id="basket.xhtml" x="1150" y="150" zoom="true"/>
+        <Node id="login/login_data_saved.xhtml" x="150" y="450" zoom="true"/>
+        <Node id="exception.xhtml" x="900" y="600" zoom="true"/>
+        <Node id="admin/admin_country_delete.xhtml" x="400" y="300" zoom="true"/>
+        <Node id="login/login_start_sharing_addressbook.xhtml" x="650" y="600" zoom="true"/>
+        <Node id="user/register.xhtml" x="1650" y="450" zoom="true"/>
+        <Node id="admin/admin_mobile_provider_edit.xhtml" x="150" y="750" zoom="true"/>
+        <Node id="admin/admin_country_edit.xhtml" x="1650" y="300" zoom="true"/>
+        <Node id="login/login_index.xhtml" x="1650" y="150" zoom="true"/>
+        <Node id="user/resend_link.xhtml" x="1150" y="450" zoom="true"/>
+        <Node id="login/login_add_addressbook.xhtml" x="900" y="750" zoom="true"/>
+        <Node id="login/login_own_addressbooks.xhtml" x="900" y="150" zoom="true"/>
+        <Node id="admin/admin_user_list.xhtml" x="1400" y="450" zoom="true"/>
+        <Node id="admin/admin_mobile_provider_delete.xhtml" x="900" y="900" zoom="true"/>
+        <Node id="admin/admin_logout.xhtml" x="150" y="900" zoom="true"/>
+        <Node id="terms.xhtml" x="650" y="900" zoom="true"/>
+        <Node id="admin/admin_user_edit.xhtml" x="150" y="1200" zoom="true"/>
+        <Node id="user/user_list.xhtml" x="400" y="600" zoom="true"/>
+        <Node id="admin/admin_mobile_provider_list.xhtml" x="400" y="450" zoom="true"/>
+        <Node id="index.xhtml" x="400" y="150" zoom="true"/>
+        <Node id="logout.xhtml" x="1150" y="750" zoom="true"/>
+        <Node id="user/register_done.xhtml" x="150" y="300" zoom="true"/>
+        <Node id="login/login_change_personal_data.xhtml" x="650" y="150" zoom="true"/>
+        <Node id="user/user_profile.xhtml" x="650" y="300" zoom="true"/>
+        <Node id="admin/admin_user_unlock.xhtml" x="1400" y="300" zoom="true"/>
+        <Node id="imprint.xhtml" x="650" y="450" zoom="true"/>
+        <Node id="user/show_addressbook.xhtml" x="900" y="450" zoom="true"/>
+        <Node id="*" x="400" y="750" zoom="true"/>
+        <Node id="user/login_error.xhtml" x="150" y="1050" zoom="true"/>
+        <Node id="login/login_other_addressbooks.xhtml" x="650" y="750" zoom="true"/>
+        <Node id="user/show_addressbook_entries.xhtml" x="1400" y="600" zoom="true"/>
+        <Node id="login/login_change_email_address.xhtml" x="150" y="150" zoom="true"/>
+        <Node id="user/lost_passwd.xhtml" x="1900" y="300" zoom="true"/>
+        <Node id="login/login_list_sharing_addressbooks.xhtml" x="400" y="1050" zoom="true"/>
+        <Node id="user/login.xhtml" x="2150" y="150" zoom="true"/>
+        <Node id="login/login_edit_user_data.xhtml" x="1150" y="300" zoom="true"/>
     </Scope>
     <Scope Scope="All Faces Configurations"/>
 </Scene>
index 1b43bd10bb1c3f7569ded06872ef984a4032da33..5b5be64cc574b2c3ee2b39fe7c898d92de04939b 100644 (file)
@@ -133,19 +133,22 @@ public class AddressbookAdminCountryWebApplicationBean implements AddressbookAdm
                        throw new FaceletException(new CountryAlreadyAddedException(country));
                }
 
+               // Init variable
+               Country updatedCountry = null;
+
                try {
                        // Send country to bean
-                       Country updatedCountry = this.countryBean.addCountry(country);
-
-                       // Fire event
-                       this.addedCountryEvent.fire(new AdminEventCountryAdded(updatedCountry));
-
-                       // Clear bean
-                       this.clear();
+                       updatedCountry = this.countryBean.addCountry(country);
                } catch (final CountryAlreadyAddedException ex) {
                        // Throw again
                        throw new FaceletException(ex);
                }
+
+               // Fire event
+               this.addedCountryEvent.fire(new AdminEventCountryAdded(updatedCountry));
+
+               // Clear bean
+               this.clear();
        }
 
        @Override
index e87eddda1a2a5acf37944bbe6f8aa8362061bae6..6b3668cf188751784efe25248df9cf266cf7b8de 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.addressbook.beans.country;
 
 import java.text.MessageFormat;
-import java.util.Collections;
 import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
@@ -94,9 +93,10 @@ public class AddressbookCountryWebApplicationBean implements AddressbookCountryW
        }
 
        @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Country> allCountries () {
                // Return "cached" version
-               return Collections.unmodifiableList(this.countryList);
+               return this.countryList;
        }
 
        /**
index 2e435ba9852b61cee75689a5f9afd9682316d016..610169ee96758ccf181db8c286a7914f2f87dc78 100644 (file)
@@ -46,9 +46,9 @@ public class AddressbookMobileProviderConverter implements Converter {
        private LoggerBeanLocal loggerBeanLocal;
 
        /**
-        * SMS provider bean
+        * Mobile provider bean
         */
-       private MobileProviderSingletonBeanRemote providerController;
+       private MobileProviderSingletonBeanRemote mobileRemoteBean;
 
        /**
         * Initialization of this converter
@@ -85,7 +85,7 @@ public class AddressbookMobileProviderConverter implements Converter {
                }
 
                // Get full list
-               List<MobileProvider> providerList = this.providerController.allMobileProvider();
+               List<MobileProvider> providerList = this.mobileRemoteBean.allMobileProvider();
 
                // Init value
                MobileProvider provider = null;
index eefde9527850e2efe4610b0dbcef731494a262a8..66c5ed16496d8466cfa47734ab0b7b6d1e740c7b 100644 (file)
@@ -322,10 +322,6 @@ EN_US=English (US)
 CONTENT_PAGE_INDEX_PARA1=Text fuer 1. Absatz.
 CONTENT_PAGE_INDEX_PARA2=Text fuer 2. Absatz.
 CONTENT_PAGE_INDEX_PARA3=Text fuer 3. Absatz.
-# @TODO Fix German umlaut!
-LINK_ADMIN_ADD_USER=Benutzeraccount hinzufuegen
-# @TODO Fix German umlaut!
-LINK_ADMIN_ADD_USER_TITLE=Hier koennen Sie einen weiteren Benutzer hinzufuegen.
 LINK_ADMIN_LIST_USER=Benuzteraccounts auflisten
 LINK_ADMIN_LIST_USER_TITLE=Alle bestehenden Benutzeraccounts auflisten.
 LINK_ADMIN_EDIT_USER=Benuzteraccount editieren
@@ -375,7 +371,7 @@ ADMIN_ADD_USER_EMAIL_LEGEND_TITLE=Vergeben Sie hier den Benutzernamen und geben
 ADMIN_ADD_USER_ENTER_USER_NAME=Benutzername (*1):
 ADMIN_ADD_USER_ENTER_EMAIL=Email-Adresse (*2):
 ADMIN_ADD_USER_USER_NAME_NOTICE=*1: Der Benutzername darf nur einmal vorhanden sein, das System prueft dies fuer Sie.
-ADMIN_ADD_USER_PASSWORD_NOTICE=Das Passwort wird dem Benutzer nach Erstellung des Zugangs an die Email-Adresse gesendet.
+ADMIN_ADD_USER_PASSWORD_NOTICE=Lassen Sie beide Passwortfelder leer und es wird ein Passwort per Zufall generiert. Das Passwort wird dem Benutzer nach Erstellung des Zugangs an die Email-Adresse gesendet.
 ADMIN_ADD_USER_EMAIL_ADDRESS_NOTICE=*2: Die Email-Adresse darf nur einmal vorhanden sein.
 ADMIN_ADD_USER_CUSTOMER_NUMBER_NOTICE=Eine Kundennummer wird automatisch beim Erstellen des Accounts erzeugt.
 #@TODO Please fix German umlauts!
@@ -425,5 +421,51 @@ ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX=Vorwahl ausserorts:
 ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME=Land:
 #@TODO Please fix German umlauts!
 ADMIN_LINK_EDIT_DELETE_COUNTRY_TITLE=Aendern oder loeschen der Laenderdaten
+#@TODO Please fix German umlauts!
+TABLE_SUMMARY_ADMIN_LIST_COUNTRIES=Listet alle bereits angelegten Laenderdaten auf.
 COUNTRY_GERMANY=Deutschland
 ERROR_TARGET_CONTROLLER_PARAMETER_NOT_SET=Fehler: Der Parameter 'targetController' ist nicht gesetzt.
+ADMIN_MENU_MOBILE_PROVIDER_TITLE=Handyanbieter verwalten
+#@TODO Please fix German umlauts!
+LINK_ADMIN_LIST_MOBILE_PROVIDER_TITLE=Hinzufuegen, auflisten, aendern und loeschen von Handyanbietern.
+PAGE_TITLE_ADMIN_MOBILE_PROVIDER_LIST=Handyanbieter verwalten
+CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_LIST=Verwalten von Handyanbietern:
+#@TODO Please fix German umlauts!
+PAGE_TITLE_ADMIN_MOBILE_PROVIDER_EDIT=Handyanbieter aendern
+#@TODO Please fix German umlauts!
+CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_EDIT=Aendern des Handyanbieters:
+#@TODO Please fix German umlauts!
+PAGE_TITLE_ADMIN_MOBILE_PROVIDER_DELETE=Handyanbieter loeschen
+#@TODO Please fix German umlauts!
+CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_DELETE=Loeschen des Handyanbieters:
+#@TODO Please fix German umlauts!
+ADMIN_ADD_MOBILE_PROVIDER_TITLE=Handyanbieter hinzufuegen
+#@TODO Please fix German umlauts!
+ADMIN_MOBILE_PROVIDER_MINIMUM_NOTICE=Es muessen alle Fehler ausgefuellt werden.
+ADMIN_MOBILE_PROVIDER_LEGEND=Daten des Handyanbieters eingeben:
+ADMIN_MOBILE_PROVIDER_LEGEND_TITLE=Geben Sie hier alle Daten des Handyanbieters ein.
+LINK_ADMIN_LIST_MOBILE_PROVIDER=Verwalten ...
+TABLE_SUMMARY_ADMIN_LIST_MOBILE_PROVIDERS=Listet alle bereits angelegten Handyanbieter auf.
+#@TODO Please fix German umlauts!
+ADMIN_ENTER_MOBILE_PROVIDER_DIAL_PREFIX=Vorwahl des Anbieters (keine fuehrende Null):
+#@TODO Please fix German umlauts!
+ADMIN_ENTER_MOBILE_PROVIDER_PATTERN=Regulaerer Ausdruck fuer Mails:
+ADMIN_ENTER_MOBILE_PROVIDER_NAME=Name des Anbieters:
+#@TODO Please fix German umlauts!
+ADMIN_SELECT_MOBILE_PROVIDER_COUNTRY=Land auswaehlen:
+#@TODO Please fix German umlauts!
+BUTTON_ADMIN_ADD_MOBILE_PROVIDER=Handyanbieter hinzufuegen
+#@TODO Please fix German umlauts!
+ADMIN_ADD_MOBILE_PROVIDER_NOTICES=Hinweise zum Hinzufuegen von Handyanbietern:
+#@TODO Please fix German umlauts!
+ADMIN_ADD_MOBILE_PROVIDER_PATTERN=Der regulaere Ausdruck darf nur ein %s enthalten und dies muss die komplette Handynummer sein. Z.B. %s@smsmail.anbieter.example
+ADMIN_ENTER_MOBILE_PROVIDER_PATTERN_EXAMPLE=(Beispiel: %s@smsmail.anbieter.example)
+ADMIN_LIST_MOBILE_PRROVIDER_ID=Id-Nummer:
+ADMIN_LIST_MOBILE_PRROVIDER_NAME=Name:
+ADMIN_LIST_MOBILE_PRROVIDER_DIAL_PREFIX=Vorwahl:
+ADMIN_LIST_MOBILE_PRROVIDER_COUNTRY=Land:
+ADMIN_LIST_MOBILE_PRROVIDER_ENTRY_CREATED=Erstellt:
+#@TODO Please fix German umlauts!
+ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE=Aendern oder loeschen des Handyanbieters
+ADMIN_ADD_USER_ENTER_PASSWORD1=Passwort eingeben:
+ADMIN_ADD_USER_ENTER_PASSWORD2=Passwort wiederholen:
index 9e71e7e7c89cbfb6950283178cf07ec04ad2ceec..cdb2d89908e3af965f36c895511d999394f6dadc 100644 (file)
@@ -296,8 +296,6 @@ EN_US=English (US)
 CONTENT_PAGE_INDEX_PARA1=Text for 1st paragraph.
 CONTENT_PAGE_INDEX_PARA2=Text for 2nd paragraph.
 CONTENT_PAGE_INDEX_PARA3=Text for 3rd paragraph.
-LINK_ADMIN_ADD_USER=Add user account
-LINK_ADMIN_ADD_USER_TITLE=Here you can add a new user account.
 LINK_ADMIN_LIST_USER=List user accounts
 LINK_ADMIN_LIST_USER_TITLE=List all existing user accounts.
 LINK_ADMIN_EDIT_USER=Edit user account
@@ -336,7 +334,7 @@ ADMIN_ADD_USER_EMAIL_LEGEND_TITLE=Enter here a user name and email address.
 ADMIN_ADD_USER_ENTER_USER_NAME=User name (*1):
 ADMIN_ADD_USER_ENTER_EMAIL=Email address (*2):
 ADMIN_ADD_USER_USER_NAME_NOTICE=*1: The user name must be unique which is checked by the system for you.
-ADMIN_ADD_USER_PASSWORD_NOTICE=The password is being sent to the user's email address after creation of the account.
+ADMIN_ADD_USER_PASSWORD_NOTICE=Keep both password fields empty to create a random password. The password is being sent to the user's email address after creation of the account.
 ADMIN_ADD_USER_EMAIL_ADDRESS_NOTICE=*2: The email address must be unique.
 ADMIN_ADD_USER_CUSTOMER_NUMBER_NOTICE=A customer number is being automatically created on creation of the account.
 BUTTON_ADMIN_ADD_USER=Add new user account
@@ -365,5 +363,36 @@ ADMIN_LIST_COUNTRY_DATA_COUNTRY_CODE=Country code:
 ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX=Dial prefix outside:
 ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME=Country:
 ADMIN_LINK_EDIT_DELETE_COUNTRY_TITLE=Edit or delete country
+TABLE_SUMMARY_ADMIN_LIST_COUNTRIES=List of all already added countries.
 COUNTRY_GERMANY=Germany
 ERROR_TARGET_CONTROLLER_PARAMETER_NOT_SET=Error: The parameter 'targetController' is not set.
+ADMIN_MENU_MOBILE_PROVIDER_TITLE=Mobile providers
+LINK_ADMIN_LIST_MOBILE_PROVIDER=Manage ...
+LINK_ADMIN_LIST_MOBILE_PROVIDER_TITLE=Add, list, edit and delete mobile providers.
+PAGE_TITLE_ADMIN_MOBILE_PROVIDER_LIST=Manage mobile providers
+CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_LIST=Manage mobile providers:
+PAGE_TITLE_ADMIN_MOBILE_PROVIDER_EDIT=Edit mobile provider
+ADMIN_ADD_MOBILE_PROVIDER_TITLE=Add mobile provider
+ADMIN_MOBILE_PROVIDER_MINIMUM_NOTICE=All fields must be filled out.
+ADMIN_MOBILE_PROVIDER_LEGEND=Enter data of mobile provider:
+ADMIN_MOBILE_PROVIDER_LEGEND_TITLE=Here you can enter all data of the mobile provider.
+CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_DELETE=Delete mobile provider:
+CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_EDIT=Edit mobile provider:
+PAGE_TITLE_ADMIN_MOBILE_PROVIDER_DELETE=Delete mobile provider
+TABLE_SUMMARY_ADMIN_LIST_MOBILE_PROVIDERS=Lists all already added mobile providers.
+ADMIN_ENTER_MOBILE_PROVIDER_DIAL_PREFIX=Dial prefix of provider (no leading zero):
+ADMIN_ENTER_MOBILE_PROVIDER_PATTERN=Pattern for mails:
+ADMIN_ENTER_MOBILE_PROVIDER_NAME=Name of provider:
+ADMIN_SELECT_MOBILE_PROVIDER_COUNTRY=Choose country:
+BUTTON_ADMIN_ADD_MOBILE_PROVIDER=Add mobile provider
+ADMIN_ADD_MOBILE_PROVIDER_NOTICES=Notices for adding mobile provider:
+ADMIN_ADD_MOBILE_PROVIDER_PATTERN=The pattern should only contain one %s which must be the full mobile number. Example: %s@smsmail.provider.example
+ADMIN_ENTER_MOBILE_PROVIDER_PATTERN_EXAMPLE=(Example: %s@smsmail.provider.example)
+ADMIN_LIST_MOBILE_PRROVIDER_ID=Id number:
+ADMIN_LIST_MOBILE_PRROVIDER_NAME=Name:
+ADMIN_LIST_MOBILE_PRROVIDER_DIAL_PREFIX=Dial prefix:
+ADMIN_LIST_MOBILE_PRROVIDER_COUNTRY=Country:
+ADMIN_LIST_MOBILE_PRROVIDER_ENTRY_CREATED=Created:
+ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE=Edit or delete mobile provider
+ADMIN_ADD_USER_ENTER_PASSWORD1=Enter password:
+ADMIN_ADD_USER_ENTER_PASSWORD2=Repeat password:
diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java
new file mode 100644 (file)
index 0000000..02aae75
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.mobileprovider;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Objects;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.events.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.events.AdminMobileProviderAddedEvent;
+import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException;
+import org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSingletonBeanRemote;
+import org.mxchange.jphone.phonenumbers.mobileprovider.CellphoneProvider;
+import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+
+/**
+ * Administrative bean (controller) for mobile provider
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("adminMobileController")
+@RequestScoped
+public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileProviderWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 184_598_175_371_269_016L;
+
+       /**
+        * Remote EJB for mobile providers (administrative)
+        */
+       private AdminMobileProviderSingletonBeanRemote adminRemoteBean;
+
+       /**
+        * Regular bean
+        */
+       @Inject
+       private PizzaMobileProviderWebRequestController mobileController;
+
+       /**
+        * Event being fired when the mobile provider was added
+        */
+       @Inject
+       @Any
+       private Event<AdminAddedMobileProviderEvent> providerAddedEvent;
+
+       /**
+        * Country instance ('s dial data)
+        */
+       private Country providerCountry;
+
+       /**
+        * Provider dial prefix (example: 0177 for German E+)
+        */
+       private Long providerDialPrefix;
+
+       /**
+        * Pattern for mail gateway
+        */
+       private String providerMailPattern;
+
+       /**
+        * Name of the provider
+        */
+       private String providerName;
+
+       /**
+        * Default constructor
+        */
+       public PizzaAdminMobileProviderWebRequestBean () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.adminRemoteBean = (AdminMobileProviderSingletonBeanRemote) context.lookup("java:global/PizzaService-ejb/adminmobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.AdminMobileProviderSingletonBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public void addMobileProvider () {
+               // Create mobile provider instance
+               MobileProvider mobileProvider = new CellphoneProvider(this.getProviderDialPrefix(), this.getProviderName(), this.getProviderCountry(), this.getProviderMailPattern());
+
+               // Is the provider already created?
+               if (this.isMobileProviderCreated(mobileProvider)) {
+                       // Then throw exception
+                       throw new FaceletException(new MobileProviderAlreadyAddedException(mobileProvider));
+               }
+
+               // Init variable
+               MobileProvider updatedProvider = null;
+
+               try {
+                       // Call remote EJB and get back an updated instance
+                       updatedProvider = this.adminRemoteBean.addMobileProvider(mobileProvider);
+               } catch (final MobileProviderAlreadyAddedException ex) {
+                       // Throw again
+                       throw new FaceletException(ex);
+               }
+
+               // Fire event
+               this.providerAddedEvent.fire(new AdminMobileProviderAddedEvent(updatedProvider));
+
+               // Clear this bean
+               this.clear();
+       }
+
+       @Override
+       public List<MobileProvider> allMobileProvider () {
+               return this.mobileController.allMobileProvider();
+       }
+
+       @Override
+       public Country getProviderCountry () {
+               return this.providerCountry;
+       }
+
+       @Override
+       public void setProviderCountry (final Country providerCountry) {
+               this.providerCountry = providerCountry;
+       }
+
+       @Override
+       public Long getProviderDialPrefix () {
+               return this.providerDialPrefix;
+       }
+
+       @Override
+       public void setProviderDialPrefix (final Long providerDialPrefix) {
+               this.providerDialPrefix = providerDialPrefix;
+       }
+
+       @Override
+       public String getProviderMailPattern () {
+               return this.providerMailPattern;
+       }
+
+       @Override
+       public void setProviderMailPattern (final String providerMailPattern) {
+               this.providerMailPattern = providerMailPattern;
+       }
+
+       @Override
+       public String getProviderName () {
+               return this.providerName;
+       }
+
+       @Override
+       public void setProviderName (final String providerName) {
+               this.providerName = providerName;
+       }
+
+       @Override
+       public boolean hasMobileProvider () {
+               return (!this.allMobileProvider().isEmpty());
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all fields
+               this.setProviderCountry(null);
+               this.setProviderDialPrefix(null);
+               this.setProviderMailPattern(null);
+               this.setProviderName(null);
+       }
+
+       /**
+        * Checks whether if the given mobile provider is already created by
+        * checking both dial prefix and country.
+        * <p>
+        * @param mobileProvider Mobile provider instance to check
+        * <p>
+        * @return Whether the given mobile provider instance is found
+        */
+       private boolean isMobileProviderCreated (final MobileProvider mobileProvider) {
+               // Default is not found
+               boolean isFound = false;
+
+               // Get list of all providers
+               List<MobileProvider> providers = this.allMobileProvider();
+
+               // Get iterator from it
+               Iterator<MobileProvider> iterator = providers.iterator();
+
+               // Loop through all
+               while (iterator.hasNext()) {
+                       // Get next element
+                       MobileProvider next = iterator.next();
+
+                       // Is the provider's dial prefix and country the same?
+                       if ((Objects.equals(mobileProvider.getProviderDialPrefix(), next.getProviderDialPrefix())) && (Objects.equals(mobileProvider.getProviderCountry(), next.getProviderCountry()))) {
+                               // Is the same, abort loop
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return result
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java
new file mode 100644 (file)
index 0000000..558de55
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.mobileprovider;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+
+/**
+ * An interface for a request web controller (bean) for administrative mobile
+ * provider purposes.
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaAdminMobileProviderWebRequestController extends Serializable {
+
+       /**
+        * Adds a mobile provider to database by calling the EJB. A pre-check on
+        * dial-prefix and country combination is done, if found, an exception is
+        * thrown.
+        */
+       void addMobileProvider ();
+
+       /**
+        * Returns a list of all mobile providers
+        * <p>
+        * @return A list of all mobile providers
+        */
+       List<MobileProvider> allMobileProvider ();
+
+       /**
+        * Checks whether mobile providers are registered
+        * <p>
+        * @return Whether mobile providers are registered
+        */
+       boolean hasMobileProvider ();
+
+       /**
+        * Getter for provider dial prefix
+        * <p>
+        * @return Provider dial prefix
+        */
+       Long getProviderDialPrefix ();
+
+       /**
+        * Setter for provider dial prefix
+        * <p>
+        * @param providerDialPrefix Provider dial prefix
+        */
+       void setProviderDialPrefix (final Long providerDialPrefix);
+
+       /**
+        * Getter for provider name
+        * <p>
+        * @return Provider name
+        */
+       String getProviderName ();
+
+       /**
+        * Setter for provider name
+        * <p>
+        * @param providerName Provider name
+        */
+       void setProviderName (final String providerName);
+
+       /**
+        * Getter for country instance ('s dial data)
+        * <p>
+        * @return Country instance
+        */
+       Country getProviderCountry ();
+
+       /**
+        * Setter for country instance ('s dial data)
+        * <p>
+        * @param country Country instance
+        */
+       void setProviderCountry (final Country country);
+
+       /**
+        * Getter for pattern for mail gateway
+        * <p>
+        * @return Pattern for mail gateway
+        */
+       String getProviderMailPattern ();
+
+       /**
+        * Setter for pattern for mail gateway
+        * <p>
+        * @param providerMailRegex Pattern for mail gateway
+        */
+       void setProviderMailPattern (final String providerMailRegex);
+
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java
new file mode 100644 (file)
index 0000000..32656b2
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2016 Roland Haeder<roland@mxchange.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.mobileprovider;
+
+import java.text.MessageFormat;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Observes;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jphone.events.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
+
+/**
+ * A general bean for mobile providers
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("mobileController")
+@SessionScoped
+public class PizzaMobileProviderWebRequestBean implements PizzaMobileProviderWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 15_869_423_671_950_276L;
+
+       /**
+        * "Cached" list of mobile providers
+        */
+       private List<MobileProvider> mobileProviders;
+
+       /**
+        * Remote EJB for mobile providers (regular)
+        */
+       private MobileProviderSingletonBeanRemote mobileRemoteBean;
+
+       /**
+        * Default constructor
+        */
+       public PizzaMobileProviderWebRequestBean () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.mobileRemoteBean = (MobileProviderSingletonBeanRemote) context.lookup("java:global/PizzaService-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+       }
+
+       @Override
+       public void afterAdminAddedMobileProvider (@Observes final AdminAddedMobileProviderEvent event) {
+               // Is all valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedMobileProvider()== null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedMobileProvider is null"); //NOI18N
+               } else if (event.getAddedMobileProvider().getProviderId()== null) {
+                       // And again ...
+                       throw new NullPointerException("event.addedMobileProvider.providerId is null"); //NOI18N
+               } else if (event.getAddedMobileProvider().getProviderId() < 1) {
+                       // Id is invalid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedMobileProvider.providerId={0} is not valid.", event.getAddedMobileProvider().getProviderId())); //NOI18N
+               }
+
+               // Add it to the list
+               this.mobileProviders.add(event.getAddedMobileProvider());
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<MobileProvider> allMobileProvider () {
+               return this.mobileProviders;
+       }
+
+       /**
+        * Initializer method
+        */
+       @PostConstruct
+       public void init () {
+               // Init list of mobile providers
+               this.mobileProviders = this.mobileRemoteBean.allMobileProvider();
+       }
+
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestController.java b/src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestController.java
new file mode 100644 (file)
index 0000000..ba780e5
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 Roland Haeder<roland@mxchange.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.mobileprovider;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jphone.events.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
+
+/**
+ * An interface for general mobile provider controller
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface PizzaMobileProviderWebRequestController extends Serializable {
+
+       /**
+        * Returns a list of all mobile providers
+        * <p>
+        * @return A list of all mobile providers
+        */
+       List<MobileProvider> allMobileProvider ();
+
+       /**
+        * Observes events being fired after the administrator has added a new
+        * mobile provider
+        * <p>
+        * @param event Event being fired
+        */
+       void afterAdminAddedMobileProvider (final AdminAddedMobileProviderEvent event);
+
+}
index 1e118a9a31e5a5a5347c9796934238347640fdcd..14d9b5dc326994523f5746801b348867f4765a65 100644 (file)
                        <from-outcome>admin_unlock_user</from-outcome>
                        <to-view-id>/admin/admin_user_unlock.xhtml</to-view-id>
                </navigation-case>
-               <navigation-case>
-                       <from-outcome>admin_add_user</from-outcome>
-                       <to-view-id>/admin/admin_user_add.xhtml</to-view-id>
-               </navigation-case>
                <navigation-case>
                        <from-outcome>admin_list_countries</from-outcome>
                        <to-view-id>/admin/admin_country_list.xhtml</to-view-id>
                </navigation-case>
+               <navigation-case>
+                       <from-outcome>admin_list_mobile_provider</from-outcome>
+                       <to-view-id>/admin/admin_mobile_provider_list.xhtml</to-view-id>
+               </navigation-case>
        </navigation-rule>
        <navigation-rule>
                <from-view-id>/user/login.xhtml</from-view-id>
                </exception-handler-factory>
        </factory>
        //-->
+    <navigation-rule>
+        <from-view-id>/admin/admin_mobile_provider_list.xhtml</from-view-id>
+        <navigation-case>
+            <from-outcome>admin_edit_mobile_provider</from-outcome>
+            <to-view-id>/admin/admin_mobile_provider_edit.xhtml</to-view-id>
+        </navigation-case>
+    </navigation-rule>
 </faces-config>
diff --git a/web/WEB-INF/templates/admin/admin_form_mobile_provider.tpl b/web/WEB-INF/templates/admin/admin_form_mobile_provider.tpl
new file mode 100644 (file)
index 0000000..7d2232c
--- /dev/null
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:f="http://java.sun.com/jsf/core"
+       xmlns:h="http://java.sun.com/jsf/html"
+       xmlns:ui="http://java.sun.com/jsf/facelets">
+
+       <div class="para notice">
+               #{msg.ADMIN_MOBILE_PROVIDER_MINIMUM_NOTICE}
+       </div>
+
+       <div class="para">
+               <fieldset id="mobile_provider">
+                       <legend title="#{msg.ADMIN_MOBILE_PROVIDER_LEGEND_TITLE}">#{msg.ADMIN_MOBILE_PROVIDER_LEGEND}</legend>
+
+                       <div class="table_row">
+                               <div class="table_left_medium">
+                                       <h:outputLabel for="providerDialPrefix" value="#{msg.ADMIN_ENTER_MOBILE_PROVIDER_DIAL_PREFIX}" />
+                               </div>
+
+                               <div class="table_right_medium">
+                                       <h:inputText class="input" id="providerDialPrefix" size="5" maxlength="20" value="#{adminMobileController.providerDialPrefix}" required="true">
+                                               <f:validateLongRange for="providerDialPrefix" minimum="0" maximum="9999" />
+                                       </h:inputText>
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+
+                       <div class="table_row">
+                               <div class="table_left_medium">
+                                       <h:outputLabel for="providerMailRegex" value="#{msg.ADMIN_ENTER_MOBILE_PROVIDER_PATTERN}" />
+                               </div>
+
+                               <div class="table_right_medium">
+                                       <h:inputText class="input" id="providerMailRegex" size="10" maxlength="30" value="#{adminMobileController.providerMailPattern}" required="true" />
+
+                                       <h:outputText class="small notice" value="#{msg.ADMIN_ENTER_MOBILE_PROVIDER_PATTERN_EXAMPLE}" />
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+
+                       <div class="table_row">
+                               <div class="table_left_medium">
+                                       <h:outputLabel for="providerName" value="#{msg.ADMIN_ENTER_MOBILE_PROVIDER_NAME}" />
+                               </div>
+
+                               <div class="table_right_medium">
+                                       <h:inputText class="input" id="providerName" size="20" maxlength="100" value="#{adminMobileController.providerName}" required="true" />
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+
+                       <div class="table_row">
+                               <div class="table_left_medium">
+                                       <h:outputLabel for="providerCountry" value="#{msg.ADMIN_SELECT_MOBILE_PROVIDER_COUNTRY}" />
+                               </div>
+
+                               <div class="table_right_medium">
+                                       <h:selectOneMenu class="select" id="providerCountry" value="#{adminMobileController.providerCountry}" converter="country">
+                                               <f:selectItems value="#{countryController.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{c.countryCode} (#{msg[c.countryI18nkey]})" />
+                                       </h:selectOneMenu>
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+               </fieldset>
+       </div>
+</ui:composition>
index 3f98abadf73de1dc8bf2ff6f3d84127f73f97702..87d709e30c88d3de49ba6317b527a993df0739c7 100644 (file)
                                </div>
 
                                <div class="table_right">
-                                       <h:selectOneMenu class="select" id="cellphoneCarrier" value="#{adminUserController.cellphoneCarrier}" converter="CellphoneCarrierConverter">
-                                               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                               <f:selectItems value="#{cellphone.allSmsProvider()}" var="p" itemValue="#{p}" itemLabel="#{p.providerCountry.countryExternalDialPrefix}#{p.providerDialPrefix} (#{p.providerName})" />
-                                       </h:selectOneMenu>
-
-                                       <h:inputText class="input" id="cellphoneNumber" size="10" maxlength="20" value="#{adminUserController.cellphoneNumber}">
-                                               <f:validator for="cellphoneNumber" validatorId="PhoneNumberValidator" />
-                                       </h:inputText>
+                                       <ui:include src="/WEB-INF/templates/generic/mobile_selection_box.tpl">
+                                               <ui:param name="targetController" value="#{adminUserController}" />
+                                       </ui:include>
                                </div>
 
                                <div class="clear"></div>
 
                        <div class="para"></div>
 
+                       <div class="table_row">
+                               <div class="table_left">
+                                       <h:outputLabel for="password1" value="#{msg.ADMIN_ADD_USER_ENTER_PASSWORD1}" />
+                               </div>
+
+                               <div class="table_right">
+                                       <h:inputSecret class="input" id="password1" size="10" maxlength="255" value="#{adminUserController.userPassword}" required="true" />
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+
+                       <div class="table_row">
+                               <div class="table_left">
+                                       <h:outputLabel for="password2" value="#{msg.ADMIN_ADD_USER_ENTER_PASSWORD2}" />
+                               </div>
+
+                               <div class="table_right">
+                                       <h:inputSecret class="input" id="password2" size="10" maxlength="255" value="#{adminUserController.userPasswordRepeat}" required="true" />
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+
                        <div class="para notice">
                                <ul>
                                        <li>#{msg.ADMIN_ADD_USER_USER_NAME_NOTICE}</li>
index 0463ea64b35abcbd2a5c685b8e4760c8fde13839..60095a667138e16d191b40db406773a313419aa6 100644 (file)
@@ -19,7 +19,6 @@
                        </div>
 
                        <ul>
-                               <li><h:link title="#{msg.LINK_ADMIN_ADD_USER_TITLE}" outcome="admin_add_user" value="#{msg.LINK_ADMIN_ADD_USER}" /></li>
                                <li><h:link title="#{msg.LINK_ADMIN_LIST_USER_TITLE}" outcome="admin_list_user" value="#{msg.LINK_ADMIN_LIST_USER}" /></li>
                                <li><h:link title="#{msg.LINK_ADMIN_EDIT_USER_TITLE}" outcome="admin_edit_user" value="#{msg.LINK_ADMIN_EDIT_USER}" /></li>
                                <li><h:link title="#{msg.LINK_ADMIN_DELETE_USER_TITLE}" outcome="admin_delete_user" value="#{msg.LINK_ADMIN_DELETE_USER}" /></li>
                                <li><h:link title="#{msg.LINK_ADMIN_LIST_COUNTRIES_TITLE}" outcome="admin_list_countries" value="#{msg.LINK_ADMIN_LIST_COUNTRIES}" /></li>
                        </ul>
 
+                       <div class="menu_header">
+                               #{msg.ADMIN_MENU_MOBILE_PROVIDER_TITLE}
+                       </div>
+
+                       <ul>
+                               <li><h:link title="#{msg.LINK_ADMIN_LIST_MOBILE_PROVIDER_TITLE}" outcome="admin_list_mobile_provider" value="#{msg.LINK_ADMIN_LIST_MOBILE_PROVIDER}" /></li>
+                       </ul>
+
                        <div class="menu_header">
                                #{msg.ADMIN_MENU_LOGOUT_TITLE}
                        </div>
index f5f1fcdc3451ce76c154c7b6d7520d498be9958f..8771740a6ccf6e8763fd6bce663b26fd078edd59 100644 (file)
                                </div>
 
                                <div class="table_right">
-                                       <h:selectOneMenu class="select" id="cellphoneCarrier" value="#{userController.cellphoneCarrier}" converter="cellphoneCarrier">
-                                               <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                                               <f:selectItems value="#{cellphone.allSmsProvider()}" var="p" itemValue="#{p}" itemLabel="#{p.providerCountry.countryExternalDialPrefix}#{p.providerDialPrefix} (#{p.providerName})" />
-                                       </h:selectOneMenu>
-
-                                       <h:inputText class="input" id="cellphoneNumber" size="10" maxlength="20" value="#{userController.cellphoneNumber}">
-                                               <f:validator for="cellphoneNumber" validatorId="PhoneNumberValidator" />
-                                       </h:inputText>
+                                       <ui:include src="/WEB-INF/templates/generic/mobile_selection_box.tpl">
+                                               <ui:param name="targetController" value="#{userController}" />
+                                       </ui:include>
                                </div>
 
                                <div class="clear"></div>
diff --git a/web/WEB-INF/templates/generic/mobile_selection_box.tpl b/web/WEB-INF/templates/generic/mobile_selection_box.tpl
new file mode 100644 (file)
index 0000000..3852130
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+       xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:f="http://java.sun.com/jsf/core"
+       xmlns:h="http://java.sun.com/jsf/html"
+       xmlns:ui="http://java.sun.com/jsf/facelets">
+
+       <ui:fragment rendered="#{not empty targetController}">
+               <h:selectOneMenu class="select" id="cellphoneCarrier" value="#{targetController.cellphoneCarrier}" converter="MobileProviderConverter">
+                       <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
+                       <f:selectItems value="#{mobileController.allMobileProvider()}" var="p" itemValue="#{p}" itemLabel="#{p.providerCountry.countryExternalDialPrefix}#{p.providerDialPrefix} (#{p.providerName})" />
+               </h:selectOneMenu>
+
+               <h:inputText class="input" id="cellphoneNumber" size="10" maxlength="20" value="#{targetController.cellphoneNumber}">
+                       <f:validator for="cellphoneNumber" validatorId="PhoneNumberValidator" />
+               </h:inputText>
+       </ui:fragment>
+
+       <ui:fragment rendered="#{empty targetController}">
+               <h:outputText class="errors" value="#{msg.ERROR_TARGET_CONTROLLER_PARAMETER_NOT_SET}" />
+       </ui:fragment>
+</ui:composition>
diff --git a/web/admin/admin_mobile_provider_delete.xhtml b/web/admin/admin_mobile_provider_delete.xhtml
new file mode 100644 (file)
index 0000000..25ac615
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+         xmlns:ui="http://java.sun.com/jsf/facelets"
+         xmlns:h="http://xmlns.jcp.org/jsf/html"
+         xmlns:f="http://xmlns.jcp.org/jsf/core"
+         >
+
+       <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
+               <ui:define name="admin_title">#{msg.PAGE_TITLE_ADMIN_MOBILE_PROVIDER_DELETE}</ui:define>
+
+               <ui:define name="content_header">
+                       #{msg.CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_DELETE}
+               </ui:define>
+
+               <ui:define name="content">
+                       Here goes your content.
+               </ui:define>
+       </ui:composition>
+</html>
diff --git a/web/admin/admin_mobile_provider_edit.xhtml b/web/admin/admin_mobile_provider_edit.xhtml
new file mode 100644 (file)
index 0000000..f7c3658
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+         xmlns:ui="http://java.sun.com/jsf/facelets"
+         xmlns:h="http://xmlns.jcp.org/jsf/html"
+         xmlns:f="http://xmlns.jcp.org/jsf/core"
+         >
+
+       <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
+               <ui:define name="admin_title">#{msg.PAGE_TITLE_ADMIN_MOBILE_PROVIDER_EDIT}</ui:define>
+
+               <ui:define name="content_header">
+                       #{msg.CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_EDIT}
+               </ui:define>
+
+               <ui:define name="content">
+                       Here goes your content.
+               </ui:define>
+       </ui:composition>
+</html>
diff --git a/web/admin/admin_mobile_provider_list.xhtml b/web/admin/admin_mobile_provider_list.xhtml
new file mode 100644 (file)
index 0000000..214e5f4
--- /dev/null
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+         xmlns:ui="http://java.sun.com/jsf/facelets"
+         xmlns:h="http://xmlns.jcp.org/jsf/html"
+         xmlns:f="http://xmlns.jcp.org/jsf/core"
+         >
+
+       <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
+               <ui:define name="admin_title">#{msg.PAGE_TITLE_ADMIN_MOBILE_PROVIDER_LIST}</ui:define>
+
+               <ui:define name="content_header">
+                       #{msg.CONTENT_TITLE_ADMIN_MOBILE_PROVIDER_LIST}
+               </ui:define>
+
+               <ui:define name="content">
+                       <h:dataTable id="table_list_mobile" var="mobile" value="#{adminMobileController.allMobileProvider()}" styleClass="table_medium" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_MOBILE_PROVIDERS}" rendered="#{adminMobileController.hasMobileProvider()}">
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_MOBILE_PRROVIDER_ID}</f:facet>
+
+                                       <h:link outcome="admin_edit_mobile_provider" title="#{msg.ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE}" value="#{mobile.providerId}">
+                                               <f:param name="providerId" value="#{mobile.providerId}" />
+                                       </h:link>
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_MOBILE_PRROVIDER_NAME}</f:facet>
+
+                                       <h:outputText value="#{mobile.providerName}" />
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_MOBILE_PRROVIDER_DIAL_PREFIX}</f:facet>
+
+                                       <h:outputText value="#{mobile.providerDialPrefix}" />
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_MOBILE_PRROVIDER_COUNTRY}</f:facet>
+
+                                       <h:outputText value="#{msg[mobile.providerCountry.countryI18nkey]}" />
+                               </h:column>
+
+                               <h:column>
+                                       <f:facet name="header">#{msg.ADMIN_LIST_MOBILE_PRROVIDER_ENTRY_CREATED}</f:facet>
+
+                                       <h:outputText id="providerEntryCreated" value="#{mobile.providerEntryCreated.time}" title="#{msg.ADMIN_MOBILE_PROVIDER_ENTRY_CREATED_TITLE}">
+                                               <f:convertDateTime for="providerEntryCreated" type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </h:column>
+                       </h:dataTable>
+
+                       <h:form id="add_provider">
+                               <div class="table_medium">
+                                       <div class="table_header">
+                                               #{msg.ADMIN_ADD_MOBILE_PROVIDER_TITLE}
+                                       </div>
+
+                                       <ui:include src="/WEB-INF/templates/admin/admin_form_mobile_provider.tpl" />
+
+                                       <div class="table_footer">
+                                               <h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
+                                               <h:commandButton class="submit" type="submit" id="register" value="#{msg.BUTTON_ADMIN_ADD_MOBILE_PROVIDER}" action="#{adminMobileController.addMobileProvider()}" />
+                                       </div>
+                               </div>
+
+                               <div class="para notice">
+                                       #{msg.ADMIN_ADD_MOBILE_PROVIDER_NOTICES}
+                                       <ul>
+                                               <li>#{msg.ADMIN_ADD_MOBILE_PROVIDER_PATTERN}</li>
+                                       </ul>
+                               </div>
+                       </h:form>
+               </ui:define>
+       </ui:composition>
+</html>