diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java index 94713ee8c..de068a3b4 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java @@ -19,6 +19,7 @@ import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItemManager; import org.librecms.contentsection.ContentSection; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.Set; @@ -247,9 +248,40 @@ public class CategorizationStep implements MvcAuthoringStep { ); tree.setRoot(buildCategorizationTreeNode(domain.getRoot())); + tree.setAssignedCategories( + buildAssignedCategoriesList(tree.getRoot(), "") + ); + return tree; } + private List buildAssignedCategoriesList( + final CategorizationTreeNode node, final String parentPath + ) { + final List assigned = new ArrayList<>(); + if (node.isAssigned()) { + assigned.add(String.join("/", parentPath, node.getTitle())); + } + + if (node.isSubCategoryAssigned()) { + assigned.addAll( + node + .getSubCategories() + .stream() + .map( + subCat -> buildAssignedCategoriesList( + subCat, String.join("/", node.getTitle() + ) + ) + ) + .flatMap(result -> result.stream()) + .collect(Collectors.toList()) + ); + } + + return assigned; + } + private CategorizationTreeNode buildCategorizationTreeNode( final Category category ) { diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationTree.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationTree.java index 7d487f6f1..2725a021c 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationTree.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationTree.java @@ -5,6 +5,10 @@ */ package org.librecms.ui.contentsections.documents; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + /** * * @author Jens Pelzetter @@ -19,6 +23,8 @@ public class CategorizationTree { private CategorizationTreeNode root; + private List assignedCategories; + public String getDomainKey() { return domainKey; } @@ -51,4 +57,12 @@ public class CategorizationTree { this.root = root; } + public List getAssignedCategories() { + return Collections.unmodifiableList(assignedCategories); + } + + public void setAssignedCategories(final List assignedCategories) { + this.assignedCategories = new ArrayList<>(assignedCategories); + } + } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DefaultStepsMessageBundle.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DefaultStepsMessageBundle.java new file mode 100644 index 000000000..9d46ca85d --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/DefaultStepsMessageBundle.java @@ -0,0 +1,29 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.librecms.ui.contentsections.documents; + +import org.libreccm.ui.AbstractMessagesBean; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("CmsDefaultStepsMessageBundle") +public class DefaultStepsMessageBundle extends AbstractMessagesBean { + + @Override + protected String getMessageBundle() { + return DefaultAuthoringStepConstants.BUNDLE; + } + + + + +} diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml index cc64f6498..bd8ea1ac6 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/documentfolder/document-folder-tree-node.xhtml @@ -13,7 +13,7 @@ data-toggle="collapse" data-target="##{folder.name}-subfolders" aria-expanded="#{folder.open ? 'true' : 'false'}" - aria-controls="##{folder.name}-subfolders" + aria-controls="#{folder.name}-subfolders" type="button"> #{CmsAdminMessages['contentsection.documentfolder.foldersnav.subfolders.expand']} diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contenttypes/categorization-tree-node.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contenttypes/categorization-tree-node.xhtml new file mode 100644 index 000000000..f4d7f3c73 --- /dev/null +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contenttypes/categorization-tree-node.xhtml @@ -0,0 +1,48 @@ +]> + + + +
  • +
    + + + + + +
    + +
      + + + + + + +
    +
    +
  • + +
    + diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contenttypes/categorization.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contenttypes/categorization.xhtml new file mode 100644 index 000000000..d69806451 --- /dev/null +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contenttypes/categorization.xhtml @@ -0,0 +1,90 @@ +]> + + + + +

    #{tree.domainTitle}

    + +
    + #{CmsDefaultStepsMessageBundle['categorization.system.assigned.to']} + +
    + + + + + + #{assigned} + + + + + + + + +
    + +
    +