group domainoptions

This commit is contained in:
Peter Hormanns 2023-12-19 20:37:03 +01:00
parent aec87c80f9
commit f539c87aea
6 changed files with 81 additions and 21 deletions

View File

@ -40,6 +40,12 @@
</libs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hsadmin.version>1.0.4</hsadmin.version>
<tomee.version>8.0.16</tomee.version>
<tomee.version>9.1.1</tomee.version>
<servlet.version>4.0.1</servlet.version>
<liquibase.version>4.17.2</liquibase.version>
<openjpa.version>3.2.2</openjpa.version>

View File

@ -9,6 +9,7 @@ import java.util.Map;
import com.vaadin.v7.data.Validator;
import com.vaadin.v7.ui.CheckBox;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.v7.ui.VerticalLayout;
import de.hsadmin.rpc.HSAdminSession;
@ -18,17 +19,23 @@ public class DomainOptionsEditor extends CustomComponent implements IHSEditor {
private static final long serialVersionUID = 2L;
private static final String[] OPTIONS =
private static final String[] EMAIL_OPTIONS =
new String[] {
"greylisting",
"autoconfig",
"dkim",
"backupmxforexternalmx",
"backupmxforexternalmx"
};
private static final String[] APACHE_OPTIONS =
new String[] {
"multiviews",
"indexes",
"htdocsfallback",
"includes",
"letsencrypt",
"letsencrypt"
};
private static final String[] SCRIPTING_OPTIONS =
new String[] {
"cgi",
"fastcgi",
"passenger",
@ -37,17 +44,34 @@ public class DomainOptionsEditor extends CustomComponent implements IHSEditor {
private final PropertyInfo propertyInfo;
private final VerticalLayout layout;
private final Map<String, CheckBox> checkboxes;
private final Map<String, CheckBox> emailCheckboxes;
private final Map<String, CheckBox> apacheCheckboxes;
private final Map<String, CheckBox> scriptingCheckboxes;
public DomainOptionsEditor(final PropertyInfo propertyInfo, final HSAdminSession session, final Map<String, String> whereContext) {
this.checkboxes = new HashMap<>();
this.emailCheckboxes = new HashMap<>();
this.apacheCheckboxes = new HashMap<>();
this.scriptingCheckboxes = new HashMap<>();
this.propertyInfo = propertyInfo;
final I18N i18n = session.getI18N();
this.setCaption(i18n.getText(propertyInfo.getName()));
layout = new VerticalLayout();
for (String opt : OPTIONS) {
layout.addComponent(new Label("E-Mail-Optionen"));
for (String opt : EMAIL_OPTIONS) {
final CheckBox checkBox = new CheckBox(i18n.getText("domainoption." + opt));
checkboxes.put(opt, checkBox);
emailCheckboxes.put(opt, checkBox);
layout.addComponent(checkBox);
}
layout.addComponent(new Label("Apache-Webserver-Optionen"));
for (String opt : APACHE_OPTIONS) {
final CheckBox checkBox = new CheckBox(i18n.getText("domainoption." + opt));
apacheCheckboxes.put(opt, checkBox);
layout.addComponent(checkBox);
}
layout.addComponent(new Label("Apache-Scripting-Optionen"));
for (String opt : SCRIPTING_OPTIONS) {
final CheckBox checkBox = new CheckBox(i18n.getText("domainoption." + opt));
scriptingCheckboxes.put(opt, checkBox);
layout.addComponent(checkBox);
}
layout.setCaption(i18n.getText(propertyInfo.getName()));
@ -58,14 +82,26 @@ public class DomainOptionsEditor extends CustomComponent implements IHSEditor {
public void setValues(final Map<String, Object> valuesMap) {
final Object optionsObject = valuesMap.get(propertyInfo.getName());
if (optionsObject == null) {
for (String opt : OPTIONS) {
checkboxes.get(opt).setValue(!"backupmxforexternalmx".equals(opt));
for (String opt : EMAIL_OPTIONS) {
emailCheckboxes.get(opt).setValue(!"backupmxforexternalmx".equals(opt));
}
for (String opt : APACHE_OPTIONS) {
apacheCheckboxes.get(opt).setValue("letsencrypt".equals(opt));
}
for (String opt : SCRIPTING_OPTIONS) {
scriptingCheckboxes.get(opt).setValue("fastcgi".equals(opt));
}
}
if (optionsObject instanceof Object[]) {
final List<Object> options = Arrays.asList((Object[]) optionsObject);
for (String opt : OPTIONS) {
checkboxes.get(opt).setValue(options.contains(opt));
for (String opt : EMAIL_OPTIONS) {
emailCheckboxes.get(opt).setValue(options.contains(opt));
}
for (String opt : APACHE_OPTIONS) {
apacheCheckboxes.get(opt).setValue(options.contains(opt));
}
for (String opt : SCRIPTING_OPTIONS) {
scriptingCheckboxes.get(opt).setValue(options.contains(opt));
}
}
}
@ -73,8 +109,18 @@ public class DomainOptionsEditor extends CustomComponent implements IHSEditor {
@Override
public Object getValue() {
final List<String> values = new ArrayList<>();
for (final String opt : OPTIONS) {
if (checkboxes.get(opt).getValue()) {
for (final String opt : EMAIL_OPTIONS) {
if (emailCheckboxes.get(opt).getValue()) {
values.add(opt);
}
}
for (final String opt : APACHE_OPTIONS) {
if (apacheCheckboxes.get(opt).getValue()) {
values.add(opt);
}
}
for (final String opt : SCRIPTING_OPTIONS) {
if (scriptingCheckboxes.get(opt).getValue()) {
values.add(opt);
}
}

View File

@ -38,11 +38,14 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
if ("user".equals(inputName)) {
return getSelectFromRemote(action, propertyInfo, session, "user", whereContext);
}
if ("validsubdomainnames".equals(inputName)) {
return getValidsubdomainnamesEditor(action, propertyInfo);
}
if ("domainoptions".equals(inputName)) {
return getDomainOptionsEditor(action, propertyInfo, session, whereContext);
}
if ("validsubdomainnames".equals(inputName)) {
return getValidsubdomainnamesEditor(action, propertyInfo, session, whereContext);
if ("passengerpython".equals(inputName)|"passengernodejs".equals(inputName)|"passengerruby".equals(inputName)|"fcgiphpbin".equals(inputName)) {
return getScriptingPathEditor(action, propertyInfo);
}
}
if ("emailaddress".equals(module) || "emailalias".equals(module)) {
@ -73,12 +76,13 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
return getEditor(action, propertyInfo);
}
private IHSEditor getValidsubdomainnamesEditor(final String action, final PropertyInfo propertyInfo, final HSAdminSession session,
final Map<String, String> whereContext) {
private IHSEditor getValidsubdomainnamesEditor(final String action, final PropertyInfo propertyInfo) {
return PanelToolbar.ACTION_EDIT.equals(action) ? getEditor(action, propertyInfo) : new NullEditor();
}
private IHSEditor getScriptingPathEditor(final String action, final PropertyInfo propertyInfo) {
return PanelToolbar.ACTION_EDIT.equals(action) ? getEditor(action, propertyInfo) : new NullEditor();
}
private IHSEditor getDomainOptionsEditor(final String action, final PropertyInfo propertyInfo, final HSAdminSession session, final Map<String, String> whereContext) {
return PanelToolbar.ACTION_EDIT.equals(action) ? new DomainOptionsEditor(propertyInfo, session, whereContext) : new NullEditor();
@ -161,7 +165,7 @@ public class GenericEditorFactory implements IEditorFactory, Serializable {
private IHSEditor getShellSelect(final String action, final PropertyInfo propertyInfo)
{
final String[] items = new String[] { "/bin/false", "/bin/bash", "/bin/csh", "/bin/dash", "/bin/ksh", "/bin/tcsh", "/bin/zsh", "/usr/bin/passwd", "/usr/bin/scponly" };
final String[] items = new String[] { "/bin/false", "/bin/bash", "/bin/csh", "/bin/dash", "/usr/bin/tcsh", "/usr/bin/zsh", "/usr/bin/passwd" };
final HSSelect field = new HSSelect(i18n, propertyInfo, 7, Arrays.asList(items));
field.setWidth("100%");
field.setEnabled(isWriteAble(propertyInfo, action));

View File

@ -49,7 +49,7 @@ domainoption.letsencrypt=Let's Encrypt-Zertifikat
domainoption.autoconfig=E-Mail Auto-Konfiguration
domainoption.dkim=Domain Key - DKIM
domainoption.cgi=CGI-Funktion aktiv
domainoption.fastcgi=FastCGI-Funltion aktiv
domainoption.fastcgi=FastCGI-Funktion aktiv
domainoption.passenger=Passenger-Modul aktiv
domainoption.passengerfriendlyerrorpages=Passenger Debug-Modus aktiv
mysqluser.name=MySQL-Benutzer

View File

@ -44,6 +44,10 @@ domainoption.backupmxforexternalmx=backupmxforexternalmx
domainoption.letsencrypt=letsencrypt
domainoption.autoconfig=email autoconfig and autodiscover
domainoption.dkim=domain key - dkim
domainoption.cgi=enable CGI
domainoption.fastcgi=enable FastCGI
domainoption.passenger=enable passenger module
domainoption.passengerfriendlyerrorpages=enable passenger error page
mysqluser.name=Nombre de usuario MySql
mysqluser.instance=Instancia de MySql
mysqluser.pac=Paquete de usuario MySql