use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.
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.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.
the class AbstractPageListController method forgeSectionRow.
protected PortfolioElementRow forgeSectionRow(Section section, AssessmentSection assessmentSection, List<Assignment> assignments, Map<OLATResourceable, List<Category>> categorizedElementMap) {
PortfolioElementRow row = new PortfolioElementRow(section, assessmentSection, config.isAssessable(), (assignments != null && assignments.size() > 0));
String openLinkId = "open_" + (++counter);
FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL);
openLink.setIconRightCSS("o_icon o_icon_start");
openLink.setPrimary(true);
row.setOpenFormLink(openLink);
openLink.setUserObject(row);
addCategoriesToRow(row, categorizedElementMap);
if (assignments != null && secCallback.canViewPendingAssignments(section) && secCallback.canInstantiateAssignment()) {
List<Assignment> startableAssignments = assignments.stream().filter(ass -> ass.getAssignmentStatus() == AssignmentStatus.notStarted).filter(ass -> ass.getPage() == null).collect(Collectors.toList());
if (!startableAssignments.isEmpty()) {
String[] keys = new String[startableAssignments.size() + 1];
String[] values = new String[startableAssignments.size() + 1];
keys[0] = "start.assignment.hint";
values[0] = translate("start.assignment.hint");
int count = 1;
for (Assignment assignment : startableAssignments) {
keys[count] = Long.toString(assignment.getKey());
values[count] = assignment.getTitle();
count++;
}
SingleSelection startEl = uifactory.addDropdownSingleselect("assignments_" + (++counter), "", flc, keys, values, null);
startEl.setDomReplacementWrapperRequired(false);
startEl.addActionListener(FormEvent.ONCHANGE);
row.setStartSelection(startEl);
}
}
return row;
}
use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.
the class BinderController method activateEntries.
private void activateEntries(UserRequest ureq) {
int numOfPages = doOpenEntries(ureq).getNumOfPages();
if (numOfPages == 1 && !secCallback.canEditBinder()) {
PortfolioElementRow firstPage = entriesCtrl.getFirstPage();
if (firstPage != null) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance("Page", firstPage.getPage().getKey());
List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromString(ores);
entriesCtrl.activate(ureq, entries, null);
}
}
}
Aggregations