diff --git a/src/main/java/org/olat/modules/portfolio/Section.java b/src/main/java/org/olat/modules/portfolio/Section.java index 4afd094baa9398670e55c5e7e893907cbd33ab1a..7cb823ea0f8ef18901149b0efde5f7aaae795d3f 100644 --- a/src/main/java/org/olat/modules/portfolio/Section.java +++ b/src/main/java/org/olat/modules/portfolio/Section.java @@ -65,5 +65,12 @@ public interface Section extends SectionRef, PortfolioElement { * @return */ public List<Page> getPages(); + + /** + * The binder is lazily loaded. + * + * @return + */ + public Binder getBinder(); } diff --git a/src/main/java/org/olat/modules/portfolio/manager/PageDAO.java b/src/main/java/org/olat/modules/portfolio/manager/PageDAO.java index 99e52da416981d4405166391d77874650787de53..5ce7030e8b13c7ab75c6c65ffb706817a265a631 100644 --- a/src/main/java/org/olat/modules/portfolio/manager/PageDAO.java +++ b/src/main/java/org/olat/modules/portfolio/manager/PageDAO.java @@ -143,8 +143,8 @@ public class PageDAO { StringBuilder sb = new StringBuilder(); sb.append("select page from pfpage as page") .append(" inner join fetch page.body as body") - .append(" left join page.section as section") - .append(" left join section.binder as binder") + .append(" left join fetch page.section as section") + .append(" left join fetch section.binder as binder") .append(" where exists (select pageMember from bgroupmember as pageMember") .append(" inner join pageMember.identity as ident on (ident.key=:ownerKey and pageMember.role='").append(GroupRoles.owner.name()).append("')") .append(" where pageMember.group.key=page.baseGroup.key or pageMember.group.key=binder.baseGroup.key") diff --git a/src/main/java/org/olat/modules/portfolio/model/PageRow.java b/src/main/java/org/olat/modules/portfolio/model/PageRow.java index bd6a187c222d9038b905728b286008fca2c5bee2..c18f8c9c917b9b26cd7fa9f32112bdc23aca3546 100644 --- a/src/main/java/org/olat/modules/portfolio/model/PageRow.java +++ b/src/main/java/org/olat/modules/portfolio/model/PageRow.java @@ -24,6 +24,7 @@ import java.util.Date; import org.olat.core.gui.components.form.flexible.elements.FormLink; import org.olat.core.gui.components.link.Link; +import org.olat.core.util.StringHelper; import org.olat.course.assessment.AssessmentHelper; import org.olat.modules.portfolio.AssessmentSection; import org.olat.modules.portfolio.Page; @@ -56,6 +57,9 @@ public class PageRow { private Link commentLink; private FormLink commentFormLink; + private String metaSectionTitle; + private String metaBinderTitle; + public PageRow(Page page, Section section, AssessmentSection assessmentSection, boolean firstPageOfSection, boolean assessable) { this.page = page; @@ -256,7 +260,19 @@ public class PageRow { this.commentFormLink = commentFormLink; } - + public boolean hasMetaBinderAndSectionTitle() { + return StringHelper.containsNonWhitespace(metaSectionTitle) || StringHelper.containsNonWhitespace(metaBinderTitle); + } + public String[] getMetaBinderAndSectionTitles() { + return new String[]{ metaSectionTitle, metaBinderTitle }; + } + public void setMetaSectionTitle(String metaSectionTitle) { + this.metaSectionTitle = metaSectionTitle; + } + + public void setMetaBinderTitle(String metaBinderTitle) { + this.metaBinderTitle = metaBinderTitle; + } } diff --git a/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java b/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java index 8c7e8bf0d3ab8134043cb5e112e4c0b35b839abb..51ab41af6b4d17a8a7c7994831259136d174b6e1 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java +++ b/src/main/java/org/olat/modules/portfolio/ui/MyPageListController.java @@ -40,6 +40,7 @@ import org.olat.modules.portfolio.BinderSecurityCallback; import org.olat.modules.portfolio.Category; import org.olat.modules.portfolio.CategoryToElement; import org.olat.modules.portfolio.Page; +import org.olat.modules.portfolio.Section; import org.olat.modules.portfolio.model.PageRow; /** @@ -88,7 +89,15 @@ public class MyPageListController extends AbstractPageListController { List<Page> pages = portfolioService.searchOwnedPages(getIdentity()); List<PageRow> rows = new ArrayList<>(pages.size()); for (Page page : pages) { - rows.add(forgeRow(page, null, false, categorizedElementMap, numberOfCommentsMap)); + PageRow row = forgeRow(page, null, false, categorizedElementMap, numberOfCommentsMap); + rows.add(row); + if(page.getSection() != null) { + Section section = page.getSection(); + row.setMetaSectionTitle(section.getTitle()); + if(section.getBinder() != null) { + row.setMetaBinderTitle(section.getBinder().getTitle()); + } + } } model.setObjects(rows); tableEl.reset(); diff --git a/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html b/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html index b351986581b6cb8e145d73055e6fef53da4f2858..e5ed7c1da57e06b9d1c04bc6350ded0e75a018ab 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html +++ b/src/main/java/org/olat/modules/portfolio/ui/_content/page_row.html @@ -71,6 +71,12 @@ <span class="o_portfolio_page_meta text-muted o_small"> $r.translate("meta.last.modified", $r.formatDateAndTime($row.lastModified)) </span> + #if(${row.hasMetaBinderAndSectionTitle()}) + <div class="o_portfolio_page_meta text-muted o_small"> + $r.translate("meta.binder.section.titles", ${row.getMetaBinderAndSectionTitles()}) + </div> + #end + <div class="o_portfolio_page_summary o_block"> $r.xssScan($row.summary) </div> diff --git a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties index 66c47c0ca4f5c8d2a6738defe437566537000347..ac17cbeccac8ea5f1d64438ee5069b159011058c 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_de.properties @@ -92,6 +92,7 @@ meta.categories=Kategorien meta.last.modified=zuletzt bearbeitet am {0} meta.last.publication=ver\u00F6ffentlich am {0} meta.section.categories=<strong>Kategorien</strong> in diesem Bereich +meta.binder.section.titles=in Mappe "{0}", Bereich "{1}" my.entries=Meine Beitr\u00E4ge my.entries.text=Liste aller Beitr\u00E4ge in chronologischer Reihenfolge unabh\u00E4ngig von ihrem Kontext. Dies ist das Herzst\u00FCck Ihrer Portfolioarbeit. my.portfolio.binders=Meine Portfolio Mappen diff --git a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties index e6351599797194c6db9beb3f5a8da246f3c3c579..5608a6278a47b8a28ed86163644ba8bd6ed3a6e0 100644 --- a/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/modules/portfolio/ui/_i18n/LocalStrings_en.properties @@ -93,6 +93,7 @@ media.center.text=Search, create, add media files or other artefacts that you wa meta.last.modified=last modified {0} meta.last.publication=published at {0} meta.section.categories=<strong>Categories</strong> in this section +meta.binder.section.titles=in binder "{0}", section "{1}" my.entries=My entries my.entries.text=List all your portfolio entries regardless of their context. This is the heart of your portfolio work. my.portfolio.binders=My portfolio binders