use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class IdentityListCourseNodeController method loadModel.
protected void loadModel(@SuppressWarnings("unused") UserRequest ureq) {
SearchAssessedIdentityParams params = getSearchParameters();
List<Identity> assessedIdentities = assessmentToolManager.getAssessedIdentities(getIdentity(), params);
List<AssessmentEntry> assessmentEntries = assessmentToolManager.getAssessmentEntries(getIdentity(), params, null);
Map<Long, AssessmentEntry> entryMap = new HashMap<>();
assessmentEntries.stream().filter(entry -> entry.getIdentity() != null).forEach((entry) -> entryMap.put(entry.getIdentity().getKey(), entry));
List<AssessedIdentityElementRow> rows = new ArrayList<>(assessedIdentities.size());
for (Identity assessedIdentity : assessedIdentities) {
AssessmentEntry entry = entryMap.get(assessedIdentity.getKey());
CompletionItem currentCompletion = new CompletionItem("current-completion-" + (++counter), getLocale());
if (entry != null) {
currentCompletion.setCompletion(entry.getCurrentRunCompletion());
AssessmentRunStatus status = entry.getCurrentRunStatus();
currentCompletion.setEnded(status != null && AssessmentRunStatus.done.equals(status));
}
FormLink toolsLink = uifactory.addFormLink("tools_" + (++counter), "tools", "", null, null, Link.NONTRANSLATED);
toolsLink.setIconLeftCSS("o_icon o_icon_actions o_icon-lg");
AssessedIdentityElementRow row = new AssessedIdentityElementRow(assessedIdentity, entry, currentCompletion, toolsLink, userPropertyHandlers, getLocale());
toolsLink.setUserObject(row);
rows.add(row);
}
usersTableModel.setObjects(rows);
List<FlexiTableFilter> filters = tableEl.getSelectedFilters();
if (filters != null && filters.size() > 0 && filters.get(0) != null) {
usersTableModel.filter(Collections.singletonList(filters.get(0)));
}
tableEl.reset();
tableEl.reloadData();
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class IdentityListCourseNodeController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
AssessedIdentityElementRow row = usersTableModel.getObject(se.getIndex());
if ("select".equals(cmd)) {
doSelect(ureq, row);
}
} else if (event instanceof FlexiTableSearchEvent) {
loadModel(ureq);
}
} else if (bulkDoneButton == source) {
doSetDone(ureq);
} else if (bulkVisibleButton == source) {
doConfirmVisible(ureq);
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
if ("tools".equals(link.getCmd())) {
doOpenTools(ureq, (AssessedIdentityElementRow) link.getUserObject(), link);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AssessmentForm method updateStatus.
private void updateStatus(ScoreEvaluation scoreEval) {
boolean closed = (scoreEval != null && scoreEval.getAssessmentStatus() == AssessmentEntryStatus.done);
if (hasPassed) {
passed.setEnabled(!closed && cut == null && !coachCourseEnv.isCourseReadOnly());
}
if (hasScore) {
score.setEnabled(!closed && !coachCourseEnv.isCourseReadOnly());
}
if (hasComment) {
userComment.setEnabled(!closed && !coachCourseEnv.isCourseReadOnly());
}
if (hasIndividualAssessmentDocs) {
uploadDocsEl.setVisible(!closed && !coachCourseEnv.isCourseReadOnly());
}
coachComment.setEnabled(!closed && !coachCourseEnv.isCourseReadOnly());
if (hasAttempts) {
attempts.setEnabled(!closed && !coachCourseEnv.isCourseReadOnly());
}
if (assessmentDocuments != null) {
for (DocumentWrapper assessmentDoc : assessmentDocuments) {
FormLink deleteButton = assessmentDoc.getDeleteButton();
if (deleteButton != null) {
deleteButton.setEnabled(!closed && !coachCourseEnv.isCourseReadOnly());
deleteButton.setVisible(!closed && !coachCourseEnv.isCourseReadOnly());
}
}
}
submitButton.setVisible(!coachCourseEnv.isCourseReadOnly());
saveAndDoneLink.setVisible(!closed && !coachCourseEnv.isCourseReadOnly());
reopenLink.setVisible(closed && !coachCourseEnv.isCourseReadOnly());
flc.setDirty(true);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AssessmentForm method reloadAssessmentDocs.
private void reloadAssessmentDocs() {
if (docsLayoutCont == null)
return;
List<File> documents = assessableCourseNode.getIndividualAssessmentDocuments(assessedUserCourseEnv);
List<DocumentWrapper> wrappers = new ArrayList<>(documents.size());
for (File document : documents) {
DocumentWrapper wrapper = new DocumentWrapper(document);
wrappers.add(wrapper);
FormLink deleteButton = uifactory.addFormLink("delete_doc_" + (++counter), "delete", null, docsLayoutCont, Link.BUTTON_XSMALL);
deleteButton.setEnabled(true);
deleteButton.setVisible(true);
wrapper.setDeleteButton(deleteButton);
}
docsLayoutCont.contextPut("documents", wrappers);
assessmentDocuments = wrappers;
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class MediaLinksController method addNewFormLink.
private void addNewFormLink(LinkWrapper link, FormLayoutContainer layoutContainer) {
// add link target
String id = link.getId();
TextElement url = uifactory.addTextElement("url_" + id, null, -1, link.getLink().getURI(), layoutContainer);
url.clearError();
url.setDisplaySize(60);
url.setMandatory(true);
url.setEnabled(false);
link.setUrl(url);
// custom media action button
FormLink mediaButton = uifactory.addFormLink("media_" + id, " ", " ", layoutContainer, Link.NONTRANSLATED);
mediaButton.setIconLeftCSS("o_icon o_icon_browse");
mediaButton.setUserObject(link);
link.setMediaButton(mediaButton);
// add link description
TextElement name = uifactory.addTextElement("displayName_" + id, null, -1, link.getLink().getDisplayName(), layoutContainer);
name.clearError();
name.setDisplaySize(40);
name.setMandatory(true);
link.setName(name);
// add link add action button
FormLink addButton = uifactory.addFormLink("add_" + id, "table.add", "table.add", layoutContainer, Link.BUTTON);
addButton.setUserObject(link);
link.setAddButton(addButton);
// add link deletion action button
FormLink delButton = uifactory.addFormLink("del_" + id, "table.delete", "table.delete", layoutContainer, Link.BUTTON);
delButton.setUserObject(link);
link.setDelButton(delButton);
}
Aggregations