parent
f4378bfcdd
commit
0496d30458
|
|
@ -70,7 +70,7 @@ public class ConfigurationController {
|
||||||
|
|
||||||
models.put("configurationClasses", configurationClasses);
|
models.put("configurationClasses", configurationClasses);
|
||||||
|
|
||||||
return "org/libreccm/ui/admin/configuration.xhtml";
|
return "org/libreccm/ui/admin/configuration/configuration.xhtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigurationTableEntry buildTableEntry(
|
private ConfigurationTableEntry buildTableEntry(
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,14 @@ package org.libreccm.ui.admin.configuration;
|
||||||
import org.libreccm.configuration.ConfigurationInfo;
|
import org.libreccm.configuration.ConfigurationInfo;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.configuration.SettingInfo;
|
import org.libreccm.configuration.SettingInfo;
|
||||||
|
import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.l10n.GlobalizationHelper;
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
import org.libreccm.l10n.LocalizedTextsUtil;
|
import org.libreccm.l10n.LocalizedTextsUtil;
|
||||||
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -31,6 +36,7 @@ import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.mvc.Controller;
|
import javax.mvc.Controller;
|
||||||
import javax.mvc.Models;
|
import javax.mvc.Models;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
|
||||||
|
|
@ -52,7 +58,10 @@ public class SettingsController {
|
||||||
@Inject
|
@Inject
|
||||||
private Models models;
|
private Models models;
|
||||||
|
|
||||||
|
@GET
|
||||||
@Path("/")
|
@Path("/")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
public String showSettings(
|
public String showSettings(
|
||||||
@PathParam("configurationClass") final String configurationClass
|
@PathParam("configurationClass") final String configurationClass
|
||||||
) {
|
) {
|
||||||
|
|
@ -64,25 +73,36 @@ public class SettingsController {
|
||||||
return "org/libreccm/ui/admin/configuration/configuration-class-not-found.xhtml";
|
return "org/libreccm/ui/admin/configuration/configuration-class-not-found.xhtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
final Object conf = confManager.findConfiguration(confClass);
|
|
||||||
final ConfigurationInfo confInfo = confManager.getConfigurationInfo(
|
final ConfigurationInfo confInfo = confManager.getConfigurationInfo(
|
||||||
confClass
|
confClass
|
||||||
);
|
);
|
||||||
|
|
||||||
confInfo
|
final LocalizedTextsUtil textUtil = globalizationHelper.getLocalizedTextsUtil(confInfo.getDescBundle());
|
||||||
|
models.put(
|
||||||
|
"confLabel",
|
||||||
|
textUtil.getText(confInfo.getTitleKey())
|
||||||
|
);
|
||||||
|
models.put(
|
||||||
|
"configurationDesc",
|
||||||
|
textUtil.getText(confInfo.getDescKey())
|
||||||
|
);
|
||||||
|
|
||||||
|
final List<SettingsTableEntry> settings = confInfo
|
||||||
.getSettings()
|
.getSettings()
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.map(info -> buildSettingsTableEntry(info.getValue(), conf))
|
.map(Map.Entry::getValue)
|
||||||
|
.map(this::buildSettingsTableEntry)
|
||||||
.sorted()
|
.sorted()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
models.put("settings", settings);
|
||||||
|
|
||||||
return "org/libreccm/ui/admin/configuration/settings.xhtml";
|
return "org/libreccm/ui/admin/configuration/settings.xhtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
private SettingsTableEntry buildSettingsTableEntry(
|
private SettingsTableEntry buildSettingsTableEntry(
|
||||||
final SettingInfo settingInfo, final Object conf
|
final SettingInfo settingInfo
|
||||||
) {
|
) {
|
||||||
Objects.requireNonNull(settingInfo);
|
Objects.requireNonNull(settingInfo);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
|
||||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
|
||||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
|
||||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
|
||||||
<ui:composition template="/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml">
|
|
||||||
|
|
||||||
<ui:param name="activePage" value="configuration" />
|
|
||||||
<ui:param name="title" value="#{AdminMessages['configuration.label']}" />
|
|
||||||
|
|
||||||
<ui:define name="breadcrumb">
|
|
||||||
<li class="breadcrumb-item active">
|
|
||||||
#{AdminMessages['configuration.label']}
|
|
||||||
</li>
|
|
||||||
</ui:define>
|
|
||||||
|
|
||||||
<ui:define name="main">
|
|
||||||
<div class="container">
|
|
||||||
<h1>#{AdminMessages['configuration.label']}</h1>
|
|
||||||
<c:forEach items="#{configurationClasses}"
|
|
||||||
var="confClass">
|
|
||||||
<div class="list-group">
|
|
||||||
<a href="#"
|
|
||||||
class="list-group-item list-group-item-action">
|
|
||||||
<div class="d-flex w-100 justify-content-between">
|
|
||||||
<h2 class="mb-1">
|
|
||||||
#{confClass.title}
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<p class="mb-1">
|
|
||||||
#{confClass.description}
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</c:forEach>
|
|
||||||
<!-- <table class="table">
|
|
||||||
<thead>
|
|
||||||
<th scope="col">
|
|
||||||
#{AdminMessages['configuration.table.headings.title']}
|
|
||||||
</th>
|
|
||||||
<th scope="col">
|
|
||||||
#{AdminMessages['configuration.table.headings.description']}
|
|
||||||
</th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<c:forEach items="#{configurationClasses}"
|
|
||||||
var="confClass">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#">
|
|
||||||
#{confClass.title}
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
#{confClass.description}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</c:forEach>
|
|
||||||
</tbody>-->
|
|
||||||
<!-- </table>-->
|
|
||||||
</div>
|
|
||||||
</ui:define>
|
|
||||||
|
|
||||||
</ui:composition>
|
|
||||||
</html>
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
<ui:composition template="/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml">
|
||||||
|
|
||||||
|
<ui:param name="activePage" value="configuration" />
|
||||||
|
<ui:param name="title" value="#{AdminMessages['configuration.label']}" />
|
||||||
|
|
||||||
|
<ui:define name="breadcrumb">
|
||||||
|
<li class="breadcrumb-item active">
|
||||||
|
#{AdminMessages['configuration.label']}
|
||||||
|
</li>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="main">
|
||||||
|
<div class="container">
|
||||||
|
<h1>#{AdminMessages['configuration.label']}</h1>
|
||||||
|
<div class="list-group">
|
||||||
|
<c:forEach items="#{configurationClasses}"
|
||||||
|
var="confClass">
|
||||||
|
<a class="list-group-item list-group-item-action"
|
||||||
|
href="#{mvc.uri('SettingsController#showSettings', { 'configurationClass': confClass.name })}">
|
||||||
|
<h2 class="h3 mb-1">
|
||||||
|
#{confClass.title}
|
||||||
|
</h2>
|
||||||
|
<p class="mb-1">
|
||||||
|
#{confClass.description}
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</c:forEach>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<ui:composition template="/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml">
|
||||||
|
|
||||||
|
<ui:param name="activePage" value="configuration" />
|
||||||
|
<ui:param name="title" value="#{AdminMessages['configuration.label']}" />
|
||||||
|
|
||||||
|
<ui:define name="breadcrumb">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
#{AdminMessages['configuration.label']}
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">>
|
||||||
|
#{confLabel}
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active">>
|
||||||
|
#{AdminMessages['configuration.settings.label']}
|
||||||
|
</li>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="main">
|
||||||
|
<div class="container">
|
||||||
|
<h1>#{confLabel}</h1>
|
||||||
|
<p>
|
||||||
|
#{confDescription}
|
||||||
|
</p>
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{AdminMessages['configuration.settings.table.headings.label']}
|
||||||
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
#{AdminMessages['configuration.settings.table.headings.value']}
|
||||||
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
#{AdminMessages['configuration.settings.table.headings.defaultValue']}
|
||||||
|
</th>
|
||||||
|
<th scope="col" colspan="3">
|
||||||
|
#{AdminMessages['configuration.settings.table.headings.actions']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="#{settings}" var="setting">
|
||||||
|
<tr>
|
||||||
|
<td>#{setting.label}</td>
|
||||||
|
<td>
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="#{setting.value == null}">
|
||||||
|
<span class="text-muted">#{setting.defaultValue}</span>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<strong>
|
||||||
|
#{setting.value}
|
||||||
|
</strong>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</td>
|
||||||
|
<td>#{setting.defaultValue}</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-info"
|
||||||
|
title="#{AdminMessages.getMessage('configuration.settings.table.actions.info.help', [setting.label])}"
|
||||||
|
type="button">
|
||||||
|
<svg class="bi"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
fill="currentColor">
|
||||||
|
<use xlink:href="#{request.contextPath}/assets/bootstrap/bootstrap-icons.svg#info-circle" />
|
||||||
|
</svg>
|
||||||
|
#{AdminMessages['configuration.settings.table.actions.info']}
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
type="button">
|
||||||
|
<svg class="bi"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
fill="currentColor">
|
||||||
|
<use xlink:href="#{request.contextPath}/assets/bootstrap/bootstrap-icons.svg#pen" />
|
||||||
|
</svg>
|
||||||
|
#{AdminMessages['configuration.settings.table.actions.edit']}
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-danger"
|
||||||
|
title="#{AdminMessages.getMessage('configuration.settings.table.actions.reset.help', [setting.label])}"
|
||||||
|
type="button">
|
||||||
|
<svg class="bi"
|
||||||
|
width="1em"
|
||||||
|
height="1em"
|
||||||
|
fill="currentColor">
|
||||||
|
<use xlink:href="#{request.contextPath}/assets/bootstrap/bootstrap-icons.svg#x-circle" />
|
||||||
|
</svg>
|
||||||
|
#{AdminMessages['configuration.settings.table.actions.reset']}
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
@ -208,3 +208,13 @@ usersgroupsroles.users.form.errors.primary_email.empty=The primary email address
|
||||||
usersgroupsroles.users.form.errors.primary_email.invalid=The primary email address of a user must be a valid email address
|
usersgroupsroles.users.form.errors.primary_email.invalid=The primary email address of a user must be a valid email address
|
||||||
configuration.table.headings.title=Configuration
|
configuration.table.headings.title=Configuration
|
||||||
configuration.table.headings.description=Description
|
configuration.table.headings.description=Description
|
||||||
|
configuration.settings.label=Settings
|
||||||
|
configuration.settings.table.headings.label=Setting
|
||||||
|
configuration.settings.table.headings.value=Current value
|
||||||
|
configuration.settings.table.headings.defaultValue=Default Value
|
||||||
|
configuration.settings.table.headings.actions=Aktionen
|
||||||
|
configuration.settings.table.actions.info=Info
|
||||||
|
configuration.settings.table.actions.info.help=Show description of setting {0}
|
||||||
|
configuration.settings.table.actions.edit=Edit
|
||||||
|
configuration.settings.table.actions.reset.help=Reset setting {0} to default value {1}
|
||||||
|
configuration.settings.table.actions.reset=Reset
|
||||||
|
|
|
||||||
|
|
@ -208,3 +208,13 @@ usersgroupsroles.users.form.errors.primary_email.empty=Die prim\u00e4re E-Mail-A
|
||||||
usersgroupsroles.users.form.errors.primary_email.invalid=Die prim\u00e4re E-Mail-Addresse eines Benutzers muss eine valide E-Mail-Addresse sein
|
usersgroupsroles.users.form.errors.primary_email.invalid=Die prim\u00e4re E-Mail-Addresse eines Benutzers muss eine valide E-Mail-Addresse sein
|
||||||
configuration.table.headings.title=Konfiguration
|
configuration.table.headings.title=Konfiguration
|
||||||
configuration.table.headings.description=Beschreibung
|
configuration.table.headings.description=Beschreibung
|
||||||
|
configuration.settings.label=Einstellungen
|
||||||
|
configuration.settings.table.headings.label=Einstellung
|
||||||
|
configuration.settings.table.headings.value=Aktueller Wert
|
||||||
|
configuration.settings.table.headings.defaultValue=Standardwert
|
||||||
|
configuration.settings.table.headings.actions=Aktionen
|
||||||
|
configuration.settings.table.actions.info=Info
|
||||||
|
configuration.settings.table.actions.info.help=Beschreibung f\u00fcr Einstellung {0} anzeigen
|
||||||
|
configuration.settings.table.actions.edit=Bearbeiten
|
||||||
|
configuration.settings.table.actions.reset.help=Einstellung {0} auf Standardwert {1} zur\u00fccksetzen
|
||||||
|
configuration.settings.table.actions.reset=Zur\u00fccksetzen
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue