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);
}
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;
}
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();
}
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();
}
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());
}
}
}
Aggregations