Search in sources :

Example 6 with PageStatus

use of org.olat.modules.portfolio.PageStatus in project OpenOLAT by OpenOLAT.

the class PageMetadataController method initStatus.

private void initStatus() {
    if (page.getSection() != null && page.getSection().getBinder() != null) {
        mainVC.contextPut("statusEnabled", Boolean.TRUE);
        PageStatus pageStatus = page.getPageStatus();
        if (pageStatus == null) {
            pageStatus = PageStatus.draft;
        }
        String status = translate("status." + pageStatus.name());
        mainVC.contextPut("pageStatus", status);
        if (secCallback.canPublish(page)) {
            publishButton = LinkFactory.createButtonSmall("publish", mainVC, this);
            publishButton.setIconLeftCSS("o_icon o_icon_publish o_icon-fw");
            publishButton.setElementCssClass("o_sel_pf_publish_entry");
        }
        if (secCallback.canRevision(page)) {
            revisionButton = LinkFactory.createButtonSmall("revision.page", mainVC, this);
            revisionButton.setIconLeftCSS("o_icon o_icon_rejected o_icon-fw");
            revisionButton.setElementCssClass("o_sel_pf_revision_entry");
            revisionButton.setTitle("revision.page.title");
        }
        if (secCallback.canClose(page)) {
            closeButton = LinkFactory.createButtonSmall("close.page", mainVC, this);
            closeButton.setIconLeftCSS("o_icon o_icon_status_done o_icon-fw");
            closeButton.setElementCssClass("o_sel_pf_close_entry");
            closeButton.setTitle("close.page.title");
        }
        if (secCallback.canReopen(page)) {
            reopenButton = LinkFactory.createButtonSmall("reopen.page", mainVC, this);
            reopenButton.setIconLeftCSS("o_icon o_icon_redo o_icon-fw");
            reopenButton.setElementCssClass("o_sel_pf_reopen_entry");
        }
    }
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus)

Example 7 with PageStatus

use of org.olat.modules.portfolio.PageStatus in project OpenOLAT by OpenOLAT.

the class SharedItemsOverviewController method doOpenPages.

private SharedPagesController doOpenPages(UserRequest ureq) {
    if (pagesCtrl == null) {
        SearchSharePagesParameters searchParams = new SearchSharePagesParameters();
        searchParams.setBookmarkOnly(false);
        searchParams.addExcludedPageStatus(PageStatus.closed, PageStatus.deleted);
        searchParams.addExcludedPageUserStatus(PageUserStatus.done);
        List<PageStatus> filters = new ArrayList<>(5);
        filters.add(PageStatus.draft);
        filters.add(PageStatus.inRevision);
        filters.add(PageStatus.published);
        WindowControl swControl = addToHistory(ureq, OresHelper.createOLATResourceableInstance("Pages", 0l), null);
        pagesCtrl = new SharedPagesController(ureq, swControl, stackPanel, searchParams, filters, PageStatus.published);
        listenTo(pagesCtrl);
    } else {
        pagesCtrl.loadModel();
        addToHistory(ureq, pagesCtrl);
    }
    mainVC.put("segmentCmp", pagesCtrl.getInitialComponent());
    return pagesCtrl;
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) SearchSharePagesParameters(org.olat.modules.portfolio.model.SearchSharePagesParameters) ArrayList(java.util.ArrayList) WindowControl(org.olat.core.gui.control.WindowControl)

Example 8 with PageStatus

use of org.olat.modules.portfolio.PageStatus in project OpenOLAT by OpenOLAT.

the class SharedItemsOverviewController method doOpenMark.

private SharedPagesController doOpenMark(UserRequest ureq) {
    if (bookmarkedPagesCtrl == null) {
        SearchSharePagesParameters searchParams = new SearchSharePagesParameters();
        searchParams.setBookmarkOnly(true);
        searchParams.addExcludedPageStatus(PageStatus.deleted);
        List<PageStatus> filters = new ArrayList<>(5);
        filters.add(PageStatus.draft);
        filters.add(PageStatus.inRevision);
        filters.add(PageStatus.published);
        filters.add(PageStatus.closed);
        WindowControl swControl = addToHistory(ureq, OresHelper.createOLATResourceableInstance("Favorits", 0l), null);
        bookmarkedPagesCtrl = new SharedPagesController(ureq, swControl, stackPanel, searchParams, filters, null);
        listenTo(bookmarkedPagesCtrl);
    } else {
        bookmarkedPagesCtrl.loadModel();
        addToHistory(ureq, bookmarkedPagesCtrl);
    }
    mainVC.put("segmentCmp", bookmarkedPagesCtrl.getInitialComponent());
    return bookmarkedPagesCtrl;
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) SearchSharePagesParameters(org.olat.modules.portfolio.model.SearchSharePagesParameters) ArrayList(java.util.ArrayList) WindowControl(org.olat.core.gui.control.WindowControl)

Example 9 with PageStatus

use of org.olat.modules.portfolio.PageStatus in project OpenOLAT by OpenOLAT.

the class StatusCellRenderer method render.

@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
    if (cellValue instanceof PageStatus) {
        PageStatus status = (PageStatus) cellValue;
        String tip = translator.translate(status.i18nKey());
        target.append("<i class='o_icon ").append(status.cssClass()).append(" o_icon-fw' title='").append(tip).append("'> </i>");
    } else if (cellValue instanceof SectionStatus) {
        SectionStatus status = (SectionStatus) cellValue;
        String tip = translator.translate(status.i18nKey());
        target.append("<i class='o_icon ").append(status.cssClass()).append(" o_icon-fw' title='").append(tip).append("'> </i>");
    }
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) SectionStatus(org.olat.modules.portfolio.SectionStatus)

Example 10 with PageStatus

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

the class PortfolioServiceImpl method changePageStatus.

@Override
public Page changePageStatus(Page page, PageStatus status, Identity identity, Role by) {
    PageStatus currentStatus = page.getPageStatus();
    Page reloadedPage = pageDao.loadByKey(page.getKey());
    ((PageImpl) reloadedPage).setPageStatus(status);
    if (status == PageStatus.published) {
        Date now = new Date();
        if (reloadedPage.getInitialPublicationDate() == null) {
            ((PageImpl) reloadedPage).setInitialPublicationDate(now);
        }
        ((PageImpl) reloadedPage).setLastPublicationDate(now);
        Section section = reloadedPage.getSection();
        // auto update the status of the evaluation form of the authors of the binder
        changeAssignmentStatus(page, section, EvaluationFormSessionStatus.done);
        if (section != null) {
            SectionStatus sectionStatus = section.getSectionStatus();
            if (currentStatus == PageStatus.closed) {
                if (sectionStatus == SectionStatus.closed) {
                    ((SectionImpl) section).setSectionStatus(SectionStatus.inProgress);
                    binderDao.updateSection(section);
                }
            } else if (sectionStatus == null || sectionStatus == SectionStatus.notStarted || sectionStatus == SectionStatus.closed) {
                ((SectionImpl) section).setSectionStatus(SectionStatus.inProgress);
                binderDao.updateSection(section);
            }
        }
    } else if (status == PageStatus.inRevision) {
        Section section = reloadedPage.getSection();
        changeAssignmentStatus(page, section, EvaluationFormSessionStatus.inProgress);
        if (section != null) {
            SectionStatus sectionStatus = section.getSectionStatus();
            if (sectionStatus == null || sectionStatus == SectionStatus.notStarted || sectionStatus == SectionStatus.closed) {
                if (sectionStatus == SectionStatus.closed) {
                    ((SectionImpl) section).setSectionStatus(SectionStatus.inProgress);
                    binderDao.updateSection(section);
                }
            }
        }
        pageUserInfosDao.updateStatus(reloadedPage, PageUserStatus.inProcess, PageUserStatus.done);
    } else if (status == PageStatus.closed) {
        // set user informations to done
        pageUserInfosDao.updateStatus(reloadedPage, PageUserStatus.done);
    }
    if (reloadedPage.getSection() != null && reloadedPage.getSection().getBinder() != null) {
        Binder binder = reloadedPage.getSection().getBinder();
        updateAssessmentEntryLastModification(binder, identity, by);
    }
    return pageDao.updatePage(reloadedPage);
}
Also used : PageImpl(org.olat.modules.portfolio.model.PageImpl) Binder(org.olat.modules.portfolio.Binder) AssessedBinder(org.olat.modules.portfolio.model.AssessedBinder) SynchedBinder(org.olat.modules.portfolio.model.SynchedBinder) PageStatus(org.olat.modules.portfolio.PageStatus) AssessedPage(org.olat.modules.portfolio.model.AssessedPage) Page(org.olat.modules.portfolio.Page) SectionStatus(org.olat.modules.portfolio.SectionStatus) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) SectionImpl(org.olat.modules.portfolio.model.SectionImpl) AssessmentSectionImpl(org.olat.modules.portfolio.model.AssessmentSectionImpl) Date(java.util.Date)

Aggregations

PageStatus (org.olat.modules.portfolio.PageStatus)30 PageUserStatus (org.olat.modules.portfolio.PageUserStatus)14 ArrayList (java.util.ArrayList)12 Date (java.util.Date)8 SectionStatus (org.olat.modules.portfolio.SectionStatus)8 AssessedPage (org.olat.modules.portfolio.model.AssessedPage)8 SearchSharePagesParameters (org.olat.modules.portfolio.model.SearchSharePagesParameters)8 List (java.util.List)6 Identity (org.olat.core.id.Identity)6 Page (org.olat.modules.portfolio.Page)6 AssessedBinder (org.olat.modules.portfolio.model.AssessedBinder)6 BigDecimal (java.math.BigDecimal)4 HashSet (java.util.HashSet)4 Map (java.util.Map)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 TypedQuery (javax.persistence.TypedQuery)4 DB (org.olat.core.commons.persistence.DB)4 PersistenceHelper.appendFuzzyLike (org.olat.core.commons.persistence.PersistenceHelper.appendFuzzyLike)4 PersistenceHelper.makeFuzzyQueryString (org.olat.core.commons.persistence.PersistenceHelper.makeFuzzyQueryString)4