use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class TeacherRollCallController 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();
TeacherRollCallRow row = tableModel.getObject(se.getIndex());
if ("all".equals(cmd)) {
doCheckAllRow(row);
}
}
} else if (source instanceof MultipleSelectionElement) {
MultipleSelectionElement check = (MultipleSelectionElement) source;
TeacherRollCallRow row = (TeacherRollCallRow) check.getUserObject();
if (row.getAuthorizedAbsence() == check) {
doAuthorizedAbsence(row, check);
if (check.isAtLeastSelected(1)) {
doCalloutReasonAbsence(ureq, check.getFormDispatchId() + "_C_0", row);
}
} else {
doCheckRow(row, check);
}
} else if (reopenButton == source) {
doReopen(ureq);
} else if (closeLectureBlocksButton == source) {
if (validateFormLogic(ureq)) {
saveLectureBlocks();
doConfirmCloseLectureBlock(ureq);
}
} else if (cancelLectureBlockButton == source) {
saveLectureBlocks();
doConfirmCancelLectureBlock(ureq);
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if (cmd != null && cmd.startsWith("abs_reason_")) {
TeacherRollCallRow row = (TeacherRollCallRow) link.getUserObject();
doCalloutReasonAbsence(ureq, link.getFormDispatchId(), row);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class ExtendedSearchController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == searchButton) {
doSearch(ureq);
} else if (source instanceof SingleSelection) {
SingleSelection attrEl = (SingleSelection) source;
if (attrEl.isOneSelected()) {
Object uObject = attrEl.getUserObject();
if (uObject instanceof ConditionalQuery) {
ConditionalQuery query = (ConditionalQuery) uObject;
query.selectAttributeType(attrEl.getSelectedKey(), null);
}
}
} else if (source instanceof FormLink) {
FormLink button = (FormLink) source;
if (button.getCmd().startsWith("add")) {
ConditionalQuery query = (ConditionalQuery) button.getUserObject();
addParameter(query);
} else if (button.getCmd().startsWith("remove")) {
ConditionalQuery query = (ConditionalQuery) button.getUserObject();
removeParameter(query);
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class CourseReminderEditController method initRuleForm.
protected RuleElement initRuleForm(UserRequest ureq, RuleSPI ruleSpi, ReminderRule rule) {
String id = Integer.toString(counter++);
String type = ruleSpi.getClass().getSimpleName();
SingleSelection typeEl = uifactory.addDropdownSingleselect("rule.type.".concat(id), null, rulesCont, typeKeys, typeValues, null);
typeEl.addActionListener(FormEvent.ONCHANGE);
for (String typeKey : typeKeys) {
if (type.equals(typeKey)) {
typeEl.select(typeKey, true);
}
}
FormLink addRuleButton = uifactory.addFormLink("add.rule.".concat(id), "add", "add.rule", null, rulesCont, Link.BUTTON);
addRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_add");
addRuleButton.setElementCssClass("o_sel_course_add_rule");
FormLink deleteRuleButton = uifactory.addFormLink("delete.rule.".concat(id), "delete", "delete.rule", null, rulesCont, Link.BUTTON);
deleteRuleButton.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
deleteRuleButton.setElementCssClass("o_sel_course_delete_rule");
RuleEditorFragment editor = ruleSpi.getEditorFragment(rule, entry);
FormItem customItem = editor.initForm(rulesCont, this, ureq);
RuleElement ruleEl = new RuleElement(typeEl, addRuleButton, deleteRuleButton, editor, customItem);
typeEl.setUserObject(ruleEl);
addRuleButton.setUserObject(ruleEl);
deleteRuleButton.setUserObject(ruleEl);
return ruleEl;
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class VideoAdminListController method initTable.
private void initTable() {
List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodingsPendingAndInProgress();
List<TranscodingQueueTableRow> rows = new ArrayList<>();
for (VideoTranscoding videoTranscoding : videoTranscodings) {
String title = videoManager.getDisplayTitleForResolution(videoTranscoding.getResolution(), getTranslator());
String resid = String.valueOf(videoTranscoding.getVideoResource().getResourceableId());
FormLink resourceLink = uifactory.addFormLink("res_" + counter++, "viewResource", resid, resid, flc, Link.LINK + Link.NONTRANSLATED);
resourceLink.setUserObject(videoTranscoding);
FormLink deleteLink = uifactory.addFormLink("del_" + counter++, "deleteQuality", "quality.delete", "quality.delete", flc, Link.LINK);
deleteLink.setUserObject(videoTranscoding);
deleteLink.setIconLeftCSS("o_icon o_icon_delete_item o_icon-fw");
String fileSize = "";
if (videoTranscoding.getSize() != 0) {
fileSize = Formatter.formatBytes(videoTranscoding.getSize());
} else if (videoTranscoding.getStatus() == VideoTranscoding.TRANSCODING_STATUS_WAITING) {
fileSize = translate("transcoding.waiting");
} else if (videoTranscoding.getStatus() <= VideoTranscoding.TRANSCODING_STATUS_DONE) {
fileSize = translate("transcoding.processing") + ": " + videoTranscoding.getStatus() + "%";
}
RepositoryEntry videoRe = repositoryService.loadByResourceKey(videoTranscoding.getVideoResource().getKey());
if (videoRe == null)
continue;
String displayname = videoRe.getDisplayname();
String initialAuthor = videoRe.getInitialAuthor();
String fullName = userManager.getUserDisplayName(initialAuthor);
FormLink authorLink = uifactory.addFormLink("author_" + counter++, "viewAuthor", fullName, fullName, flc, Link.LINK + Link.NONTRANSLATED);
authorLink.setUserObject(initialAuthor);
Date creationDate = videoTranscoding.getCreationDate();
rows.add(new TranscodingQueueTableRow(resourceLink, displayname, creationDate, authorLink, title, fileSize, videoTranscoding.getFormat(), deleteLink));
}
tableModel.setObjects(rows);
if (flc.hasFormComponent(tableEl)) {
flc.remove(tableEl);
}
if (flc.hasFormComponent(refreshButton)) {
flc.remove(refreshButton);
}
tableEl = uifactory.addTableElement(getWindowControl(), "queue", tableModel, getTranslator(), flc);
tableEl.setCustomizeColumns(false);
tableEl.setNumOfRowsEnabled(false);
refreshButton = uifactory.addFormLink("button.refresh", flc, Link.BUTTON);
refreshButton.setIconLeftCSS("o_icon o_icon_refresh o_icon-fw");
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class VideoAdminListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source instanceof FormLink && ((FormLink) source).getCmd().equals("deleteQuality")) {
FormLink link = (FormLink) source;
VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
videoManager.deleteVideoTranscoding(videoTranscoding);
} else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewAuthor")) {
showUserInfo(ureq, baseSecurity.findIdentityByName((String) source.getUserObject()));
} else if (source instanceof FormLink && ((FormLink) source).getCmd().equals("viewResource")) {
FormLink link = (FormLink) source;
VideoTranscoding videoTranscoding = (VideoTranscoding) link.getUserObject();
launch(ureq, videoTranscoding);
}
initTable();
}
Aggregations