Search in sources :

Example 41 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

the class BinderPageListController method updateTimeline.

private void updateTimeline() {
    List<PortfolioElementRow> pages = model.getObjects();
    List<TimelinePoint> points = new ArrayList<>(pages.size());
    for (PortfolioElementRow page : pages) {
        if (page.isPage()) {
            String s = page.getPageStatus() == null ? "draft" : page.getPageStatus().name();
            points.add(new TimelinePoint(page.getKey().toString(), page.getTitle(), page.getCreationDate(), s));
        }
    }
    timelineEl.setPoints(points);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint)

Example 42 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

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 43 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

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 44 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

the class AbstractPageListController method getSelectedRows.

protected List<PortfolioElementRow> getSelectedRows() {
    Set<Integer> indexes = tableEl.getMultiSelectedIndex();
    List<PortfolioElementRow> selectedRows = new ArrayList<>(indexes.size());
    for (Integer index : indexes) {
        PortfolioElementRow row = model.getObject(index.intValue());
        selectedRows.add(row);
    }
    return selectedRows;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList)

Example 45 with PortfolioElementRow

use of org.olat.modules.portfolio.ui.model.PortfolioElementRow in project openolat by klemens.

the class AbstractPageListController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (pageCtrl == source) {
        if (event == Event.CHANGED_EVENT) {
            loadModel(ureq, null);
            fireEvent(ureq, Event.CHANGED_EVENT);
        } else if (event instanceof PageRemovedEvent) {
            loadModel(ureq, null);
            stackPanel.popUpToController(this);
            fireEvent(ureq, Event.CHANGED_EVENT);
        } else if (event instanceof PageDeletedEvent) {
            loadModel(ureq, null);
            fireEvent(ureq, event);
        }
    } else if (commentsCtrl == source) {
        if (event == Event.CHANGED_EVENT || "comment_count_changed".equals(event.getCommand())) {
            loadModel(ureq, null);
            fireEvent(ureq, Event.CHANGED_EVENT);
        }
        cmc.deactivate();
        cleanUp();
    } else if (editAssignmentCtrl == source || moveAssignmentCtrl == source) {
        if (event == Event.CHANGED_EVENT || event == Event.DONE_EVENT) {
            loadModel(ureq, null);
            fireEvent(ureq, Event.CHANGED_EVENT);
        }
        cmc.deactivate();
        cleanUp();
    } else if (confirmCloseSectionCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            PortfolioElementRow row = (PortfolioElementRow) confirmCloseSectionCtrl.getUserObject();
            doClose(ureq, row);
        }
    } else if (confirmReopenSectionCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            PortfolioElementRow row = (PortfolioElementRow) confirmReopenSectionCtrl.getUserObject();
            doReopen(ureq, row);
        }
    } else if (confirmDeleteAssignmentCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            PortfolioElementRow row = (PortfolioElementRow) confirmDeleteAssignmentCtrl.getUserObject();
            doDelete(row);
            loadModel(ureq, null);
        }
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) PageDeletedEvent(org.olat.modules.portfolio.ui.event.PageDeletedEvent) PageRemovedEvent(org.olat.modules.portfolio.ui.event.PageRemovedEvent)

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