Search in sources :

Example 16 with PageStatus

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

the class PageMetadataController method syncUserInfosStatus.

private void syncUserInfosStatus() {
    PageStatus status = page.getPageStatus();
    PageUserStatus userStatus = pageUserInfos.getStatus();
    if ((status == PageStatus.inRevision || status == PageStatus.published) && (userStatus == null || userStatus == PageUserStatus.incoming)) {
        pageUserInfos.setStatus(PageUserStatus.inProcess);
    } else if ((status == PageStatus.closed || status == PageStatus.deleted) && (userStatus != PageUserStatus.done)) {
        pageUserInfos.setStatus(PageUserStatus.done);
    }
    pageUserInfos.setRecentLaunch(new Date());
    pageUserInfos = portfolioService.updatePageUserInfos(pageUserInfos);
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) PageUserStatus(org.olat.modules.portfolio.PageUserStatus) Date(java.util.Date)

Example 17 with PageStatus

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

the class EvaluationFormHandler method getControllerForAssignment.

private Controller getControllerForAssignment(UserRequest ureq, WindowControl wControl, PageBody body, Assignment assignment, boolean onePage) {
    PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
    // find the evaluation form
    RepositoryEntry re = assignment.getFormEntry();
    Page page = assignment.getPage();
    PageStatus pageStatus = page.getPageStatus();
    Controller ctrl = null;
    List<AccessRights> accessRights = portfolioService.getAccessRights(page);
    boolean anonym = assignment.isAnonymousExternalEvaluation();
    if (pageStatus == null || pageStatus == PageStatus.draft) {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, false, false);
        }
    } else if (assignment.isOnlyAutoEvaluation()) {
        // only the auto evaluation is shown
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted);
            ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                ctrl = new EvaluationFormController(ureq, wControl, owner, body, re, true, false);
            }
        }
    } else {
        if (hasRole(PortfolioRoles.owner, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.published) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            if (coachesAndReviewers.size() > 0) {
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, false);
            }
        } else if (hasRole(PortfolioRoles.coach, ureq.getIdentity(), accessRights)) {
            Identity owner = getOwner(accessRights);
            List<Identity> coachesAndReviewers = getCoachesAndReviewers(accessRights);
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            ctrl = new MultiEvaluationFormController(ureq, wControl, owner, coachesAndReviewers, body, re, false, readOnly, onePage, anonym);
        } else if (hasRole(PortfolioRoles.reviewer, ureq.getIdentity(), accessRights) || hasRole(PortfolioRoles.invitee, ureq.getIdentity(), accessRights)) {
            boolean readOnly = (pageStatus == PageStatus.draft) || (pageStatus == PageStatus.closed) || (pageStatus == PageStatus.deleted) || onePage;
            if (assignment.isReviewerSeeAutoEvaluation()) {
                Identity owner = getOwner(accessRights);
                List<Identity> reviewers = Collections.singletonList(ureq.getIdentity());
                ctrl = new MultiEvaluationFormController(ureq, wControl, owner, reviewers, body, re, true, readOnly, onePage, anonym);
            } else {
                ctrl = new EvaluationFormController(ureq, wControl, ureq.getIdentity(), body, re, readOnly, !readOnly);
            }
        }
    }
    return ctrl;
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Page(org.olat.modules.portfolio.Page) RepositoryEntry(org.olat.repository.RepositoryEntry) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) Controller(org.olat.core.gui.control.Controller) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioHomeController(org.olat.modules.portfolio.ui.PortfolioHomeController) AccessRights(org.olat.modules.portfolio.model.AccessRights) MultiEvaluationFormController(org.olat.modules.portfolio.ui.MultiEvaluationFormController) EvaluationFormController(org.olat.modules.forms.ui.EvaluationFormController) PortfolioService(org.olat.modules.portfolio.PortfolioService) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity)

Example 18 with PageStatus

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

the class SharedPageStatusCellRenderer method renderPageRow.

public String renderPageRow(PageRow pageRow) {
    if (pageRow == null || pageRow.getPage() == null)
        return "";
    StringOutput target = new StringOutput(64);
    PageStatus pageStatus = pageRow.getPage().getPageStatus();
    PageUserStatus userStatus = pageRow.getUserInfosStatus();
    render(target, pageStatus, userStatus);
    return target.toString();
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) PageUserStatus(org.olat.modules.portfolio.PageUserStatus) StringOutput(org.olat.core.gui.render.StringOutput)

Example 19 with PageStatus

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

the class SharedPageStatusCellRenderer method renderPortfolioElementRow.

public String renderPortfolioElementRow(PortfolioElementRow elementRow) {
    if (elementRow == null || elementRow.getPage() == null)
        return "";
    StringOutput target = new StringOutput(64);
    PageStatus pageStatus = elementRow.getPage().getPageStatus();
    PageUserStatus userStatus = elementRow.getUserInfosStatus();
    render(target, pageStatus, userStatus);
    return target.toString();
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) PageUserStatus(org.olat.modules.portfolio.PageUserStatus) StringOutput(org.olat.core.gui.render.StringOutput)

Example 20 with PageStatus

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

the class SharedPagesController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.bookmark));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.userInfosStatus, new SharedPageStatusCellRenderer(getTranslator())));
    FlexiCellRenderer titleRenderer = new BooleanCellRenderer(new StaticFlexiCellRenderer("select", new PageTitleCellRenderer()), new PageTitleCellRenderer());
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, true, "select", SharePageCols.pageName.ordinal(), "select", true, SharePageCols.pageName.sortKey(), FlexiColumnModel.ALIGNMENT_LEFT, titleRenderer));
    SortKey defaultSortKey = null;
    if (isAdministrativeUser) {
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ShareItemCols.username));
        defaultSortKey = new SortKey(Cols.username.name(), true);
    }
    // followed by the users fields
    int colPos = USER_PROPS_OFFSET;
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        String propName = userPropertyHandler.getName();
        if (defaultSortKey == null && i == 0) {
            defaultSortKey = new SortKey(propName, true);
        } else if (UserConstants.LASTNAME.equals(propName) && !isAdministrativeUser) {
            defaultSortKey = new SortKey(propName, true);
        }
        boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
        columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName));
        colPos++;
    }
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.lastChanges));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(SharePageCols.pageStatus, new StatusCellRenderer(getTranslator())));
    model = new SharedPagesDataModel(columnsModel, getLocale());
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 20, false, getTranslator(), formLayout);
    tableEl.setSearchEnabled(true);
    tableEl.setCustomizeColumns(true);
    tableEl.setElementCssClass("o_binder_shared_bookmark_pages_listing");
    tableEl.setEmtpyTableMessageKey("table.sEmptyTable");
    tableEl.setPageSize(24);
    tableEl.setAndLoadPersistedPreferences(ureq, "shared-bookmark-pages");
    if (filters != null && !filters.isEmpty()) {
        List<FlexiTableFilter> tableFilters = new ArrayList<>(filters.size());
        for (PageStatus status : filters) {
            String label = translate(status.i18nKey());
            tableFilters.add(new FlexiTableFilter(label, status.name(), "o_icon ".concat(status.cssClass())));
        }
        tableFilters.add(FlexiTableFilter.SPACER);
        tableFilters.add(new FlexiTableFilter(translate("filter.show.all"), "all", true));
        tableEl.setFilters("Filters", tableFilters, true);
        if (defaultFilter != null) {
            tableEl.setSelectedFilterKey(defaultFilter.name());
        }
    }
}
Also used : PageStatus(org.olat.modules.portfolio.PageStatus) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) FlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer) PageTitleCellRenderer(org.olat.modules.portfolio.ui.renderer.PageTitleCellRenderer) ArrayList(java.util.ArrayList) StatusCellRenderer(org.olat.modules.portfolio.ui.renderer.StatusCellRenderer) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) SortKey(org.olat.core.commons.persistence.SortKey) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) FlexiTableFilter(org.olat.core.gui.components.form.flexible.elements.FlexiTableFilter) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

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