Implementován validátor pro Globální nastavení.

closes #236
Verze_3.0
František Přibyl 10 years ago
parent 6db416dd04
commit 2819cc125c

@ -170,6 +170,8 @@ public class Constants {
public final static int LEN_DESCRIPTION = 8192;
public final static int LEN_RESULT_MESSAGE = 8192;
public final static String MAIL_URL_KEYWORD = "-url-";
public final static String KEY_SIGN_DATA = "SIGN_DATA";
public final static String KEY_SIGN_GUID = "SIGN_GUID";
}

@ -0,0 +1,31 @@
package info.bukova.isspst;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegExUtils {
public static List<String> getMatches(String input, String regEx, int group) {
List<String> list = new ArrayList<String>();
if (!StringUtils.isNullOrEmpty(input) && !StringUtils.isNullOrEmpty(regEx)) {
Pattern pattern = Pattern.compile(regEx);
Matcher matcher = pattern.matcher(input);
int groupCount = matcher.groupCount() + 1;
if ((groupCount >= 0) && (group < groupCount)) {
while (matcher.find()) {
String item = matcher.group(group);
list.add(item);
}
}
}
return list;
}
public static List<String> getMatches(String input, String regEx) {
return RegExUtils.getMatches(input, regEx, 0);
}
}

@ -1,5 +1,6 @@
package info.bukova.isspst.mail;
import info.bukova.isspst.Constants;
import info.bukova.isspst.EntityUrlResolver;
import info.bukova.isspst.UrlResolverHolder;
@ -57,7 +58,7 @@ public class EntityMessageBuilder implements MessageBuilder {
for (String p : properties) {
try {
if (p.equals("-url-")) {
if (p.equals(Constants.MAIL_URL_KEYWORD)) {
ret = ret.replaceAll("\\[" + p + "\\]", getUrl(data));
} else {
ret = ret.replaceAll("\\[" + p + "\\]", BeanUtils.getProperty(data, p));

@ -0,0 +1,19 @@
package info.bukova.isspst.ui;
import org.zkoss.bind.annotation.Init;
public class BindingViewModel<T> extends DocumentViewModel {
private BindingForm<T> dataForm;
@Init
public void initBindingViewModel() {
super.initDocumentViewModel();
dataForm = new BindingForm<T>();
}
public BindingForm<T> getDataForm() {
return this.dataForm;
}
}

@ -20,28 +20,26 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window;
public class FormViewModel<T extends DataModel> extends DocumentViewModel
public class FormViewModel<T extends DataModel> extends BindingViewModel<T>
{
private T dataBean;
private Map<String, String> errMessages;
private Service<T> service;
private boolean newRec;
private ServiceConstraint<T> constraint;
private BindingForm<T> dataForm;
@Init
public void initFormViewModel(@ExecutionArgParam("selected") T selected, @ExecutionArgParam("service") Service<T> service)
{
super.initDocumentViewModel();
super.initBindingViewModel();
this.dataBean = selected;
this.service = service;
constraint = new ServiceConstraint<T>();
constraint.setDataBean(selected);
constraint.setService(service);
dataForm = new BindingForm<T>();
dataForm.setDataBean(selected);
this.getDataForm().setDataBean(selected);
if (selected.getId() == 0 && selected.getCreated() == null)
{
@ -186,9 +184,4 @@ public class FormViewModel<T extends DataModel> extends DocumentViewModel
{
return true;
}
public BindingForm<T> getDataForm() {
return dataForm;
}
}

@ -6,13 +6,13 @@ import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.mail.MailMessage;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.sort.ReflectionTools;
import info.bukova.isspst.storage.FileStorage;
import info.bukova.isspst.ui.DocumentViewModel;
import info.bukova.isspst.ui.BindingViewModel;
import info.bukova.isspst.ui.LocaleConverter;
import info.bukova.isspst.ui.SecurityHelper;
import info.bukova.isspst.validators.GlobalSettingValidator;
import java.awt.image.RenderedImage;
import java.io.IOException;
@ -23,6 +23,10 @@ import java.util.Set;
import javax.imageio.ImageIO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.SimpleForm;
import org.zkoss.bind.Validator;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ContextParam;
@ -33,8 +37,9 @@ import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
public class GlobalSettingsVM extends DocumentViewModel
public class GlobalSettingsVM extends BindingViewModel<SettingsData>
{
private final static Logger log = LoggerFactory.getLogger(GlobalSettingsVM.class.getName());
@WireVariable
private GlobalSettingsService settingsService;
@ -45,11 +50,16 @@ public class GlobalSettingsVM extends DocumentViewModel
@WireVariable
private FileStorage storage;
private Validator globalSettingValidator;
@Init(superclass = true)
public void init() {
public void init(@BindingParam("window") Window mainWindow) {
settings = settingsService.getSettings();
locConverter = new LocaleConverter();
setRefundsHours(settings.getRefunds().keySet());
this.getDataForm().setDataBean(this.settings);
this.globalSettingValidator = new GlobalSettingValidator(mainWindow);
}
public SettingsData getSettings() {
@ -108,16 +118,35 @@ public class GlobalSettingsVM extends DocumentViewModel
return locConverter;
}
private void insertString(SimpleForm form, String property, String field) {
if (form == null) {
log.warn("SimpleForm neexistuje !!!");
return;
}
Set<String> set = form.getFieldNames();
if (set.contains(property)) {
String text = (String) form.getField(property);
text += "[" + field + "]";
form.setField(property, text);
this.getDataForm().bind();
return;
}
log.warn("SimpleForm property '" + property + "' neexistuje !!!");
}
@Command
@NotifyChange("settings")
public void insertField(@BindingParam("field") String field, @BindingParam("message") MailMessage message) {
message.setText(message.getText() + "[" + field + "]");
public void insertField2Fx(@BindingParam("form") SimpleForm form, @BindingParam("property") String property, @BindingParam("field") String field) {
this.insertString(form, property, field);
}
@Command
@NotifyChange("settings")
public void insertUrl(@BindingParam("message") MailMessage message) {
message.setText(message.getText() + "[-url-]");
public void insertUrl2Fx(@BindingParam("form") SimpleForm form, @BindingParam("property") String property) {
this.insertString(form, property, Constants.MAIL_URL_KEYWORD);
}
@Command
@ -185,4 +214,12 @@ public class GlobalSettingsVM extends DocumentViewModel
return null;
}
}
public Validator getGlobalSettingValidator() {
return globalSettingValidator;
}
public void setGlobalSettingValidator(Validator globalSettingValidator) {
this.globalSettingValidator = globalSettingValidator;
}
}

@ -1,11 +1,12 @@
package info.bukova.isspst.validators;
import info.bukova.isspst.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import info.bukova.isspst.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.Property;
import org.zkoss.bind.ValidationContext;
import org.zkoss.bind.validator.AbstractValidator;
@ -17,7 +18,11 @@ import org.zkoss.zul.Messagebox;
public abstract class BaseValidator extends AbstractValidator
{
HtmlBasedComponent htmlComponent;
private final static Logger log = LoggerFactory.getLogger(BaseValidator.class.getName());
protected ValidationContext ctx;
private HtmlBasedComponent htmlComponent;
protected Logger getLogger()
{
@ -124,4 +129,38 @@ public abstract class BaseValidator extends AbstractValidator
return (String)value;
}
protected String getStringProperty(String propertyName) {
if (this.ctx == null) {
log.warn("Neznámý ValidationContext!!!");
return "";
}
if (StringUtils.isNullOrTrimmedEmpty(propertyName)) {
log.warn("Chybné propertyName!!!");
return "";
}
Property property = ctx.getProperties(propertyName)[0];
if (property == null) {
log.warn("Neexistující propertyName!!!");
return "";
}
Object o = property.getValue();
if (o instanceof String) {
return (String) o;
}
else {
log.warn("Chybný typ property '" + propertyName + "'!!!");
return "";
}
}
@Override
public void validate(ValidationContext ctx) {
this.ctx = ctx;
}
}

@ -0,0 +1,155 @@
package info.bukova.isspst.validators;
import info.bukova.isspst.Constants;
import info.bukova.isspst.RegExUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.sort.ReflectionTools;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.ValidationContext;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabbox;
import org.zkoss.zul.Window;
public class GlobalSettingValidator extends BaseValidator {
private final static Logger log = LoggerFactory.getLogger(GlobalSettingValidator.class.getName());
private Window mainWindow;
private SettingsData settingsData;
public GlobalSettingValidator(Window mainWindow) {
this.mainWindow = mainWindow;
}
private String SwitchTabs(String idIncludedPage, String idTabBox, String idTab, boolean select) {
if (this.mainWindow == null) {
log.warn("Neznámé okno globálního nastavení!!!");
return "";
}
if (StringUtils.isNullOrEmpty(idTabBox) || StringUtils.isNullOrEmpty(idTab)) {
log.warn("Neznámý Tabbox nebo Tab identifikátor globálního nastavení!!!");
return "";
}
Component component = this.mainWindow;
if (!StringUtils.isNullOrEmpty(idIncludedPage)) {
Component includedPageComponent = component.getFellow(idIncludedPage);
if (includedPageComponent != null) {
component = includedPageComponent;
}
}
Tabbox tabBox = (Tabbox) component.getFellowIfAny(idTabBox, true);
if (tabBox == null) {
log.warn("Neznámý Tabbox identifikátor '" + idTabBox + "' globálního nastavení!!!");
return "";
}
else {
Tab tab = (Tab) component.getFellowIfAny(idTab, true);
if (tab == null) {
log.warn("Neznámý Tab identifikátor '" + idTab + "' globálního nastavení!!!");
return "";
}
else {
if (select) {
tabBox.setSelectedTab(tab);
}
return tab.getLabel();
}
}
}
private void validateMailMessage(String text, String idTab, String idComponent) {
if (this.ctx == null) {
log.warn("Neznámý ValidationContext!!!");
return;
}
List<String> properties = ReflectionTools.getEntityFields(Requirement.class);
properties.add(Constants.MAIL_URL_KEYWORD);
if (StringUtils.isNullOrEmpty(text)) {
return;
}
List<String> matches;
final String regex = "\\[([^\\[\\]]*?)\\]";
matches = RegExUtils.getMatches(text, regex, 1);
String message = "";
for (int i = 0; i < matches.size(); i++) {
String propertyCandidate = matches.get(i);
if (!properties.contains(propertyCandidate)) {
message = "Vlastnost [" + propertyCandidate + "] neexistuje!";
break;
}
}
if (StringUtils.isNullOrEmpty(message)) {
text = text.replaceAll(regex, "");
}
if (StringUtils.isNullOrEmpty(message) && text.contains("[")) {
message = "Chybně použitý speciální znak '[' !\n";
}
if (StringUtils.isNullOrEmpty(message) && text.contains("]")) {
message = "Chybně použitý speciální znak ']' !\n";
}
boolean badCondition = !StringUtils.isNullOrEmpty(message);
if (badCondition) {
this.SwitchTabs("", "idTabBox", "idTabEmails", true);
this.SwitchTabs("idIncludedPageEmails", "idTabBoxEmails", idTab, true);
this.errorMsg(this.ctx, message, idComponent);
}
}
@Override
public void validate(ValidationContext ctx) {
super.validate(ctx);
// Map<String, Property[]> map = ctx.getProperties();
//
// for (Map.Entry<String, Property[]> entry : map.entrySet()) {
// String key = entry.getKey();
// Property[] values = entry.getValue();
// }
String value;
value = this.getStringProperty("newReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsNewRequirement", "idEmailNewReqTemplateText");
value = this.getStringProperty("authReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsAuthRequirement", "idEmailAuthReqTemplateText");
value = this.getStringProperty("confReqTemplate.text");
this.validateMailMessage(value, "idTabEmailsConfirmRequirement", "idEmailConfReqTemplateText");
value = this.getStringProperty("reqPassenger.text");
this.validateMailMessage(value, "idTabEmailsReqTripPassengers", "idEmailReqPassengerTemplateText");
value = this.getStringProperty("confReqTripPassenger.text");
this.validateMailMessage(value, "idTabEmailsConfirmTripPassengers", "idEmailConfReqTripPassengerTemplateText");
}
}

@ -1,172 +1,276 @@
<?page title="email" contentType="text/html;charset=UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
<zk
xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<tabbox>
<tabs>
<tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/>
<tab label="${labels.ReqTripPassengers}"/>
<tab label="${labels.ConfirmTripPassengers}"/>
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.newReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}"/>
<html content="@load(vm.settings.newReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<hbox>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start" disabled="@load(not vm.canSave)"/>
<button label="${labels.GlobalSettingsInsertUrl}" onClick="@command('insertUrl', message=vm.settings.newReqTemplate)" disabled="@load(not vm.canSave)"/>
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.authReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.authReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<hbox>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start" disabled="@load(not vm.canSave)"/>
<button label="${labels.GlobalSettingsInsertUrl}" onClick="@command('insertUrl', message=vm.settings.authReqTemplate)" disabled="@load(not vm.canSave)"/>
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.reqPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.reqPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsPassenger, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTripPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTripPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
<button label="${labels.InsertField}" popup="fieldsConfirmPass, position=after_start" disabled="@load(not vm.canSave)"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup id="fieldsNew" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.newReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsAuth" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.authReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirm" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirmPass" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTripPassenger)"/>
</template>
</menupopup>
<menupopup id="fieldsPassenger" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.reqPassenger)"/>
</template>
</menupopup>
<tabbox id="idTabBoxEmails">
<tabs>
<tab
id="idTabEmailsNewRequirement"
label="${labels.NewRequirement}" />
<tab
id="idTabEmailsAuthRequirement"
label="${labels.AuthRequirement}" />
<tab
id="idTabEmailsConfirmRequirement"
label="${labels.ConfirmRequirement}" />
<tab
id="idTabEmailsReqTripPassengers"
label="${labels.ReqTripPassengers}" />
<tab
id="idTabEmailsConfirmTripPassengers"
label="${labels.ConfirmTripPassengers}" />
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
id="idEmailNewReqTemplateSubject"
instant="true"
value="@bind(vm.settings.newReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.newReqTemplate.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailNewReqTemplateText"
content="@load(vm.settings.newReqTemplate.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<hbox>
<button
label="${labels.InsertField}"
popup="fieldsNew, position=after_start"
disabled="@load(not vm.canSave)" />
<button
label="${labels.GlobalSettingsInsertUrl}"
onClick="@command('insertUrl2Fx', form=fx, property='newReqTemplate.text')"
disabled="@load(not vm.canSave)" />
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.authReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.authReqTemplate.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailAuthReqTemplateText"
content="@load(vm.settings.authReqTemplate.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<hbox>
<button
label="${labels.InsertField}"
popup="fieldsAuth, position=after_start"
disabled="@load(not vm.canSave)" />
<button
label="${labels.GlobalSettingsInsertUrl}"
onClick="@command('insertUrl2Fx', form=fx, property='authReqTemplate.text')"
disabled="@load(not vm.canSave)" />
</hbox>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTemplate.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.confReqTemplate.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailConfReqTemplateText"
content="@load(vm.settings.confReqTemplate.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<button
label="${labels.InsertField}"
popup="fieldsConfirm, position=after_start"
disabled="@load(not vm.canSave)" />
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.reqPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.reqPassenger.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailReqPassengerTemplateText"
content="@load(vm.settings.reqPassenger.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<button
label="${labels.InsertField}"
popup="fieldsPassenger, position=after_start"
disabled="@load(not vm.canSave)" />
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<label value="${labels.MailSubject}" />
<textbox
value="@bind(vm.settings.confReqTripPassenger.subject)"
width="100%"
maxlength="@load(vm.lengthText)"
readonly="@load(not vm.canSave)" />
</row>
<row spans="2">
<vbox>
<ckeditor
toolbar="Basic"
value="@bind(fx.confReqTripPassenger.text)"
width="460px"
height="180px"
if="${vm.canSave}" />
<html
id="idEmailConfReqTripPassengerTemplateText"
content="@load(vm.settings.confReqTripPassenger.text)"
width="460px"
height="180px"
if="${not vm.canSave}" />
<button
label="${labels.InsertField}"
popup="fieldsConfirmPass, position=after_start"
disabled="@load(not vm.canSave)" />
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup
id="fieldsNew"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='newReqTemplate.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsAuth"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='authReqTemplate.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsConfirm"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='confReqTemplate.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsConfirmPass"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='confReqTripPassenger.text', field=each)" />
</template>
</menupopup>
<menupopup
id="fieldsPassenger"
children="@load(vm.requirementFields)">
<template name="children">
<menuitem
label="@load(each) @converter(vm.locConverter)"
onClick="@command('insertField2Fx', form=fx, property='reqPassenger.text', field=each)" />
</template>
</menupopup>
</zk>

@ -5,7 +5,9 @@
border="normal"
closable="true"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM', window=editWin)"
form="@id('fx') @init(vm.dataForm) @load(vm.settings) @save(vm.settings, before='save') @validator(vm.globalSettingValidator)"
validationMessages="@id('vmsg')"
width="750px"
height="600px"
binder="@init(queueName='email')">
@ -14,11 +16,14 @@
zclass="form-caption"
label="${labels.GlobalSettings}" />
<tabbox
id="idTabBox"
orient="vertical"
vflex="1">
<tabs width="140px">
<tab label="${labels.Requirements}" />
<tab label="${labels.EMails}" />
<tab
label="${labels.EMails}"
id="idTabEmails" />
<tab label="${labels.ContactInfo }" />
<tab label="${labels.BankInfo}" />
<tab label="${labels.TravelOrders}" />
@ -28,7 +33,9 @@
<include src="/settings/global/requirements.zul" />
</tabpanel>
<tabpanel>
<include src="/settings/global/email.zul" />
<include
id="idIncludedPageEmails"
src="/settings/global/email.zul" />
</tabpanel>
<tabpanel>
<include src="/settings/global/address.zul" />

Loading…
Cancel
Save