Domain-options shown and editable in web interface.
Minor corrections elsewhere.
This commit is contained in:
parent
fd02157854
commit
3ff6a8a581
@ -11,6 +11,7 @@ import de.hsadmin.web.config.PropertyDefaultValue;
|
|||||||
import de.hsadmin.web.config.PropertySelectValues;
|
import de.hsadmin.web.config.PropertySelectValues;
|
||||||
import de.hsadmin.web.config.PropertyTableColumn;
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
import de.hsadmin.web.vaadin.DatePropertyFieldFactory;
|
import de.hsadmin.web.vaadin.DatePropertyFieldFactory;
|
||||||
|
import de.hsadmin.web.vaadin.DomainOptionsPropertyFieldFactory;
|
||||||
import de.hsadmin.web.vaadin.SelectPropertyFieldFactory;
|
import de.hsadmin.web.vaadin.SelectPropertyFieldFactory;
|
||||||
|
|
||||||
public class DomainModule extends GenericModule {
|
public class DomainModule extends GenericModule {
|
||||||
@ -56,6 +57,8 @@ public class DomainModule extends GenericModule {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
userProp.setWriteOnce(true);
|
userProp.setWriteOnce(true);
|
||||||
|
PropertyConfig optionsProp = new PropertyConfig(moduleConfig, "domainoptions", String.class, PropertyTableColumn.HIDDEN, new DomainOptionsPropertyFieldFactory(this));
|
||||||
|
optionsProp.setWriteOnce(true);
|
||||||
PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN);
|
PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN);
|
||||||
pacProp.setDefaultValue(new PropertyDefaultValue() {
|
pacProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
@Override
|
@Override
|
||||||
@ -74,6 +77,7 @@ public class DomainModule extends GenericModule {
|
|||||||
moduleConfig.addProperty(idProp);
|
moduleConfig.addProperty(idProp);
|
||||||
moduleConfig.addProperty(nameProp);
|
moduleConfig.addProperty(nameProp);
|
||||||
moduleConfig.addProperty(userProp);
|
moduleConfig.addProperty(userProp);
|
||||||
|
moduleConfig.addProperty(optionsProp);
|
||||||
moduleConfig.addProperty(pacProp);
|
moduleConfig.addProperty(pacProp);
|
||||||
moduleConfig.addProperty(hiveProp);
|
moduleConfig.addProperty(hiveProp);
|
||||||
moduleConfig.addProperty(sinceProp);
|
moduleConfig.addProperty(sinceProp);
|
||||||
|
@ -19,6 +19,7 @@ public class DomainReadonlyModule extends AbstractModule {
|
|||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "domainoptions", String.class, PropertyTableColumn.HIDDEN));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, PropertyTableColumn.HIDDEN));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, PropertyTableColumn.HIDDEN));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class, new DatePropertyFieldFactory()));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class, new DatePropertyFieldFactory()));
|
||||||
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ListOfStringsProperty implements XmlrpcProperty {
|
public class ListOfStringsProperty implements XmlrpcProperty {
|
||||||
|
|
||||||
public final List<String> properties;
|
private final List<String> properties;
|
||||||
|
|
||||||
public ListOfStringsProperty(){
|
public ListOfStringsProperty(){
|
||||||
this.properties = new ArrayList<String>();
|
this.properties = new ArrayList<String>();
|
||||||
@ -15,6 +15,10 @@ public class ListOfStringsProperty implements XmlrpcProperty {
|
|||||||
public boolean add(String string){
|
public boolean add(String string){
|
||||||
return properties.add(string);
|
return properties.add(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean contains(String string){
|
||||||
|
return properties.contains(string);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object toXmlrpcParam() {
|
public Object toXmlrpcParam() {
|
||||||
|
@ -1,57 +1,90 @@
|
|||||||
package de.hsadmin.web.vaadin;
|
package de.hsadmin.web.vaadin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.vaadin.terminal.Sizeable;
|
import com.vaadin.terminal.Sizeable;
|
||||||
import com.vaadin.ui.AbstractField;
|
import com.vaadin.ui.AbstractField;
|
||||||
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
|
import com.vaadin.ui.Label;
|
||||||
|
import com.vaadin.ui.Select;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
|
||||||
import de.hsadmin.web.AbstractProperty;
|
import de.hsadmin.web.AbstractProperty;
|
||||||
|
import de.hsadmin.web.GenericModule;
|
||||||
import de.hsadmin.web.HsarwebException;
|
import de.hsadmin.web.HsarwebException;
|
||||||
import de.hsadmin.web.ListOfStringsProperty;
|
import de.hsadmin.web.ListOfStringsProperty;
|
||||||
|
import de.hsadmin.web.Module;
|
||||||
import de.hsadmin.web.XmlrpcProperty;
|
import de.hsadmin.web.XmlrpcProperty;
|
||||||
|
import de.hsadmin.web.config.LocaleConfig;
|
||||||
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
import de.hsadmin.web.config.PropertyFieldFactory;
|
import de.hsadmin.web.config.PropertyFieldFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author pblissenbach
|
* @author Purodha Blissenbach
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DomainOptionsPropertyFieldFactory implements PropertyFieldFactory {
|
public class DomainOptionsPropertyFieldFactory implements PropertyFieldFactory {
|
||||||
private Map<String,AbstractProperty> optionTypes ; // TODO: auf Vorrat hier
|
private final Module module;
|
||||||
private ListOfStringsProperty setOptions ;
|
private final ModuleConfig config ;
|
||||||
|
// TODO: besorge Options und ihre Typen aus der DB
|
||||||
|
private static final String[] OPTION_NAMES = new String[] { "backupmxforexternalmx", "greylisting", "htdocsfallback", "includes", "indexes", "multiviews", "php"};
|
||||||
|
// private final Map<String,AbstractProperty> optionTypes ; // TODO: auf Vorrat hier
|
||||||
|
// TODO: besorge Options .... Ende
|
||||||
private boolean readOnly = false;
|
private boolean readOnly = false;
|
||||||
private boolean writeOnce = false;
|
private boolean writeOnce = false;
|
||||||
private VerticalLayout layout;
|
private VerticalLayout layout;
|
||||||
|
private List<SingleDomainOption> optionLayout ;
|
||||||
|
private ListOfStringsProperty setOptions ;
|
||||||
|
|
||||||
public DomainOptionsPropertyFieldFactory() {
|
public DomainOptionsPropertyFieldFactory(Module module) {
|
||||||
// TODO: besorge Options und ihre Typen aus der DB
|
this.module = module;
|
||||||
optionTypes = new HashMap<String,AbstractProperty>() ;
|
this.config = module.getModuleConfig();
|
||||||
optionTypes.put("backupmxforexternalmx", null);
|
optionLayout = new ArrayList<SingleDomainOption>() ;
|
||||||
optionTypes.put("greylisting", null);
|
|
||||||
optionTypes.put("htdocsfallback", null);
|
|
||||||
optionTypes.put("includes", null);
|
|
||||||
optionTypes.put("indexes", null);
|
|
||||||
optionTypes.put("multiviews", null);
|
|
||||||
optionTypes.put("nonexistiondomainoptionfortesting", null); // TESTCASE
|
|
||||||
optionTypes.put("php", null);
|
|
||||||
// TODO: besorge Options .... Ende
|
|
||||||
// setOptions = null ;
|
|
||||||
setOptions = new ListOfStringsProperty() ;
|
setOptions = new ListOfStringsProperty() ;
|
||||||
// TODO Auto-generated constructor stub
|
}
|
||||||
|
|
||||||
|
private void repaint() {
|
||||||
|
layout.removeAllComponents();
|
||||||
|
for (int idx=0 ; idx<OPTION_NAMES.length ; ++idx ) {
|
||||||
|
layout.addComponent(optionLayout.get(idx).getComponent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) {
|
public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) {
|
||||||
// TODO Auto-generated method stub
|
this.setOptions = (ListOfStringsProperty) value ;
|
||||||
return null;
|
layout = new VerticalLayout();
|
||||||
|
layout.setCaption(prop.getLabel());
|
||||||
|
layout.setData(prop.getId());
|
||||||
|
if (value instanceof ListOfStringsProperty) {
|
||||||
|
ListOfStringsProperty list = (ListOfStringsProperty) value;
|
||||||
|
for (int idx=0 ; idx<OPTION_NAMES.length ; ++idx ) {
|
||||||
|
optionLayout.add(new SingleDomainOption(this, OPTION_NAMES[idx], list.contains(OPTION_NAMES[idx]) ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Eine leere Liste von Domainoptionen wird angezeigt werden.
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XmlrpcProperty getValue(PropertyConfig prop, Object component)
|
public XmlrpcProperty getValue(PropertyConfig prop, Object component) throws HsarwebException {
|
||||||
throws HsarwebException {
|
setOptions = new ListOfStringsProperty() ;
|
||||||
|
for (int idx=0 ; idx<OPTION_NAMES.length ; ++idx ) {
|
||||||
|
if(Boolean.TRUE.equals(optionLayout.get(idx).getValue()))
|
||||||
|
{
|
||||||
|
setOptions.add(OPTION_NAMES[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
return setOptions;
|
return setOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,35 +109,49 @@ public class DomainOptionsPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SingleDomainOption {
|
class SingleDomainOption {
|
||||||
|
private final DomainOptionsPropertyFieldFactory owner;
|
||||||
|
private final String optionName;
|
||||||
private HorizontalLayout targetLine;
|
private HorizontalLayout targetLine;
|
||||||
private HorizontalLayout leftPart;
|
private Select select ;
|
||||||
private HorizontalLayout rightPart;
|
|
||||||
private int index;
|
|
||||||
private String optionName;
|
|
||||||
private String testunusedoptionName;
|
|
||||||
private DomainOptionsPropertyFieldFactory owner;
|
|
||||||
|
|
||||||
protected SingleDomainOption(DomainOptionsPropertyFieldFactory owner, int key, String optionName, Object optionValue) {
|
protected SingleDomainOption(DomainOptionsPropertyFieldFactory owner, String optionName, boolean optionValue) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.index = key;
|
|
||||||
this.optionName = optionName;
|
this.optionName = optionName;
|
||||||
targetLine = new HorizontalLayout();
|
targetLine = new HorizontalLayout();
|
||||||
targetLine.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
targetLine.setWidth(500.0f, Sizeable.UNITS_PIXELS);
|
||||||
leftPart = new HorizontalLayout();
|
HorizontalLayout leftPart = new HorizontalLayout();
|
||||||
leftPart.setWidth(100.0f, Sizeable.UNITS_PIXELS);
|
leftPart.setWidth(220.0f, Sizeable.UNITS_PIXELS);
|
||||||
leftPart.setCaption(optionName);
|
Label label = new Label(owner.config.getLabel("domainoption."+optionName),Label.CONTENT_RAW);
|
||||||
rightPart = new HorizontalLayout();
|
leftPart.addComponent( label); // setCaption(owner.config.getLabel("domainoption."+optionName));
|
||||||
rightPart.setWidth(380.0f, Sizeable.UNITS_PIXELS);
|
HorizontalLayout rightPart = new HorizontalLayout();
|
||||||
// ToDO: Fallunterscheidungen nach Optionsart. Z.Z. nur Boolean.
|
// ToDO: Fallunterscheidungen nach Optionsart. Z.Z. nur Boolean:
|
||||||
|
{
|
||||||
|
this.select = new Select();
|
||||||
|
this.select.setWidth(90.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
this.select.setImmediate(true);
|
||||||
|
this.select.setNewItemsAllowed(false);
|
||||||
|
this.select.setNullSelectionAllowed(false);
|
||||||
|
this.select.addItem("y");
|
||||||
|
this.select.setItemCaption("y" , owner.config.getLabel("yes"));
|
||||||
|
this.select.addItem("n");
|
||||||
|
this.select.setItemCaption("n" , owner.config.getLabel("no"));
|
||||||
|
this.select.setValue(optionValue ? "y" : "n");
|
||||||
|
rightPart.addComponent(this.select);
|
||||||
|
}
|
||||||
|
targetLine.addComponent(leftPart);
|
||||||
|
targetLine.addComponent(rightPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public Component getComponent() {
|
||||||
String value = null;
|
return targetLine;
|
||||||
if (rightPart.getComponentCount() > 0) {
|
}
|
||||||
Object object = ((AbstractField) rightPart.getComponent(0)).getValue();
|
|
||||||
if (object != null && object instanceof String) {
|
public Boolean getValue() {
|
||||||
value = ((String) object).trim();
|
Boolean value = null;
|
||||||
}
|
String val = (String) this.select.getValue();
|
||||||
|
if( val.equals("y") || val.equals("n") )
|
||||||
|
{
|
||||||
|
value = (val.equals("y"));
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -28,17 +28,18 @@ import de.hsadmin.web.config.PropertyFieldFactory;
|
|||||||
|
|
||||||
public class EMailTargetPropertyFieldFactory implements PropertyFieldFactory {
|
public class EMailTargetPropertyFieldFactory implements PropertyFieldFactory {
|
||||||
|
|
||||||
private Module module;
|
private final Module module;
|
||||||
private boolean readOnly = false;
|
private boolean readOnly = false;
|
||||||
private boolean writeOnce = false;
|
private boolean writeOnce = false;
|
||||||
private List<String> users;
|
private List<String> users;
|
||||||
private List<String> mailAliases;
|
private List<String> mailAliases;
|
||||||
private Map<Integer, SingleEMailTarget> targets;
|
private final Map<Integer, SingleEMailTarget> targets;
|
||||||
private int lastIndex;
|
private int lastIndex;
|
||||||
private VerticalLayout layout;
|
private VerticalLayout layout;
|
||||||
|
|
||||||
public EMailTargetPropertyFieldFactory(Module module) {
|
public EMailTargetPropertyFieldFactory(Module module) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
|
targets = new HashMap<Integer, SingleEMailTarget>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTarget(SingleEMailTarget target) {
|
public void removeTarget(SingleEMailTarget target) {
|
||||||
@ -66,13 +67,10 @@ public class EMailTargetPropertyFieldFactory implements PropertyFieldFactory {
|
|||||||
@Override
|
@Override
|
||||||
public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) {
|
public Object createFieldComponent(PropertyConfig prop, XmlrpcProperty value) {
|
||||||
GenericModule genModule = (GenericModule) module;
|
GenericModule genModule = (GenericModule) module;
|
||||||
users = genModule.getUsers();
|
|
||||||
mailAliases = genModule.getEMailAliases();
|
|
||||||
layout = new VerticalLayout();
|
layout = new VerticalLayout();
|
||||||
layout.setCaption(prop.getLabel());
|
layout.setCaption(prop.getLabel());
|
||||||
layout.setData(prop.getId());
|
layout.setData(prop.getId());
|
||||||
|
|
||||||
targets = new HashMap<Integer, SingleEMailTarget>();
|
|
||||||
lastIndex = 0;
|
lastIndex = 0;
|
||||||
if (value instanceof AbstractProperty) {
|
if (value instanceof AbstractProperty) {
|
||||||
String stringValue = ((AbstractProperty) value).toStringValue();
|
String stringValue = ((AbstractProperty) value).toStringValue();
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
id=identifier
|
id=identifier
|
||||||
name=domain
|
name=domain
|
||||||
user=admin
|
user=admin
|
||||||
|
domainoptions=domain options
|
||||||
|
domainoption.backupmxforexternalmx=BackUpMxForExternalMx
|
||||||
|
domainoption.greylisting=GreyListing
|
||||||
|
domainoption.htdocsfallback=HtDocsFallback
|
||||||
|
domainoption.includes=Includes
|
||||||
|
domainoption.indexes=Indexes
|
||||||
|
domainoption.multiviews=MultiViews
|
||||||
|
domainoption.php=PHP
|
||||||
|
yes=Yes
|
||||||
|
no=No
|
||||||
pac=packet
|
pac=packet
|
||||||
hive=host
|
hive=host
|
||||||
since=connected since
|
since=connected since
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
id=Schlüssel
|
id=Schlüssel
|
||||||
name=Domain
|
name=Domain
|
||||||
user=Administrator
|
user=Administrator
|
||||||
|
domainoptions=Optionen
|
||||||
|
domainoption.backupmxforexternalmx=BackUpMxForExternalMx
|
||||||
|
domainoption.greylisting=GreyListing
|
||||||
|
domainoption.htdocsfallback=HtDocsFallback
|
||||||
|
domainoption.includes=Includes
|
||||||
|
domainoption.indexes=Indexes
|
||||||
|
domainoption.multiviews=MultiViews
|
||||||
|
domainoption.php=PHP
|
||||||
|
yes=Ja
|
||||||
|
no=Nein
|
||||||
pac=Paket
|
pac=Paket
|
||||||
hive=Server
|
hive=Server
|
||||||
since=aufgeschaltet seit
|
since=aufgeschaltet seit
|
||||||
|
21
hsarweb/src/texts/domain_ksh.properties
Normal file
21
hsarweb/src/texts/domain_ksh.properties
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
id=Schlößelnommer
|
||||||
|
name=Domähn
|
||||||
|
user=Verwallder
|
||||||
|
domainoptions=Enschtällonge
|
||||||
|
domainoption.backupmxforexternalmx=BackUpMxForExternalMx
|
||||||
|
domainoption.greylisting=Jräilesteng
|
||||||
|
domainoption.htdocsfallback=Zeröckfalle op <code lang="en">htdocs</code>
|
||||||
|
domainoption.includes=Enkluudes
|
||||||
|
domainoption.indexes=Endäxe
|
||||||
|
domainoption.multiviews=Maltivjuhs
|
||||||
|
domainoption.php=PHP
|
||||||
|
yes=Joh
|
||||||
|
no=Nää
|
||||||
|
pac=Packätt
|
||||||
|
hive=ßööver
|
||||||
|
since=opjeschalldt zigg
|
||||||
|
moduletitle=Domähne
|
||||||
|
moduleicon=../runo/icons/16/document-web.png
|
||||||
|
new=En neue Domähn aanjääje
|
||||||
|
update=Enschtällonge för en Domähn ändern
|
||||||
|
delete=En Domähne fottschmiiße
|
@ -4,7 +4,7 @@ password=et Pa
|
|||||||
password1=neu Paßwoot
|
password1=neu Paßwoot
|
||||||
password2=et Paßwoot norr_ens
|
password2=et Paßwoot norr_ens
|
||||||
comment=Aanmärkonge
|
comment=Aanmärkonge
|
||||||
shell=däm Metmaacher sing Shell
|
shell=däm Metmaacher singe <code lang="en">shell</code>
|
||||||
userid=däm Metmaacher sing Nommer
|
userid=däm Metmaacher sing Nommer
|
||||||
homedir=et Heimatverzeischneß
|
homedir=et Heimatverzeischneß
|
||||||
pac=Pakätt
|
pac=Pakätt
|
||||||
|
Loading…
Reference in New Issue
Block a user