diff --git a/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation.java b/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation.java index e2d0965c..970bfeed 100644 --- a/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation.java +++ b/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation.java @@ -139,6 +139,9 @@ public interface PerunRegistrarTranslation extends PerunTranslation { @DefaultMessage("You must select at least one option!") public String cantBeEmptyCheckBox(); + @DefaultMessage("You must check this box!") + public String cantBeEmptySingleCheckBox(); + @DefaultMessage("Incorrect email address format!") public String incorrectEmail(); diff --git a/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/GroupCheckBox.java b/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/GroupCheckBox.java index 6417bccb..9140f47b 100644 --- a/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/GroupCheckBox.java +++ b/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/GroupCheckBox.java @@ -1,5 +1,6 @@ package cz.metacentrum.perun.wui.registrar.widgets.items; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Widget; import cz.metacentrum.perun.wui.model.beans.ApplicationFormItemData; import cz.metacentrum.perun.wui.model.beans.ApplicationFormItemTexts; @@ -24,6 +25,25 @@ public GroupCheckBox(PerunForm form, ApplicationFormItemData item, String lang) private boolean preview = false; + @Override + protected Widget initWidget() { + super.initWidget(); + + boolean isGroupApplication = Window.Location.getParameter("group") != null; + if (isGroupApplication) { + for (Widget widget : getWidget()) { + if (widget instanceof CheckBox) { + CheckBox checkBox = (CheckBox) widget; + String[] parsedGroupName = checkBox.getText().split(Window.Location.getParameter("group") + ":"); + // use group name without parent group prefix + checkBox.setText(parsedGroupName[1]); + } + } + } + + return getWidget(); + } + @Override protected Widget initWidgetOnlyPreview() { setSelectOptionsFromValue(); diff --git a/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/validators/CheckboxValidator.java b/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/validators/CheckboxValidator.java index fdcc705a..ba999e2e 100644 --- a/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/validators/CheckboxValidator.java +++ b/perun-wui-registrar/src/main/java/cz/metacentrum/perun/wui/registrar/widgets/items/validators/CheckboxValidator.java @@ -24,7 +24,11 @@ public boolean validateLocal(Checkbox checkbox) { } else { // single checkbox - prefer own error message setResult(Result.EMPTY); - checkbox.setRawStatus(getErrorMsgOrDefault(checkbox), ValidationState.ERROR); + String msg = getErrorMsgOrDefault(checkbox); + if (msg.equals(getTransl().incorrectFormat())) { + msg = getTransl().cantBeEmptySingleCheckBox(); + } + checkbox.setRawStatus(msg, ValidationState.ERROR); } return false; } diff --git a/perun-wui-registrar/src/main/resources/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation_cs.properties b/perun-wui-registrar/src/main/resources/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation_cs.properties index cf6ac553..1b743f5a 100644 --- a/perun-wui-registrar/src/main/resources/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation_cs.properties +++ b/perun-wui-registrar/src/main/resources/cz/metacentrum/perun/wui/registrar/client/resources/PerunRegistrarTranslation_cs.properties @@ -55,6 +55,7 @@ duplicateKeys=Každý klíč musí být unikátní! cantBeEmpty=Položka nesmí být prázdná! cantBeEmptySelect=Musíte vybrat jednu z možností! cantBeEmptyCheckBox=Musíte vybrat alespoň jednu možnost! +cantBeEmptySingleCheckBox=Tuhle položku musíte označit! incorrectEmail=Neplatný formát e-mailové adresy! checkAndSubmit=Zkontrolovat a odeslat formulář passEmpty=Heslo nesmí být prázdné!