Content Types Management UI
Former-commit-id: 3f43eab84bcce3087cbe96d4464fc9ea25c74efapull/10/head
parent
bfb3b972da
commit
7824208d36
|
|
@ -0,0 +1,836 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.libreccm.api.Identifier;
|
||||||
|
import org.libreccm.api.IdentifierParser;
|
||||||
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
import org.libreccm.l10n.LocalizedTextsUtil;
|
||||||
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
|
import org.libreccm.security.PermissionChecker;
|
||||||
|
import org.libreccm.security.PermissionManager;
|
||||||
|
import org.libreccm.security.Role;
|
||||||
|
import org.libreccm.workflow.Workflow;
|
||||||
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
import org.librecms.contentsection.ContentSectionManager;
|
||||||
|
import org.librecms.contentsection.ContentSectionRepository;
|
||||||
|
import org.librecms.contentsection.ContentType;
|
||||||
|
import org.librecms.contentsection.ContentTypeManager;
|
||||||
|
import org.librecms.contentsection.ContentTypeMode;
|
||||||
|
import org.librecms.contentsection.privileges.AdminPrivileges;
|
||||||
|
import org.librecms.contentsection.privileges.TypePrivileges;
|
||||||
|
import org.librecms.contenttypes.ContentTypeInfo;
|
||||||
|
import org.librecms.contenttypes.ContentTypesManager;
|
||||||
|
import org.librecms.lifecycle.LifecycleDefinition;
|
||||||
|
import org.librecms.ui.CmsAdminMessages;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.mvc.Controller;
|
||||||
|
import javax.mvc.Models;
|
||||||
|
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.PathParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Controller
|
||||||
|
@Path("/{sectionIdentifier}/configuration/documenttypes")
|
||||||
|
public class ConfigurationDocumentTypesController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CmsAdminMessages cmsAdminMessages;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentSectionModel sectionModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentSectionManager sectionManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentSectionRepository sectionRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentTypeManager typeManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentTypesManager typesManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DocumentTypeModel documentTypeModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DocumentTypesModel documentTypesModel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private GlobalizationHelper globalizationHelper;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private IdentifierParser identifierParser;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Models models;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PermissionChecker permissionChecker;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PermissionManager permissionManager;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String listDocumentTypes(
|
||||||
|
@PathParam("sectionIdentifier") final String sectionIdentifierParam
|
||||||
|
) {
|
||||||
|
final Identifier sectionIdentifier = identifierParser.parseIdentifier(
|
||||||
|
sectionIdentifierParam
|
||||||
|
);
|
||||||
|
|
||||||
|
final Optional<ContentSection> sectionResult;
|
||||||
|
switch (sectionIdentifier.getType()) {
|
||||||
|
case ID:
|
||||||
|
sectionResult = sectionRepo.findById(
|
||||||
|
Long.parseLong(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case UUID:
|
||||||
|
sectionResult = sectionRepo.findByUuid(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sectionResult = sectionRepo.findByLabel(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sectionResult.isPresent()) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
}
|
||||||
|
final ContentSection section = sectionResult.get();
|
||||||
|
sectionModel.setSection(section);
|
||||||
|
|
||||||
|
if (!permissionChecker.isPermitted(
|
||||||
|
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
|
||||||
|
)) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
documentTypesModel.setAssignedTypes(
|
||||||
|
section
|
||||||
|
.getContentTypes()
|
||||||
|
.stream()
|
||||||
|
.map(this::buildDocumentTypesTableRowModel)
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
documentTypesModel.setAvailableTypes(
|
||||||
|
typesManager
|
||||||
|
.getAvailableContentTypes()
|
||||||
|
.stream()
|
||||||
|
.filter(
|
||||||
|
type -> !sectionManager.hasContentType(
|
||||||
|
type.getContentItemClass(), section
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map(this::buildDocumentTypeInfoModel)
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
model -> model.getContentItemClass(),
|
||||||
|
model -> model
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
documentTypesModel.setAvailableLifecycles(
|
||||||
|
section
|
||||||
|
.getLifecycleDefinitions()
|
||||||
|
.stream()
|
||||||
|
.map(def -> buildLifecycleModel(def, false))
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
model -> model.getUuid(),
|
||||||
|
model -> model.getLabel()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
documentTypesModel.setAvailableWorkflows(
|
||||||
|
section
|
||||||
|
.getWorkflowTemplates()
|
||||||
|
.stream()
|
||||||
|
.map(workflow -> buildWorkflowModel(workflow, false))
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
model -> model.getUuid(),
|
||||||
|
model -> model.getName()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return "org/librecms/ui/contentsection/configuration/documenttypes.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String addDocumentType(
|
||||||
|
@PathParam("sectionIdentifier") final String sectionIdentifierParam,
|
||||||
|
@FormParam("contentItemClass") final String contentItemClass,
|
||||||
|
@FormParam("defaultLifecycleUuid") final String defaultLifecycleUuid,
|
||||||
|
@FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid
|
||||||
|
) {
|
||||||
|
final Identifier sectionIdentifier = identifierParser.parseIdentifier(
|
||||||
|
sectionIdentifierParam
|
||||||
|
);
|
||||||
|
|
||||||
|
final Optional<ContentSection> sectionResult;
|
||||||
|
switch (sectionIdentifier.getType()) {
|
||||||
|
case ID:
|
||||||
|
sectionResult = sectionRepo.findById(
|
||||||
|
Long.parseLong(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case UUID:
|
||||||
|
sectionResult = sectionRepo.findByUuid(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sectionResult = sectionRepo.findByLabel(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sectionResult.isPresent()) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
}
|
||||||
|
final ContentSection section = sectionResult.get();
|
||||||
|
sectionModel.setSection(section);
|
||||||
|
|
||||||
|
if (!permissionChecker.isPermitted(
|
||||||
|
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
|
||||||
|
)) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
final Optional<ContentTypeInfo> typeInfo = typesManager
|
||||||
|
.getAvailableContentTypes()
|
||||||
|
.stream()
|
||||||
|
.filter(
|
||||||
|
type -> type.getContentItemClass().getName().equals(
|
||||||
|
contentItemClass
|
||||||
|
)
|
||||||
|
).findAny();
|
||||||
|
|
||||||
|
if (!typeInfo.isPresent()) {
|
||||||
|
models.put(
|
||||||
|
"errors",
|
||||||
|
cmsAdminMessages.getMessage(
|
||||||
|
"contentsection.configuration.documenttypes.type_not_available",
|
||||||
|
new String[]{sectionIdentifierParam, contentItemClass}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return listDocumentTypes(sectionIdentifierParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Optional<LifecycleDefinition> defaultLifecycle = section
|
||||||
|
.getLifecycleDefinitions()
|
||||||
|
.stream()
|
||||||
|
.filter(def -> def.getUuid().equals(defaultLifecycleUuid))
|
||||||
|
.findAny();
|
||||||
|
|
||||||
|
if (!defaultLifecycle.isPresent()) {
|
||||||
|
models.put(
|
||||||
|
"errors",
|
||||||
|
cmsAdminMessages.getMessage(
|
||||||
|
"contentsection.configuration.documenttypes.selected_lifecycle_not_available",
|
||||||
|
new String[]{sectionIdentifierParam, defaultLifecycleUuid}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return listDocumentTypes(sectionIdentifierParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Optional<Workflow> defaultWorkflow = section
|
||||||
|
.getWorkflowTemplates()
|
||||||
|
.stream()
|
||||||
|
.filter(def -> def.getUuid().equals(defaultWorkflowUuid))
|
||||||
|
.findAny();
|
||||||
|
|
||||||
|
if (!defaultWorkflow.isPresent()) {
|
||||||
|
models.put(
|
||||||
|
"errors",
|
||||||
|
cmsAdminMessages.getMessage(
|
||||||
|
"contentsection.configuration.documenttypes.selected_workflow_not_available",
|
||||||
|
new String[]{sectionIdentifierParam, defaultWorkflowUuid}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return listDocumentTypes(sectionIdentifierParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
sectionManager.addContentTypeToSection(
|
||||||
|
typeInfo.get().getContentItemClass(),
|
||||||
|
section,
|
||||||
|
defaultLifecycle.get(),
|
||||||
|
defaultWorkflow.get()
|
||||||
|
);
|
||||||
|
|
||||||
|
return String.format(
|
||||||
|
"redirect:%s/configuration/documenttypes", sectionIdentifierParam
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @GET
|
||||||
|
// @Path("/{documentType}")
|
||||||
|
// public String showDocumentType(
|
||||||
|
// @PathParam("sectionIdentifier") final String sectionIdentifierParam,
|
||||||
|
// @PathParam("documentType") final String documentTypeParam
|
||||||
|
// ) {
|
||||||
|
// final Identifier sectionIdentifier = identifierParser.parseIdentifier(
|
||||||
|
// sectionIdentifierParam
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// final Optional<ContentSection> sectionResult;
|
||||||
|
// switch (sectionIdentifier.getType()) {
|
||||||
|
// case ID:
|
||||||
|
// sectionResult = sectionRepo.findById(
|
||||||
|
// Long.parseLong(
|
||||||
|
// sectionIdentifier.getIdentifier()
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// case UUID:
|
||||||
|
// sectionResult = sectionRepo.findByUuid(
|
||||||
|
// sectionIdentifier.getIdentifier()
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// sectionResult = sectionRepo.findByLabel(
|
||||||
|
// sectionIdentifier.getIdentifier()
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!sectionResult.isPresent()) {
|
||||||
|
// models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
// return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
// }
|
||||||
|
// final ContentSection section = sectionResult.get();
|
||||||
|
// sectionModel.setSection(section);
|
||||||
|
//
|
||||||
|
// if (!permissionChecker.isPermitted(
|
||||||
|
// AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
|
||||||
|
// )) {
|
||||||
|
// models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
// return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final Optional<ContentType> typeResult = section
|
||||||
|
// .getContentTypes()
|
||||||
|
// .stream()
|
||||||
|
// .filter(type -> type.getContentItemClass().equals(documentTypeParam))
|
||||||
|
// .findAny();
|
||||||
|
//
|
||||||
|
// if (!typeResult.isPresent()) {
|
||||||
|
// return "org/librecms/ui/contentsection/configuration/documenttype-not-found.xhtml";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final ContentType type = typeResult.get();
|
||||||
|
//
|
||||||
|
// documentTypeModel.setContentItemClass(sectionIdentifierParam);
|
||||||
|
// documentTypeModel.setDescriptions(
|
||||||
|
// type
|
||||||
|
// .getDescription()
|
||||||
|
// .getValues()
|
||||||
|
// .entrySet()
|
||||||
|
// .stream()
|
||||||
|
// .collect(Collectors.toMap(
|
||||||
|
// entry -> entry.getKey().toString(),
|
||||||
|
// entry -> entry.getValue()
|
||||||
|
// ))
|
||||||
|
// );
|
||||||
|
// documentTypeModel.setLabels(
|
||||||
|
// type
|
||||||
|
// .getLabel()
|
||||||
|
// .getValues()
|
||||||
|
// .entrySet()
|
||||||
|
// .stream()
|
||||||
|
// .collect(Collectors.toMap(
|
||||||
|
// entry -> entry.getKey().toString(),
|
||||||
|
// entry -> entry.getValue()
|
||||||
|
// ))
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// final LifecycleDefinition defaultLifecycle = type.getDefaultLifecycle();
|
||||||
|
// documentTypeModel.setLifecycles(
|
||||||
|
// section
|
||||||
|
// .getLifecycleDefinitions()
|
||||||
|
// .stream()
|
||||||
|
// .map(
|
||||||
|
// def -> buildLifecycleModel(
|
||||||
|
// def, def.equals(defaultLifecycle)
|
||||||
|
// )
|
||||||
|
// ).collect(Collectors.toList())
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// final Workflow defaultWorkflow = type.getDefaultWorkflow();
|
||||||
|
// documentTypeModel.setWorkflows(
|
||||||
|
// section
|
||||||
|
// .getWorkflowTemplates()
|
||||||
|
// .stream()
|
||||||
|
// .map(
|
||||||
|
// template -> buildWorkflowModel(
|
||||||
|
// template, template.equals(defaultWorkflow)
|
||||||
|
// )
|
||||||
|
// ).collect(Collectors.toList())
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// return "org/librecms/ui/contentsection/configuration/documenttype.xhtml";
|
||||||
|
// }
|
||||||
|
@POST
|
||||||
|
@Path("/{documentType}")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String updateDocumentType(
|
||||||
|
@PathParam("sectionIdentifier") final String sectionIdentifierParam,
|
||||||
|
@PathParam("documentType") final String documentTypeParam,
|
||||||
|
@FormParam("defaultLifecycleUuid") final String defaultLifecycleUuid,
|
||||||
|
@FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid,
|
||||||
|
@FormParam("roleUuids") final Set<String> roleUuids
|
||||||
|
) {
|
||||||
|
final Identifier sectionIdentifier = identifierParser.parseIdentifier(
|
||||||
|
sectionIdentifierParam
|
||||||
|
);
|
||||||
|
|
||||||
|
final Optional<ContentSection> sectionResult;
|
||||||
|
switch (sectionIdentifier.getType()) {
|
||||||
|
case ID:
|
||||||
|
sectionResult = sectionRepo.findById(
|
||||||
|
Long.parseLong(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case UUID:
|
||||||
|
sectionResult = sectionRepo.findByUuid(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sectionResult = sectionRepo.findByLabel(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sectionResult.isPresent()) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
}
|
||||||
|
final ContentSection section = sectionResult.get();
|
||||||
|
sectionModel.setSection(section);
|
||||||
|
|
||||||
|
if (!permissionChecker.isPermitted(
|
||||||
|
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
|
||||||
|
)) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
final Optional<ContentType> typeResult = section
|
||||||
|
.getContentTypes()
|
||||||
|
.stream()
|
||||||
|
.filter(type -> type.getContentItemClass().equals(documentTypeParam))
|
||||||
|
.findAny();
|
||||||
|
|
||||||
|
if (!typeResult.isPresent()) {
|
||||||
|
return "org/librecms/ui/contentsection/configuration/documenttype-not-found.xhtml";
|
||||||
|
}
|
||||||
|
final ContentType type = typeResult.get();
|
||||||
|
|
||||||
|
final Optional<LifecycleDefinition> defaultLifecycle = section
|
||||||
|
.getLifecycleDefinitions()
|
||||||
|
.stream()
|
||||||
|
.filter(def -> def.getUuid().equals(defaultLifecycleUuid))
|
||||||
|
.findAny();
|
||||||
|
|
||||||
|
if (!defaultLifecycle.isPresent()) {
|
||||||
|
models.put(
|
||||||
|
"errors",
|
||||||
|
cmsAdminMessages.getMessage(
|
||||||
|
"contentsection.configuration.documenttypes.selected_lifecycle_not_available",
|
||||||
|
new String[]{defaultLifecycleUuid}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return listDocumentTypes(sectionIdentifierParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Optional<Workflow> defaultWorkflow = section
|
||||||
|
.getWorkflowTemplates()
|
||||||
|
.stream()
|
||||||
|
.filter(def -> def.getUuid().equals(defaultWorkflowUuid))
|
||||||
|
.findAny();
|
||||||
|
|
||||||
|
if (!defaultWorkflow.isPresent()) {
|
||||||
|
models.put(
|
||||||
|
"errors",
|
||||||
|
cmsAdminMessages.getMessage(
|
||||||
|
"contentsection.configuration.documenttypes.selected_workflow_not_available",
|
||||||
|
new String[]{defaultWorkflowUuid}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return listDocumentTypes(sectionIdentifierParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
typeManager
|
||||||
|
.setDefaultLifecycle(type, defaultLifecycle.get());
|
||||||
|
typeManager.setDefaultWorkflow(
|
||||||
|
type, defaultWorkflow.get()
|
||||||
|
);
|
||||||
|
|
||||||
|
for (final Role role : section.getRoles()) {
|
||||||
|
if (roleUuids.contains(role.getUuid())) {
|
||||||
|
typeManager.grantUsageOfType(type, role);
|
||||||
|
} else {
|
||||||
|
typeManager.denyUsageOnType(type, role);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format(
|
||||||
|
"redirect:%s/configuration/documenttypes/",
|
||||||
|
sectionIdentifierParam
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @POST
|
||||||
|
// @Path("/{documentType}/default-workflow")
|
||||||
|
// public String setDefaultWorkflow(
|
||||||
|
// @PathParam("sectionIdentifier") final String sectionIdentifierParam,
|
||||||
|
// @PathParam("documentType") final String documentTypeParam,
|
||||||
|
// @FormParam("defaultWorkflowUuid") final String defaultWorkflowUuid
|
||||||
|
// ) {
|
||||||
|
// final Identifier sectionIdentifier = identifierParser.parseIdentifier(
|
||||||
|
// sectionIdentifierParam
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// final Optional<ContentSection> sectionResult;
|
||||||
|
// switch (sectionIdentifier.getType()) {
|
||||||
|
// case ID:
|
||||||
|
// sectionResult = sectionRepo.findById(
|
||||||
|
// Long.parseLong(
|
||||||
|
// sectionIdentifier.getIdentifier()
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// case UUID:
|
||||||
|
// sectionResult = sectionRepo.findByUuid(
|
||||||
|
// sectionIdentifier.getIdentifier()
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// sectionResult = sectionRepo.findByLabel(
|
||||||
|
// sectionIdentifier.getIdentifier()
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!sectionResult.isPresent()) {
|
||||||
|
// models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
// return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
// }
|
||||||
|
// final ContentSection section = sectionResult.get();
|
||||||
|
// sectionModel.setSection(section);
|
||||||
|
//
|
||||||
|
// if (!permissionChecker.isPermitted(
|
||||||
|
// AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
|
||||||
|
// )) {
|
||||||
|
// models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
// return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final Optional<ContentType> typeResult = section
|
||||||
|
// .getContentTypes()
|
||||||
|
// .stream()
|
||||||
|
// .filter(type -> type.getContentItemClass().equals(documentTypeParam))
|
||||||
|
// .findAny();
|
||||||
|
//
|
||||||
|
// if (!typeResult.isPresent()) {
|
||||||
|
// return "org/librecms/ui/contentsection/configuration/documenttype-not-found.xhtml";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// final Optional<Workflow> defaultWorkflow = section
|
||||||
|
// .getWorkflowTemplates()
|
||||||
|
// .stream()
|
||||||
|
// .filter(def -> def.getUuid().equals(defaultWorkflowUuid))
|
||||||
|
// .findAny();
|
||||||
|
//
|
||||||
|
// if (!defaultWorkflow.isPresent()) {
|
||||||
|
// models.put(
|
||||||
|
// "errors",
|
||||||
|
// cmsAdminMessages.getMessage(
|
||||||
|
// "contentsection.configuration.documenttypes.selected_workflow_not_available",
|
||||||
|
// new String[]{defaultWorkflowUuid}
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// return listDocumentTypes(sectionIdentifierParam);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// typeManager.setDefaultWorkflow(
|
||||||
|
// typeResult.get(), defaultWorkflow.get()
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// return String.format(
|
||||||
|
// "redirect:%s/configuration/documenttypes/%s",
|
||||||
|
// sectionIdentifierParam,
|
||||||
|
// documentTypeParam
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
@POST
|
||||||
|
@Path("/{documentType}/@remove")
|
||||||
|
@AuthorizationRequired
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String removeDocumentType(
|
||||||
|
@PathParam("sectionIdentifier") final String sectionIdentifierParam,
|
||||||
|
@PathParam("documentType") final String documentTypeParam
|
||||||
|
) {
|
||||||
|
final Identifier sectionIdentifier = identifierParser.parseIdentifier(
|
||||||
|
sectionIdentifierParam
|
||||||
|
);
|
||||||
|
|
||||||
|
final Optional<ContentSection> sectionResult;
|
||||||
|
switch (sectionIdentifier.getType()) {
|
||||||
|
case ID:
|
||||||
|
sectionResult = sectionRepo.findById(
|
||||||
|
Long.parseLong(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case UUID:
|
||||||
|
sectionResult = sectionRepo.findByUuid(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sectionResult = sectionRepo.findByLabel(
|
||||||
|
sectionIdentifier.getIdentifier()
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sectionResult.isPresent()) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/contentsection-not-found.xhtml";
|
||||||
|
}
|
||||||
|
final ContentSection section = sectionResult.get();
|
||||||
|
sectionModel.setSection(section);
|
||||||
|
|
||||||
|
if (!permissionChecker.isPermitted(
|
||||||
|
AdminPrivileges.ADMINISTER_CONTENT_TYPES, section
|
||||||
|
)) {
|
||||||
|
models.put("sectionIdentifier", sectionIdentifier);
|
||||||
|
return "org/librecms/ui/contentsection/access-denied.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
final Optional<ContentType> typeResult = section
|
||||||
|
.getContentTypes()
|
||||||
|
.stream()
|
||||||
|
.filter(type -> type.getContentItemClass().equals(documentTypeParam))
|
||||||
|
.findAny();
|
||||||
|
|
||||||
|
if (!typeResult.isPresent()) {
|
||||||
|
return "org/librecms/ui/contentsection/configuration/documenttype-not-found.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
final ContentTypeInfo typeInfo = typesManager.getContentTypeInfo(
|
||||||
|
typeResult.get()
|
||||||
|
);
|
||||||
|
|
||||||
|
sectionManager.removeContentTypeFromSection(
|
||||||
|
typeInfo.getContentItemClass(), section
|
||||||
|
);
|
||||||
|
|
||||||
|
return String.format(
|
||||||
|
"redirect:%s/configuration/documenttypes/",
|
||||||
|
sectionIdentifierParam
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocumentTypesTableRowModel buildDocumentTypesTableRowModel(
|
||||||
|
final ContentType type
|
||||||
|
) {
|
||||||
|
final ContentTypeInfo typeInfo = typesManager
|
||||||
|
.getContentTypeInfo(type);
|
||||||
|
|
||||||
|
final DocumentTypesTableRowModel model
|
||||||
|
= new DocumentTypesTableRowModel();
|
||||||
|
model.setDisplayName(type.getDisplayName());
|
||||||
|
model.setUuid(type.getUuid());
|
||||||
|
|
||||||
|
model.setContentItemClass(type.getContentItemClass());
|
||||||
|
|
||||||
|
model.setDefaultLifecycleLabel(
|
||||||
|
Optional
|
||||||
|
.ofNullable(type.getDefaultLifecycle())
|
||||||
|
.map(
|
||||||
|
lifecycle -> globalizationHelper
|
||||||
|
.getValueFromLocalizedString(
|
||||||
|
lifecycle.getLabel()
|
||||||
|
)
|
||||||
|
).orElse("")
|
||||||
|
);
|
||||||
|
model.setDefaultLifecycleUuid(
|
||||||
|
Optional
|
||||||
|
.ofNullable(type.getDefaultLifecycle())
|
||||||
|
.map(LifecycleDefinition::getUuid)
|
||||||
|
.map(uuid -> Arrays.asList(new String[]{uuid}))
|
||||||
|
.orElse(Collections.emptyList())
|
||||||
|
);
|
||||||
|
model.setDefaultWorkflowLabel(
|
||||||
|
Optional
|
||||||
|
.ofNullable(type.getDefaultWorkflow())
|
||||||
|
.map(
|
||||||
|
workflow -> globalizationHelper.getValueFromLocalizedString(
|
||||||
|
workflow.getName()
|
||||||
|
)
|
||||||
|
).orElse("")
|
||||||
|
);
|
||||||
|
model.setDefaultWorkflowUuid(
|
||||||
|
Optional
|
||||||
|
.ofNullable(type.getDefaultWorkflow())
|
||||||
|
.map(Workflow::getUuid)
|
||||||
|
.map(uuid -> Arrays.asList(new String[]{uuid}))
|
||||||
|
.orElse(Collections.emptyList())
|
||||||
|
);
|
||||||
|
final LocalizedTextsUtil labelUtil = globalizationHelper
|
||||||
|
.getLocalizedTextsUtil(typeInfo.getLabelBundle());
|
||||||
|
model.setLabel(labelUtil.getText(typeInfo.getLabelKey()));
|
||||||
|
|
||||||
|
final LocalizedTextsUtil descUtil = globalizationHelper
|
||||||
|
.getLocalizedTextsUtil(typeInfo.getDescriptionBundle());
|
||||||
|
model.setDescription(descUtil.getText(typeInfo.getDescriptionKey()));
|
||||||
|
model.setMode(
|
||||||
|
Optional
|
||||||
|
.ofNullable(type.getMode())
|
||||||
|
.map(ContentTypeMode::toString)
|
||||||
|
.orElse("")
|
||||||
|
);
|
||||||
|
|
||||||
|
model.setPermissions(
|
||||||
|
type
|
||||||
|
.getContentSection()
|
||||||
|
.getRoles()
|
||||||
|
.stream()
|
||||||
|
.map(role -> buildDocumentTypePermissionModel(type, role))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocumentTypeInfoModel buildDocumentTypeInfoModel(
|
||||||
|
final ContentTypeInfo typeInfo
|
||||||
|
) {
|
||||||
|
final DocumentTypeInfoModel model = new DocumentTypeInfoModel();
|
||||||
|
model.setContentItemClass(typeInfo.getContentItemClass().getName());
|
||||||
|
|
||||||
|
final LocalizedTextsUtil labelUtil = globalizationHelper
|
||||||
|
.getLocalizedTextsUtil(typeInfo.getLabelBundle());
|
||||||
|
model.setLabel(labelUtil.getText(typeInfo.getLabelKey()));
|
||||||
|
|
||||||
|
final LocalizedTextsUtil descUtil = globalizationHelper
|
||||||
|
.getLocalizedTextsUtil(typeInfo.getDescriptionBundle());
|
||||||
|
model.setDescription(descUtil.getText(typeInfo.getDescriptionKey()));
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocumentTypeLifecycleModel buildLifecycleModel(
|
||||||
|
final LifecycleDefinition definition,
|
||||||
|
final boolean defaultLifecycle
|
||||||
|
) {
|
||||||
|
final DocumentTypeLifecycleModel model
|
||||||
|
= new DocumentTypeLifecycleModel();
|
||||||
|
model.setDefaultLifecycle(defaultLifecycle);
|
||||||
|
model.setDefinitionId(definition.getDefinitionId());
|
||||||
|
model.setDescription(
|
||||||
|
globalizationHelper.getValueFromLocalizedString(
|
||||||
|
definition.getDescription()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
model.setLabel(
|
||||||
|
globalizationHelper.getValueFromLocalizedString(
|
||||||
|
definition.getLabel()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
model.setUuid(definition.getUuid());
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocumentTypeWorkflowModel buildWorkflowModel(
|
||||||
|
final Workflow workflow, final boolean defaultWorkflow
|
||||||
|
) {
|
||||||
|
final DocumentTypeWorkflowModel model = new DocumentTypeWorkflowModel();
|
||||||
|
model.setDefaultWorkflow(defaultWorkflow);
|
||||||
|
model.setDescription(
|
||||||
|
globalizationHelper.getValueFromLocalizedString(
|
||||||
|
workflow.getDescription()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
model.setName(
|
||||||
|
globalizationHelper.getValueFromLocalizedString(
|
||||||
|
workflow.getName()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
model.setUuid(workflow.getUuid());
|
||||||
|
model.setWorkflowId(workflow.getWorkflowId());
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocumentTypePermissionModel buildDocumentTypePermissionModel(
|
||||||
|
final ContentType type, final Role role
|
||||||
|
) {
|
||||||
|
final DocumentTypePermissionModel model
|
||||||
|
= new DocumentTypePermissionModel();
|
||||||
|
model.setRoleName(role.getName());
|
||||||
|
model.setRoleUuid(role.getUuid());
|
||||||
|
model.setCanUse(
|
||||||
|
permissionChecker.isPermitted(TypePrivileges.USE_TYPE, type, role)
|
||||||
|
);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,7 @@ public class ContentSectionApplication extends Application {
|
||||||
classes.add(AssetFolderController.class);
|
classes.add(AssetFolderController.class);
|
||||||
classes.add(CategoriesController.class);
|
classes.add(CategoriesController.class);
|
||||||
classes.add(ConfigurationController.class);
|
classes.add(ConfigurationController.class);
|
||||||
|
classes.add(ConfigurationDocumentTypesController.class);
|
||||||
classes.add(ConfigurationRolesController.class);
|
classes.add(ConfigurationRolesController.class);
|
||||||
classes.add(ContentSectionController.class);
|
classes.add(ContentSectionController.class);
|
||||||
classes.add(DocumentFolderController.class);
|
classes.add(DocumentFolderController.class);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class DocumentTypeInfoModel {
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String contentItemClass;
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(final String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContentItemClass() {
|
||||||
|
return contentItemClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentItemClass(final String contentItemClass) {
|
||||||
|
this.contentItemClass = contentItemClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class DocumentTypeLifecycleModel {
|
||||||
|
|
||||||
|
private long definitionId;
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private boolean defaultLifecycle;
|
||||||
|
|
||||||
|
public long getDefinitionId() {
|
||||||
|
return definitionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefinitionId(final long definitionId) {
|
||||||
|
this.definitionId = definitionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(final String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(final String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefaultLifecycle() {
|
||||||
|
return defaultLifecycle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultLifecycle(final boolean defaultLifecycle) {
|
||||||
|
this.defaultLifecycle = defaultLifecycle;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Named("CmsDocumentTypeModel")
|
||||||
|
public class DocumentTypeModel {
|
||||||
|
|
||||||
|
private String displayName;
|
||||||
|
|
||||||
|
private String contentItemClass;
|
||||||
|
|
||||||
|
private Map<String, String> labels;
|
||||||
|
|
||||||
|
private Map<String, String> descriptions;
|
||||||
|
|
||||||
|
private List<DocumentTypeLifecycleModel> lifecycles;
|
||||||
|
|
||||||
|
private List<DocumentTypeWorkflowModel> workflows;
|
||||||
|
|
||||||
|
public String getContentItemClass() {
|
||||||
|
return contentItemClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentItemClass(final String contentItemClass) {
|
||||||
|
this.contentItemClass = contentItemClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getLabels() {
|
||||||
|
return Collections.unmodifiableMap(labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabels(final Map<String, String> labels) {
|
||||||
|
this.labels = new HashMap<>(labels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getDescriptions() {
|
||||||
|
return Collections.unmodifiableMap(descriptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescriptions(final Map<String, String> descriptions) {
|
||||||
|
this.descriptions = new HashMap<>(descriptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DocumentTypeLifecycleModel> getLifecycles() {
|
||||||
|
return Collections.unmodifiableList(lifecycles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLifecycles(
|
||||||
|
final List<DocumentTypeLifecycleModel> lifecyles
|
||||||
|
) {
|
||||||
|
this.lifecycles = new ArrayList<>(lifecyles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DocumentTypeWorkflowModel> getWorkflows() {
|
||||||
|
return Collections.unmodifiableList(workflows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkflows(final List<DocumentTypeWorkflowModel> workflows) {
|
||||||
|
this.workflows = new ArrayList<>(workflows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayName(String displayName) {
|
||||||
|
this.displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class DocumentTypePermissionModel {
|
||||||
|
|
||||||
|
private String roleUuid;
|
||||||
|
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
private boolean canUse;
|
||||||
|
|
||||||
|
public String getRoleUuid() {
|
||||||
|
return roleUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleUuid(final String roleUuid) {
|
||||||
|
this.roleUuid = roleUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(final String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCanUse() {
|
||||||
|
return canUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanUse(final boolean canUse) {
|
||||||
|
this.canUse = canUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class DocumentTypeWorkflowModel {
|
||||||
|
|
||||||
|
private long workflowId;
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private boolean defaultWorkflow;
|
||||||
|
|
||||||
|
public long getWorkflowId() {
|
||||||
|
return workflowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkflowId(final long workflowId) {
|
||||||
|
this.workflowId = workflowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(final String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefaultWorkflow() {
|
||||||
|
return defaultWorkflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultWorkflow(final boolean defaultWorkflow) {
|
||||||
|
this.defaultWorkflow = defaultWorkflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Named("CmsDocumentTypesModel")
|
||||||
|
public class DocumentTypesModel {
|
||||||
|
|
||||||
|
private List<DocumentTypesTableRowModel> assignedTypes;
|
||||||
|
|
||||||
|
private Map<String, DocumentTypeInfoModel> availableTypes;
|
||||||
|
|
||||||
|
private Map<String, String> availableLifecycles;
|
||||||
|
|
||||||
|
private Map<String, String> availableWorkflows;
|
||||||
|
|
||||||
|
public List<DocumentTypesTableRowModel> getAssignedTypes() {
|
||||||
|
return Collections.unmodifiableList(assignedTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAssignedTypes(
|
||||||
|
final List<DocumentTypesTableRowModel> assignedTypes
|
||||||
|
) {
|
||||||
|
this.assignedTypes = new ArrayList<>(assignedTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, DocumentTypeInfoModel> getAvailableTypes() {
|
||||||
|
return Collections.unmodifiableMap(availableTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailableTypes(
|
||||||
|
final Map<String, DocumentTypeInfoModel> availableTypes
|
||||||
|
) {
|
||||||
|
this.availableTypes = new HashMap<>(availableTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getAvailableLifecycles() {
|
||||||
|
return Collections.unmodifiableMap(availableLifecycles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailableLifecycles(
|
||||||
|
final Map<String, String> availableLifecycles
|
||||||
|
) {
|
||||||
|
this.availableLifecycles = new HashMap<>(availableLifecycles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getAvailableWorkflows() {
|
||||||
|
return Collections.unmodifiableMap(availableWorkflows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailableWorkflows(
|
||||||
|
final Map<String, String> availableWorkflows
|
||||||
|
) {
|
||||||
|
this.availableWorkflows = new HashMap<>(availableWorkflows);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class DocumentTypesTableRowModel {
|
||||||
|
|
||||||
|
private String displayName;
|
||||||
|
|
||||||
|
private String contentItemClass;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String mode;
|
||||||
|
|
||||||
|
private String defaultLifecycleLabel;
|
||||||
|
|
||||||
|
private List<String> defaultLifecycleUuid;
|
||||||
|
|
||||||
|
private String defaultWorkflowLabel;
|
||||||
|
|
||||||
|
private List<String> defaultWorkflowUuid;
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
private List<DocumentTypePermissionModel> permissions;
|
||||||
|
|
||||||
|
public String getContentItemClass() {
|
||||||
|
return contentItemClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentItemClass(final String contentItemClass) {
|
||||||
|
this.contentItemClass = contentItemClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(final String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMode() {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMode(final String mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultLifecycleLabel() {
|
||||||
|
return defaultLifecycleLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultLifecycleLabel(final String defaultLifecycleLabel) {
|
||||||
|
this.defaultLifecycleLabel = defaultLifecycleLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultWorkflowLabel() {
|
||||||
|
return defaultWorkflowLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultWorkflowLabel(final String defaultWorkflowLabel) {
|
||||||
|
this.defaultWorkflowLabel = defaultWorkflowLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayName(final String displayName) {
|
||||||
|
this.displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(final String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDefaultLifecycleUuid() {
|
||||||
|
return Collections.unmodifiableList(defaultLifecycleUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultLifecycleUuid(final List<String> defaultLifecycleUuid) {
|
||||||
|
this.defaultLifecycleUuid = new ArrayList<>(defaultLifecycleUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDefaultWorkflowUuid() {
|
||||||
|
return Collections.unmodifiableList(defaultWorkflowUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultWorkflowUuid(final List<String> defaultWorkflowUuid) {
|
||||||
|
this.defaultWorkflowUuid = new ArrayList<>(defaultWorkflowUuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DocumentTypePermissionModel> getPermissions() {
|
||||||
|
return Collections.unmodifiableList(permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(
|
||||||
|
final List<DocumentTypePermissionModel> permissions) {
|
||||||
|
this.permissions = new ArrayList<>(permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link #{activeConfPage == 'contenttypes' ? 'active' : ''}"
|
<a class="nav-link #{activeConfPage == 'documentTypes' ? 'active' : ''}"
|
||||||
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/contenttypes">
|
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/documenttypes">
|
||||||
#{CmsAdminMessages['contentsection.configuration.contenttypes.title']}
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.title']}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,315 @@
|
||||||
|
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||||
|
<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:cms="http://xmlns.jcp.org/jsf/composite/components/cms"
|
||||||
|
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="configuration" />
|
||||||
|
<ui:param name="title"
|
||||||
|
value="#{CmsAdminMessages['contentsection.configuration.documenttypes.title']}" />
|
||||||
|
|
||||||
|
<ui:define name="breadcrumb">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.title']}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li aria-current="page" class="breadcrumb-item">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.title']}
|
||||||
|
</li>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
<ui:define name="main">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<ui:include src="configuration-tabs.xhtml">
|
||||||
|
<ui:param name="activeConfPage" value="documentTypes" />
|
||||||
|
</ui:include>
|
||||||
|
|
||||||
|
<h1>#{CmsAdminMessages['contentsection.configuration.documenttypes.title']}</h1>
|
||||||
|
|
||||||
|
<c:if test="#{not empty errors}">
|
||||||
|
<c:forEach items="#{errors}" var="error">
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
#{error}
|
||||||
|
</div>
|
||||||
|
</c:forEach>
|
||||||
|
</c:if>
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
<div class="text-right">
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#add-documenttype-dialog"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="plus-circle" />
|
||||||
|
<span>#{CmsAdminMessages['contentsection.configuration.documenttypes.add']}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div aria-hidden="true"
|
||||||
|
aria-labelledby="add-documenttype-dialog-title"
|
||||||
|
class="modal fade"
|
||||||
|
id="add-documenttype-dialog"
|
||||||
|
tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/documenttypes"
|
||||||
|
class="modal-content"
|
||||||
|
method="post">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2 class="modal-title"
|
||||||
|
id="add-documenttype-dialog-title">
|
||||||
|
#{CmsAdminMessages.getMessage('contentsection.configuration.documentypes.add.dialog.title', [ContentSectionModel.sectionName])}
|
||||||
|
</h2>
|
||||||
|
<button aria-label="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.cancel']}"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="x" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<bootstrap:formGroupSelect help="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.type.help']}"
|
||||||
|
inputId="add-documenttype-dialog-type"
|
||||||
|
name="contentItemClass"
|
||||||
|
label="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.type.label']}"
|
||||||
|
options="#{CmsDocumentTypesModel.availableTypes}"
|
||||||
|
/>
|
||||||
|
<bootstrap:formGroupSelect help="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.default_lifecycle.help']}"
|
||||||
|
inputId="add-documenttype-dialog-default-lifecycle"
|
||||||
|
name="defaultLifecycleUuid"
|
||||||
|
label="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.default_lifecycle.label']}"
|
||||||
|
options="#{CmsDocumentTypesModel.availableLifecycles}"
|
||||||
|
/>
|
||||||
|
<bootstrap:formGroupSelect help="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.default_workflow.help']}"
|
||||||
|
inputId="add-documenttype-dialog-default-lifecycle"
|
||||||
|
name="defaultWorkflowUuid"
|
||||||
|
label="#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.default_workflow.label']}"
|
||||||
|
options="#{CmsDocumentTypesModel.availableWorkflows}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-warning"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.cancel']}
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
type="submit" >
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.add.dialog.submit']}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.cols.label']}
|
||||||
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.cols.item_class']}
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.cols.default_lifecycle']}
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.cols.default_workflow']}
|
||||||
|
</th>
|
||||||
|
<th class="text-center" colspan="3">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.cols.actions']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="#{CmsDocumentTypesModel.assignedTypes}"
|
||||||
|
var="type">
|
||||||
|
<tr>
|
||||||
|
<td>#{type.label}</td>
|
||||||
|
<td>#{type.contentItemClass}</td>
|
||||||
|
<td>#{type.defaultLifecycleLabel}</td>
|
||||||
|
<td>#{type.defaultWorkflowLabel}</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-info"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#documenttype-#{type.uuid}-info-dialog"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="info-circle" />
|
||||||
|
<span class="sr-only">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.info_button.label']}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<div aria-hidden="true"
|
||||||
|
aria-labelledby="documenttype-#{type.uuid}-info-dialog-title"
|
||||||
|
class="modal fade"
|
||||||
|
id="documenttype-#{type.uuid}-info-dialog"
|
||||||
|
tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2 id="documenttype-#{type.uuid}-info-dialog-title">
|
||||||
|
#{CmsAdminMessages.getMessage('contentsection.configuration.documenttypes.info.dialog.title', [type.label])}
|
||||||
|
</h2>
|
||||||
|
<button aria-label="#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.cancel']}"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="x" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<h3>
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.description']}
|
||||||
|
</h3>
|
||||||
|
<p>
|
||||||
|
#{type.description}
|
||||||
|
</p>
|
||||||
|
<h3>#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.permissions']}</h3>
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.permissions.role']}
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.permissions.canuse']}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="#{type.permissions}"
|
||||||
|
var="permission">
|
||||||
|
<tr>
|
||||||
|
<td>#{permission.roleName}</td>
|
||||||
|
<td class="text-center font-weight-bold #{permission.canUse ? 'text-success' : 'text-danger'}">
|
||||||
|
<c:choose>
|
||||||
|
<c:when test="#{permission.canUse}">
|
||||||
|
<bootstrap:svgIcon icon="check" />
|
||||||
|
<span class="sr-only">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.permissions.canuse.yes']}
|
||||||
|
</span>
|
||||||
|
</c:when>
|
||||||
|
<c:otherwise>
|
||||||
|
<bootstrap:svgIcon icon="x"/>
|
||||||
|
<span class="sr-only">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.permissions.canuse.no']}
|
||||||
|
</span>
|
||||||
|
</c:otherwise>
|
||||||
|
</c:choose>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-warning"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.info.dialog.cancel']}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-info"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#documenttype-#{type.uuid}-edit-dialog"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="pen" />
|
||||||
|
<span>
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.table.edit_button.label']}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<div aria-hidden="true"
|
||||||
|
aria-labelledby="documenttype-#{type.uuid}-edit-dialog-title"
|
||||||
|
class="modal fade"
|
||||||
|
id="documenttype-#{type.uuid}-edit-dialog"
|
||||||
|
tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/documenttypes/#{type.contentItemClass}"
|
||||||
|
class="modal-content"
|
||||||
|
method="post">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2 class="modal-title"
|
||||||
|
id="edit-documenttype-#{type.uuid}-dialog-title">
|
||||||
|
#{CmsAdminMessages.getMessage('contentsection.configuration.documentypes.edit.dialog.title', [ContentSectionModel.sectionName, type.label])}
|
||||||
|
</h2>
|
||||||
|
<button aria-label="#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.cancel']}"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
<bootstrap:svgIcon icon="x" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<bootstrap:formGroupSelect
|
||||||
|
help="#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.default_lifecycle.help']}"
|
||||||
|
inputId="edit-documenttype-#{type.uuid}-dialog-default-lifecycle"
|
||||||
|
name="defaultLifecycleUuid"
|
||||||
|
label="#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.default_lifecycle.label']}"
|
||||||
|
options="#{CmsDocumentTypesModel.availableLifecycles}"
|
||||||
|
selectedOptions="#{type.defaultLifecycleUuid}"
|
||||||
|
/>
|
||||||
|
<bootstrap:formGroupSelect
|
||||||
|
help="#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.default_workflow.help']}"
|
||||||
|
inputId="edit-documenttype-#{type.uuid}-dialog-default-lifecycle"
|
||||||
|
name="defaultWorkflowUuid"
|
||||||
|
label="#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.default_workflow.label']}"
|
||||||
|
options="#{CmsDocumentTypesModel.availableWorkflows}"
|
||||||
|
selectedOptions="#{type.defaultWorkflowUuid}"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h3>#{CmsAdminMessages['contentsection.configuration.documenttypes.info.edit_dialog.permissions']}</h3>
|
||||||
|
<c:forEach items="#{type.permissions}"
|
||||||
|
var="permission">
|
||||||
|
<bootstrap:formCheck
|
||||||
|
checked="#{permission.canUse}"
|
||||||
|
inputId="edit-documenttype-#{type.uuid}-dialog-#{permission.roleName}-canuse"
|
||||||
|
label="#{permission.roleName}"
|
||||||
|
name="roleUuids"
|
||||||
|
value="#{permission.roleUuid}"
|
||||||
|
/>
|
||||||
|
</c:forEach>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-warning"
|
||||||
|
data-dismiss="modal"
|
||||||
|
type="button">
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.cancel']}
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
type="submit" >
|
||||||
|
#{CmsAdminMessages['contentsection.configuration.documenttypes.edit.dialog.submit']}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<libreccm:deleteDialog
|
||||||
|
actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/documenttypes/#{type.contentItemClass}/@remove"
|
||||||
|
buttonText="#{CmsAdminMessages['contentsection.configuration.documenttypes.remove_button.label']}"
|
||||||
|
cancelLabel="#{CmsAdminMessages['contentsection.configuration.documenttypes.remove_dialog.cancel']}"
|
||||||
|
confirmLabel="#{CmsAdminMessages['contentsection.configuration.documenttypes.remove_dialog.confirm']}"
|
||||||
|
dialogId="documenttype-#{type.uuid}-remove-dialog-title"
|
||||||
|
dialogTitle="#{CmsAdminMessages['contentsection.configuration.documenttypes.remove_dialog.title']}"
|
||||||
|
message="#{CmsAdminMessages.getMessage('contentsection.configuration.documenttypes.remove_dialog.message', [ContentSectionModel.sectionName, type.label])}"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ui:define>
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
id="configuration-contenttypes-body">
|
id="configuration-contenttypes-body">
|
||||||
<h2 class="card-title">
|
<h2 class="card-title">
|
||||||
<a class="stretched-link"
|
<a class="stretched-link"
|
||||||
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/contenttypes">
|
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/documenttypes">
|
||||||
#{CmsAdminMessages['contentsection.configuration.contenttypes.title']}
|
#{CmsAdminMessages['contentsection.configuration.contenttypes.title']}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ contentsections.categorystems.category.objects.none=No objects in this category
|
||||||
contentsection.configuration.heading=Configuration of Content Section {0}
|
contentsection.configuration.heading=Configuration of Content Section {0}
|
||||||
contentsection.configuration.roles.title=Roles
|
contentsection.configuration.roles.title=Roles
|
||||||
contentsection.configuration.roles.description=Manage roles for this content section
|
contentsection.configuration.roles.description=Manage roles for this content section
|
||||||
contentsection.configuration.contenttypes.title=Content Types
|
contentsection.configuration.contenttypes.title=Document Types
|
||||||
contentsection.configuration.contenttypes.description=Manage the document types available in this content section
|
contentsection.configuration.contenttypes.description=Manage the document types available in this content section
|
||||||
contentsection.configuration.lifecycles.title=Lifecycles
|
contentsection.configuration.lifecycles.title=Lifecycles
|
||||||
contentsection.configuration.lifecycles.description=Manage lifecycles for documents in this content section
|
contentsection.configuration.lifecycles.description=Manage lifecycles for documents in this content section
|
||||||
|
|
@ -382,3 +382,45 @@ contentsection.configuration.roles.role_details.description.value.label=Localize
|
||||||
contentsection.configuration.roles.role_details.description.edit.value.label=Localized description
|
contentsection.configuration.roles.role_details.description.edit.value.label=Localized description
|
||||||
contentsection.configuration.roles.role_details.description.remove.text=Are you sure to remove the following localized description
|
contentsection.configuration.roles.role_details.description.remove.text=Are you sure to remove the following localized description
|
||||||
contentsection.configuration.roles.role_details.description.remove.title=Remove localized description
|
contentsection.configuration.roles.role_details.description.remove.title=Remove localized description
|
||||||
|
contentsection.configuration.documenttypes.type_not_available=Document type {1} is not available for content section {0}.
|
||||||
|
contentsection.configuration.documenttypes.selected_lifecycle_not_available=Content Section {0} has no lifecycle {1}.
|
||||||
|
contentsection.configuration.documenttypes.selected_workflow_not_available=Content Section {0} has no workflow {1}.
|
||||||
|
contentsection.configuration.documenttypes.title=Document Types
|
||||||
|
contentsection.configuration.documenttypes.add=Add document type
|
||||||
|
contentsection.configuration.documentypes.add.dialog.title=Add document type to Content Section {0}
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.cancel=Cancel
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.type.help=Choose the document Type to add
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.type.label=Document type
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_lifecycle.help=Default Lifecycle for the document typ
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_lifecycle.label=Default Lifecycle
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_workflow.help=Default Workflow for the document typ
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_workflow.label=Default Workflow
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.submit=Add document type
|
||||||
|
contentsection.configuration.documenttypes.table.cols.label=Label
|
||||||
|
contentsection.configuration.documenttypes.table.cols.item_class=Content Item Class
|
||||||
|
contentsection.configuration.documenttypes.table.cols.default_lifecycle=Default Lifecycle
|
||||||
|
contentsection.configuration.documenttypes.table.cols.default_workflow=Default Workflow
|
||||||
|
contentsection.configuration.documenttypes.table.cols.actions=Actions
|
||||||
|
contentsection.configuration.documenttypes.table.info_button.label=Show details of the document type
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.title=Details Document Type {0}
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.description=Description
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions=Permissions
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.role=Role
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.canuse=Can use?
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.canuse.yes=Yes
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.canuse.no=No
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.cancel=Close
|
||||||
|
contentsection.configuration.documenttypes.table.edit_button.label=Edit
|
||||||
|
contentsection.configuration.documentypes.edit.dialog.title=Edit Document Type {1} of Content Section {0}
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.cancel=Cancel
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_lifecycle.help=Default Lifecycle for the document typ
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_lifecycle.label=Default Lifecycle
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_workflow.help=Default Workflow for the document typ
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_workflow.label=Default Workflow
|
||||||
|
contentsection.configuration.documenttypes.info.edit_dialog.permissions=Permissions
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.submit=Apply
|
||||||
|
contentsection.configuration.documenttypes.remove_button.label=Remove
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.cancel=Cancel
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.confirm=Remove Document Type
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.title=Confirm Document Type removal
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.message=Are you sure to remove the document type {1} from content section {0}?
|
||||||
|
|
|
||||||
|
|
@ -383,3 +383,45 @@ contentsection.configuration.roles.role_details.description.value.label=Lokalisi
|
||||||
contentsection.configuration.roles.role_details.description.edit.value.label=Lokalisierte Beschreibung
|
contentsection.configuration.roles.role_details.description.edit.value.label=Lokalisierte Beschreibung
|
||||||
contentsection.configuration.roles.role_details.description.remove.text=Sind Sie sicher, dass Sie die folgende lokalisierte Beschreibung entfernen wollen?
|
contentsection.configuration.roles.role_details.description.remove.text=Sind Sie sicher, dass Sie die folgende lokalisierte Beschreibung entfernen wollen?
|
||||||
contentsection.configuration.roles.role_details.description.remove.title=Lokalisierte Beschreibung entfernen
|
contentsection.configuration.roles.role_details.description.remove.title=Lokalisierte Beschreibung entfernen
|
||||||
|
contentsection.configuration.documenttypes.type_not_available=Dokumententype{1} ist f\u00fcr Content Section {0} nicht verf\u00fcgbar.
|
||||||
|
contentsection.configuration.documenttypes.selected_lifecycle_not_available=Kein Lebenszyklus {1} f\u00fcr Content Section {0} gefunden.
|
||||||
|
contentsection.configuration.documenttypes.selected_workflow_not_available=Kein Arbeitsablauf {1} f\u00fcr Content Section {0} gefunden.
|
||||||
|
contentsection.configuration.documenttypes.title=Dokumenttypen
|
||||||
|
contentsection.configuration.documenttypes.add=Dokumenttyp hinzuf\u00fcgen
|
||||||
|
contentsection.configuration.documentypes.add.dialog.title=Dokumenttyp zur Content Section {0} hinzuf\u00fcgen
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.cancel=Abbrechen
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.type.help=W\u00e4hlen Sie die Dokumenttyp der hinzugef\u00fcgt werden soll
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.type.label=Dokumententyp
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_lifecycle.help=Voreingestellter Lebenszyklus f\u00fcr den Dokumenttyp
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_lifecycle.label=Standard-Lebenszyklus
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_workflow.help=Voreingestellter Arbeitsablauf f\u00fcr den Dokumenttyp
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.default_workflow.label=Standard-Arbeitsablauf
|
||||||
|
contentsection.configuration.documenttypes.add.dialog.submit=Dokumenttyp hinzuf\u00fcgen
|
||||||
|
contentsection.configuration.documenttypes.table.cols.label=Bezeichnung
|
||||||
|
contentsection.configuration.documenttypes.table.cols.item_class=Content Item Klasse
|
||||||
|
contentsection.configuration.documenttypes.table.cols.default_lifecycle=Standard-Lebenszyklus
|
||||||
|
contentsection.configuration.documenttypes.table.cols.default_workflow=Standard-Arbeitablauf
|
||||||
|
contentsection.configuration.documenttypes.table.cols.actions=Aktionen
|
||||||
|
contentsection.configuration.documenttypes.table.info_button.label=Details des Dokumenttyps anzeigen
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.title=Details Dokumenttyp {0}
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.description=Beschreibung
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions=Berechtigungen
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.role=Rolle
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.canuse=Darf verwenden?
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.canuse.yes=Ja
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.permissions.canuse.no=Nein
|
||||||
|
contentsection.configuration.documenttypes.info.dialog.cancel=Schlie\u00dfen
|
||||||
|
contentsection.configuration.documenttypes.table.edit_button.label=Bearbeiten
|
||||||
|
contentsection.configuration.documentypes.edit.dialog.title=Dokument Typ {1} der Content Section {0} bearbeiten
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.cancel=Abbrechen
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_lifecycle.help=Voreingestellter Lebenszyklus f\u00fcr den Dokumenttyp
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_lifecycle.label=Standard-Lebenszyklus
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_workflow.help=Voreingestellter Arbeitsablauf f\u00fcr den Dokumenttyp
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.default_workflow.label=Standard-Arbeitsablauf
|
||||||
|
contentsection.configuration.documenttypes.info.edit_dialog.permissions=Berechtigungen
|
||||||
|
contentsection.configuration.documenttypes.edit.dialog.submit=Anwenden
|
||||||
|
contentsection.configuration.documenttypes.remove_button.label=Entfernen
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.cancel=Abbrechen
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.confirm=Dokumenttyp entfernen
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.title=Entfernen des Dokumenttyps best\u00e4tigen
|
||||||
|
contentsection.configuration.documenttypes.remove_dialog.message=Sind Sie sicher, dass Sie den Dokumenttyp {1} aus der Content Section {0} entfernen wollen?
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@
|
||||||
</cc:interface>
|
</cc:interface>
|
||||||
<cc:implementation>
|
<cc:implementation>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input checked="#{cc.attrs.value ? 'checked': null}"
|
<input checked="#{cc.attrs.checked ? 'checked': null}"
|
||||||
class="form-check-input"
|
class="form-check-input"
|
||||||
id="#{cc.attrs.inputId}"
|
id="#{cc.attrs.inputId}"
|
||||||
name="#{cc.attrs.name}"
|
name="#{cc.attrs.name}"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
value="#{value}" />
|
value="#{cc.attrs.value}" />
|
||||||
<label for="#{cc.attrs.inputId}">#{cc.attrs.label}</label>
|
<label for="#{cc.attrs.inputId}">#{cc.attrs.label}</label>
|
||||||
</div>
|
</div>
|
||||||
</cc:implementation>
|
</cc:implementation>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue