Create Steps basic structure

pull/10/head
Jens Pelzetter 2021-04-13 21:16:28 +02:00
parent fa9fab7ad0
commit 7d9193c474
35 changed files with 847 additions and 1248 deletions

View File

@ -75,13 +75,13 @@ import javax.xml.bind.annotation.XmlRootElement;
order = 2
)
})
@MvcAuthoringKit(
createStep = MvcArticleCreateStep.class,
authoringSteps = {
MvcArticlePropertiesStep.class,
MvcArticleTextBodyStep.class
}
)
//@MvcAuthoringKit(
// createStep = MvcArticleCreateStep.class,
// authoringSteps = {
// MvcArticlePropertiesStep.class,
// MvcArticleTextBodyStep.class
// }
//)
@XmlRootElement(name = "article", namespace = CMS_XML_NS)
public class Article extends ContentItem implements Serializable {

View File

@ -18,6 +18,8 @@
*/
package org.librecms.ui.contentsections;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.ui.IsAuthenticatedFilter;
import org.librecms.ui.contentsections.documents.DocumentController;
import org.librecms.ui.contentsections.documents.DocumentLifecyclesController;
@ -37,6 +39,10 @@ import javax.ws.rs.core.Application;
@ApplicationPath("/@contentsections")
public class ContentSectionApplication extends Application {
private static final Logger LOGGER = LogManager.getLogger(
ContentSectionApplication.class
);
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<>();
@ -58,4 +64,6 @@ public class ContentSectionApplication extends Application {
return classes;
}
}

View File

@ -79,7 +79,7 @@ public class ContentSectionModel {
*
* @param section The content section.
*/
protected void setSection(final ContentSection section) {
public void setSection(final ContentSection section) {
this.section = Objects.requireNonNull(
section, "Parameter section can't be null"
);

View File

@ -0,0 +1,202 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.libreccm.api.Identifier;
import org.libreccm.api.IdentifierParser;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.Folder;
import org.librecms.contentsection.FolderManager;
import org.librecms.contentsection.FolderRepository;
import org.librecms.contentsection.FolderType;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.SortedMap;
import java.util.TreeMap;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @param <T>
*/
@Dependent
public abstract class AbstractMvcDocumentCreateStep<T extends ContentItem>
implements MvcDocumentCreateStep<T> {
@Inject
private ContentSectionRepository sectionRepo;
@Inject
private FolderRepository folderRepository;
/**
* Provides operations for folders.
*/
@Inject
private FolderManager folderManager;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
@Inject
private IdentifierParser identifierParser;
private boolean canCreate;
/**
* The current folder.
*/
private Folder folder;
/**
* The current content section.
*/
private ContentSection section;
/**
* Messages to be shown to the user.
*/
private SortedMap<String, String> messages;
public AbstractMvcDocumentCreateStep() {
messages = new TreeMap<>();
}
@Override
public ContentSection getContentSection() {
return section;
}
@Override
public void setContentSection(final ContentSection section) {
this.section = section;
}
@Override
public String getContentSectionLabel() {
return section.getLabel();
}
@Override
public String getContentSectionTitle() {
return globalizationHelper.getValueFromLocalizedString(
section.getTitle()
);
}
// protected final void setContentSectionByIdentifier(
// final String sectionIdentifierParam
// ) {
// final Identifier identifier = identifierParser.parseIdentifier(
// sectionIdentifierParam
// );
// final Optional<ContentSection> sectionResult;
// switch (identifier.getType()) {
// case ID:
// sectionResult = sectionRepo.findById(
// Long.parseLong(identifier.getIdentifier())
// );
// break;
// case UUID:
// sectionResult = sectionRepo.findByUuid(
// identifier.getIdentifier()
// );
// break;
// default:
// sectionResult = sectionRepo.findByLabel(
// identifier.getIdentifier()
// );
// break;
// }
//
// if (sectionResult.isPresent()) {
// section = sectionResult.get();
// canCreate = true;
// } else {
// messages.put("error", "ContentSection not found.");
// canCreate = false;
// }
// }
// protected final void setFolderByPath(final String folderPath) {
// final Optional<Folder> folderResult = folderRepository.findByPath(
// section,
// folderPath,
// FolderType.DOCUMENTS_FOLDER
// );
// if (folderResult.isPresent()) {
// folder = folderResult.get();
// if (itemPermissionChecker.canCreateNewItems(folder)) {
// canCreate = true;
// } else {
// canCreate = false;
// messages.put("error", "Not allowed");
// }
// } else {
// messages.put("error", "Folder not found.");
// canCreate = false;
// }
// }
@Override
public boolean getCanCreate() {
return canCreate;
}
@Override
public Folder getFolder() {
return folder;
}
@Override
public void setFolder(final Folder folder) {
this.folder = folder;
}
@Override
public String getFolderPath() {
return folderManager.getFolderPath(folder);
}
@Override
public Map<String, String> getMessages() {
return Collections.unmodifiableSortedMap(messages);
}
public void addMessage(final String context, final String message) {
messages.put(context, message);
}
public void setMessages(final SortedMap<String, String> messages) {
this.messages = new TreeMap<>(messages);
}
}

View File

@ -1,162 +0,0 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
/**
* A pseudo implemention of the {@link MvcDocumentCreateStep} interface used by
* the {@link DocumentController} to show an error message when the requested
* content section does not exist.
*
* Most of methods in this implementation are throwing an
* {@link UnsupportedOperationException}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ContentSectionNotFound
implements MvcDocumentCreateStep<ContentItem>, MvcAuthoringStep {
@Override
public Class<ContentItem> getDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getBundle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentSection(ContentSection section) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentSection getContentSection() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setFolder(Folder folder) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Folder getFolder() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Class<? extends ContentItem> supportedDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentItem(ContentItem document) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentItem getContentItem() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String showStep() {
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
}
@GET
@Path("/documentPath:(.+)?")
public String showForAllGets() {
return showStep();
}
@POST
@Path("/")
public String showForPost() {
return showStep();
}
@POST
@Path("/documentPath:(.+)?")
public String showForAllPosts() {
return showStep();
}
@Override
public String showCreateForm() {
return showStep();
}
@Override
public String createContentItem() {
return showStep();
}
@Override
public String getContentSectionLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getFolderPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentItemPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentItemTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, String> getMessages() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@ -1,105 +0,0 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import java.util.Map;
/**
* A pseudo implemention of the {@link MvcDocumentCreateStep} interface used by
* the {@link DocumentController} to show an error message when the requested
* document type/content type is not available for the current content section.
*
* Most of methods in this implementation are throwing an
* {@link UnsupportedOperationException}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ContentTypeNotAvailable
implements MvcDocumentCreateStep<ContentItem> {
@Override
public Class<ContentItem> getDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getBundle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentSection(ContentSection section) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentSection getContentSection() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setFolder(Folder folder) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Folder getFolder() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String showCreateForm() {
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override
public String getContentSectionLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getFolderPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, String> getMessages() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@ -1,104 +0,0 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import java.util.Map;
/**
* A pseudo implemention of the {@link MvcDocumentCreateStep} interface used by
* the {@link DocumentController} to show an error message when the current
* user is not permitted to create new items.
*
* Most of methods in this implementation are throwing an
* {@link UnsupportedOperationException}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/public class CreateDenied
implements MvcDocumentCreateStep<ContentItem>{
@Override
public Class<ContentItem> getDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getBundle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentSection getContentSection() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentSection(ContentSection section) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Folder getFolder() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setFolder(Folder folder) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getFolderPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, String> getMessages() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String showCreateForm() {
return "org/librecms/ui/contentsection/documents/access-denied.xhtml";
}
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/access-denied.xhtml";
}
}

View File

@ -1,112 +0,0 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import java.util.Map;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
/**
* A pseudo implemention of the {@link MvcDocumentCreateStep} interface used by
* the {@link DocumentController} to show an error message when not create step
* for the requested document type/content type is available.
*
* Most of methods in this implementation are throwing an
* {@link UnsupportedOperationException}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class CreateStepNotAvailable
implements MvcDocumentCreateStep<ContentItem> {
@Override
public Class<ContentItem> getDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getBundle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentSection(ContentSection section) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentSection getContentSection() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setFolder(Folder folder) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Folder getFolder() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@POST
@Path("/")
@Override
public String showCreateForm() {
return "org/librecms/ui/contentsection/documents/create-step-not-available.xhtml";
}
@POST
@Path("/@create")
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/create-step-not-available.xhtml";
}
@Override
public String getContentSectionLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getFolderPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, String> getMessages() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@ -32,15 +32,14 @@ import org.librecms.contentsection.privileges.ItemPrivileges;
import org.librecms.lifecycle.Lifecycle;
import org.librecms.lifecycle.LifecycleDefinition;
import org.librecms.lifecycle.Phase;
import org.librecms.ui.contentsections.ContentSectionModel;
import org.librecms.ui.contentsections.ContentSectionsUi;
import org.librecms.ui.contentsections.DocumentFolderController;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -57,6 +56,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MultivaluedMap;
/**
* Controller for the UI for managing documents ({@link ContentItem}s.)
@ -74,6 +74,9 @@ public class DocumentController {
@Inject
private ContentItemManager itemManager;
@Inject
private ContentSectionModel sectionModel;
/**
* {@link ContentSectionsUi} instance providing for helper functions for
* dealing with {@link ContentSection}s.
@ -100,12 +103,11 @@ public class DocumentController {
@Inject
private ContentItemRepository itemRepo;
/**
* All available {@link MvcAuthoringStep}s.
*/
@Inject
private Instance<MvcAuthoringStep> authoringSteps;
// /**
// * All available {@link MvcAuthoringStep}s.
// */
// @Inject
// private Instance<MvcAuthoringStep> authoringSteps;
/**
* All available {@link MvcDocumentCreateStep}s.
*/
@ -152,6 +154,26 @@ public class DocumentController {
@Inject
private SelectedDocumentModel selectedDocumentModel;
// @GET
// @Path("/@pathtest")
// public String pathTest() {
//
// models.put("folderPath", "--root folder--");
//
// return "org/librecms/ui/contentsection/documents/pathTest.xhtml";
// }
//
// @GET
// @Path("/{folderPath:(.*)?}/@pathtest")
// public String pathTest(@PathParam("folderPath") final String folderPath) {
// if (folderPath == null || folderPath.isEmpty()) {
// models.put("folderPath", "--root folder--");
// } else {
// models
// .put("folderPath", String.format("folderPath: %s", folderPath));
// }
// return "org/librecms/ui/contentsection/documents/pathTest.xhtml";
// }
/**
* Redirect requests to the root path of this controller to the
* {@link DocumentFolderController}. The root path of this controller has no
@ -184,236 +206,214 @@ public class DocumentController {
* @param sectionIdentifier The identifier of the current content section.
* @param documentType The type of the document to create.
*
* @return The create step subresource.
* @return The template of the create step.
*/
@GET
@Path("/@create/{documentType}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public MvcDocumentCreateStep<? extends ContentItem> createDocument(
public String showCreateStep(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("documentType") final String documentType
) {
return createDocument(sectionIdentifier, "", documentType);
return showCreateStep(sectionIdentifier, "", documentType);
}
/**
* Delegates requests for the path {@code @create} to the create step
* (subresource) of the document type.
* Shows the create step of the document type.
*
* @param sectionIdentifier The identifier of the current content section.
* @param folderPath Path of the folder in which the new document is
* created.
* @param documentType The type of the document to create.
*
* @return The create step subresource.
* @return The create step template.
*/
@Path("/{folderPath:(.+)?}/@create/")
@GET
@Path("/{folderPath:(.+)?}/@create/{documentType}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
@SuppressWarnings("unchecked")
public MvcDocumentCreateStep<? extends ContentItem> createDocument(
public String showCreateStep(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("folderPath") final String folderPath,
@FormParam("documentType") final String documentType
) {
final Optional<ContentSection> sectionResult = sectionsUi
.findContentSection(sectionIdentifier);
if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier);
return new ContentSectionNotFound();
}
final ContentSection section = sectionResult.get();
final Folder folder;
if (folderPath.isEmpty()) {
folder = section.getRootDocumentsFolder();
} else {
final Optional<Folder> folderResult = folderRepo
.findByPath(
section, folderPath, FolderType.DOCUMENTS_FOLDER
);
if (!folderResult.isPresent()) {
models.put("section", section.getLabel());
models.put("folderPath", folderPath);
return new FolderNotFound();
}
folder = folderResult.get();
}
if (!itemPermissionChecker.canCreateNewItems(folder)) {
models.put("section", section.getLabel());
models.put("folderPath", folderPath);
models.put(
"step", defaultStepsMessageBundle.getMessage("create_step")
);
return new CreateDenied();
}
final Class<? extends ContentItem> documentClass;
try {
documentClass = (Class<? extends ContentItem>) Class.forName(
documentType
);
} catch (ClassNotFoundException ex) {
models.put("documentType", documentType);
return new DocumentTypeClassNotFound();
}
final boolean hasRequestedType = section
.getContentTypes()
.stream()
.anyMatch(
type -> type.getContentItemClass().equals(documentType)
);
if (!hasRequestedType) {
models.put("documentType", documentType);
models.put("section", section.getLabel());
return new ContentTypeNotAvailable();
}
final Instance<MvcDocumentCreateStep<?>> instance = createSteps
.select(new CreateDocumentOfTypeLiteral(documentClass));
if (instance.isUnsatisfied() || instance.isAmbiguous()) {
models.put("section", section.getLabel());
models.put("folderPath", folderPath);
models.put("documentType", documentType);
return new CreateStepNotAvailable();
}
final MvcDocumentCreateStep<? extends ContentItem> createStep = instance
.get();
createStep.setContentSection(section);
createStep.setFolder(folder);
return createStep;
}
/**
* Redirects to the first authoring step for the document identified by the
* provided path.
*
* @param sectionIdentifier The identifier of the current content section.
* @param documentPath The path of the document.
*
* @return A redirect to the first authoring step of the document, or the
* {@link DocumentNotFound} pseudo authoring step.
*/
@Path("/{documentPath:(.+)?}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String editDocument(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("documentPath") final String documentPath
) {
final Optional<ContentSection> sectionResult = sectionsUi
.findContentSection(sectionIdentifier);
if (!sectionResult.isPresent()) {
sectionsUi.showContentSectionNotFound(sectionIdentifier);
}
final ContentSection section = sectionResult.get();
final Optional<ContentItem> itemResult = itemRepo
.findByPath(section, documentPath);
if (!itemResult.isPresent()) {
models.put("section", section.getLabel());
models.put("documentPath", documentPath);
documentUi.showDocumentNotFound(section, documentPath);
}
final ContentItem item = itemResult.get();
if (!itemPermissionChecker.canEditItem(item)) {
return documentUi.showAccessDenied(
section,
item,
defaultStepsMessageBundle.getMessage("edit_denied")
);
}
return String.format(
"redirect:/%s/documents/%s/@authoringsteps/%s",
final CreateStepResult result = findCreateStep(
sectionIdentifier,
documentPath,
findPathFragmentForFirstStep(item)
folderPath, documentType
);
if (result.isCreateStepAvailable()) {
return result.getCreateStep().showCreateStep();
} else {
return result.getErrorTemplate();
}
}
/**
* Redirect requests for an authoring step to the subresource of the
* authoring step.
*
* @param sectionIdentifier The identifier of the current content
* section.
* @param documentPath The path of the document to edit.
* @param authoringStepIdentifier The identifier/path fragment of the
* authoring step.
*
* @return The authoring step subresource.
*/
@Path("/{documentPath:(.+)?}/@authoringsteps/{authoringStep}")
@POST
@Path("/@create/{documentType}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public MvcAuthoringStep editDocument(
public String createDocument(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("documentPath") final String documentPath,
@PathParam("authoringStep") final String authoringStepIdentifier
@PathParam("documentType") final String documentType,
final MultivaluedMap<String, String> formParameters
) {
final Optional<ContentSection> sectionResult = sectionsUi
.findContentSection(sectionIdentifier);
if (!sectionResult.isPresent()) {
models.put("sectionIdentifier", sectionIdentifier);
return new ContentSectionNotFound();
}
final ContentSection section = sectionResult.get();
final Optional<ContentItem> itemResult = itemRepo
.findByPath(section, documentPath);
if (!itemResult.isPresent()) {
models.put("section", section.getLabel());
models.put("documentPath", documentPath);
return new DocumentNotFound();
}
final ContentItem item = itemResult.get();
if (!itemPermissionChecker.canEditItem(item)) {
models.put("section", section.getLabel());
models.put("documentPath", itemManager.getItemFolder(item));
models.put(
"step", defaultStepsMessageBundle.getMessage("edit_step")
return createDocument(
sectionIdentifier,
"", documentType,
formParameters
);
return new EditDenied();
}
final Instance<MvcAuthoringStep> instance = authoringSteps
.select(
new AuthoringStepPathFragmentLiteral(
authoringStepIdentifier
)
@POST
@Path("/{folderPath:(.+)?}/@create/{documentType}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
@SuppressWarnings({"unchecked", "unchecked"})
public String createDocument(
@PathParam("sectionIdentifier") final String sectionIdentifier,
@PathParam("folderPath") final String folderPath,
@PathParam("documentType") final String documentType,
final MultivaluedMap<String, String> formParameters
) {
final CreateStepResult result = findCreateStep(
sectionIdentifier,
folderPath, documentType
);
if (instance.isUnsatisfied() || instance.isAmbiguous()) {
models.put("section", section.getLabel());
models.put("documentPath", documentPath);
models.put("authoringStep", authoringStepIdentifier);
return new AuthoringStepNotAvailable();
}
final MvcAuthoringStep authoringStep = instance.get();
if (!authoringStep.supportedDocumentType().isAssignableFrom(item
.getClass())) {
models.put("section", section.getLabel());
models.put("documentPath", documentPath);
models.put("documentType", item.getClass().getName());
models.put("authoringStep", authoringStepIdentifier);
return new UnsupportedDocumentType();
}
models.put("authoringStep", authoringStepIdentifier);
selectedDocumentModel.setContentItem(item);
authoringStep.setContentSection(section);
authoringStep.setContentItem(item);
return authoringStep;
if (result.isCreateStepAvailable()) {
return result.getCreateStep().createItem(formParameters);
} else {
return result.getErrorTemplate();
}
}
// /**
// * Redirects to the first authoring step for the document identified by the
// * provided path.
// *
// * @param sectionIdentifier The identifier of the current content section.
// * @param documentPath The path of the document.
// *
// * @return A redirect to the first authoring step of the document, or the
// * {@link DocumentNotFound} pseudo authoring step.
// */
// @Path("/{documentPath:(.+)?}")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public String editDocument(
// @PathParam("sectionIdentifier") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// sectionsUi.showContentSectionNotFound(sectionIdentifier);
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// models.put("section", section.getLabel());
// models.put("documentPath", documentPath);
// documentUi.showDocumentNotFound(section, documentPath);
// }
// final ContentItem item = itemResult.get();
// if (!itemPermissionChecker.canEditItem(item)) {
// return documentUi.showAccessDenied(
// section,
// item,
// defaultStepsMessageBundle.getMessage("edit_denied")
// );
// }
//
// return String.format(
// "redirect:/%s/documents/%s/@authoringsteps/%s",
// sectionIdentifier,
// documentPath,
// findPathFragmentForFirstStep(item)
// );
// }
// /**
// * Redirect requests for an authoring step to the subresource of the
// * authoring step.
// *
// * @param sectionIdentifier The identifier of the current content
// * section.
// * @param documentPath The path of the document to edit.
// * @param authoringStepIdentifier The identifier/path fragment of the
// * authoring step.
// *
// * @return The authoring step subresource.
// */
// @Path("/{documentPath:(.+)?}/@authoringsteps/{authoringStep}")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public MvcAuthoringStep editDocument(
// @PathParam("sectionIdentifier") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath,
// @PathParam("authoringStep") final String authoringStepIdentifier
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// models.put("sectionIdentifier", sectionIdentifier);
// return new ContentSectionNotFound();
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// models.put("section", section.getLabel());
// models.put("documentPath", documentPath);
// return new DocumentNotFound();
// }
// final ContentItem item = itemResult.get();
// if (!itemPermissionChecker.canEditItem(item)) {
// models.put("section", section.getLabel());
// models.put("documentPath", itemManager.getItemFolder(item));
// models.put(
// "step", defaultStepsMessageBundle.getMessage("edit_step")
// );
// return new EditDenied();
// }
//
// final Instance<MvcAuthoringStep> instance = authoringSteps
// .select(
// new AuthoringStepPathFragmentLiteral(
// authoringStepIdentifier
// )
// );
// if (instance.isUnsatisfied() || instance.isAmbiguous()) {
// models.put("section", section.getLabel());
// models.put("documentPath", documentPath);
// models.put("authoringStep", authoringStepIdentifier);
// return new AuthoringStepNotAvailable();
// }
// final MvcAuthoringStep authoringStep = instance.get();
//
// if (!authoringStep.supportedDocumentType().isAssignableFrom(item
// .getClass())) {
// models.put("section", section.getLabel());
// models.put("documentPath", documentPath);
// models.put("documentType", item.getClass().getName());
// models.put("authoringStep", authoringStepIdentifier);
// return new UnsupportedDocumentType();
// }
//
// models.put("authoringStep", authoringStepIdentifier);
//
// selectedDocumentModel.setContentItem(item);
//
// authoringStep.setContentSection(section);
// authoringStep.setContentItem(item);
//
// return authoringStep;
// }
/**
* Show the document history page.
*
@ -650,7 +650,7 @@ public class DocumentController {
* @return A redirect to the publish step (redirect after POST pattern).
*/
@POST
@Path("/{documentPath:(.+)?}/@publish")
@Path("/{documentPath:(.+)?}/@unpublish")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String unpublish(
@ -686,50 +686,46 @@ public class DocumentController {
);
}
// /**
// * Helper method for reading the authoring steps for the current content
// * item.
// *
// * @param item The content item.
// *
// * @return A list of authoring steps for the provided item.
// */
// private List<MvcAuthoringStep> readAuthoringSteps(
// final ContentItem item
// ) {
// final MvcAuthoringKit authoringKit = item
// .getClass()
// .getAnnotation(MvcAuthoringKit.class);
//
// final Class<? extends MvcAuthoringStep>[] stepClasses = authoringKit
// .authoringSteps();
//
// return Arrays
// .stream(stepClasses)
// .map(authoringSteps::select)
// .filter(instance -> instance.isResolvable())
// .map(Instance::get)
// .collect(Collectors.toList());
// }
/**
* Helper method for reading the authoring steps for the current content
* item.
*
* @param item The content item.
*
* @return A list of authoring steps for the provided item.
* // * Helper method for finding the path fragment for the first authoring
* step // * for a content item. // * // * @param item The content item. //
* * // * @return The path fragment of the first authoring step of the item.
* //
*/
private List<MvcAuthoringStep> readAuthoringSteps(
final ContentItem item
) {
final MvcAuthoringKit authoringKit = item
.getClass()
.getAnnotation(MvcAuthoringKit.class);
final Class<? extends MvcAuthoringStep>[] stepClasses = authoringKit
.authoringSteps();
return Arrays
.stream(stepClasses)
.map(authoringSteps::select)
.filter(instance -> instance.isResolvable())
.map(Instance::get)
.collect(Collectors.toList());
}
/**
* Helper method for finding the path fragment for the first authoring step
* for a content item.
*
* @param item The content item.
*
* @return The path fragment of the first authoring step of the item.
*/
private String findPathFragmentForFirstStep(final ContentItem item) {
final List<MvcAuthoringStep> steps = readAuthoringSteps(item);
final MvcAuthoringStep firstStep = steps.get(0);
final AuthoringStepPathFragment pathFragment = firstStep
.getClass()
.getAnnotation(AuthoringStepPathFragment.class);
return pathFragment.value();
}
// private String findPathFragmentForFirstStep(final ContentItem item) {
// final List<MvcAuthoringStep> steps = readAuthoringSteps(item);
//
// final MvcAuthoringStep firstStep = steps.get(0);
// final AuthoringStepPathFragment pathFragment = firstStep
// .getClass()
// .getAnnotation(AuthoringStepPathFragment.class);
// return pathFragment.value();
// }
/**
* Helper method for building an entry in the list of lifecycles for the
* view.
@ -841,4 +837,172 @@ public class DocumentController {
}
/**
* Helper method for showing the "document folder not found" page if there
* is not folder for the provided path.
*
* @param section The content section.
* @param folderPath The folder path.
*
* @return The template of the "document folder not found" page.
*/
private String showDocumentFolderNotFound(
final ContentSection section, final String folderPath
) {
models.put("contentSection", section.getLabel());
models.put("folderPath", folderPath);
return "org/librecms/ui/contentsection/documentfolder/documentfolder-not-found.xhtml";
}
/**
* Helper method for showing the "documenttype not available" page if the
* requested document type is not available for the current content section.
*
* @param section The content section.
* @param folderPath The folder path.
*
* @return The template of the "document folder not found" page.
*/
private String showDocumentTypeNotFound(
final ContentSection section, final String documentType
) {
models.put("section", section.getLabel());
models.put("documentType", documentType);
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
private String showCreateStepNotAvailable(
final ContentSection section,
final String folderPath,
final String documentType
) {
models.put("section", section.getLabel());
models.put("folderPath", folderPath);
models.put("documentType", documentType);
return "org/librecms/ui/contentsection/documents/create-step-not-available.xhtml";
}
private CreateStepResult findCreateStep(
final String sectionIdentifier,
final String folderPath,
final String documentType
) {
final Optional<ContentSection> sectionResult = sectionsUi
.findContentSection(sectionIdentifier);
if (!sectionResult.isPresent()) {
return new CreateStepResult(
sectionsUi.showContentSectionNotFound(sectionIdentifier)
);
}
final ContentSection section = sectionResult.get();
sectionModel.setSection(section);
final Folder folder;
if (folderPath.isEmpty()) {
folder = section.getRootDocumentsFolder();
} else {
final Optional<Folder> folderResult = folderRepo
.findByPath(
section, folderPath, FolderType.DOCUMENTS_FOLDER
);
if (!folderResult.isPresent()) {
return new CreateStepResult(
showDocumentFolderNotFound(section, folderPath)
);
}
folder = folderResult.get();
}
if (!itemPermissionChecker.canCreateNewItems(folder)) {
return new CreateStepResult(
sectionsUi.showAccessDenied(
"sectionidentifier", sectionIdentifier,
"folderPath", folderPath,
"step", defaultStepsMessageBundle.getMessage("create_step")
)
);
}
//final Class<? extends ContentItem> documentClass;
final Class<?> clazz;
try {
// documentClass = (Class<? extends ContentItem>) Class.forName(
// documentType
// );
clazz = Class.forName(documentType);
} catch (ClassNotFoundException ex) {
return new CreateStepResult(
showDocumentTypeNotFound(section, documentType)
);
}
@SuppressWarnings("unchecked")
final Class<? extends ContentItem> documentClass
= (Class<? extends ContentItem>) clazz;
final boolean hasRequestedType = section
.getContentTypes()
.stream()
.anyMatch(
type -> type.getContentItemClass().equals(documentType)
);
if (!hasRequestedType) {
return new CreateStepResult(
showDocumentTypeNotFound(section, documentType)
);
}
final Instance<MvcDocumentCreateStep<?>> instance = createSteps
.select(new CreateDocumentOfTypeLiteral(documentClass));
if (instance.isUnsatisfied() || instance.isAmbiguous()) {
return new CreateStepResult(
showCreateStepNotAvailable(section, folderPath, documentType)
);
}
final MvcDocumentCreateStep<? extends ContentItem> createStep = instance
.get();
createStep.setContentSection(section);
createStep.setFolder(folder);
return new CreateStepResult(createStep);
}
private class CreateStepResult {
private final MvcDocumentCreateStep<? extends ContentItem> createStep;
private final boolean createStepAvailable;
private final String errorTemplate;
public CreateStepResult(
final MvcDocumentCreateStep<? extends ContentItem> createStep
) {
this.createStep = createStep;
createStepAvailable = true;
errorTemplate = null;
}
public CreateStepResult(final String errorTemplate) {
this.createStep = null;
createStepAvailable = false;
this.errorTemplate = errorTemplate;
}
public MvcDocumentCreateStep<? extends ContentItem> getCreateStep() {
return createStep;
}
public boolean isCreateStepAvailable() {
return createStepAvailable;
}
public String getErrorTemplate() {
return errorTemplate;
}
}
}

View File

@ -1,105 +0,0 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import java.util.Map;
/**
* A pseudo implemention of the {@link MvcDocumentCreateStep} interface used by
* the {@link DocumentController} to show an error message when the requested
* document type does not exist.
*
* Most of methods in this implementation are throwing an
* {@link UnsupportedOperationException}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
class DocumentTypeClassNotFound
implements MvcDocumentCreateStep<ContentItem> {
@Override
public Class<ContentItem> getDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getBundle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentSection(ContentSection section) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentSection getContentSection() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setFolder(Folder folder) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Folder getFolder() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String showCreateForm() {
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override
public String getContentSectionLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getFolderPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, String> getMessages() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@ -1,105 +0,0 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import java.util.Map;
/**
* A pseudo implemention of the {@link MvcDocumentCreateStep} interface used by
* the {@link DocumentController} to show an error message when the requested
* folder does not exist.
*
* Most of methods in this implementation are throwing an
* {@link UnsupportedOperationException}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class FolderNotFound
implements MvcDocumentCreateStep<ContentItem> {
@Override
public Class<ContentItem> getDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getDescription() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getBundle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setContentSection(ContentSection section) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ContentSection getContentSection() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setFolder(Folder folder) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Folder getFolder() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String showCreateForm() {
return "org/librecms/ui/contentsection/documents/folder-not-found.xhtml";
}
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/folder-not-found.xhtml";
}
@Override
public String getContentSectionLabel() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getContentSectionTitle() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getFolderPath() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, String> getMessages() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@ -26,26 +26,54 @@ import org.librecms.contentsection.Folder;
import java.util.Map;
import java.util.ResourceBundle;
import javax.inject.Named;
import javax.transaction.Transactional;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.MultivaluedMap;
/**
* A create step for a document/content item. Implementing classes are used as
* subresources by {@link DocumentController#createDocument(java.lang.String, java.lang.String)
* }. An implmenting class must be a named CDI bean (annotated with
* {@link Named}), annotated with the {@link CreatesDocumentOfType} qualifier
* annotation. The implementing bean must also contain properties annotated with
* {@link FormParam} for all fields of the create form.
* A create step for a document/content item. Implementing classes are MUST be
* CDI beans (request scope is recommended). They are retrieved by the
* {@link DocumentController} using CDI. The {@link DocumentController} will
* first call
* {@link #setContentSection(org.librecms.contentsection.ContentSection)} and {@link #setFolder(org.librecms.contentsection.Folder)
* } to provide the current current content section and folder. After that,
* depending on the request method, either {@link #showCreateStep} or {@link #createItem(javax.ws.rs.core.Form)]
* will be called.
*
* In most cases, {@link AbstractMvcDocumentCreateStep} should be used as
* base for implementations. {@link AbstractMvcDocumentCreateStep} implements
* several common operations.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*
* @param <T> The document type created by the create step.
*/
public interface MvcDocumentCreateStep<T extends ContentItem> {
/**
* Return the template for the create step.
*
* @return
*/
String showCreateStep();
/**
* Processes the data from the create step form and creates the
* document/content item.
*
* @param formParams The data of the create step form.
*
* @return A redirect to the first authoring step of the new document.
*/
String createItem(MultivaluedMap<String, String> formParams);
/**
* Should be set by the implementing class to indicate if the current user
* can create document in the current folder.
*
* @return
*/
boolean getCanCreate();
/**
* The document type generated by the create step described by an instance
* of this class.
@ -130,25 +158,5 @@ public interface MvcDocumentCreateStep<T extends ContentItem> {
*/
Map<String, String> getMessages();
/**
* Endpoint displaying the create form.
*
* @return The template of the create step.
*/
@GET
@Path("/")
@Transactional(Transactional.TxType.REQUIRED)
String showCreateForm();
/**
* Creates the new document using the values provided in the form
* parameters.
*
* @return A redirect to the new content item.
*/
@POST
@Path("/")
@Transactional(Transactional.TxType.REQUIRED)
String createContentItem();
//
}

View File

@ -23,32 +23,19 @@ import org.libreccm.l10n.LocalizedString;
import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.Folder;
import org.librecms.contentsection.FolderManager;
import org.librecms.contenttypes.Article;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcDocumentCreateStep;
import org.librecms.ui.contentsections.documents.CreatesDocumentOfType;
import org.librecms.ui.contentsections.documents.DocumentUi;
import java.util.Locale;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import org.librecms.ui.contentsections.documents.MvcDocumentCreateStep;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.mvc.Models;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MultivaluedMap;
/**
* Describes the create step for {@link Article}.
@ -58,10 +45,19 @@ import javax.ws.rs.Path;
@RequestScoped
@Named("CmsArticleCreateStep")
@CreatesDocumentOfType(Article.class)
public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
public class MvcArticleCreateStep
extends AbstractMvcDocumentCreateStep<Article> {
@Inject
private ArticleMessageBundle articleMessageBundle;
private static final String FORM_PARAM_NAME = "name";
private static final String FORM_PARAM_TITLE = "title";
private static final String FORM_PARAM_SUMMARY = "summary";
private static final String FORM_PARAM_INITIAL_LOCALE = "initialLocale";
private static final String FORM_PARAM_SELECTED_WORKFLOW
= "selectedWorkflow";
/**
* Provides functions for working with content items.
@ -75,81 +71,43 @@ public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
@Inject
private ContentItemRepository itemRepo;
@Inject
private DocumentUi documentUi;
/**
* Provides operations for folders.
*/
@Inject
private FolderManager folderManager;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
@Inject
private ItemPermissionChecker itemPermissionChecker;
/**
* Used to provided data for the views without a named bean.
*/
@Inject
private Models models;
/**
* The current content section.
*/
private ContentSection section;
/**
* The current folder.
*/
private Folder folder;
/**
* Messages to be shown to the user.
*/
private SortedMap<String, String> messages;
/**
* Name of the article.
*/
@FormParam("name")
private String name;
/**
* Title of the article.
*/
@FormParam("title")
private String title;
/**
* Summary of the article.
*/
@FormParam("summary")
private String summary;
/**
* The initial locale of the article.
*/
@FormParam("locale")
private String initialLocale;
/**
* The workflow to use for the new article.
*/
@FormParam("selectedWorkflow")
private String selectedWorkflow;
public MvcArticleCreateStep() {
messages = new TreeMap<>();
}
@Override
public Class<Article> getDocumentType() {
return Article.class;
@ -167,175 +125,6 @@ public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
return ArticleStepsConstants.BUNDLE;
}
@Override
public ContentSection getContentSection() {
return section;
}
@Override
public String getContentSectionLabel() {
return section.getLabel();
}
@Override
public String getContentSectionTitle() {
return globalizationHelper
.getValueFromLocalizedString(section.getTitle());
}
@Override
public void setContentSection(final ContentSection section) {
this.section = section;
}
@Override
public Folder getFolder() {
return folder;
}
@Override
public String getFolderPath() {
return folderManager.getFolderPath(folder);
}
@Override
public void setFolder(final Folder folder) {
this.folder = folder;
}
@Override
public Map<String, String> getMessages() {
return Collections.unmodifiableSortedMap(messages);
}
public void addMessage(final String context, final String message) {
messages.put(context, message);
}
public void setMessages(final SortedMap<String, String> messages) {
this.messages = new TreeMap<>(messages);
}
@POST
@Path("/")
@Override
public String showCreateForm() {
if (itemPermissionChecker.canCreateNewItems(folder)) {
return "org/librecms/ui/contenttypes/article/create-article.xhtml";
} else {
return documentUi.showAccessDenied(
section,
getFolderPath(),
articleMessageBundle.getMessage("create_new_article.denied")
);
}
}
@POST
@Path("/@create")
@Override
public String createContentItem() {
if (name == null || name.isEmpty()) {
messages.put(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.name.error.missing")
);
}
if (!name.matches("^([a-zA-Z0-9_-]*)$")) {
messages.put(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.name.error.invalid")
);
}
if (title == null || title.isEmpty()) {
messages.put(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.title.error.missing")
);
}
if (summary == null || summary.isEmpty()) {
messages.put(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.summary.error.missing")
);
}
if (initialLocale == null || initialLocale.isEmpty()) {
messages.put(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.initial_locale.error.missing")
);
}
final Optional<Workflow> workflowResult = section
.getWorkflowTemplates()
.stream()
.filter(template -> template.getUuid().equals(selectedWorkflow))
.findAny();
if (!workflowResult.isPresent()) {
messages.put(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.error.not_available")
);
}
if (!messages.isEmpty()) {
final String folderPath = getFolderPath();
if (folderPath.isEmpty() || "/".equals(folderPath)) {
return String.format(
"/@contentsections/%s/documents/@create/%s",
section.getLabel(),
getDocumentType().getName()
);
} else {
return String.format(
"/@contentsections/%s/documents/%s/@create/%s",
section.getLabel(),
folderPath,
getDocumentType().getName()
);
}
}
final Locale locale = new Locale(initialLocale);
final Article article = itemManager.createContentItem(
name,
section,
folder,
workflowResult.get(),
Article.class,
locale
);
article.getTitle().addValue(locale, title);
article.getDescription().addValue(locale, summary);
itemRepo.save(article);
return String.format(
"redirect:/%s/documents/%s/%s/@edit/basicproperties",
section.getLabel(),
folderManager.getFolderPath(folder),
name
);
}
public String getName() {
return name;
}
@ -354,7 +143,7 @@ public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
public String getSelectedWorkflow() {
if (selectedWorkflow == null || selectedWorkflow.isEmpty()) {
return section
return getContentSection()
.getContentTypes()
.stream()
.filter(
@ -375,29 +164,135 @@ public class MvcArticleCreateStep implements MvcDocumentCreateStep<Article> {
}
}
public Map<String, String> getAvailableLocales() {
return globalizationHelper
.getAvailableLocales()
.stream()
.collect(Collectors.toMap(
Locale::toString,
locale -> locale.getDisplayLanguage(
globalizationHelper.getNegotiatedLocale()
)
));
@Override
public String showCreateStep() {
return "org/librecms/ui/contenttypes/article/create-article.xhtml";
}
public Map<String, String> getAvailableWorkflows() {
return section
@Override
public String createItem(final MultivaluedMap<String, String> formParams) {
if (!formParams.containsKey(FORM_PARAM_NAME)
|| formParams.getFirst(FORM_PARAM_NAME) == null
|| formParams.getFirst(FORM_PARAM_NAME).isEmpty()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.name.error.missing")
);
}
name = formParams.getFirst(FORM_PARAM_NAME);
if (!name.matches("^([a-zA-Z0-9_-]*)$")) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.name.error.invalid")
);
}
if (!formParams.containsKey(FORM_PARAM_TITLE)
|| formParams.getFirst(FORM_PARAM_TITLE) == null
|| formParams.getFirst(FORM_PARAM_TITLE).isEmpty()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.title.error.missing")
);
}
title = formParams.getFirst(FORM_PARAM_TITLE);
if (!formParams.containsKey(FORM_PARAM_SUMMARY)
|| formParams.getFirst(FORM_PARAM_SUMMARY) == null
|| formParams.getFirst(FORM_PARAM_SUMMARY).isEmpty()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.summary.error.missing")
);
}
summary = formParams.getFirst(FORM_PARAM_SUMMARY);
if (!formParams.containsKey(FORM_PARAM_INITIAL_LOCALE)
|| formParams.getFirst(FORM_PARAM_INITIAL_LOCALE) == null
|| formParams.getFirst(FORM_PARAM_INITIAL_LOCALE).isEmpty()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.initial_locale.error.missing")
);
}
final Locale locale = new Locale(
formParams.getFirst(FORM_PARAM_INITIAL_LOCALE)
);
if (!formParams.containsKey(FORM_PARAM_SELECTED_WORKFLOW)
|| formParams.getFirst(FORM_PARAM_SELECTED_WORKFLOW) == null
|| formParams.getFirst(FORM_PARAM_SELECTED_WORKFLOW).isEmpty()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.none_selected")
);
}
selectedWorkflow = formParams.getFirst(FORM_PARAM_SELECTED_WORKFLOW);
final Optional<Workflow> workflowResult = getContentSection()
.getWorkflowTemplates()
.stream()
.collect(
Collectors.toMap(
workflow -> workflow.getUuid(),
workflow -> globalizationHelper.getValueFromLocalizedString(
workflow.getName()
)
)
.filter(template -> template.getUuid().equals(selectedWorkflow))
.findAny();
if (!workflowResult.isPresent()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.error.not_available")
);
}
if (!getMessages().isEmpty()) {
final String folderPath = getFolderPath();
if (folderPath.isEmpty() || "/".equals(folderPath)) {
return String.format(
"/@contentsections/%s/documents/@create/%s",
getContentSectionLabel(),
getDocumentType().getName()
);
} else {
return String.format(
"/@contentsections/%s/documents/%s/@create/%s",
getContentSectionLabel(),
folderPath,
getDocumentType().getName()
);
}
}
final Article article = itemManager.createContentItem(
name,
getContentSection(),
getFolder(),
workflowResult.get(),
Article.class,
locale
);
article.getTitle().addValue(locale, title);
article.getDescription().addValue(locale, summary);
itemRepo.save(article);
return String.format(
"redirect:/%s/documents/%s/%s/@edit/basicproperties",
getContentSectionLabel(),
getFolderPath(),
name
);
}

View File

@ -4,13 +4,13 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.document_access_denied.title']}" />
<ui:define name="breadcrumb">
<ui:include src="document-breadcrumbs.xhtml" />
<!--<ui:include src="document-breadcrumbs.xhtml" />-->
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document_access_denied.breadcrumb']}
</li>

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['relatedinfo.asset.not_found.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['relatedinfo.attachmentlist.not_found.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.authoringstep.not_available.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['categorization.domain.not_found.title']}" />

View File

@ -4,13 +4,13 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.createstep.not_available.title']}" />
<ui:define name="breadcrumb">
<ui:include src="document-breadcrumbs.xhtml" />
<!--<ui:include src="document-breadcrumbs.xhtml" />-->
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.documents.createstep.breadcrumb']} #{documentType}
</li>

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.document.not_found.title']}" />

View File

@ -4,13 +4,13 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.document_type.not_available.title']}" />
<ui:define name="breadcrumb">
<ui:include src="document-breadcrumbs.xhtml" />
<!--<ui:include src="document-breadcrumbs.xhtml" />-->
<li aria-current="page" class="breadcrumb-item">
#{documentType}
</li>

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.folder.not_found.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['relatedinfo.internal_link.not_found.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.lifecycle.not_available.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['publishstep.lifecycle.not_available.title']}" />

View File

@ -0,0 +1,15 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
>
<head>
<title>Content Section #{ContentSectionModel.sectionName} #{title} - LibreCMS</title>
</head>
<body>
<pre>
#{folderPath}
</pre>
</body>
</html>

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.document.lifecycle_phase.not_available.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.publishstep.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.attachmentlist.details.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['contentsection.documents.relatedinfo.internallink.details.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['contentsection.document.relatedinfo.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsDefaultStepsMessageBundle['relatedinfo.target_item.not_found.title']}" />

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.workflow.task.not_available.title']}" />

View File

@ -4,13 +4,13 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.document_type.not_supported.title']}" />
<ui:define name="breadcrumb">
<ui:include src="document-breadcrumbs.xhtml" />
<!--<ui:include src="document-breadcrumbs.xhtml" />-->
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/@documents/#{CmsSelectedDocumentModel.itemPath}">
#{CmsAdminMessages['contentsection.unsupportedDocumentType.breadcrumb']}

View File

@ -4,7 +4,7 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/content-section/documents/document.xhtml">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/document.xhtml">
<ui:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.workflow.not_available.title']}" />