Search in sources :

Example 6 with SharedItemRow

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

the class SharedBindersController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            SharedItemRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                Activateable2 activeateable = doSelectBinder(ureq, row);
                if (activeateable != null) {
                    activeateable.activate(ureq, null, null);
                }
            } else if ("leave".equals(cmd)) {
                doConfirmLeaveBinder(ureq, row);
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
            loadModel(se.getSearch());
        } else if ("ONCLICK".equals(event.getCommand())) {
            String row = ureq.getParameter("select-section");
            String expand = ureq.getParameter("expand-section");
            if (StringHelper.isLong(row)) {
                doSelectSection(ureq);
            } else if (StringHelper.containsNonWhitespace(expand)) {
                doExpandSections(ureq);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)

Example 7 with SharedItemRow

use of org.olat.modules.portfolio.model.SharedItemRow in project OpenOLAT by OpenOLAT.

the class SharedBindersController method doSelectSection.

private void doSelectSection(UserRequest ureq) {
    try {
        String row = ureq.getParameter("select-section");
        int index = Integer.parseInt(row);
        SharedItemRow itemRow = model.getObject(index);
        if (itemRow != null) {
            String sectionParam = ureq.getParameter("section");
            int sectionIndex = Integer.parseInt(sectionParam);
            AssessedBinderSection section = itemRow.getSections().get(sectionIndex);
            Activateable2 activeateable = doSelectBinder(ureq, itemRow);
            if (activeateable != null) {
                List<ContextEntry> entries = new ArrayList<>(2);
                entries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("Entries", 0l)));
                entries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("Section", section.getSectionKey())));
                activeateable.activate(ureq, entries, null);
            }
        }
    } catch (Exception e) {
        logError("", e);
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) ArrayList(java.util.ArrayList) AssessedBinderSection(org.olat.modules.portfolio.model.AssessedBinderSection) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 8 with SharedItemRow

use of org.olat.modules.portfolio.model.SharedItemRow in project OpenOLAT by OpenOLAT.

the class SharedBindersController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            SharedItemRow row = model.getObject(se.getIndex());
            if ("select".equals(cmd)) {
                Activateable2 activeateable = doSelectBinder(ureq, row);
                if (activeateable != null) {
                    activeateable.activate(ureq, null, null);
                }
            } else if ("leave".equals(cmd)) {
                doConfirmLeaveBinder(ureq, row);
            }
        } else if (event instanceof FlexiTableSearchEvent) {
            FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
            loadModel(se.getSearch());
        } else if ("ONCLICK".equals(event.getCommand())) {
            String row = ureq.getParameter("select-section");
            String expand = ureq.getParameter("expand-section");
            if (StringHelper.isLong(row)) {
                doSelectSection(ureq);
            } else if (StringHelper.containsNonWhitespace(expand)) {
                doExpandSections(ureq);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)

Example 9 with SharedItemRow

use of org.olat.modules.portfolio.model.SharedItemRow in project OpenOLAT by OpenOLAT.

the class SharedBindersController method loadModel.

private void loadModel(String searchString) {
    List<AssessedBinder> assessedBinders = portfolioService.searchSharedBindersWith(getIdentity(), searchString);
    List<SharedItemRow> rows = new ArrayList<>(assessedBinders.size());
    for (AssessedBinder assessedBinder : assessedBinders) {
        SharedItemRow row = new SharedItemRow(assessedBinder.getAssessedIdentity(), userPropertyHandlers, getLocale());
        row.setBinderTitle(assessedBinder.getBinderTitle());
        row.setBinderKey(assessedBinder.getBinderKey());
        row.setLastModified(assessedBinder.getLastModified());
        row.setEntryDisplayName(assessedBinder.getEntryDisplayname());
        row.setAssessmentEntry(assessedBinder);
        row.setRecentLaunch(assessedBinder.getRecentLaunch());
        List<AssessedBinderSection> sections = assessedBinder.getSections();
        if (sections != null && sections.size() > 1) {
            Collections.sort(sections, new AssessedBinderSectionComparator());
        }
        row.setSections(sections);
        row.setNumOfOpenSections(assessedBinder.getNumOfOpenSections());
        row.setNumOfDraftPages(assessedBinder.getNumOfDraftPages());
        row.setNumOfInRevisionPages(assessedBinder.getNumOfInRevisionPages());
        row.setNumOfClosedPages(assessedBinder.getNumOfClosedPages());
        row.setNumOfNewlyPublishedPages(assessedBinder.getNumOfNewlyPublishedPages());
        rows.add(row);
    }
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) ArrayList(java.util.ArrayList) AssessedBinderSection(org.olat.modules.portfolio.model.AssessedBinderSection) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder)

Example 10 with SharedItemRow

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

the class SharedBindersController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (confirmLeaveCtrl == source) {
        if (DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
            SharedItemRow row = (SharedItemRow) confirmLeaveCtrl.getUserObject();
            doLeaveBinder(row);
        }
    }
    super.event(ureq, source, event);
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow)

Aggregations

SharedItemRow (org.olat.modules.portfolio.model.SharedItemRow)14 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)6 AssessedBinderSection (org.olat.modules.portfolio.model.AssessedBinderSection)6 ArrayList (java.util.ArrayList)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 Form (org.olat.core.gui.components.form.flexible.impl.Form)2 NameValuePair (org.olat.core.gui.components.form.flexible.impl.NameValuePair)2 FlexiTableElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)2 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)2