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