Template Skeletons for editing content items, some refactoring

pull/10/head
Jens Pelzetter 2021-03-18 21:11:19 +01:00
parent a6119e09a2
commit 4b1a3e8f27
32 changed files with 651 additions and 333 deletions

View File

@ -6,6 +6,9 @@
package org.librecms.ui.contentsections;
import org.libreccm.ui.IsAuthenticatedFilter;
import org.librecms.ui.contentsections.documents.DocumentController;
import org.librecms.ui.contentsections.documents.DocumentLifecyclesController;
import org.librecms.ui.contentsections.documents.DocumentWorkflowController;
import java.util.HashSet;
import java.util.Set;
@ -33,6 +36,9 @@ public class ContentSectionApplication extends Application {
classes.add(ConfigurationWorkflowController.class);
classes.add(ContentSectionController.class);
classes.add(DocumentFolderController.class);
classes.add(DocumentController.class);
classes.add(DocumentLifecyclesController.class);
classes.add(DocumentWorkflowController.class);
classes.add(IsAuthenticatedFilter.class);
return classes;

View File

@ -25,7 +25,7 @@ import javax.ws.rs.Path;
public class AuthoringStepNotAvailable implements MvcAuthoringStep {
@Override
public Class<? extends ContentItem> supportedDocumenType() {
public Class<? extends ContentItem> supportedDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@ -66,7 +66,7 @@ public class AuthoringStepNotAvailable implements MvcAuthoringStep {
@Override
public String showStep() {
return "org/librecms/ui/contentsection/authoringstep-not-available.xhtml";
return "org/librecms/ui/contentsection/documents/authoringstep-not-available.xhtml";
}
@GET

View File

@ -62,7 +62,7 @@ public class ContentSectionNotFound
}
@Override
public Class<? extends ContentItem> supportedDocumenType() {
public Class<? extends ContentItem> supportedDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@ -64,7 +64,7 @@ public class ContentTypeNotAvailable
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/document-type-not-notavailable.xhtml";
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override

View File

@ -64,7 +64,7 @@ public class CreateStepNotAvailable
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/create-step-not-notavailable.xhtml";
return "org/librecms/ui/contentsection/documents/create-step-not-available.xhtml";
}
@Override

View File

@ -22,6 +22,8 @@ import org.librecms.ui.contentsections.ContentSectionsUi;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -181,6 +183,36 @@ public class DocumentController {
return createStep;
}
@Path("/{documentPath:(.+)?}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String editDocument(
@PathParam("sectionIdentifider") 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();
return String.format(
"redirect:/%s/documents/%s/@authoringsteps/%s",
sectionIdentifier,
documentPath,
findPathFragmentForFirstStep(item)
);
}
@Path("/{documentPath:(.+)?}/@authoringsteps/{authoringStep}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
@ -220,7 +252,7 @@ public class DocumentController {
}
final MvcAuthoringStep authoringStep = instance.get();
if (!authoringStep.supportedDocumenType().isAssignableFrom(item
if (!authoringStep.supportedDocumentType().isAssignableFrom(item
.getClass())) {
models.put("section", section.getLabel());
models.put("documentPath", documentPath);
@ -367,7 +399,7 @@ public class DocumentController {
if (!result.isPresent()) {
models.put("section", section.getLabel());
models.put("lifecycleDefUuid", selectedLifecycleUuid);
return "org/librecms/ui/contentsection/lifecycle-def-not-found.xhtml";
return "org/librecms/ui/contentsection/documents/lifecycle-def-not-found.xhtml";
}
}
@ -452,248 +484,34 @@ public class DocumentController {
);
}
// @POST
// @Path("/{documentPath:(.+)?}/@workflow/tasks/${taskIdentifier}/@lock")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public String lockTask(
// @PathParam("sectionIdentifider") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath,
// @PathParam("taskIdentifier") final String taskIdentifier,
// @FormParam("returnUrl") final String returnUrl
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// return sectionsUi.showContentSectionNotFound(sectionIdentifier);
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// return documentUi.showDocumentNotFound(section, documentPath);
// }
// final ContentItem item = itemResult.get();
// selectedDocumentModel.setContentItem(item);
//
// final Optional<AssignableTask> taskResult = findTask(
// item, taskIdentifier
// );
// if (!taskResult.isPresent()) {
// return showTaskNotFound(section, documentPath, taskIdentifier);
// }
//
// final AssignableTask task = taskResult.get();
// assignableTaskManager.lockTask(task);
//
// return String.format("redirect:%s", returnUrl);
// }
// @POST
// @Path("/{documentPath:(.+)?}/@workflow/tasks/${taskIdentifier}/@unlock")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public String unlockTask(
// @PathParam("sectionIdentifider") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath,
// @PathParam("taskIdentifier") final String taskIdentifier,
// @FormParam("returnUrl") final String returnUrl
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// return sectionsUi.showContentSectionNotFound(sectionIdentifier);
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// return documentUi.showDocumentNotFound(section, documentPath);
// }
// final ContentItem item = itemResult.get();
// selectedDocumentModel.setContentItem(item);
//
// final Optional<AssignableTask> taskResult = findTask(
// item, taskIdentifier
// );
// if (!taskResult.isPresent()) {
// return showTaskNotFound(section, documentPath, taskIdentifier);
// }
//
// final AssignableTask task = taskResult.get();
// assignableTaskManager.unlockTask(task);
//
// return String.format("redirect:%s", returnUrl);
// }
//
// @POST
// @Path("/{documentPath:(.+)?}/@workflow/tasks/${taskIdentifier}/@finish")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public String finishTask(
// @PathParam("sectionIdentifider") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath,
// @PathParam("taskIdentifier") final String taskIdentifier,
// @FormParam("comment") @DefaultValue("") final String comment,
// @FormParam("returnUrl") final String returnUrl
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// return sectionsUi.showContentSectionNotFound(sectionIdentifier);
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// return documentUi.showDocumentNotFound(section, documentPath);
// }
// final ContentItem item = itemResult.get();
// selectedDocumentModel.setContentItem(item);
//
// final Optional<AssignableTask> taskResult = findTask(
// item, taskIdentifier
// );
// if (!taskResult.isPresent()) {
// return showTaskNotFound(section, documentPath, taskIdentifier);
// }
//
// final AssignableTask task = taskResult.get();
// if (comment.isEmpty()) {
// assignableTaskManager.finish(task);
// } else {
// assignableTaskManager.finish(task, comment);
// }
//
// return String.format("redirect:%s", returnUrl);
// }
//
// @POST
// @Path(
// "/{documentPath:(.+)?}/@workflow/@applyAlternative/{workflowIdentifier}")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public String applyAlternateWorkflow(
// @PathParam("sectionIdentifider") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath,
// @FormParam("newWorkflowUuid") final String newWorkflowUuid,
// @FormParam("returnUrl") final String returnUrl
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// return sectionsUi.showContentSectionNotFound(sectionIdentifier);
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// return documentUi.showDocumentNotFound(section, documentPath);
// }
// final ContentItem item = itemResult.get();
// selectedDocumentModel.setContentItem(item);
//
// if (!permissionChecker.isPermitted(
// ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, item)) {
// return sectionsUi.showAccessDenied(
// "sectionIdentifier", sectionIdentifier,
// "documentPath", documentPath
// );
// }
//
// final Optional<Workflow> workflowResult = section
// .getWorkflowTemplates()
// .stream()
// .filter(template -> template.getUuid().equals(newWorkflowUuid))
// .findAny();
// if (!workflowResult.isPresent()) {
// models.put("section", section.getLabel());
// models.put("workflowUuid", newWorkflowUuid);
// return "org/librecms/ui/contentsection/workflow-not-found.xhtml";
// }
//
// workflowManager.createWorkflow(workflowResult.get(), item);
// return String.format("redirect:%s", returnUrl);
// }
//
// @POST
// @Path("/{documentPath:(.+)?}/@workflow/@restart")
// @AuthorizationRequired
// @Transactional(Transactional.TxType.REQUIRED)
// public String restartWorkflow(
// @PathParam("sectionIdentifider") final String sectionIdentifier,
// @PathParam("documentPath") final String documentPath,
// @FormParam("returnUrl") final String returnUrl
// ) {
// final Optional<ContentSection> sectionResult = sectionsUi
// .findContentSection(sectionIdentifier);
// if (!sectionResult.isPresent()) {
// return sectionsUi.showContentSectionNotFound(sectionIdentifier);
// }
// final ContentSection section = sectionResult.get();
//
// final Optional<ContentItem> itemResult = itemRepo
// .findByPath(section, documentPath);
// if (!itemResult.isPresent()) {
// return documentUi.showDocumentNotFound(section, documentPath);
// }
// final ContentItem item = itemResult.get();
// selectedDocumentModel.setContentItem(item);
//
// if (!permissionChecker.isPermitted(
// ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, item)) {
// return sectionsUi.showAccessDenied(
// "sectionIdentifier", sectionIdentifier,
// "documentPath", documentPath
// );
// }
//
// if (item.getWorkflow() != null) {
// workflowManager.start(item.getWorkflow());
// }
//
// return String.format("redirect:%s", returnUrl);
// }
//
// private Optional<AssignableTask> findTask(
// final ContentItem item,
// final String taskIdentifier
// ) {
// final Workflow workflow = item.getWorkflow();
// if (workflow == null) {
// return Optional.empty();
// }
//
// final Identifier identifier = identifierParser.parseIdentifier(
// taskIdentifier
// );
// switch (identifier.getType()) {
// case ID:
// return workflow
// .getTasks()
// .stream()
// .filter(task -> task instanceof AssignableTask)
// .map(task -> (AssignableTask) task)
// .filter(
// task -> task.getTaskId() == Long
// .parseLong(identifier.getIdentifier())
// ).findAny();
// default:
// return workflow
// .getTasks()
// .stream()
// .filter(task -> task instanceof AssignableTask)
// .map(task -> (AssignableTask) task)
// .filter(
// task -> task.getUuid().equals(
// identifier.getIdentifier()
// )
// ).findAny();
// }
// }
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());
}
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 LifecycleListEntry buildLifecycleListEntry(
final LifecycleDefinition definition
) {

View File

@ -24,7 +24,6 @@ import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.mvc.Controller;
import javax.mvc.Models;
import javax.transaction.Transactional;
@ -102,7 +101,7 @@ public class DocumentLifecyclesController {
if (!phaseResult.isPresent()) {
models.put("section", section.getLabel());
models.put("phaseId", phaseId);
return "org/librecms/ui/contentsection/phase-not-found.xhtml";
return "org/librecms/ui/contentsection/documents/phase-not-found.xhtml";
}
final Phase phase = phaseResult.get();

View File

@ -25,7 +25,7 @@ import javax.ws.rs.Path;
public class DocumentNotFound implements MvcAuthoringStep {
@Override
public Class<? extends ContentItem> supportedDocumenType() {
public Class<? extends ContentItem> supportedDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View File

@ -59,12 +59,12 @@ class DocumentTypeClassNotFound
@Override
public String showCreateForm() {
return "org/librecms/ui/contentsection/documents/document-type-not-found.xhtml";
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override
public String createContentItem() {
return "org/librecms/ui/contentsection/documents/document-type-not-found.xhtml";
return "org/librecms/ui/contentsection/documents/document-type-not-available.xhtml";
}
@Override

View File

@ -228,7 +228,7 @@ public class DocumentWorkflowController {
if (!workflowResult.isPresent()) {
models.put("section", section.getLabel());
models.put("workflowUuid", newWorkflowUuid);
return "org/librecms/ui/contentsection/workflow-not-found.xhtml";
return "org/librecms/ui/contentsection/documents/workflow-not-found.xhtml";
}
workflowManager.createWorkflow(workflowResult.get(), item);
@ -319,7 +319,7 @@ public class DocumentWorkflowController {
models.put("section", section.getLabel());
models.put("documentPath", documentPath);
models.put("taskIdentifier", taskIdentifier);
return "org/librecms/ui/contentsection/task-not-found.xhtml";
return "org/librecms/ui/contentsection/documents/task-not-found.xhtml";
}
}

View File

@ -7,7 +7,9 @@ package org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import javax.mvc.Controller;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Provides the steps for creating and viewing and editing a document (content
@ -19,6 +21,7 @@ import javax.mvc.Controller;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface MvcAuthoringKit {
/**
@ -26,7 +29,7 @@ public @interface MvcAuthoringKit {
*
* @return Descriptor class for the create step.
*/
Class<? extends MvcDocumentCreateStep> createStep();
Class<? extends MvcDocumentCreateStep<?>> createStep();
/**
* The authoring steps for editing the properties of the document. They are

View File

@ -32,7 +32,7 @@ public interface MvcAuthoringStep {
*
* @return The document type supported by the authoring step.
*/
Class<? extends ContentItem> supportedDocumenType();
Class<? extends ContentItem> supportedDocumentType();
/**
* Gets the localized label of the authoring step. The language variant to

View File

@ -13,11 +13,15 @@ import org.libreccm.workflow.AssignableTaskManager;
import org.libreccm.workflow.TaskState;
import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.Folder;
import org.librecms.contentsection.FolderManager;
import org.librecms.contentsection.privileges.ItemPrivileges;
import org.librecms.ui.contentsections.FolderBreadcrumbsModel;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
@ -35,6 +39,12 @@ public class SelectedDocumentModel {
@Inject
private AssignableTaskManager taskManager;
@Inject
private ContentItemManager itemManager;
@Inject
private FolderManager folderManager;
@Inject
private GlobalizationHelper globalizationHelper;
@ -46,14 +56,55 @@ public class SelectedDocumentModel {
private ContentItem item;
private String itemTitle;
private String itemPath;
private List<FolderBreadcrumbsModel> parentFolderBreadcrumbs;
private Workflow workflow;
private TaskListEntry currentTask;
private List<TaskListEntry> allTasks;
public String getItemTitle() {
return itemTitle;
}
public String getItemPath() {
return itemPath;
}
public List<FolderBreadcrumbsModel> getParentFolderBreadcrumbs() {
return Collections.unmodifiableList(parentFolderBreadcrumbs);
}
public List<TaskListEntry> getAllTasks() {
return Collections.unmodifiableList(allTasks);
}
public TaskListEntry getCurrentTask() {
return currentTask;
}
public boolean getCanChangeWorkflow() {
return permissionChecker.isPermitted(
ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, item
);
}
void setContentItem(final ContentItem item) {
this.item = Objects.requireNonNull(item);
itemTitle = globalizationHelper.getValueFromLocalizedString(
item.getTitle()
);
itemPath = itemManager.getItemPath(item);
parentFolderBreadcrumbs = itemManager
.getItemFolders(item)
.stream()
.map(this::buildFolderBreadcrumbsModel)
.collect(Collectors.toList());
workflow = item.getWorkflow();
allTasks = workflow
.getTasks()
@ -73,14 +124,14 @@ public class SelectedDocumentModel {
}
}
public TaskListEntry getCurrentTask() {
return currentTask;
}
public boolean getCanChangeWorkflow() {
return permissionChecker.isPermitted(
ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, item
);
private FolderBreadcrumbsModel buildFolderBreadcrumbsModel(
final Folder folder
) {
final FolderBreadcrumbsModel model = new FolderBreadcrumbsModel();
model.setCurrentFolder(false);
model.setPath(folderManager.getFolderPath(folder));
model.setPathToken(folder.getName());
return model;
}
private TaskListEntry buildTaskListEntry(final AssignableTask task) {

View File

@ -25,7 +25,7 @@ import javax.ws.rs.Path;
public class UnsupportedDocumentType implements MvcAuthoringStep {
@Override
public Class<? extends ContentItem> supportedDocumenType() {
public Class<? extends ContentItem> supportedDocumentType() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@ -66,7 +66,7 @@ public class UnsupportedDocumentType implements MvcAuthoringStep {
@Override
public String showStep() {
return "org/librecms/ui/contentsection/unsupported-documenttype.xhtml";
return "org/librecms/ui/contentsection/documents/unsupported-documenttype.xhtml";
}
@GET

View File

@ -62,7 +62,7 @@ public class MvcArticlePropertiesStep implements MvcAuthoringStep {
private Article document;
@Override
public Class<? extends ContentItem> supportedDocumenType() {
public Class<? extends ContentItem> supportedDocumentType() {
return Article.class;
}

View File

@ -61,7 +61,7 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep {
private Article document;
@Override
public Class<? extends ContentItem> supportedDocumenType() {
public Class<? extends ContentItem> supportedDocumentType() {
return Article.class;
}

View File

@ -0,0 +1,29 @@
<!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: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:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.authoringstep.not_available.title']}" />
<ui:define name="breadcrumb">
<ui:include src="document-breadcrumbs.xhtml" />
<li aria-current="page" class="breadcrumb-item">
#{authoringStep}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.documents.authoringstep.not_available.message', [section, documentPath, authoringStep])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,40 @@
<!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: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/contentsection/contentsection.xhtml">
<ui:define name="documentMain">
<div class="row">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link #{activeDocumentTab == 'editTab' ? 'active' : ''}"
href="#{mvc.basePath}/documents/#{CmsSelectedDocumentModel.itemPath}">
#{CmsAdminMessages['contentsection.document.tabs.edit.title']}
</a>
</li>
<li class="nav-item">
<a class="nav-link #{activeDocumentTab == 'history' ? 'active' : ''}"
href="#{mvc.basePath}/documents/#{CmsSelectedDocumentModel.itemPath}/@history">
#{CmsAdminMessages['contentsection.document.tabs.history.title']}
</a>
</li>
</ul>
<div class="col-sm-3">
<!-- Workflow widget -->
<!-- Authoring steps -->
</div>
<div class="col-sm-9">
<ui:insert name="authoringStep" />
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,30 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.documents.createstep.breadcrumb']} #{documentType}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.documents.createstep.not_available.message', [section, folderPath, documentType])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,32 @@
<!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:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition>
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}">
#{ContentSectionModel.sectionName}
</a>
</li>
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentfolders">
#{CmsAdminMessages['contentsection.documents.title']}
</a>
</li>
<c:forEach items="#{CmsSelectedDocumentModel.parentFolderBreadcrumbs}"
var="breadcrumb">
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentsfolders/#{breadcrumb.path}">
#{breadcrumb.pathToken}
</a>
</li>
</c:forEach>
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}">
#{CmsSelectedDocumentModel.itemTitle}
</a>
</li>
</ui:composition>
</html>

View File

@ -0,0 +1,33 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document_not_found.breadcrumb']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.document.not_available.message', [section, documentPath])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,30 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{documentType}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.documents.document_type.not_available.message', [section, documentType])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,54 @@
<!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: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/contentsection/contentsection.xhtml">
<ui:param name="activePage" value="documentFolders" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documentfolders.title']}" />
<ui:define name="breadcrumb">
<c:choose>
<c:when test="#{DocumentFolderModel.breadcrumbs.isEmpty()}">
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.documentfolders.title']}
</li>
</c:when>
<c:otherwise>
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentfolders">
#{CmsAdminMessages['contentsection.documentfolders.title']}
</a>
</li>
</c:otherwise>
</c:choose>
<c:forEach items="#{DocumentFolderModel.breadcrumbs}"
var="breadcrumb">
<c:choose>
<c:when test="#{breadcrumb.currentFolder}">
<li class="breadcrumb-item #{breadcrumb.currentFolder ? 'active' : ''}">
#{breadcrumb.pathToken}
</li>
</c:when>
<c:otherwise>
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentfolders/#{breadcrumb.path}">#{breadcrumb.pathToken}</a>
</li>
</c:otherwise>
</c:choose>
</c:forEach>
</ui:define>
<ui:define name="main">
<div class="container-fluid">
<h1>#{CmsAdminMessages.getMessage("contentsection.document.heading", [ContentSectionModel.sectionName, CmsSelectedDocumentModel.itemTitle])}</h1>
<ui:insert name="documentMain" />
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,43 @@
<!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: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:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.document_type.not_available.title']}" />
<ui:define name="breadcrumb">
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}">
#{ContentSectionModel.sectionName}
</a>
</li>
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentfolders">
#{CmsAdminMessages['contentsection.documents.title']}
</a>
</li>
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.folder_not_found.breadcrumb']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.document.folder_not_found.message', [section, folderPath])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,20 @@
<!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: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/contentsection/contentsection.xhtml">
<ui:param name="activeDocumentTab" value="history" />
<ui:define name="documentMain">
<div class="container">
<div class="alert alert-info" role="alert">
Not implemented yet.
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,31 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document.publishstep.breadcrumb']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.document.lifecycle.not_available.message', [section, lifecycleDefUuid])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,32 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document.publishstep.breadcrumb']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.document.lifecycle.not_available.message', [section, phaseId])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,28 @@
<!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: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:param name="activePage" value="document" />
<ui:param name="title" value="#{CmsAdminMessages['contentsection.documents.publishstep.title']}" />
<ui:define name="breadcrumb">
<ui:include src="document-breadcrumbs.xhtml" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document.publishstep.title']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-info" role="alert">
Not implemented yet.
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,33 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document.workflows.breadcrumb']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.document.lifecycle.not_available.message', [section, documentPath, taskIdentifier])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,35 @@
<!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: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: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" />
<li class="breadcrumb-item">
<a href="#{mvc.basePath}/@documents/#{CmsSelectedDocumentModel.itemPath}">
#{CmsAdminMessages['contentsection.unsupportedDocumentType.breadcrumb']}
</a>
</li>
<li aria-current="page">
#{authoringStep}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.documents.document_type_not_available.message', [section, documentPath, documentType, authoringStep])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,32 @@
<!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: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: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" />
<li aria-current="page" class="breadcrumb-item">
#{CmsAdminMessages['contentsection.document.workflows.breadcrumb']}
</li>
</ui:define>
<ui:define name="main">
<div class="container">
<div class="alert alert-danger" role="alert">
#{CmsAdminMessages.getMessage('contentsection.document.lifecycle.not_available.message', [section, workflowUuid])}
</div>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -1,61 +0,0 @@
/*
* 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.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class LifecyclesControllerTest {
public LifecyclesControllerTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of updatePhaseDates method, of class DocumentLifecyclesController.
*/
@Test
public void testUpdatePhaseDates() {
System.out.println("updatePhaseDates");
String sectionIdentifier = "";
String documentPath = "";
long phaseId = 0L;
String startDateParam = "";
String endDateParam = "";
DocumentLifecyclesController instance = new DocumentLifecyclesController();
String expResult = "";
String result
= instance.updatePhaseDates(sectionIdentifier, documentPath, phaseId,
startDateParam, endDateParam);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}