Search in sources :

Example 6 with PortfolioElementRow

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;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 7 with PortfolioElementRow

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);
        }
    }
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) OLATResourceable(org.olat.core.id.OLATResourceable) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 8 with PortfolioElementRow

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);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) SortKey(org.olat.core.commons.persistence.SortKey) FlexiTableRenderEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRenderEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Example 9 with PortfolioElementRow

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());
        }
    }
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow)

Example 10 with PortfolioElementRow

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);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableRenderEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRenderEvent)

Aggregations

PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)48 ArrayList (java.util.ArrayList)16 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)14 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)12 Section (org.olat.modules.portfolio.Section)12 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 OLATResourceable (org.olat.core.id.OLATResourceable)10 List (java.util.List)8 Assignment (org.olat.modules.portfolio.Assignment)8 Category (org.olat.modules.portfolio.Category)8 Page (org.olat.modules.portfolio.Page)8 HashMap (java.util.HashMap)6 Component (org.olat.core.gui.components.Component)6 FlexiTableRenderEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRenderEvent)6 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 CategoryToElement (org.olat.modules.portfolio.CategoryToElement)6 TimelinePoint (org.olat.modules.portfolio.ui.component.TimelinePoint)6 Map (java.util.Map)4 Set (java.util.Set)4