Search in sources :

Example 1 with SharedItemRow

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

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)

Example 2 with SharedItemRow

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

the class SharedBindersController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries.isEmpty())
        return;
    Long resId = entries.get(0).getOLATResourceable().getResourceableId();
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        SharedItemRow activatedRow = null;
        List<SharedItemRow> rows = model.getObjects();
        for (SharedItemRow row : rows) {
            if (row.getBinderKey().equals(resId)) {
                activatedRow = row;
                break;
            }
        }
        if (activatedRow != null) {
            Activateable2 activeateable = doSelectBinder(ureq, activatedRow);
            if (activeateable != null) {
                List<ContextEntry> subEntries = entries.subList(1, entries.size());
                activeateable.activate(ureq, subEntries, entries.get(0).getTransientState());
            }
        }
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 3 with SharedItemRow

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

the class SharedBindersController method doExpandSections.

private void doExpandSections(UserRequest ureq) {
    try {
        String row = ureq.getParameter("expand-section");
        int index = Integer.parseInt(row);
        SharedItemRow itemRow = model.getObject(index);
        if (itemRow != null) {
            itemRow.setExpandSections(!itemRow.isExpandSections());
        }
        tableEl.getComponent().setDirty(true);
    } catch (NumberFormatException e) {
        logError("", e);
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow)

Example 4 with SharedItemRow

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

the class SelectSectionsCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
    if (cellValue instanceof SharedItemRow) {
        SharedItemRow itemRow = (SharedItemRow) cellValue;
        List<AssessedBinderSection> sections = itemRow.getSections();
        if (sections != null && sections.size() > 0) {
            FlexiTableElementImpl ftE = source.getFlexiTableElement();
            String id = source.getFormDispatchId();
            Form rootForm = ftE.getRootForm();
            boolean expand = itemRow.isExpandSections();
            for (int i = 0; i < sections.size(); i++) {
                if (i > 0) {
                    if (expand)
                        target.append("<br />");
                    else
                        target.append(" | ");
                }
                NameValuePair pair1 = new NameValuePair("select-section", Integer.toString(row));
                NameValuePair pair2 = new NameValuePair("section", Integer.toString(i));
                String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair1, pair2);
                target.append("<a href=\"javascript:").append(jsCode).append(";\"").append(">");
                if (expand) {
                    target.append(StringHelper.escapeHtml(sections.get(i).getSectionTitle()));
                } else {
                    target.append(i + 1);
                }
                target.append("</a>");
            }
            NameValuePair pair = new NameValuePair("expand-section", Integer.toString(row));
            String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair);
            target.append(" <a href=\"javascript:").append(jsCode).append(";\"").append(">");
            if (itemRow.isExpandSections()) {
                target.append("<i class='o_icon o_icon-sm o_icon_expand'> </i>");
            } else {
                target.append("<i class='o_icon o_icon-sm o_icon_compress'> </i>");
            }
            target.append("</a>");
        }
    }
}
Also used : SharedItemRow(org.olat.modules.portfolio.model.SharedItemRow) NameValuePair(org.olat.core.gui.components.form.flexible.impl.NameValuePair) Form(org.olat.core.gui.components.form.flexible.impl.Form) AssessedBinderSection(org.olat.modules.portfolio.model.AssessedBinderSection) FlexiTableElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableElementImpl)

Example 5 with SharedItemRow

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

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)

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