Search in sources :

Example 1 with AssignmentType

use of org.olat.modules.portfolio.AssignmentType in project OpenOLAT by OpenOLAT.

the class AssignmentEditController method validateFormLogic.

@Override
protected boolean validateFormLogic(UserRequest ureq) {
    boolean allOk = true;
    titleEl.clearError();
    if (!StringHelper.containsNonWhitespace(titleEl.getValue())) {
        titleEl.setErrorKey("form.legende.mandatory", null);
        allOk &= false;
    }
    if (sectionsEl != null) {
        sectionsEl.clearError();
        if (!sectionsEl.isOneSelected()) {
            sectionsEl.setErrorKey("form.legende.mandatory", null);
            allOk &= false;
        }
    }
    typeEl.clearError();
    selectFormLayout.clearError();
    if (typeEl.isOneSelected()) {
        AssignmentType type = AssignmentType.valueOf(typeEl.getSelectedKey());
        if (type == AssignmentType.form) {
            if (formEntry == null) {
                selectFormLayout.setErrorKey("form.legende.mandatory", null);
                allOk &= false;
            }
        }
    } else {
        typeEl.setErrorKey("form.legende.mandatory", null);
        allOk &= false;
    }
    return allOk & super.validateFormLogic(ureq);
}
Also used : AssignmentType(org.olat.modules.portfolio.AssignmentType)

Example 2 with AssignmentType

use of org.olat.modules.portfolio.AssignmentType in project openolat by klemens.

the class AssignmentEditController method validateFormLogic.

@Override
protected boolean validateFormLogic(UserRequest ureq) {
    boolean allOk = true;
    titleEl.clearError();
    if (!StringHelper.containsNonWhitespace(titleEl.getValue())) {
        titleEl.setErrorKey("form.legende.mandatory", null);
        allOk &= false;
    }
    if (sectionsEl != null) {
        sectionsEl.clearError();
        if (!sectionsEl.isOneSelected()) {
            sectionsEl.setErrorKey("form.legende.mandatory", null);
            allOk &= false;
        }
    }
    typeEl.clearError();
    selectFormLayout.clearError();
    if (typeEl.isOneSelected()) {
        AssignmentType type = AssignmentType.valueOf(typeEl.getSelectedKey());
        if (type == AssignmentType.form) {
            if (formEntry == null) {
                selectFormLayout.setErrorKey("form.legende.mandatory", null);
                allOk &= false;
            }
        }
    } else {
        typeEl.setErrorKey("form.legende.mandatory", null);
        allOk &= false;
    }
    return allOk & super.validateFormLogic(ureq);
}
Also used : AssignmentType(org.olat.modules.portfolio.AssignmentType)

Example 3 with AssignmentType

use of org.olat.modules.portfolio.AssignmentType in project OpenOLAT by OpenOLAT.

the class AssignmentEditController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String title = titleEl.getValue();
    String summary = summaryEl.getValue();
    String content = contentEl.getValue();
    AssignmentType type = AssignmentType.valueOf(typeEl.getSelectedKey());
    boolean onlyAutoEvaluation = evaluationFormEl.isOneSelected() && evaluationFormEl.isSelected(0);
    boolean reviewerCanSeeAutoEvaluation = reviewerSeeAutoEvaEl.isAtLeastSelected(1);
    boolean anonymousExternEvaluation = anonymousExternEvaEl.isAtLeastSelected(1);
    Section selectedSection = section;
    if (sectionsEl != null && sectionsEl.isOneSelected()) {
        String selectedKey = sectionsEl.getSelectedKey();
        Long selectedSectionKey = new Long(selectedKey);
        selectedSection = portfolioService.getSection(new SectionKeyRef(selectedSectionKey));
    }
    if (assignment == null) {
        assignment = portfolioService.addAssignment(title, summary, content, type, selectedSection, onlyAutoEvaluation, reviewerCanSeeAutoEvaluation, anonymousExternEvaluation, formEntry);
    } else {
        assignment = portfolioService.updateAssignment(assignment, title, summary, content, type, onlyAutoEvaluation, reviewerCanSeeAutoEvaluation, anonymousExternEvaluation, formEntry);
    }
    persistUploadedFiles();
    deleteTempStorage();
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : AssignmentType(org.olat.modules.portfolio.AssignmentType) SectionKeyRef(org.olat.modules.portfolio.model.SectionKeyRef) Section(org.olat.modules.portfolio.Section)

Example 4 with AssignmentType

use of org.olat.modules.portfolio.AssignmentType in project openolat by klemens.

the class AssignmentEditController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String title = titleEl.getValue();
    String summary = summaryEl.getValue();
    String content = contentEl.getValue();
    AssignmentType type = AssignmentType.valueOf(typeEl.getSelectedKey());
    boolean onlyAutoEvaluation = evaluationFormEl.isOneSelected() && evaluationFormEl.isSelected(0);
    boolean reviewerCanSeeAutoEvaluation = reviewerSeeAutoEvaEl.isAtLeastSelected(1);
    boolean anonymousExternEvaluation = anonymousExternEvaEl.isAtLeastSelected(1);
    Section selectedSection = section;
    if (sectionsEl != null && sectionsEl.isOneSelected()) {
        String selectedKey = sectionsEl.getSelectedKey();
        Long selectedSectionKey = new Long(selectedKey);
        selectedSection = portfolioService.getSection(new SectionKeyRef(selectedSectionKey));
    }
    if (assignment == null) {
        assignment = portfolioService.addAssignment(title, summary, content, type, selectedSection, onlyAutoEvaluation, reviewerCanSeeAutoEvaluation, anonymousExternEvaluation, formEntry);
    } else {
        assignment = portfolioService.updateAssignment(assignment, title, summary, content, type, onlyAutoEvaluation, reviewerCanSeeAutoEvaluation, anonymousExternEvaluation, formEntry);
    }
    persistUploadedFiles();
    deleteTempStorage();
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : AssignmentType(org.olat.modules.portfolio.AssignmentType) SectionKeyRef(org.olat.modules.portfolio.model.SectionKeyRef) Section(org.olat.modules.portfolio.Section)

Aggregations

AssignmentType (org.olat.modules.portfolio.AssignmentType)4 Section (org.olat.modules.portfolio.Section)2 SectionKeyRef (org.olat.modules.portfolio.model.SectionKeyRef)2