diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/App.java b/www-client/src/main/java/fr/agrometinfo/www/client/App.java index 2528e987455e0a7b0ccc11eb5756e731a8dc8c69..920e6230623c4ed6296263f11a65335d47a755fa 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/App.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/App.java @@ -18,6 +18,7 @@ import com.google.gwt.user.client.Window; import elemental2.dom.DomGlobal; import fr.agrometinfo.www.client.i18n.AppConstants; +import fr.agrometinfo.www.client.i18n.AppMessages; import fr.agrometinfo.www.client.presenter.LayoutPresenter; import fr.agrometinfo.www.client.util.ApplicationUtils; import fr.agrometinfo.www.shared.service.ApplicationServiceFactory; @@ -54,14 +55,19 @@ public class App implements EntryPoint { */ private static final EventBus EVENT_BUS = new SimpleEventBus(); + /** + * I18n messages. + */ + public static final AppMessages MSGS = GWT.create(AppMessages.class); + private static void checkVersion() { final Date clientDate = ApplicationUtils.getVersionDate(); if (clientDate != null) { ApplicationServiceFactory.INSTANCE// .getApplicationDate() // .onSuccess(serverDate -> { - GWT.log("serverDate = " + serverDate); - GWT.log("clientDate = " + clientDate); + GWT.log("serverDate = " + serverDate); + GWT.log("clientDate = " + clientDate); if (serverDate != null && clientDate.before(serverDate) && DomGlobal.window.confirm(CSTS.reloadingApplication())) { ApplicationUtils.hardReload(); diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppConstants.java b/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppConstants.java index 7a307a1f9666ef78848f1b6cf9c68fc5d025408c..a04911d9d88708cd58918124a6c49b02cd947e2b 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppConstants.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/i18n/AppConstants.java @@ -299,6 +299,22 @@ public interface AppConstants extends com.google.gwt.i18n.client.ConstantsWithLo @DefaultStringValue("Toggle right panel") String toggleRightPanel(); + /** + * @return translation + */ + @DefaultStringValue("AgroMetInfo is currently being redesigned.<br/>" + + "To keep up to date, you can send us a message to " + + "<a href=\"mailto:support-agrometinfo@inrae.fr?subject=AgroMetInfo:%20contact\">" + + "support-agrometinfo@inrae.fr</a> " + + "or use the contact form.") + String welcomeBody(); + + /** + * @return translation + */ + @DefaultStringValue("Welcome to AgroMetInfo") + String welcomeTitle(); + /** * @return translation */ diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/presenter/LayoutPresenter.java b/www-client/src/main/java/fr/agrometinfo/www/client/presenter/LayoutPresenter.java index e395b31494020dd97678d33bccfd16bfddf7e04d..997413fe510066455709b61d9b7a68353523be1b 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/presenter/LayoutPresenter.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/presenter/LayoutPresenter.java @@ -178,6 +178,8 @@ public final class LayoutPresenter implements Presenter { rightPanelPresenter.setLayoutView(view); rightPanelPresenter.start(); + new WelcomePresenter().start(); + IndicatorServiceFactory.INSTANCE.getPeriods() // .onSuccess(this::setPeriods) // .onFailed(view::failureNotification) // diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/presenter/WelcomePresenter.java b/www-client/src/main/java/fr/agrometinfo/www/client/presenter/WelcomePresenter.java new file mode 100644 index 0000000000000000000000000000000000000000..16b0e900e01095f2815439d7d32f115669768d26 --- /dev/null +++ b/www-client/src/main/java/fr/agrometinfo/www/client/presenter/WelcomePresenter.java @@ -0,0 +1,43 @@ +package fr.agrometinfo.www.client.presenter; + +import fr.agrometinfo.www.client.view.BaseView; +import fr.agrometinfo.www.client.view.WelcomeView; + +/** + * Presenter related to the welcome message. + * + * @author Olivier Maury + */ +public final class WelcomePresenter implements Presenter { + /** + * Interface for the related view. + */ + public interface View extends BaseView<WelcomePresenter> { + /** + * Close modal. + */ + void close(); + } + + /** + * Related view. + */ + private WelcomeView view; + + /** + * Display contact form. + */ + public void showContactView() { + view.close(); + final ContactPresenter presenter = new ContactPresenter(); + presenter.start(); + } + + @Override + public void start() { + view = new WelcomeView(); + view.setPresenter(this); + view.init(); + } + +} diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/view/ContactView.java b/www-client/src/main/java/fr/agrometinfo/www/client/view/ContactView.java index 3f3eafc499b57d47a1c3cabc4f5f5095f737dc96..81adee1be074406b5dea786601f7615c44cfff80 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/view/ContactView.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/view/ContactView.java @@ -31,7 +31,7 @@ public final class ContactView extends AbstractBaseView<ContactPresenter> implem private static final AppConstants CSTS = GWT.create(AppConstants.class); /** - * The modal used to display the login form. + * The modal used to display the contact form. */ private ModalDialog modal; @@ -59,6 +59,8 @@ public final class ContactView extends AbstractBaseView<ContactPresenter> implem public void init() { GWT.log("ContactView.init()"); nameTextBox = TextBox.create(CSTS.contactNameField()) + .setAttribute("autocomplete", "on") // + .setName("name") .setRequired(true) .setRequiredErrorMessage(CSTS.requiredErrorMessage()) .setAutoValidation(true) diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/view/WelcomeView.java b/www-client/src/main/java/fr/agrometinfo/www/client/view/WelcomeView.java new file mode 100644 index 0000000000000000000000000000000000000000..582f75ef0fd465788142cf839c5675081bfa8aa5 --- /dev/null +++ b/www-client/src/main/java/fr/agrometinfo/www/client/view/WelcomeView.java @@ -0,0 +1,63 @@ +package fr.agrometinfo.www.client.view; + +import static org.jboss.elemento.Elements.div; + +import org.dominokit.domino.ui.button.Button; +import org.dominokit.domino.ui.modals.ModalDialog; + +import com.google.gwt.core.client.GWT; + +import fr.agrometinfo.www.client.App; +import fr.agrometinfo.www.client.i18n.AppConstants; +import fr.agrometinfo.www.client.presenter.WelcomePresenter; + +/** + * View to display contact form. + * + * @author Olivier Maury + */ +public final class WelcomeView implements WelcomePresenter.View { + + /** + * I18N constants. + */ + private static final AppConstants CSTS = App.CSTS; + + /** + * The modal used to display the message. + */ + private ModalDialog modal; + + /** + * Related presenter. + */ + private WelcomePresenter presenter; + + @Override + public void close() { + modal.close(); + } + + @Override + public void init() { + GWT.log("WelcomeView.init()"); + modal = ModalDialog.create(CSTS.welcomeTitle()) // + .appendChild(div().apply(e -> e.innerHTML = CSTS.welcomeBody())) // + .appendFooterChild(Button.create(CSTS.close()) // + .linkify() // + .addClickListener(e -> this.close()) // + ) + .appendFooterChild( + Button.create(CSTS.contactUs()) // + .linkify() // + .addClickListener(e -> presenter.showContactView())) // + .setAutoClose(true) // + .open(); + } + + @Override + public void setPresenter(final WelcomePresenter p) { + this.presenter = p; + } + +} diff --git a/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppConstants_fr.properties b/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppConstants_fr.properties index d8a2bba24f2938b2493697099c1a1063cc8a863b..3436fb93eb3c312d0265620558ded14dc70a0729 100644 --- a/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppConstants_fr.properties +++ b/www-client/src/main/resources/fr/agrometinfo/www/client/i18n/AppConstants_fr.properties @@ -44,4 +44,8 @@ releaseNotesPath = release-notes.html reloadingApplication = Rechargement de l'application pour une nouvelle version\u2026 seePrivacyPolicy = Consultez le paragraphe « Données personnelles » dans les mentions légales. toggleRightPanel = Afficher / masquer le panneau de droite +welcomeBody = AgroMetInfo est en cours de refonte.<br/>\ +Pour rester au courant des évolutions, vous pouvez nous envoyer un message à \ +<a href="mailto:support-agrometinfo@inrae.fr?subject=AgroMetInfo:%20contact">support-agrometinfo@inrae.fr</a> ou utiliser le formulaire de contact. +welcomeTitle = Bienvenue sur AgroMetInfo yes = Oui