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);
}
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);
}
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);
}
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());
}
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());
}
Aggregations