Search in sources :

Example 1 with UserShortDescription

use of org.olat.admin.user.UserShortDescription in project OpenOLAT by OpenOLAT.

the class SingleParticipantCallController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        int numOfChecks = lectureBlock.getPlannedLecturesNumber();
        List<Integer> absences = rollCall.getLecturesAbsentList();
        for (int i = 0; i < numOfChecks; i++) {
            String checkId = "check_" + i;
            MultipleSelectionElement check = uifactory.addCheckboxesHorizontal(checkId, null, layoutCont, onKeys, onValues);
            check.setDomReplacementWrapperRequired(false);
            check.addActionListener(FormEvent.ONCHANGE);
            if (absences.contains(i)) {
                check.select(onKeys[0], true);
            }
            checks.add(check);
        }
        layoutCont.contextPut("checks", checks);
        DisplayPortraitController portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), calledIdentity, true, false);
        listenTo(portraitCtr);
        layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
        UserShortDescription userDescr = new UserShortDescription(ureq, getWindowControl(), calledIdentity);
        listenTo(userDescr);
        layoutCont.getFormItemComponent().put("userDescr", userDescr.getInitialComponent());
    }
    if (autorizedAbsenceEnabled) {
        authorizedAbsencedEl = uifactory.addCheckboxesHorizontal("authorized.absence", "authorized.absence", formLayout, onKeys, onValues);
        authorizedAbsencedEl.setDomReplacementWrapperRequired(false);
        authorizedAbsencedEl.addActionListener(FormEvent.ONCHANGE);
        if (rollCall.getAbsenceAuthorized() != null && rollCall.getAbsenceAuthorized().booleanValue()) {
            authorizedAbsencedEl.select(onKeys[0], true);
        }
        String reason = rollCall.getAbsenceReason();
        absenceReasonEl = uifactory.addTextAreaElement("absence.reason", "authorized.absence.reason", 2000, 4, 36, false, reason, formLayout);
        absenceReasonEl.setDomReplacementWrapperRequired(false);
        absenceReasonEl.setPlaceholderKey("authorized.absence.reason", null);
        absenceReasonEl.setVisible(authorizedAbsencedEl.isAtLeastSelected(1));
        absenceReasonEl.setMandatory(!absenceDefaultAuthorized);
    }
    String comment = rollCall.getComment();
    commentEl = uifactory.addTextAreaElement("comment", "rollcall.comment", 2000, 4, 36, false, comment, formLayout);
    commentEl.setPlaceholderKey("rollcall.comment", null);
    selectAllLink = uifactory.addFormLink("all", formLayout);
    uifactory.addFormSubmitButton("save", "save.next", formLayout);
    uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
}
Also used : DisplayPortraitController(org.olat.user.DisplayPortraitController) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) UserShortDescription(org.olat.admin.user.UserShortDescription) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 2 with UserShortDescription

use of org.olat.admin.user.UserShortDescription in project openolat by klemens.

the class AccessRightsEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (member != null && formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        Controller portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), member, true, true);
        layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
        listenTo(portraitCtr);
        Controller userShortDescrCtr = new UserShortDescription(ureq, getWindowControl(), member);
        layoutCont.getFormItemComponent().put("userShortDescription", userShortDescrCtr.getInitialComponent());
        listenTo(userShortDescrCtr);
    }
    selectAll = uifactory.addFormLink("form.checkall", "form.checkall", null, formLayout, Link.LINK);
    selectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_on");
    deselectAll = uifactory.addFormLink("form.uncheckall", "form.uncheckall", null, formLayout, Link.LINK);
    deselectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_off");
    // binder
    MultipleSelectionElement coachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
    coachEl.addActionListener(FormEvent.ONCHANGE);
    coachEl.setVisible(grading);
    MultipleSelectionElement reviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
    reviewerEl.addActionListener(FormEvent.ONCHANGE);
    binderRow = new BinderAccessRightsRow(coachEl, reviewerEl, binder);
    coachEl.setUserObject(binderRow);
    reviewerEl.setUserObject(binderRow);
    // sections
    List<Section> sections = portfolioService.getSections(binder);
    Map<Long, SectionAccessRightsRow> sectionMap = new HashMap<>();
    for (Section section : sections) {
        MultipleSelectionElement sectionCoachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        sectionCoachEl.addActionListener(FormEvent.ONCHANGE);
        sectionCoachEl.setVisible(grading);
        MultipleSelectionElement sectionReviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        sectionReviewerEl.addActionListener(FormEvent.ONCHANGE);
        SectionAccessRightsRow sectionRow = new SectionAccessRightsRow(sectionCoachEl, sectionReviewerEl, section, binderRow);
        binderRow.getSections().add(sectionRow);
        sectionMap.put(section.getKey(), sectionRow);
        sectionCoachEl.setUserObject(sectionRow);
        sectionReviewerEl.setUserObject(sectionRow);
    }
    // pages
    List<Page> pages = portfolioService.getPages(binder, null);
    for (Page page : pages) {
        Section section = page.getSection();
        SectionAccessRightsRow sectionRow = sectionMap.get(section.getKey());
        MultipleSelectionElement pageCoachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        pageCoachEl.addActionListener(FormEvent.ONCHANGE);
        pageCoachEl.setVisible(grading);
        MultipleSelectionElement pageReviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        pageReviewerEl.addActionListener(FormEvent.ONCHANGE);
        PortfolioElementAccessRightsRow pageRow = new PortfolioElementAccessRightsRow(pageCoachEl, pageReviewerEl, page, sectionRow);
        sectionRow.getPages().add(pageRow);
        pageCoachEl.setUserObject(pageRow);
        pageReviewerEl.setUserObject(pageRow);
    }
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("binderRow", binderRow);
        layoutCont.contextPut("grading", new Boolean(grading));
    }
    if (hasButtons) {
        FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
        formLayout.add(buttonsCont);
        buttonsCont.setRootForm(mainForm);
        formLayout.add("buttons", buttonsCont);
        uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
        removeLink = uifactory.addFormLink("remove", buttonsCont, Link.BUTTON);
        if (canEdit) {
            uifactory.addFormSubmitButton("save", buttonsCont);
        }
    }
}
Also used : DisplayPortraitController(org.olat.user.DisplayPortraitController) UserShortDescription(org.olat.admin.user.UserShortDescription) HashMap(java.util.HashMap) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) Page(org.olat.modules.portfolio.Page) DisplayPortraitController(org.olat.user.DisplayPortraitController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) Controller(org.olat.core.gui.control.Controller) Section(org.olat.modules.portfolio.Section) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)

Example 3 with UserShortDescription

use of org.olat.admin.user.UserShortDescription in project OpenOLAT by OpenOLAT.

the class AccessRightsEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (member != null && formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        Controller portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), member, true, true);
        layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
        listenTo(portraitCtr);
        Controller userShortDescrCtr = new UserShortDescription(ureq, getWindowControl(), member);
        layoutCont.getFormItemComponent().put("userShortDescription", userShortDescrCtr.getInitialComponent());
        listenTo(userShortDescrCtr);
    }
    selectAll = uifactory.addFormLink("form.checkall", "form.checkall", null, formLayout, Link.LINK);
    selectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_on");
    deselectAll = uifactory.addFormLink("form.uncheckall", "form.uncheckall", null, formLayout, Link.LINK);
    deselectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_off");
    // binder
    MultipleSelectionElement coachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
    coachEl.addActionListener(FormEvent.ONCHANGE);
    coachEl.setVisible(grading);
    MultipleSelectionElement reviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
    reviewerEl.addActionListener(FormEvent.ONCHANGE);
    binderRow = new BinderAccessRightsRow(coachEl, reviewerEl, binder);
    coachEl.setUserObject(binderRow);
    reviewerEl.setUserObject(binderRow);
    // sections
    List<Section> sections = portfolioService.getSections(binder);
    Map<Long, SectionAccessRightsRow> sectionMap = new HashMap<>();
    for (Section section : sections) {
        MultipleSelectionElement sectionCoachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        sectionCoachEl.addActionListener(FormEvent.ONCHANGE);
        sectionCoachEl.setVisible(grading);
        MultipleSelectionElement sectionReviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        sectionReviewerEl.addActionListener(FormEvent.ONCHANGE);
        SectionAccessRightsRow sectionRow = new SectionAccessRightsRow(sectionCoachEl, sectionReviewerEl, section, binderRow);
        binderRow.getSections().add(sectionRow);
        sectionMap.put(section.getKey(), sectionRow);
        sectionCoachEl.setUserObject(sectionRow);
        sectionReviewerEl.setUserObject(sectionRow);
    }
    // pages
    List<Page> pages = portfolioService.getPages(binder, null);
    for (Page page : pages) {
        Section section = page.getSection();
        SectionAccessRightsRow sectionRow = sectionMap.get(section.getKey());
        MultipleSelectionElement pageCoachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        pageCoachEl.addActionListener(FormEvent.ONCHANGE);
        pageCoachEl.setVisible(grading);
        MultipleSelectionElement pageReviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
        pageReviewerEl.addActionListener(FormEvent.ONCHANGE);
        PortfolioElementAccessRightsRow pageRow = new PortfolioElementAccessRightsRow(pageCoachEl, pageReviewerEl, page, sectionRow);
        sectionRow.getPages().add(pageRow);
        pageCoachEl.setUserObject(pageRow);
        pageReviewerEl.setUserObject(pageRow);
    }
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        layoutCont.contextPut("binderRow", binderRow);
        layoutCont.contextPut("grading", new Boolean(grading));
    }
    if (hasButtons) {
        FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
        formLayout.add(buttonsCont);
        buttonsCont.setRootForm(mainForm);
        formLayout.add("buttons", buttonsCont);
        uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
        removeLink = uifactory.addFormLink("remove", buttonsCont, Link.BUTTON);
        if (canEdit) {
            uifactory.addFormSubmitButton("save", buttonsCont);
        }
    }
}
Also used : DisplayPortraitController(org.olat.user.DisplayPortraitController) UserShortDescription(org.olat.admin.user.UserShortDescription) HashMap(java.util.HashMap) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) Page(org.olat.modules.portfolio.Page) DisplayPortraitController(org.olat.user.DisplayPortraitController) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) Controller(org.olat.core.gui.control.Controller) Section(org.olat.modules.portfolio.Section) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)

Example 4 with UserShortDescription

use of org.olat.admin.user.UserShortDescription in project openolat by klemens.

the class SingleParticipantCallController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        int numOfChecks = lectureBlock.getPlannedLecturesNumber();
        List<Integer> absences = rollCall.getLecturesAbsentList();
        for (int i = 0; i < numOfChecks; i++) {
            String checkId = "check_" + i;
            MultipleSelectionElement check = uifactory.addCheckboxesHorizontal(checkId, null, layoutCont, onKeys, onValues);
            check.setDomReplacementWrapperRequired(false);
            check.addActionListener(FormEvent.ONCHANGE);
            if (absences.contains(i)) {
                check.select(onKeys[0], true);
            }
            checks.add(check);
        }
        layoutCont.contextPut("checks", checks);
        DisplayPortraitController portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), calledIdentity, true, false);
        listenTo(portraitCtr);
        layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
        UserShortDescription userDescr = new UserShortDescription(ureq, getWindowControl(), calledIdentity);
        listenTo(userDescr);
        layoutCont.getFormItemComponent().put("userDescr", userDescr.getInitialComponent());
    }
    if (autorizedAbsenceEnabled) {
        authorizedAbsencedEl = uifactory.addCheckboxesHorizontal("authorized.absence", "authorized.absence", formLayout, onKeys, onValues);
        authorizedAbsencedEl.setDomReplacementWrapperRequired(false);
        authorizedAbsencedEl.addActionListener(FormEvent.ONCHANGE);
        if (rollCall.getAbsenceAuthorized() != null && rollCall.getAbsenceAuthorized().booleanValue()) {
            authorizedAbsencedEl.select(onKeys[0], true);
        }
        String reason = rollCall.getAbsenceReason();
        absenceReasonEl = uifactory.addTextAreaElement("absence.reason", "authorized.absence.reason", 2000, 4, 36, false, reason, formLayout);
        absenceReasonEl.setDomReplacementWrapperRequired(false);
        absenceReasonEl.setPlaceholderKey("authorized.absence.reason", null);
        absenceReasonEl.setVisible(authorizedAbsencedEl.isAtLeastSelected(1));
        absenceReasonEl.setMandatory(!absenceDefaultAuthorized);
    }
    String comment = rollCall.getComment();
    commentEl = uifactory.addTextAreaElement("comment", "rollcall.comment", 2000, 4, 36, false, comment, formLayout);
    commentEl.setPlaceholderKey("rollcall.comment", null);
    selectAllLink = uifactory.addFormLink("all", formLayout);
    uifactory.addFormSubmitButton("save", "save.next", formLayout);
    uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
}
Also used : DisplayPortraitController(org.olat.user.DisplayPortraitController) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) UserShortDescription(org.olat.admin.user.UserShortDescription) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Aggregations

UserShortDescription (org.olat.admin.user.UserShortDescription)4 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 DisplayPortraitController (org.olat.user.DisplayPortraitController)4 HashMap (java.util.HashMap)2 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)2 Controller (org.olat.core.gui.control.Controller)2 Page (org.olat.modules.portfolio.Page)2 Section (org.olat.modules.portfolio.Section)2