Search in sources :

Example 31 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class TeacherLecturesTableController method loadModel.

protected void loadModel(List<LectureBlockRow> blocks) {
    for (LectureBlockRow row : blocks) {
        FormLink toolsLink = uifactory.addFormLink("tools_" + (counter++), "tools", "", null, null, Link.NONTRANSLATED);
        toolsLink.setIconLeftCSS("o_icon o_icon-lg o_icon_actions");
        toolsLink.setUserObject(row);
        row.setToolsLink(toolsLink);
    }
    tableModel.setObjects(blocks);
    tableEl.reset(true, true, true);
}
Also used : FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 32 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class TeacherLecturesTableController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            if ("details".equals(cmd)) {
                LectureBlockRow row = tableModel.getObject(se.getIndex());
                doSelectLectureBlock(ureq, row.getLectureBlock());
            } else if ("export".equals(cmd)) {
                LectureBlockRow row = tableModel.getObject(se.getIndex());
                doExportLectureBlock(ureq, row.getLectureBlock());
            } else if ("open.course".equals(cmd)) {
                LectureBlockRow row = tableModel.getObject(se.getIndex());
                doOpenCourseLectures(ureq, row);
            }
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("tools".equals(cmd)) {
            LectureBlockRow row = (LectureBlockRow) link.getUserObject();
            doOpenTools(ureq, row, link);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LectureBlockRow(org.olat.modules.lecture.model.LectureBlockRow)

Example 33 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class ReasonAdminController method loadModel.

private void loadModel() {
    List<Reason> reasons = lectureService.getAllReasons();
    List<ReasonRow> rows = new ArrayList<>(reasons.size());
    for (Reason reason : reasons) {
        String linkName = "tools-" + counter++;
        FormLink toolsLink = uifactory.addFormLink(linkName, "", null, flc, Link.LINK | Link.NONTRANSLATED);
        toolsLink.setIconRightCSS("o_icon o_icon_actions o_icon-lg");
        toolsLink.setUserObject(reason);
        flc.add(linkName, toolsLink);
        rows.add(new ReasonRow(reason, toolsLink));
    }
    dataModel.setObjects(rows);
    tableEl.reset(true, true, true);
}
Also used : ArrayList(java.util.ArrayList) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Reason(org.olat.modules.lecture.Reason)

Example 34 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class WikiEditArticleForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    wikiContent = uifactory.addTextAreaElement("wikiContentElement", 20, 110, page.getContent(), formLayout);
    wikiContent.setElementCssClass("o_sel_wiki_content");
    wikiContent.setLabel(null, null);
    // OO-31 prevent trimming, so first line can be with inset (wiki pre-formatted)
    wikiContent.preventValueTrim(true);
    wikiContent.setFocus(true);
    updateComment = uifactory.addTextElement("wikiUpdateComment", null, 40, "", formLayout);
    updateComment.setExampleKey("update.comment", null);
    // Button layout
    final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
    formLayout.add(buttonLayout);
    FormSubmit submit = uifactory.addFormSubmitButton("save", buttonLayout);
    submit.setElementCssClass("o_sel_wiki_save");
    FormLink saveAndClose = uifactory.addFormLink("save.and.close", buttonLayout, Link.BUTTON);
    saveAndClose.setElementCssClass("o_sel_wiki_save_and_close");
    if (getIdentity().getKey().equals(Long.valueOf(page.getInitalAuthor())) || securityCallback.mayEditWikiMenu()) {
        uifactory.addFormLink("delete.page", buttonLayout, Link.BUTTON);
    }
    uifactory.addFormLink("preview", buttonLayout, Link.BUTTON);
    uifactory.addFormLink("media.upload", buttonLayout, Link.BUTTON);
    uifactory.addFormLink("manage.media", buttonLayout, Link.BUTTON);
    uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl());
}
Also used : FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 35 with FormLink

use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.

the class GroupAssessmentController method loadModel.

/**
 * @return True if all results are the same
 */
private ModelInfos loadModel() {
    // load participants, load datas
    ICourse course = CourseFactory.loadCourse(courseEntry);
    List<Identity> identities = businessGroupService.getMembers(assessedGroup, GroupRoles.participant.name());
    Map<Identity, AssessmentEntry> identityToEntryMap = new HashMap<>();
    List<AssessmentEntry> entries = course.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(assessedGroup, gtaNode);
    for (AssessmentEntry entry : entries) {
        identityToEntryMap.put(entry.getIdentity(), entry);
    }
    int count = 0;
    boolean same = true;
    StringBuilder duplicateWarning = new StringBuilder();
    Float scoreRef = null;
    Boolean passedRef = null;
    String commentRef = null;
    Boolean userVisibleRef = null;
    List<AssessmentRow> rows = new ArrayList<>(identities.size());
    for (Identity identity : identities) {
        AssessmentEntry entry = identityToEntryMap.get(identity);
        ScoreEvaluation scoreEval = null;
        if (withScore || withPassed) {
            scoreEval = gtaNode.getUserScoreEvaluation(entry);
            if (scoreEval == null) {
                scoreEval = ScoreEvaluation.EMPTY_EVALUATION;
            }
        }
        String comment = null;
        if (withComment && entry != null) {
            comment = entry.getComment();
        }
        boolean duplicate = duplicateMemberKeys.contains(identity.getKey());
        if (duplicate) {
            if (duplicateWarning.length() > 0)
                duplicateWarning.append(", ");
            duplicateWarning.append(StringHelper.escapeHtml(userManager.getUserDisplayName(identity)));
        }
        AssessmentRow row = new AssessmentRow(identity, duplicate);
        rows.add(row);
        if (withScore) {
            Float score = scoreEval.getScore();
            String pointVal = AssessmentHelper.getRoundedScore(score);
            TextElement pointEl = uifactory.addTextElement("point" + count, null, 5, pointVal, flc);
            pointEl.setDisplaySize(5);
            row.setScoreEl(pointEl);
            if (count == 0) {
                scoreRef = score;
            } else if (!same(scoreRef, score)) {
                same = false;
            }
        }
        if (withPassed && cutValue == null) {
            Boolean passed = scoreEval.getPassed();
            MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + count, null, flc, onKeys, onValues);
            if (passed != null && passed.booleanValue()) {
                passedEl.select(onKeys[0], passed.booleanValue());
            }
            row.setPassedEl(passedEl);
            if (count == 0) {
                passedRef = passed;
            } else if (!same(passedRef, passed)) {
                same = false;
            }
        }
        if (withComment) {
            FormLink commentLink = uifactory.addFormLink("comment-" + CodeHelper.getRAMUniqueID(), "comment", "comment", null, flc, Link.LINK);
            if (StringHelper.containsNonWhitespace(comment)) {
                commentLink.setIconLeftCSS("o_icon o_icon_comments");
            } else {
                commentLink.setIconLeftCSS("o_icon o_icon_comments_none");
            }
            commentLink.setUserObject(row);
            row.setComment(comment);
            row.setCommentEditLink(commentLink);
            if (count == 0) {
                commentRef = comment;
            } else if (!same(commentRef, comment)) {
                same = false;
            }
        }
        if (withScore || withPassed || withPassed) {
            Boolean userVisible = scoreEval.getUserVisible();
            if (userVisible == null) {
                userVisible = Boolean.TRUE;
            }
            if (count == 0) {
                userVisibleRef = userVisible;
            } else if (!same(userVisibleRef, userVisible)) {
                same = false;
            }
        }
        count++;
    }
    model.setObjects(rows);
    table.reset();
    return new ModelInfos(same, scoreRef, passedRef, commentRef, userVisibleRef, duplicateWarning.toString());
}
Also used : ScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ICourse(org.olat.course.ICourse) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentEntry(org.olat.modules.assessment.AssessmentEntry) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Identity(org.olat.core.id.Identity)

Aggregations

FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)376 ArrayList (java.util.ArrayList)108 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)64 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)40 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)36 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)34 List (java.util.List)30 FormItem (org.olat.core.gui.components.form.flexible.FormItem)28 HashMap (java.util.HashMap)26 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)24 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)22 Date (java.util.Date)18 Map (java.util.Map)18 Link (org.olat.core.gui.components.link.Link)18 Identity (org.olat.core.id.Identity)18 Component (org.olat.core.gui.components.Component)16 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)16 FormEvent (org.olat.core.gui.components.form.flexible.impl.FormEvent)16 Controller (org.olat.core.gui.control.Controller)16 Event (org.olat.core.gui.control.Event)16