use of org.olat.modules.portfolio.ui.model.PortfolioElementRow 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.modules.portfolio.ui.model.PortfolioElementRow in project OpenOLAT by OpenOLAT.
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);
}
}
}
use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project OpenOLAT by OpenOLAT.
the class BinderPageListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof FlexiTableRenderEvent) {
FlexiTableRenderEvent re = (FlexiTableRenderEvent) event;
if (re.getRendererType() == FlexiTableRendererType.custom) {
tableEl.sort(new SortKey(null, false));
}
} else if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("select-page".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPendingAssignment()) {
doStartAssignment(ureq, row);
} else {
doOpenRow(ureq, row, false);
}
}
}
} else if (previousSectionLink == source) {
Section previousSection = (Section) previousSectionLink.getUserObject();
doFilterSection(previousSection);
} else if (nextSectionLink == source) {
Section nextSection = (Section) nextSectionLink.getUserObject();
doFilterSection(nextSection);
} else if (showAllSectionsLink == source) {
doShowAll();
} else if (newSectionButton == source) {
doCreateNewSection(ureq);
} else if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
if ("new.entry".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doCreateNewPage(ureq, row.getSection());
} else if ("new.assignment".equals(cmd)) {
PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
doCreateNewAssignment(ureq, row.getSection());
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project OpenOLAT by OpenOLAT.
the class BinderPageListController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
super.activate(ureq, entries, state);
if (entries == null || entries.isEmpty())
return;
String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
if ("Section".equalsIgnoreCase(resName)) {
Long resId = entries.get(0).getOLATResourceable().getResourceableId();
PortfolioElementRow activatedRow = null;
for (PortfolioElementRow row : model.getObjects()) {
if (row.getSection() != null && row.getSection().getKey().equals(resId)) {
activatedRow = row;
break;
}
}
if (activatedRow != null) {
doFilterSection(activatedRow.getSection());
}
}
}
use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project OpenOLAT by OpenOLAT.
the class DeletedPageListController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof FlexiTableRenderEvent) {
FlexiTableRenderEvent se = (FlexiTableRenderEvent) event;
deleteButton.setVisible(se.getRendererType() == FlexiTableRendererType.classic && model.getRowCount() > 0);
tableEl.setSelectAllEnable(tableEl.getRendererType() == FlexiTableRendererType.classic);
} else if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
String cmd = se.getCommand();
if ("select-page".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
doOpenRow(ureq, row, false);
} else if ("restore".equals(cmd)) {
PortfolioElementRow row = model.getObject(se.getIndex());
if (row.isPage()) {
doRestorePage(ureq, row);
}
}
}
} else if (deleteButton == source) {
doConfirmDelete(ureq);
}
super.formInnerEvent(ureq, source, event);
}
Aggregations