use of org.olat.modules.portfolio.PageStatus in project openolat by klemens.
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());
}
}
}
use of org.olat.modules.portfolio.PageStatus in project openolat by klemens.
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 klemens.
the class SharedPageStatusCellRenderer method render.
@Override
public void render(Renderer renderer, StringOutput target, Object cellValue, int row, FlexiTableComponent source, URLBuilder ubu, Translator trans) {
if (cellValue instanceof SharedPageRow) {
SharedPageRow pageRow = (SharedPageRow) cellValue;
PageStatus status = pageRow.getStatus();
PageUserStatus userStatus = pageRow.getUserStatus();
render(target, status, userStatus);
} else if (cellValue instanceof PortfolioElementRow) {
PortfolioElementRow elementRow = (PortfolioElementRow) cellValue;
if (elementRow.getPage() != null) {
PageStatus status = elementRow.getPageStatus();
PageUserStatus userStatus = elementRow.getUserInfosStatus();
render(target, status, userStatus);
}
}
}
use of org.olat.modules.portfolio.PageStatus in project openolat by klemens.
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 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);
}
Aggregations