diff --git a/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java b/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java index 242ed8469..33c279a2f 100644 --- a/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java +++ b/ccm-cms/src/main/java/org/librecms/assets/LegalMetadata.java @@ -23,6 +23,9 @@ import com.arsdigita.cms.ui.assets.forms.LegalMetadataForm; import org.librecms.contentsection.Asset; import org.hibernate.envers.Audited; import org.libreccm.l10n.LocalizedString; +import org.librecms.ui.contentsections.assets.LegalMetadataCreateStep; +import org.librecms.ui.contentsections.assets.LegalMetadataEditStep; +import org.librecms.ui.contentsections.assets.MvcAssetEditKit; import java.io.Serializable; import java.util.ArrayList; @@ -49,14 +52,20 @@ import static org.librecms.assets.AssetConstants.*; * * @author Jens Pelzetter */ -@AssetType(assetForm = LegalMetadataForm.class, - labelKey = "legal_metadata.label", - labelBundle = ASSETS_BUNDLE, - descriptionKey = "legal_metadata.description", - descriptionBundle = ASSETS_BUNDLE) @Entity @Table(name = "LEGAL_METADATA", schema = DB_SCHEMA) @Audited +@AssetType( + assetForm = LegalMetadataForm.class, + labelKey = "legal_metadata.label", + labelBundle = ASSETS_BUNDLE, + descriptionKey = "legal_metadata.description", + descriptionBundle = ASSETS_BUNDLE +) +@MvcAssetEditKit( + createStep = LegalMetadataCreateStep.class, + editStep = LegalMetadataEditStep.class +) public class LegalMetadata extends Asset implements Serializable { private static final long serialVersionUID = -5766376031105842907L; @@ -73,11 +82,12 @@ public class LegalMetadata extends Asset implements Serializable { @Embedded @AssociationOverride( name = "values", - joinTable = @JoinTable(name = "LEGAL_METADATA_RIGHTS", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "ASSET_ID") - } + joinTable = @JoinTable( + name = "LEGAL_METADATA_RIGHTS", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "ASSET_ID") + } ) ) private LocalizedString rights; @@ -89,11 +99,13 @@ public class LegalMetadata extends Asset implements Serializable { private String creator; @ElementCollection - @CollectionTable(name = "LEGAL_METADATA_CONTRIBUTORS", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "LEGAL_METADATA_ID") - }) + @CollectionTable( + name = "LEGAL_METADATA_CONTRIBUTORS", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "LEGAL_METADATA_ID") + } + ) @Column(name = "CONTRIBUTORS") private List contributors; @@ -140,6 +152,14 @@ public class LegalMetadata extends Asset implements Serializable { return Collections.unmodifiableList(contributors); } + public void addContributor(final String contributor) { + contributors.add(contributor); + } + + public void removeContributor(final String contributor) { + contributors.remove(contributor); + } + public void setContributors(final List contributors) { this.contributors = new ArrayList<>(contributors); } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/AbstractMvcAssetCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/AbstractMvcAssetCreateStep.java index 63b20015b..8ffab45e9 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/AbstractMvcAssetCreateStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/AbstractMvcAssetCreateStep.java @@ -19,8 +19,8 @@ package org.librecms.ui.contentsections.assets; import org.libreccm.l10n.GlobalizationHelper; +import org.libreccm.l10n.LocalizedString; import org.libreccm.security.AuthorizationRequired; -import org.librecms.assets.PostalAddress; import org.librecms.contentsection.Asset; import org.librecms.contentsection.AssetManager; import org.librecms.contentsection.ContentSection; @@ -54,7 +54,7 @@ public abstract class AbstractMvcAssetCreateStep @Inject private AssetManager assetManager; - + /** * Provides operations for folders. */ @@ -189,7 +189,7 @@ public abstract class AbstractMvcAssetCreateStep public String getAssetType() { return getAssetClass().getName(); } - + @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) @Override @@ -245,7 +245,6 @@ public abstract class AbstractMvcAssetCreateStep final Locale locale = new Locale(initialLocale); // final T asset = createAsset(name, title, locale, folder); - final T asset = assetManager.createAsset( name, title, @@ -254,11 +253,13 @@ public abstract class AbstractMvcAssetCreateStep getAssetClass() ); - return setAssetProperties(asset); + return setAssetProperties(asset, formParams); } protected abstract Class getAssetClass(); - protected abstract String setAssetProperties(final T asset); + protected abstract String setAssetProperties( + final T asset, final Map formParams + ); } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/CmsAssetEditSteps.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/CmsAssetEditSteps.java index f68f9efc9..68ff6730b 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/CmsAssetEditSteps.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/CmsAssetEditSteps.java @@ -18,7 +18,6 @@ */ package org.librecms.ui.contentsections.assets; - import java.util.HashSet; import java.util.Set; @@ -26,27 +25,26 @@ import java.util.Set; * * @author Jens Pelzetter */ -public class CmsAssetEditSteps implements MvcAssetEditSteps { +public class CmsAssetEditSteps implements MvcAssetEditSteps { @Override public Set> getClasses() { final Set> classes = new HashSet<>(); - + + classes.add(LegalMetadataEditStep.class); classes.add(PostalAddressEditStep.class); classes.add(SideNoteEditStep.class); - + return classes; } @Override public Set> getResourceClasses() { final Set> classes = new HashSet<>(); - + classes.add(SideNoteEditStepResources.class); - + return classes; } - - - + } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataCreateStep.java new file mode 100644 index 000000000..b2d263c43 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataCreateStep.java @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2021 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.ui.contentsections.assets; + +import org.libreccm.l10n.GlobalizationHelper; +import org.libreccm.security.AuthorizationRequired; +import org.librecms.assets.LegalMetadata; + +import java.util.Locale; +import java.util.Map; +import java.util.Optional; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.inject.Named; +import javax.transaction.Transactional; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("CmsLegalMetadataCreateStep") +public class LegalMetadataCreateStep + extends AbstractMvcAssetCreateStep { + + private String rightsHolder; + + private String rights; + + private String publisher; + + private String creator; + + @Inject + private GlobalizationHelper globalizationHelper; + + @Override + public String showCreateStep() { + return "org/librecms/ui/contentsection/assets/legalmetadata/create-legalmetadata.xhtml"; + } + + @Override + public String getLabel() { + return globalizationHelper + .getLocalizedTextsUtil(getBundle()) + .getText("legalmetadata.create"); + } + + @Override + public String getDescription() { + return globalizationHelper + .getLocalizedTextsUtil(getBundle()) + .getText("legalmetadata.description"); + } + + @Override + public String getBundle() { + return MvcAssetStepsConstants.BUNDLE; + } + + @Override + protected Class getAssetClass() { + return LegalMetadata.class; + } + + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + protected String setAssetProperties( + final LegalMetadata asset, final Map formParams + ) { + rights = Optional + .ofNullable(formParams.get("rights")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + rightsHolder = Optional + .ofNullable(formParams.get("rightsHolder")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + publisher = Optional + .ofNullable(formParams.get("publisher")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + Optional + .ofNullable(formParams.get("creator")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + + asset.setCreator(creator); + asset.setPublisher(publisher); + asset.getRights().addValue(new Locale(getInitialLocale()), rights); + asset.setRightsHolder(rightsHolder); + + return String.format( + "redirect:/%s/assets/%s/%s/@legalmetadata-edit", + getContentSectionLabel(), + getFolderPath(), + getName() + ); + } + + public String getRightsHolder() { + return rightsHolder; + } + + public String getRights() { + return rights; + } + + public String getPublisher() { + return publisher; + } + + public String getCreator() { + return creator; + } + + public GlobalizationHelper getGlobalizationHelper() { + return globalizationHelper; + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataEditStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataEditStep.java new file mode 100644 index 000000000..8a9ff3325 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataEditStep.java @@ -0,0 +1,368 @@ +/* + * Copyright (C) 2021 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.ui.contentsections.assets; + +import org.libreccm.l10n.GlobalizationHelper; +import org.libreccm.security.AuthorizationRequired; +import org.librecms.assets.LegalMetadata; +import org.librecms.contentsection.AssetRepository; +import org.librecms.ui.contentsections.AssetPermissionsChecker; +import org.librecms.ui.contentsections.ContentSectionNotFoundException; + +import java.util.Locale; +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 Jens Pelzetter + */ +@RequestScoped +@Path(MvcAssetEditSteps.PATH_PREFIX + "legalmetadata-edit") +@Controller +@MvcAssetEditStepDef( + bundle = MvcAssetStepsConstants.BUNDLE, + descriptionKey = "legalmetadata.editstep.description", + labelKey = "legalmetadata.editstep.label", + supportedAssetType = LegalMetadata.class +) +public class LegalMetadataEditStep extends AbstractMvcAssetEditStep { + + @Inject + private AssetStepsDefaultMessagesBundle messageBundle; + + @Inject + private AssetUi assetUi; + + @Inject + private AssetRepository assetRepo; + + @Inject + private GlobalizationHelper globalizationHelper; + + @Inject + private AssetPermissionsChecker assetPermissionsChecker; + + @Inject + private Models models; + + @Inject + private LegalMetadataEditStepModel editStepModel; + + @Override + public Class getStepClass() { + return LegalMetadataEditStep.class; + } + + @Override + protected void init() throws ContentSectionNotFoundException, + AssetNotFoundException { + super.init(); + + if (getAsset() instanceof LegalMetadata) { + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + + editStepModel.setContributors(legalMetadata.getContributors()); + editStepModel.setCreator(legalMetadata.getCreator()); + editStepModel.setPublisher(legalMetadata.getPublisher()); + editStepModel.setRights( + legalMetadata + .getRights() + .getValues() + .entrySet() + .stream() + .collect( + Collectors.toMap( + entry -> entry.getKey().toString(), + entry -> entry.getValue() + ) + ) + ); + editStepModel.setRightsHolder(legalMetadata.getRightsHolder()); + } else { + throw new AssetNotFoundException( + assetUi.showAssetNotFound( + getContentSection(), getAssetPath() + ), + String.format( + "No asset for path %s found in section %s.", + getAssetPath(), + getContentSection().getLabel() + ) + ); + } + + } + + @GET + @Path("/") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + @Override + public String showStep( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + return "org/librecms/ui/contentsection/assets/legalmetadata/edit-legalmetadata.xhtml"; + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + + @POST + @Path("/properties") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String updateProperties( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath, + @FormParam("rightsHolder") final String rightsHolder, + @FormParam("publisher") final String publisher, + @FormParam("creator") final String creator + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + legalMetadata.setRightsHolder(rightsHolder); + legalMetadata.setPublisher(publisher); + legalMetadata.setCreator(creator); + + assetRepo.save(legalMetadata); + + return buildRedirectPathForStep(); + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + + @POST + @Path("/rights/add") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String addRights( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath, + @FormParam("locale") final String localeParam, + @FormParam("value") final String value + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + final Locale locale = new Locale(localeParam); + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + legalMetadata.getRights().addValue(locale, value); + + assetRepo.save(legalMetadata); + + return buildRedirectPathForStep(); + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + + @POST + @Path("/rights/edit/{locale}") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String editRights( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath, + @PathParam("locale") final String localeParam, + @FormParam("value") final String value + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + final Locale locale = new Locale(localeParam); + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + legalMetadata.getRights().addValue(locale, value); + + assetRepo.save(legalMetadata); + + return buildRedirectPathForStep(); + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + + @POST + @Path("/rights/remove/{locale}") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String removeRights( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath, + @PathParam("locale") final String localeParam + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + final Locale locale = new Locale(localeParam); + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + legalMetadata.getRights().removeValue(locale); + + assetRepo.save(legalMetadata); + + return buildRedirectPathForStep(); + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + + @POST + @Path("/contributors/add") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String addContributor( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath, + @FormParam("contributor") final String contributor + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + + legalMetadata.addContributor(contributor); + assetRepo.save(legalMetadata); + + return buildRedirectPathForStep(); + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + + @POST + @Path("/contributors/remove/{index}") + @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) + public String removeContributor( + @PathParam(MvcAssetEditSteps.SECTION_IDENTIFIER_PATH_PARAM) + final String sectionIdentifier, + @PathParam(MvcAssetEditSteps.ASSET_PATH_PATH_PARAM_NAME) + final String assetPath, + @PathParam("index") final int indexParam + ) { + try { + init(); + } catch (ContentSectionNotFoundException ex) { + return ex.showErrorMessage(); + } catch (AssetNotFoundException ex) { + return ex.showErrorMessage(); + } + + if (assetPermissionsChecker.canEditAsset(getAsset())) { + final LegalMetadata legalMetadata = (LegalMetadata) getAsset(); + + final String contributor = legalMetadata + .getContributors() + .get(indexParam); + legalMetadata.removeContributor(contributor); + assetRepo.save(legalMetadata); + + return buildRedirectPathForStep(); + } else { + return assetUi.showAccessDenied( + getContentSection(), + getAsset(), + messageBundle.get("asset.edit.denied")); + } + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataEditStepModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataEditStepModel.java new file mode 100644 index 000000000..84e7248c7 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/LegalMetadataEditStepModel.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2021 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.ui.contentsections.assets; + +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 Jens Pelzetter + */ +@RequestScoped +@Named("CmsLegalMetadataEditStepModel") +public class LegalMetadataEditStepModel { + + private String rightsHolder; + + private Map rights; + + private String publisher; + + private String creator; + + private List contributors; + + public String getRightsHolder() { + return rightsHolder; + } + + protected void setRightsHolder(final String rightsHolder) { + this.rightsHolder = rightsHolder; + } + + public Map getRights() { + return Collections.unmodifiableMap(rights); + } + + protected void setRights(final Map rights) { + this.rights = new HashMap<>(rights); + } + + public String getPublisher() { + return publisher; + } + + protected void setPublisher(final String publisher) { + this.publisher = publisher; + } + + public String getCreator() { + return creator; + } + + protected void setCreator(final String creator) { + this.creator = creator; + } + + public List getContributors() { + return Collections.unmodifiableList(contributors); + } + + protected void setContributors(final List contributors) { + this.contributors = new ArrayList<>(contributors); + } + + + +} diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressCreateStep.java index 1f03cea16..3baf0c1da 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressCreateStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressCreateStep.java @@ -28,6 +28,7 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Locale; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -74,7 +75,36 @@ public class PostalAddressCreateStep @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) @Override - protected String setAssetProperties(final PostalAddress postalAddress) { + protected String setAssetProperties( + final PostalAddress postalAddress, + final Map formParams + ) { + address = Optional + .ofNullable(formParams.get("address")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + postalCode = Optional + .ofNullable(formParams.get("postalCode")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + city = Optional + .ofNullable(formParams.get("city")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + state = Optional + .ofNullable(formParams.get("state")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + isoCountryCode = Optional + .ofNullable(formParams.get("isoCountryCode")) + .filter(value -> value.length > 0) + .map(value -> value[0]) + .orElse(null); + postalAddress.setAddress(address); postalAddress.setPostalCode(postalCode); postalAddress.setCity(city); diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressEditStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressEditStep.java index 688fbba27..b96b82d38 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressEditStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/PostalAddressEditStep.java @@ -21,14 +21,11 @@ package org.librecms.ui.contentsections.assets; import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.security.AuthorizationRequired; import org.librecms.assets.PostalAddress; -import org.librecms.contentsection.AssetManager; import org.librecms.contentsection.AssetRepository; -import org.librecms.contentsection.FolderManager; import org.librecms.ui.contentsections.AssetPermissionsChecker; import org.librecms.ui.contentsections.ContentSectionNotFoundException; import java.util.Arrays; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Locale; diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/SideNoteCreateStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/SideNoteCreateStep.java index baea56933..5cde7b035 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/SideNoteCreateStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/assets/SideNoteCreateStep.java @@ -24,6 +24,7 @@ import org.librecms.assets.SideNote; import org.librecms.contentsection.AssetRepository; import java.util.Locale; +import java.util.Map; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; @@ -44,8 +45,6 @@ public class SideNoteCreateStep extends AbstractMvcAssetCreateStep { @Inject private GlobalizationHelper globalizationHelper; - private String name; - private String text; @Override @@ -84,7 +83,9 @@ public class SideNoteCreateStep extends AbstractMvcAssetCreateStep { @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) @Override - public String setAssetProperties(final SideNote sideNote) { + public String setAssetProperties( + final SideNote sideNote, final Map formParams + ) { sideNote.getText().addValue(new Locale(getInitialLocale()), text); assetRepo.save(sideNote); @@ -92,7 +93,7 @@ public class SideNoteCreateStep extends AbstractMvcAssetCreateStep { "redirect:/%s/assets/%s/%s/@sidenote-edit", getContentSectionLabel(), getFolderPath(), - name + getName() ); } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/AbstractMvcAuthoringStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/AbstractMvcAuthoringStep.java index 4d4924fee..3a808966d 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/AbstractMvcAuthoringStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/AbstractMvcAuthoringStep.java @@ -36,6 +36,7 @@ import java.util.Optional; import javax.inject.Inject; import javax.mvc.Models; import javax.servlet.http.HttpServletRequest; +import javax.transaction.Transactional; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.WebApplicationException; @@ -101,6 +102,7 @@ public abstract class AbstractMvcAuthoringStep implements MvcAuthoringStep { * @throws ContentSectionNotFoundException * @throws DocumentNotFoundException */ + @Transactional(Transactional.TxType.REQUIRED) protected void init() throws ContentSectionNotFoundException, DocumentNotFoundException { contentSection = sectionsUi diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java index 1eb481beb..34b2b9da1 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStep.java @@ -40,7 +40,6 @@ import java.util.stream.Collectors; 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; @@ -58,7 +57,6 @@ import javax.ws.rs.PathParam; @RequestScoped @Path(MvcAuthoringSteps.PATH_PREFIX + "categorization") @Controller -@Named("CmsCategorizationStep") @MvcAuthoringStepDef( bundle = DefaultAuthoringStepConstants.BUNDLE, descriptionKey = "authoringsteps.categorization.description", @@ -70,6 +68,9 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { @Inject private CategoryManager categoryManager; + @Inject + private CategorizationStepModel categorizationStepModel; + @Inject private DocumentUi documentUi; @@ -85,10 +86,27 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { @Inject private PermissionChecker permissionChecker; + @Override + @Transactional(Transactional.TxType.REQUIRED) + protected void init() throws ContentSectionNotFoundException, + DocumentNotFoundException { + super.init(); + + categorizationStepModel.setCategorizationTrees( + getContentSection() + .getDomains() + .stream() + .map(DomainOwnership::getDomain) + .map(this::buildCategorizationTree) + .collect(Collectors.toList()) + ); + } + + @Override public Class getStepClass() { return CategorizationStep.class; } - + @GET @Path("/") @Transactional(Transactional.TxType.REQUIRED) @@ -109,7 +127,7 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { if (permissionChecker.isPermitted( ItemPrivileges.CATEGORIZE, getDocument() )) { - return "org/librecms/ui/documents/categorization.xhtml"; + return "org/librecms/ui/contentsection/documents/categorization.xhtml"; } else { return documentUi.showAccessDenied( getContentSection(), @@ -119,32 +137,14 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { } } - /** - * Provides a tree view of the category system assigned to the current - * content section in an format which can be processed in MVC templates. - * - * The categories assigned to the current item as marked. - * - * @return Tree view of the category systems assigned to the current content - * section. - */ - @Transactional(Transactional.TxType.REQUIRED) - public List getCategorizationTrees() { - return getContentSection() - .getDomains() - .stream() - .map(DomainOwnership::getDomain) - .map(this::buildCategorizationTree) - .collect(Collectors.toList()); - } - /** * Update the categorization of the current item. - + * * * * @param domainParam * @param assignedCategoriesParam + * * @return A redirect to the categorization step. */ @MvcAuthoringAction( @@ -156,7 +156,7 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { public String updateCategorization( @PathParam("domain") final String domainParam, - @FormParam("assignedCategories") + @FormParam("assignedCategories") final Set assignedCategoriesParam ) { try { @@ -166,7 +166,7 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { } catch (DocumentNotFoundException ex) { return ex.showErrorMessage(); } - + final Identifier domainIdentifier = identifierParser.parseIdentifier( domainParam ); @@ -214,7 +214,7 @@ public class CategorizationStep extends AbstractMvcAuthoringStep { updateAssignedCategories( domainResult.get().getRoot(), assignedCategoriesParam ); - + return buildRedirectPathForStep(); } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStepModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStepModel.java new file mode 100644 index 000000000..9d973f86b --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/CategorizationStepModel.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.ui.contentsections.documents; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("CmsCategorizationStep") +public class CategorizationStepModel { + + private List categorizationTrees; + + /** + * Provides a tree view of the category system assigned to the current + * content section in an format which can be processed in MVC templates. + * + * The categories assigned to the current item as marked. + * + * @return Tree view of the category systems assigned to the current content + * section. + */ + public List getCategorizationTrees() { + return Collections.unmodifiableList(categorizationTrees); + } + + protected void setCategorizationTrees( + final List categorizationTrees + ) { + this.categorizationTrees = new ArrayList<>(categorizationTrees); + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStep.java index 9b3098152..995191f0e 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStep.java @@ -60,7 +60,6 @@ import javax.ws.rs.PathParam; @RequestScoped @Path(MvcAuthoringSteps.PATH_PREFIX + "publish") @Controller -@Named("CmsPublishStep") @MvcAuthoringStepDef( bundle = DefaultAuthoringStepConstants.BUNDLE, descriptionKey = "authoringsteps.publish.description", @@ -97,12 +96,41 @@ public class PublishStep extends AbstractMvcAuthoringStep { @Inject private Models models; - + + @Inject + private PublishStepModel publishStepModel; + @Override public Class getStepClass() { return PublishStep.class; } + @Override + protected void init() throws ContentSectionNotFoundException, + DocumentNotFoundException { + super.init(); + + publishStepModel.setAssignedLifecycleLabel( + Optional + .ofNullable(getDocument().getLifecycle()) + .map(Lifecycle::getDefinition) + .map(LifecycleDefinition::getLabel) + .map(globalizationHelper::getValueFromLocalizedString) + .orElse("") + ); + + publishStepModel.setAssignedLifecycleDescription( + Optional + .ofNullable(getDocument().getLifecycle()) + .map(Lifecycle::getDefinition) + .map(LifecycleDefinition::getDescription) + .map(globalizationHelper::getValueFromLocalizedString) + .orElse("") + ); + + publishStepModel.setLive(itemManager.isLive(getDocument())); + } + @GET @Path("/") @Transactional(Transactional.TxType.REQUIRED) @@ -148,45 +176,6 @@ public class PublishStep extends AbstractMvcAuthoringStep { } } - /** - * Get the label of the lifecycle assigned to the current content item. The - * value is determined from the label of the definition of the lifecycle - * using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString) - * }. - * - * @return The label of the lifecycle assigned to the current content item, - * or an empty string if no lifecycle is assigned to the item. - */ - @Transactional(Transactional.TxType.REQUIRED) - public String getAssignedLifecycleLabel() { - return Optional - .ofNullable(getDocument().getLifecycle()) - .map(Lifecycle::getDefinition) - .map(LifecycleDefinition::getLabel) - .map(globalizationHelper::getValueFromLocalizedString) - .orElse(""); - - } - - /** - * Get the description of the lifecycle assigned to the current content - * item. The value is determined from the description of the definition of - * the lifecycle using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString) - * }. - * - * @return The description of the lifecycle assigned to the current content - * item, or an empty string if no lifecycle is assigned to the item. - */ - @Transactional(Transactional.TxType.REQUIRED) - public String getAssignedLifecycleDecription() { - return Optional - .ofNullable(getDocument().getLifecycle()) - .map(Lifecycle::getDefinition) - .map(LifecycleDefinition::getDescription) - .map(globalizationHelper::getValueFromLocalizedString) - .orElse(""); - } - /** * Publishes the current content item.If the item is already live, the * {@code selectedLifecycleDefUuid} is ignored.The apply a new lifecycle the diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStepModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStepModel.java index cd3fec7d2..5759d0b4a 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStepModel.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/PublishStepModel.java @@ -18,6 +18,8 @@ */ package org.librecms.ui.contentsections.documents; +import org.libreccm.l10n.GlobalizationHelper; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -27,22 +29,74 @@ import javax.inject.Named; /** * Model providing some data for the views of the {@link PublishStep}. - * + * * @author Jens Pelzetter */ @RequestScoped @Named("CmsDocumentPublishStepModel") public class PublishStepModel { + private String assignedLifecycleLabel; + + private String assignedLifecycleDescription; + + private boolean live; + + /** + * The phases of the lifecycle assigned to the current content item. + */ + private List phases; + /** * A list of the available lifecycles. */ private List availableListcycles; /** - * The phases of the lifecycle assigned to the current content item. + * Get the label of the lifecycle assigned to the current content item. The + * value is determined from the label of the definition of the lifecycle + * using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString) + * }. + * + * @return The label of the lifecycle assigned to the current content item, + * or an empty string if no lifecycle is assigned to the item. */ - private List phases; + public String getAssignedLifecycleLabel() { + return assignedLifecycleLabel; + } + + protected void setAssignedLifecycleLabel( + final String assignedLifecycleLabel + ) { + this.assignedLifecycleLabel = assignedLifecycleLabel; + } + + public boolean getLive() { + return live; + } + + public void setLive(final boolean live) { + this.live = live; + } + + /** + * Get the description of the lifecycle assigned to the current content + * item. The value is determined from the description of the definition of + * the lifecycle using {@link GlobalizationHelper#getValueFromLocalizedString(org.libreccm.l10n.LocalizedString) + * }. + * + * @return The description of the lifecycle assigned to the current content + * item, or an empty string if no lifecycle is assigned to the item. + */ + public String getAssignedLifecycleDecription() { + return assignedLifecycleDescription; + } + + protected void setAssignedLifecylceDescription( + final String assignedLifecycleDescription + ) { + this.assignedLifecycleDescription = assignedLifecycleDescription; + } public PublishStepModel() { availableListcycles = new ArrayList<>(); diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStep.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStep.java index 90665f5c9..ec0d1fb7a 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStep.java @@ -102,7 +102,6 @@ import javax.ws.rs.core.MediaType; @RequestScoped @Path(MvcAuthoringSteps.PATH_PREFIX + "relatedinfo") @Controller -@Named("CmsRelatedInfoStep") @MvcAuthoringStepDef( bundle = DefaultAuthoringStepConstants.BUNDLE, descriptionKey = "authoringsteps.relatedinfo.description", @@ -248,11 +247,29 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep { @Inject private PermissionChecker permissionChecker; + @Inject + private RelatedInfoStepModel relatedInfoStepModel; + @Override public Class getStepClass() { return RelatedInfoStep.class; } - + + @Override + @Transactional(Transactional.TxType.REQUIRED) + protected void init() throws ContentSectionNotFoundException, + DocumentNotFoundException { + super.init(); + relatedInfoStepModel.setAttachmentLists( + getDocument() + .getAttachments() + .stream() + .filter(list -> !list.getName().startsWith(".")) + .map(this::buildAttachmentListDto) + .collect(Collectors.toList()) + ); + } + @GET @Path("/") @Transactional(Transactional.TxType.REQUIRED) @@ -283,23 +300,6 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep { } } - /** - * Gets the {@link AttachmentList}s of the current content item and converts - * them to {@link AttachmentListDto}s to make data about the lists available - * in the views. - * - * @return A list of the {@link AttachmentList} of the current content item. - */ - @Transactional(Transactional.TxType.REQUIRED) - public List getAttachmentLists() { - return getDocument() - .getAttachments() - .stream() - .filter(list -> !list.getName().startsWith(".")) - .map(this::buildAttachmentListDto) - .collect(Collectors.toList()); - } - /** * Gets the asset folder tree of the current content section as JSON data. * @@ -676,8 +676,8 @@ public class RelatedInfoStep extends AbstractMvcAuthoringStep { ); listRepo.save(list); return buildRedirectPathForStep( - String.format("/attachmentlists/%s", list.getName()) - ); + String.format("/attachmentlists/%s", list.getName()) + ); } else { return documentUi.showAccessDenied( getContentSection(), diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepModel.java new file mode 100644 index 000000000..b0f48e0f3 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/RelatedInfoStepModel.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2021 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.ui.contentsections.documents; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Named; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Named("CmsRelatedInfoStep") +public class RelatedInfoStepModel { + + private List attachmentsLists; + + /** + * Gets the {@link AttachmentList}s of the current content item and converts + * them to {@link AttachmentListDto}s to make data about the lists available + * in the views. + * + * @return A list of the {@link AttachmentList} of the current content item. + */ + public List getAttachmentLists() { + return Collections.unmodifiableList(attachmentsLists); + } + + protected void setAttachmentLists( + final List attachmentLists + ) { + this.attachmentsLists = new ArrayList<>(attachmentLists); + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/SelectedDocumentModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/SelectedDocumentModel.java index 4d64e3894..3ef827c7e 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/SelectedDocumentModel.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/documents/SelectedDocumentModel.java @@ -48,7 +48,6 @@ import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Path; import javax.ws.rs.core.UriBuilder; - /** * Model/named bean providing data about the currently selected document for * several views. @@ -229,24 +228,26 @@ public class SelectedDocumentModel { .excludeDefaultAuthoringSteps(); authoringStepsList = buildAuthoringStepsList(item); workflow = item.getWorkflow(); - workflowName = globalizationHelper.getValueFromLocalizedString( - workflow.getName() - ); - allTasks = workflow - .getTasks() - .stream() - .filter(task -> task instanceof AssignableTask) - .map(task -> (AssignableTask) task) - .map(this::buildTaskListEntry) - .collect(Collectors.toList()); + if (workflow != null) { + workflowName = globalizationHelper.getValueFromLocalizedString( + workflow.getName() + ); + allTasks = workflow + .getTasks() + .stream() + .filter(task -> task instanceof AssignableTask) + .map(task -> (AssignableTask) task) + .map(this::buildTaskListEntry) + .collect(Collectors.toList()); - currentTask = allTasks - .stream() - .filter(task -> task.getTaskState() == TaskState.ENABLED) - .findFirst() - .orElse(null); - if (currentTask != null) { - currentTask.setCurrentTask(true); + currentTask = allTasks + .stream() + .filter(task -> task.getTaskState() == TaskState.ENABLED) + .findFirst() + .orElse(null); + if (currentTask != null) { + currentTask.setCurrentTask(true); + } } } @@ -299,9 +300,9 @@ public class SelectedDocumentModel { entry.setLocked(task.isLocked()); entry.setLockedByCurrentUser( shiro - .getUser() - .map(user -> Objects.equals(user, task.getLockingUser())) - .orElse(false) + .getUser() + .map(user -> Objects.equals(user, task.getLockingUser())) + .orElse(false) ); return entry; diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/legalmetadata/create-legalmetadata.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/legalmetadata/create-legalmetadata.xhtml new file mode 100644 index 000000000..db607dd6d --- /dev/null +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/legalmetadata/create-legalmetadata.xhtml @@ -0,0 +1,99 @@ +]> + + + + +
+

#{CmsAssetsStepsDefaultMessagesBundle["legalmetadata.createform.title"]}

+ + + + + +
+ + + + + + + + + + + + + + + + #{CmsAssetsStepsDefaultMessagesBundle['createform.cancel']} + + + + + +
+ +
+ +
+ diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/legalmetadata/edit-legalmetadata.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/legalmetadata/edit-legalmetadata.xhtml new file mode 100644 index 000000000..5e6063d9d --- /dev/null +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/legalmetadata/edit-legalmetadata.xhtml @@ -0,0 +1,335 @@ +]> + + + + + +
+

#{CmsAssetsStepsDefaultMessagesBundle.getMessage('legalmetadata.editstep.header', [CmsLegalMetadataEditStep.name])}

+ +

#{CmsAssetsStepsDefaultMessagesBundle['editstep.name.header']}

+
+
#{CmsLegalMetadataEditStep.name}
+ + + +
+ + + + + + + +

#{CmsAssetsStepsDefaultMessagesBundle['editstep.legalmetadata.properties.header']}

+ + +
+ +
+ +
+
+
+
#{CmsAssetsStepsDefaultMessagesBundle['editform.legalmetadata.rightsholder.label']}
+
#{CmsLegalMetadataEditStepModel.rightsHolder}
+
+
+
#{CmsAssetsStepsDefaultMessagesBundle['editform.legalmetadata.publisher.label']}
+
#{CmsLegalMetadataEditStepModel.publisher}
+
+
+
#{CmsAssetsStepsDefaultMessagesBundle['editform.legalmetadata.creator.label']}
+
#{CmsLegalMetadataEditStepModel.creator}
+
+
+ + + +

#{CmsAssetsStepsDefaultMessagesBundle['editstep.legalmetadata.contributors.header']}

+ + +
+ +
+
+ +
+
+ + + + + + + + + + + + + + + +
#{CmsAssetsStepsDefaultMessagesBundle['editstep.legalmetadata.contributors.col.contributors.header']}#{CmsAssetsStepsDefaultMessagesBundle['editstep.legalmetadata.contributors.col.actions.header']}
#{contributor} + + + +
+ + + +
+
+ +
+ + diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/postaladdress/create-postaladdress.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/postaladdress/create-postaladdress.xhtml index e60591972..f5f92566f 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/postaladdress/create-postaladdress.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/assets/postaladdress/create-postaladdress.xhtml @@ -36,7 +36,7 @@ name="locale" options="#{CmsPostalAddressCreateStep.availableLocales}" required="true" - selectedOptions="#{[CmsPostalAddressCreate.initialLocale]}" + selectedOptions="#{[CmsPostalAddressCreateStep.initialLocale]}" />