diff --git a/ccm-core/src/main/java/org/libreccm/ui/MvcLocaleResolver.java b/ccm-core/src/main/java/org/libreccm/ui/MvcLocaleResolver.java new file mode 100644 index 000000000..ca80dcbfa --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/ui/MvcLocaleResolver.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.ui; + +import org.libreccm.l10n.GlobalizationHelper; + +import java.util.Locale; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.mvc.locale.LocaleResolver; +import javax.mvc.locale.LocaleResolverContext; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +public class MvcLocaleResolver implements LocaleResolver { + + @Inject + private GlobalizationHelper globalizationHelper; + + @Override + public Locale resolveLocale(final LocaleResolverContext context) { + return globalizationHelper.getNegotiatedLocale(); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/ui/admin/AdminMessages.java b/ccm-core/src/main/java/org/libreccm/ui/admin/AdminMessages.java new file mode 100644 index 000000000..6890af911 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/ui/admin/AdminMessages.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2020 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.ui.admin; + +import org.libreccm.l10n.GlobalizationHelper; + +import java.util.AbstractMap; +import java.util.ResourceBundle; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("AdminMessages") +public class AdminMessages extends AbstractMap { + + @Inject + private GlobalizationHelper globalizationHelper; + + private ResourceBundle messages; + + + + @PostConstruct + private void init() { + messages = ResourceBundle.getBundle( + AdminConstants.ADMIN_BUNDLE, + globalizationHelper.getNegotiatedLocale() + ); + } + + public String getMessage(final String key) { + if (messages.containsKey(key)) { + return messages.getString(key); + } else { + return "???key???"; + } + } + + public String get(final String key) { + return getMessage(key); + } + + @Override + public Set> entrySet() { + return messages + .keySet() + .stream() + .collect( + Collectors.toMap(key -> key, key-> messages.getString(key)) + ) + .entrySet(); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/ui/admin/applications/ApplicationsPage.java b/ccm-core/src/main/java/org/libreccm/ui/admin/applications/ApplicationsPage.java index 57b5da792..0eb0e7f4a 100644 --- a/ccm-core/src/main/java/org/libreccm/ui/admin/applications/ApplicationsPage.java +++ b/ccm-core/src/main/java/org/libreccm/ui/admin/applications/ApplicationsPage.java @@ -67,7 +67,7 @@ public class ApplicationsPage implements AdminPage { @Override public String getIcon() { - return "journals"; + return "puzzle"; } @Override diff --git a/ccm-core/src/main/java/org/libreccm/ui/admin/sites/SitesPage.java b/ccm-core/src/main/java/org/libreccm/ui/admin/sites/SitesPage.java index 3b80c3df7..bab4b12cf 100644 --- a/ccm-core/src/main/java/org/libreccm/ui/admin/sites/SitesPage.java +++ b/ccm-core/src/main/java/org/libreccm/ui/admin/sites/SitesPage.java @@ -66,7 +66,7 @@ public class SitesPage implements AdminPage { @Override public String getIcon() { - return "bookshelf"; + return "collection"; } @Override diff --git a/ccm-core/src/main/java/org/libreccm/ui/admin/systeminformation/SystemInformationController.java b/ccm-core/src/main/java/org/libreccm/ui/admin/systeminformation/SystemInformationController.java index bbc38465e..a85cd9521 100644 --- a/ccm-core/src/main/java/org/libreccm/ui/admin/systeminformation/SystemInformationController.java +++ b/ccm-core/src/main/java/org/libreccm/ui/admin/systeminformation/SystemInformationController.java @@ -23,7 +23,9 @@ import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.RequiresPrivilege; import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; import javax.mvc.Controller; +import javax.mvc.MvcContext; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -36,6 +38,9 @@ import javax.ws.rs.Path; @Path("/systeminformation") public class SystemInformationController { + @Inject + private MvcContext mvc; + @GET @Path("/") @AuthorizationRequired diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/applications.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/applications.xhtml index 367fdcefb..25c5db283 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/applications.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/applications.xhtml @@ -4,13 +4,22 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + +
-

Applications

+

#{AdminMessages['applications.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/categories.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/categories.xhtml index b7a561028..5c639f229 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/categories.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/categories.xhtml @@ -4,13 +4,22 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + +
-

Categories

+

#{AdminMessages['categories.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml index ec030cdf1..cd0d52d15 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml @@ -44,6 +44,16 @@ +
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/configuration.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/configuration.xhtml index e96b95e44..2b3f210b2 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/configuration.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/configuration.xhtml @@ -4,13 +4,22 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + +
-

Configuration

+

#{AdminMessages['configuration.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/dashboard.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/dashboard.xhtml index b1d4b38ef..a77b8a7b7 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/dashboard.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/dashboard.xhtml @@ -4,13 +4,19 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + +
-

LibreCCM Admin Dashboard

+

#{AdminMessages['dashboard.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/imexport.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/imexport.xhtml index 76b0e2744..0910af948 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/imexport.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/imexport.xhtml @@ -4,13 +4,22 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + +
-

Import/Export

+

#{AdminMessages['imexport.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites.xhtml index 8747255cc..9ed2f5fc9 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/sites.xhtml @@ -4,13 +4,23 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + + +
-

Sites

+

#{AdminMessages['sites.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/systeminformation.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/systeminformation.xhtml index 1135e06c9..e4fd53b3d 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/systeminformation.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/systeminformation.xhtml @@ -4,11 +4,21 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + +
-

System Information

+

#{AdminMessages['systeminformation.label']}

@@ -42,7 +52,7 @@ role="tabpanel" aria-labelled="LibreCCM System Information Tab" > -

LibreCCM System Information

+

AdminMessages['systeminformation.tabs.libreccm.label']

@@ -58,7 +68,7 @@ role="tabpanel" aria-labelled="Java System Properties Tab" > -

Java System Properties

+

#{AdminMessages['systeminformation.tabs.java.label']}

@@ -70,23 +80,6 @@
-
diff --git a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/users-groups-roles.xhtml b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/users-groups-roles.xhtml index 984c6243a..426afd3b2 100644 --- a/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/users-groups-roles.xhtml +++ b/ccm-core/src/main/resources/WEB-INF/views/org/libreccm/ui/admin/users-groups-roles.xhtml @@ -4,13 +4,22 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> + - + + + + + +
-

Users/Groups/Roles

+

#{AdminMessages['usersgroupsroles.label']}

Placeholder

+
diff --git a/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle.properties b/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle.properties index 3242d3205..8edd74f1b 100644 --- a/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle.properties +++ b/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle.properties @@ -14,3 +14,6 @@ sites.label=Sites sites.description=Manage sites usersgroupsroles.label=Users/Groups/Roles usersgroupsroles.description=Manage users, groups and roles +systeminformation.tabs.libreccm.label=LibreCCM System Information +systeminformation.tabs.java.label=Java System Properties +breadcrumbs.start=LibreCCM Admin diff --git a/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle_de.properties b/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle_de.properties index 1ffeb074a..7f68a543e 100644 --- a/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle_de.properties +++ b/ccm-core/src/main/resources/org/libreccm/ui/AdminBundle_de.properties @@ -5,7 +5,7 @@ applications.description=Verwalten der Anwendungsinstanzen imexport.label=Import/Export categories.label=Kategorien categories.description=Verwaltung der Kategorien -configuration.label=Configuration +configuration.label=Konfguration configuration.description=Bearbeiten der Konfiguration dashboard.label=Dashboard dashboard.description=Provides access to all applications @@ -14,3 +14,6 @@ sites.label=Sites sites.description=Sites verwalten usersgroupsroles.label=Benutzer*innen/Gruppen/Rollen usersgroupsroles.description=Verwaltungen von Benutzer*innen, Gruppen und Rollen +systeminformation.tabs.libreccm.label=LibreCCM System Informationen +systeminformation.tabs.java.label=Java System Properties +breadcrumbs.start=LibreCCM Admin