use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof FlexiTableSearchEvent) {
FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
loadModel(ureq, se.getSearch());
} else if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("up".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPendingAssignment()) {
doMoveUpAssignment(ureq, row);
}
} else if ("down".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPendingAssignment()) {
doMoveDownAssignment(ureq, row);
}
}
}
} else if (timelineSwitchOnButton == source) {
doSwitchTimelineOff();
} else if (timelineSwitchOffButton == source) {
doSwitchTimelineOn();
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("open.full".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doOpenRow(ureq, row, false);
} else if ("comment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doComment(ureq, row.getPage());
} else if ("close.section".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doConfirmCloseSection(ureq, row);
} else if ("reopen.section".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doConfirmReopenSection(ureq, row);
} else if ("edit.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doEditAssignment(ureq, row);
} else if ("delete.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doConfirmDeleteAssignment(ureq, row);
} else if ("move.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doMoveAssignment(ureq, row);
} else if ("start.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doStartAssignment(ureq, row);
} else if ("open.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doOpenAssignment(ureq, row);
} else if ("up.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doMoveUpAssignment(ureq, row);
} else if ("down.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doMoveDownAssignment(ureq, row);
}
} else if (source instanceof SingleSelection) {
SingleSelection startAssignment = (SingleSelection) source;
if (startAssignment.isOneSelected()) {
String selectedKey = startAssignment.getSelectedKey();
try {
Long key = Long.parseLong(selectedKey);
doStartAssignment(ureq, key);
} catch (Exception e) {
//
}
}
} else if (source == flc) {
if ("ONCLICK".equals(event.getCommand())) {
String category = ureq.getParameter("tag_select");
if (StringHelper.containsNonWhitespace(category)) {
tableEl.quickSearch(ureq, category);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AbstractPageListController method forgePendingAssignmentRow.
protected PortfolioElementRow forgePendingAssignmentRow(Assignment assignment, Section section, List<Assignment> assignments) {
int index = assignments == null ? 0 : assignments.indexOf(assignment);
PortfolioElementRow row = new PortfolioElementRow(assignment, section, index);
if (secCallback.canInstantiateAssignment()) {
if (assignment.getAssignmentStatus() == AssignmentStatus.notStarted) {
String title = assignment.getTitle();
FormLink startLink = uifactory.addFormLink("create_assign_" + (++counter), "start.assignment", title, null, flc, Link.NONTRANSLATED);
startLink.setUserObject(row);
startLink.setIconLeftCSS("o_icon o_icon_assignment o_icon-fw");
row.setInstantiateAssignmentLink(startLink);
}
} else if (secCallback.canNewAssignment()) {
if (assignment.getTemplateReference() == null) {
FormLink editLink = uifactory.addFormLink("edit_assign_" + (++counter), "edit.assignment", "edit", null, flc, Link.BUTTON);
editLink.setUserObject(row);
row.setEditAssignmentLink(editLink);
FormLink deleteLink = uifactory.addFormLink("del_assign_" + (++counter), "delete.assignment", "delete", null, flc, Link.BUTTON);
deleteLink.setUserObject(row);
row.setDeleteAssignmentLink(deleteLink);
FormLink moveLink = uifactory.addFormLink("move_assign_" + (++counter), "move.assignment", "move", null, flc, Link.BUTTON);
moveLink.setUserObject(row);
row.setMoveAssignmentLink(moveLink);
FormLink upLink = uifactory.addFormLink("up_assign_" + (++counter), "up.assignment", "", null, flc, Link.BUTTON | Link.NONTRANSLATED);
upLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_up");
upLink.setEnabled(index > 0);
upLink.setUserObject(row);
row.setUpAssignmentLink(upLink);
FormLink downLink = uifactory.addFormLink("down_assign_" + (++counter), "down.assignment", "", null, flc, Link.BUTTON | Link.NONTRANSLATED);
downLink.setIconLeftCSS("o_icon o_icon o_icon-lg o_icon_move_down");
downLink.setUserObject(row);
downLink.setEnabled(assignments != null && index + 1 != assignments.size());
row.setDownAssignmentLink(downLink);
}
}
return row;
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class AssignmentEditController method updateAssignmentDocumentForm.
protected void updateAssignmentDocumentForm(UserRequest ureq) {
if (mapperUri == null) {
mapperUri = registerCacheableMapper(ureq, "assigment-" + CodeHelper.getRAMUniqueID(), new DocumentMapper());
filesLayout.contextPut("mapperUri", mapperUri);
}
List<VFSItem> files = new ArrayList<>();
if (assignment != null && StringHelper.containsNonWhitespace(assignment.getStorage())) {
documentContainer = fileStorage.getAssignmentContainer(assignment);
files.addAll(documentContainer.getItems(new SystemItemFilter()));
}
// add files from TempFolder
if (tempUploadFolder != null) {
files.addAll(tempUploadFolder.getItems(new SystemItemFilter()));
}
Collections.sort(files, new Comparator<VFSItem>() {
final Collator c = Collator.getInstance(getLocale());
@Override
public int compare(final VFSItem o1, final VFSItem o2) {
return c.compare((o1).getName(), (o2).getName());
}
});
filesLayout.contextPut("files", files);
// add delete links for each attachment if user is allowed to see them
int count = 0;
for (VFSItem file : files) {
FormLink deleteLink = uifactory.addFormLink("delete_" + (++count), filesLayout, Link.BUTTON_XSMALL);
deleteLink.setUserObject(file);
deleteLink.setI18nKey("delete");
}
boolean hasFile = files.size() > 0;
filesLayout.setVisible(files.size() > 0);
filesLayout.showLabel(hasFile);
documentUploadEl.showLabel(!hasFile);
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class BinderAssessmentController method forgeAssessmentSection.
private void forgeAssessmentSection(AssessmentSectionWrapper row) {
AssessmentSection assessmentSection = row.getAssessmentSection();
Section section = row.getSection();
if (!SectionStatus.isClosed(section)) {
// score
String pointVal = null;
if (assessmentSection != null && assessmentSection.getScore() != null) {
BigDecimal score = assessmentSection.getScore();
pointVal = AssessmentHelper.getRoundedScore(score);
}
TextElement pointEl = uifactory.addTextElement("point" + (++counter), null, 5, pointVal, flc);
pointEl.setDisplaySize(5);
row.setScoreEl(pointEl);
// passed
Boolean passed = assessmentSection == null ? null : assessmentSection.getPassed();
MultipleSelectionElement passedEl = uifactory.addCheckboxesHorizontal("check" + (++counter), null, flc, onKeys, onValues);
if (passed != null && passed.booleanValue()) {
passedEl.select(onKeys[0], passed.booleanValue());
}
row.setPassedEl(passedEl);
}
if (SectionStatus.isClosed(section)) {
FormLink reopenButton = uifactory.addFormLink("reopen" + (++counter), "reopen", "reopen", null, flc, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_pf_reopen_section");
reopenButton.setUserObject(row);
row.setButton(reopenButton);
} else {
FormLink closeButton = uifactory.addFormLink("close" + (++counter), "close", "close.section", null, flc, Link.BUTTON);
closeButton.setElementCssClass("o_sel_pf_close_section");
closeButton.setUserObject(row);
row.setButton(closeButton);
}
}
use of org.olat.core.gui.components.form.flexible.elements.FormLink in project OpenOLAT by OpenOLAT.
the class BinderListController method forgePortfolioRow.
protected BinderRow forgePortfolioRow(BinderStatistics binderRow) {
String openLinkId = "open_" + (++counter);
FormLink openLink = uifactory.addFormLink(openLinkId, "open", "open", null, flc, Link.LINK);
openLink.setIconRightCSS("o_icon o_icon_start");
VFSLeaf image = portfolioService.getPosterImageLeaf(binderRow);
BinderRow row = new BinderRow(binderRow, image, openLink);
openLink.setUserObject(row);
return row;
}
Aggregations