Search in sources :

Example 1 with ValidationMessage

use of org.olat.modules.portfolio.ui.editor.ValidationMessage in project OpenOLAT by OpenOLAT.

the class EvaluationFormController method validate.

@Override
public boolean validate(UserRequest ureq, List<ValidationMessage> messages) {
    boolean allFiled = true;
    for (EvaluationFormElementWrapper elementWrapper : elementWrapperList) {
        if (elementWrapper.isTextInput()) {
            TextInputWrapper wrapper = elementWrapper.getTextInputWrapper();
            if (wrapper != null && !hasResponse(wrapper.getId())) {
                allFiled &= false;
            }
        } else if (elementWrapper.isFileUpload()) {
            FileUploadWrapper wrapper = elementWrapper.getFileUploadWrapper();
            if (wrapper != null && !hasResponse(wrapper.getId())) {
                allFiled &= false;
            }
        } else if (elementWrapper.getSliders() != null && elementWrapper.getSliders().size() > 0) {
            for (SliderWrapper slider : elementWrapper.getSliders()) {
                if (slider != null && !hasResponse(slider.getId())) {
                    allFiled &= false;
                }
            }
        }
    }
    if (!allFiled) {
        String msg = translate("warning.form.not.completed");
        messages.add(new ValidationMessage(Level.warning, msg));
    }
    return validateFormLogic(ureq);
}
Also used : SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) ValidationMessage(org.olat.modules.portfolio.ui.editor.ValidationMessage) TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) FileUploadWrapper(org.olat.modules.forms.ui.model.FileUploadWrapper)

Example 2 with ValidationMessage

use of org.olat.modules.portfolio.ui.editor.ValidationMessage in project openolat by klemens.

the class PageRunController method doConfirmPublish.

private void doConfirmPublish(UserRequest ureq) {
    List<ValidationMessage> messages = new ArrayList<>();
    pageCtrl.validateElements(ureq, messages);
    String title = translate("publish.confirm.title");
    String text = translate("publish.confirm.descr", new String[] { StringHelper.escapeHtml(page.getTitle()) });
    if (messages.size() > 0) {
        StringBuilder sb = new StringBuilder();
        sb.append("<p>").append(text).append("</p>");
        for (ValidationMessage message : messages) {
            sb.append("<p class='o_warning'>").append(message.getMessage()).append("</p>");
        }
        text = sb.toString();
    }
    confirmPublishCtrl = activateYesNoDialog(ureq, title, text, confirmPublishCtrl);
}
Also used : ValidationMessage(org.olat.modules.portfolio.ui.editor.ValidationMessage) ArrayList(java.util.ArrayList)

Example 3 with ValidationMessage

use of org.olat.modules.portfolio.ui.editor.ValidationMessage in project OpenOLAT by OpenOLAT.

the class EvaluationFormController method doConfirmDone.

private void doConfirmDone(UserRequest ureq) {
    for (EvaluationFormElementWrapper elementWrapper : elementWrapperList) {
        if (elementWrapper.isTextInput()) {
            TextInputWrapper wrapper = elementWrapper.getTextInputWrapper();
            String value = wrapper.getTextEl().getValue();
            saveNumericalResponse(null, value, wrapper.getId());
        }
    }
    StringBuilder sb = new StringBuilder();
    sb.append("<p>").append(translate("confirm.done")).append("</p>");
    List<ValidationMessage> messages = new ArrayList<>();
    validate(ureq, messages);
    if (messages.size() > 0) {
        for (ValidationMessage message : messages) {
            sb.append("<p class='o_warning'>").append(message.getMessage()).append("</p>");
        }
    }
    confirmDoneCtrl = activateYesNoDialog(ureq, null, sb.toString(), confirmDoneCtrl);
}
Also used : ValidationMessage(org.olat.modules.portfolio.ui.editor.ValidationMessage) TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList)

Example 4 with ValidationMessage

use of org.olat.modules.portfolio.ui.editor.ValidationMessage in project OpenOLAT by OpenOLAT.

the class PageRunController method doConfirmPublish.

private void doConfirmPublish(UserRequest ureq) {
    List<ValidationMessage> messages = new ArrayList<>();
    pageCtrl.validateElements(ureq, messages);
    String title = translate("publish.confirm.title");
    String text = translate("publish.confirm.descr", new String[] { StringHelper.escapeHtml(page.getTitle()) });
    if (messages.size() > 0) {
        StringBuilder sb = new StringBuilder();
        sb.append("<p>").append(text).append("</p>");
        for (ValidationMessage message : messages) {
            sb.append("<p class='o_warning'>").append(message.getMessage()).append("</p>");
        }
        text = sb.toString();
    }
    confirmPublishCtrl = activateYesNoDialog(ureq, title, text, confirmPublishCtrl);
}
Also used : ValidationMessage(org.olat.modules.portfolio.ui.editor.ValidationMessage) ArrayList(java.util.ArrayList)

Example 5 with ValidationMessage

use of org.olat.modules.portfolio.ui.editor.ValidationMessage in project openolat by klemens.

the class EvaluationFormController method doConfirmDone.

private void doConfirmDone(UserRequest ureq) {
    for (EvaluationFormElementWrapper elementWrapper : elementWrapperList) {
        if (elementWrapper.isTextInput()) {
            TextInputWrapper wrapper = elementWrapper.getTextInputWrapper();
            String value = wrapper.getTextEl().getValue();
            saveNumericalResponse(null, value, wrapper.getId());
        }
    }
    StringBuilder sb = new StringBuilder();
    sb.append("<p>").append(translate("confirm.done")).append("</p>");
    List<ValidationMessage> messages = new ArrayList<>();
    validate(ureq, messages);
    if (messages.size() > 0) {
        for (ValidationMessage message : messages) {
            sb.append("<p class='o_warning'>").append(message.getMessage()).append("</p>");
        }
    }
    confirmDoneCtrl = activateYesNoDialog(ureq, null, sb.toString(), confirmDoneCtrl);
}
Also used : ValidationMessage(org.olat.modules.portfolio.ui.editor.ValidationMessage) TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) EvaluationFormElementWrapper(org.olat.modules.forms.ui.model.EvaluationFormElementWrapper) ArrayList(java.util.ArrayList)

Aggregations

ValidationMessage (org.olat.modules.portfolio.ui.editor.ValidationMessage)6 ArrayList (java.util.ArrayList)4 EvaluationFormElementWrapper (org.olat.modules.forms.ui.model.EvaluationFormElementWrapper)4 TextInputWrapper (org.olat.modules.forms.ui.model.TextInputWrapper)4 FileUploadWrapper (org.olat.modules.forms.ui.model.FileUploadWrapper)2 SliderWrapper (org.olat.modules.forms.ui.model.SliderWrapper)2