Search in sources :

Example 91 with Section

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

the class PageRunController method doEditMetadata.

private void doEditMetadata(UserRequest ureq) {
    if (editMetadataCtrl != null)
        return;
    removeAsListenerAndDispose(editMetadataCtrl);
    Binder binder = null;
    Section section = null;
    if (page.getSection() != null) {
        section = page.getSection();
        binder = portfolioService.getBinderBySection(section);
    }
    boolean editMetadata = secCallback.canEditPageMetadata(page, assignments);
    editMetadataCtrl = new PageMetadataEditController(ureq, getWindowControl(), binder, editMetadata, section, editMetadata, page, editMetadata);
    listenTo(editMetadataCtrl);
    String title = translate("edit.page.metadata");
    cmc = new CloseableModalController(getWindowControl(), null, editMetadataCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : Binder(org.olat.modules.portfolio.Binder) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) Section(org.olat.modules.portfolio.Section)

Example 92 with Section

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

the class MyPageListController method loadModel.

@Override
protected void loadModel(UserRequest ureq, String searchString) {
    Map<Long, Long> numberOfCommentsMap = portfolioService.getNumberOfCommentsOnOwnedPage(getIdentity());
    List<CategoryToElement> categorizedElements = portfolioService.getCategorizedOwnedPages(getIdentity());
    Map<OLATResourceable, List<Category>> categorizedElementMap = new HashMap<>();
    for (CategoryToElement categorizedElement : categorizedElements) {
        List<Category> categories = categorizedElementMap.get(categorizedElement.getCategorizedResource());
        if (categories == null) {
            categories = new ArrayList<>();
            categorizedElementMap.put(categorizedElement.getCategorizedResource(), categories);
        }
        categories.add(categorizedElement.getCategory());
    }
    List<Assignment> assignments = portfolioService.searchOwnedAssignments(getIdentity());
    Map<Page, List<Assignment>> pageToAssignments = new HashMap<>();
    for (Assignment assignment : assignments) {
        Page page = assignment.getPage();
        List<Assignment> assignmentList;
        if (pageToAssignments.containsKey(page)) {
            assignmentList = pageToAssignments.get(page);
        } else {
            assignmentList = new ArrayList<>();
            pageToAssignments.put(page, assignmentList);
        }
        assignmentList.add(assignment);
    }
    FormLink newEntryButton = uifactory.addFormLink("new.entry." + (++counter), "new.entry", "create.new.page", null, flc, Link.BUTTON);
    newEntryButton.setCustomEnabledLinkCSS("btn btn-primary");
    List<Page> pages = portfolioService.searchOwnedPages(getIdentity(), searchString);
    List<PortfolioElementRow> rows = new ArrayList<>(pages.size());
    List<TimelinePoint> points = new ArrayList<>(pages.size());
    for (Page page : pages) {
        if (page.getPageStatus() == PageStatus.deleted) {
            continue;
        }
        List<Assignment> assignmentList = pageToAssignments.get(page);
        PortfolioElementRow row = forgePageRow(ureq, page, null, assignmentList, categorizedElementMap, numberOfCommentsMap, true);
        rows.add(row);
        if (page.getSection() != null) {
            Section section = page.getSection();
            row.setMetaSectionTitle(section.getTitle());
            if (section.getBinder() != null) {
                row.setMetaBinderTitle(section.getBinder().getTitle());
            }
        }
        row.setNewFloatingEntryLink(newEntryButton);
        String s = page.getPageStatus() == null ? "draft" : page.getPageStatus().name();
        points.add(new TimelinePoint(page.getKey().toString(), page.getTitle(), page.getCreationDate(), s));
    }
    timelineEl.setPoints(points);
    // clean up the posters
    disposeRows();
    model.setObjects(rows);
    tableEl.reset();
    tableEl.reloadData();
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Category(org.olat.modules.portfolio.Category) OLATResourceable(org.olat.core.id.OLATResourceable) HashMap(java.util.HashMap) CategoryToElement(org.olat.modules.portfolio.CategoryToElement) ArrayList(java.util.ArrayList) Page(org.olat.modules.portfolio.Page) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) Section(org.olat.modules.portfolio.Section) Assignment(org.olat.modules.portfolio.Assignment) ArrayList(java.util.ArrayList) List(java.util.List) TimelinePoint(org.olat.modules.portfolio.ui.component.TimelinePoint)

Example 93 with Section

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

the class PageListDataModel method filter.

public List<Section> filter(Section section) {
    if (section == null) {
        super.setObjects(backup);
        return null;
    } else if (backup == null) {
        return new ArrayList<>();
    }
    Set<Section> sectionSet = new HashSet<>();
    List<Section> sectionList = new ArrayList<>();
    List<PortfolioElementRow> sectionRows = new ArrayList<>();
    for (PortfolioElementRow row : backup) {
        if (row.getSection() != null) {
            if (!sectionSet.contains(row.getSection())) {
                sectionSet.add(row.getSection());
                sectionList.add(row.getSection());
            }
            if (section.equals(row.getSection())) {
                sectionRows.add(row);
            }
        }
    }
    super.setObjects(sectionRows);
    return sectionList;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) ArrayList(java.util.ArrayList) Section(org.olat.modules.portfolio.Section) HashSet(java.util.HashSet)

Example 94 with Section

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

the class TableOfContentController method loadPagesModel.

private void loadPagesModel(Map<Long, SectionRow> sectionMap) {
    boolean showUserInfos = secCallback.canPageUserInfosStatus();
    mainVC.contextPut("userInfos", Boolean.valueOf(showUserInfos));
    Map<Long, PageUserInformations> userInfosToPages = new HashMap<>();
    if (showUserInfos) {
        List<PageUserInformations> userInfos = portfolioService.getPageUserInfos(binder, getIdentity());
        for (PageUserInformations userInfo : userInfos) {
            userInfosToPages.put(userInfo.getPage().getKey(), userInfo);
        }
        mainVC.contextPut("userInfosRenderer", new SharedPageStatusCellRenderer(getTranslator()));
    }
    Map<Long, Long> numberOfCommentsMap = portfolioService.getNumberOfComments(binder);
    List<Page> pages = portfolioService.getPages(binder, null);
    for (Page page : pages) {
        Section section = page.getSection();
        if (section != null && sectionMap.containsKey(section.getKey())) {
            boolean viewElement = secCallback.canViewElement(page);
            boolean viewTitleElement = secCallback.canViewTitleOfElement(page);
            if (viewElement || viewTitleElement) {
                SectionRow sectionRow = sectionMap.get(section.getKey());
                PageRow pageRow = forgePageRow(page, numberOfCommentsMap, viewElement);
                sectionRow.getPages().add(pageRow);
                if (showUserInfos) {
                    PageUserInformations userInfos = userInfosToPages.get(pageRow.getPage().getKey());
                    if (userInfos != null) {
                        pageRow.setUserInfosStatus(userInfos.getStatus());
                    }
                }
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) PageUserInformations(org.olat.modules.portfolio.PageUserInformations)

Example 95 with Section

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

the class TableOfContentController method doClose.

private void doClose(SectionRow row) {
    Section section = row.getSection();
    section = portfolioService.changeSectionStatus(section, SectionStatus.closed, getIdentity());
    ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_SECTION_CLOSE, getClass(), LoggingResourceable.wrap(section));
}
Also used : AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section)

Aggregations

Section (org.olat.modules.portfolio.Section)190 Page (org.olat.modules.portfolio.Page)100 Test (org.junit.Test)86 Identity (org.olat.core.id.Identity)80 Binder (org.olat.modules.portfolio.Binder)72 AssessmentSection (org.olat.modules.portfolio.AssessmentSection)68 Assignment (org.olat.modules.portfolio.Assignment)48 BinderImpl (org.olat.modules.portfolio.model.BinderImpl)40 SynchedBinder (org.olat.modules.portfolio.model.SynchedBinder)38 ArrayList (java.util.ArrayList)36 RepositoryEntry (org.olat.repository.RepositoryEntry)26 SectionRef (org.olat.modules.portfolio.SectionRef)24 HashMap (java.util.HashMap)22 Date (java.util.Date)16 PageUserInformations (org.olat.modules.portfolio.PageUserInformations)14 BigDecimal (java.math.BigDecimal)12 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)12 SectionImpl (org.olat.modules.portfolio.model.SectionImpl)12 PortfolioElementRow (org.olat.modules.portfolio.ui.model.PortfolioElementRow)12 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)10