ccm-cms-mvc #19

Merged
jensp merged 13 commits from ccm-cms-mvc into master 2022-03-14 19:09:03 +01:00
64 changed files with 7068 additions and 65 deletions

View File

@ -90,7 +90,7 @@ class ProfileSiteItemController {
) )
) )
); );
profileSiteItem.getPosition().addValue(locale, position); profileSiteItem.getPosition().putValue(locale, position);
} }
public void setInterests( public void setInterests(
@ -108,7 +108,7 @@ class ProfileSiteItemController {
) )
) )
); );
profileSiteItem.getInterests().addValue(locale, interests); profileSiteItem.getInterests().putValue(locale, interests);
} }
public void setMisc( public void setMisc(
@ -124,7 +124,7 @@ class ProfileSiteItemController {
) )
) )
); );
profileSiteItem.getMisc().addValue(locale, misc); profileSiteItem.getMisc().putValue(locale, misc);
} }
} }

View File

@ -42,10 +42,12 @@ import org.libreccm.l10n.LocalizedString;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.ui.contentsections.documents.MvcAuthoringKit;
import org.librecms.ui.contenttypes.event.MvcEventCreateStep;
import org.librecms.ui.contenttypes.event.MvcEventInfoStep;
import org.librecms.ui.contenttypes.event.MvcEventPropertiesStep;
import javax.validation.constraints.NotNull; import static org.librecms.CmsConstants.DB_SCHEMA;
import static org.librecms.CmsConstants.*;
/** /**
* @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a> * @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
@ -77,6 +79,13 @@ import static org.librecms.CmsConstants.*;
order = 2 order = 2
) )
}) })
@MvcAuthoringKit(
createStep = MvcEventCreateStep.class,
authoringSteps = {
MvcEventPropertiesStep.class,
MvcEventInfoStep.class
}
)
public class Event extends ContentItem implements Serializable { public class Event extends ContentItem implements Serializable {
private static final long serialVersionUID = -9104886733503414635L; private static final long serialVersionUID = -9104886733503414635L;
@ -94,9 +103,8 @@ public class Event extends ContentItem implements Serializable {
)) ))
private LocalizedString text; private LocalizedString text;
@Column(name = "START_DATE", nullable = false) @Column(name = "START_DATE")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@NotNull
private Date startDate; private Date startDate;
@Column(name = "END_DATE") @Column(name = "END_DATE")

View File

@ -26,6 +26,10 @@ import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.ui.contentsections.documents.MvcAuthoringKit;
import org.librecms.ui.contenttypes.news.MvcNewsCreateStep;
import org.librecms.ui.contenttypes.news.MvcNewsPropertiesStep;
import org.librecms.ui.contenttypes.news.MvcNewsTextBodyStep;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -74,6 +78,13 @@ import static org.librecms.CmsConstants.*;
order = 2 order = 2
) )
}) })
@MvcAuthoringKit(
createStep = MvcNewsCreateStep.class,
authoringSteps = {
MvcNewsPropertiesStep.class,
MvcNewsTextBodyStep.class
}
)
public class News extends ContentItem implements Serializable { public class News extends ContentItem implements Serializable {
private static final long serialVersionUID = -4939565845920227974L; private static final long serialVersionUID = -4939565845920227974L;
@ -96,7 +107,7 @@ public class News extends ContentItem implements Serializable {
*/ */
@Column(name = "NEWS_DATE", nullable = false) @Column(name = "NEWS_DATE", nullable = false)
@NotNull @NotNull
@Temporal(TemporalType.DATE) @Temporal(TemporalType.TIMESTAMP)
private Date releaseDate; private Date releaseDate;
/** /**

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2022 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui.contentsections.documents;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public final class CmsEditorUtil {
private CmsEditorUtil() {
// Nothing
}
public static CmsEditorLocaleVariantRow buildVariantRow(
final Map.Entry<Locale, String> entry
) {
final CmsEditorLocaleVariantRow variant
= new CmsEditorLocaleVariantRow();
variant.setLocale(entry.getKey().toString());
final Document document = Jsoup.parseBodyFragment(entry.getValue());
variant.setWordCount(
new StringTokenizer(document.body().text()).countTokens()
);
return variant;
}
}

View File

@ -25,9 +25,15 @@ import org.librecms.ui.contentsections.documents.relatedinfo.RelatedInfoStepServ
import org.librecms.ui.contenttypes.article.MvcArticlePropertiesStep; import org.librecms.ui.contenttypes.article.MvcArticlePropertiesStep;
import org.librecms.ui.contenttypes.article.MvcArticleTextBodyStep; import org.librecms.ui.contenttypes.article.MvcArticleTextBodyStep;
import org.librecms.ui.contenttypes.article.MvcArticleTextBodyStepResources; import org.librecms.ui.contenttypes.article.MvcArticleTextBodyStepResources;
import org.librecms.ui.contenttypes.event.MvcEventInfoStep;
import org.librecms.ui.contenttypes.event.MvcEventInfoStepResources;
import org.librecms.ui.contenttypes.event.MvcEventPropertiesStep;
import org.librecms.ui.contenttypes.mpa.MpaSectionsResources; import org.librecms.ui.contenttypes.mpa.MpaSectionsResources;
import org.librecms.ui.contenttypes.mpa.MvcMpaPropertiesStep; import org.librecms.ui.contenttypes.mpa.MvcMpaPropertiesStep;
import org.librecms.ui.contenttypes.mpa.MvcMpaSectionsStep; import org.librecms.ui.contenttypes.mpa.MvcMpaSectionsStep;
import org.librecms.ui.contenttypes.news.MvcNewsPropertiesStep;
import org.librecms.ui.contenttypes.news.MvcNewsTextBodyStep;
import org.librecms.ui.contenttypes.news.MvcNewsTextBodyStepResources;
import java.util.Set; import java.util.Set;
@ -51,8 +57,12 @@ public class CmsMvcAuthoringSteps implements MvcAuthoringSteps {
RelatedInfoStep.class, RelatedInfoStep.class,
MvcArticlePropertiesStep.class, MvcArticlePropertiesStep.class,
MvcArticleTextBodyStep.class, MvcArticleTextBodyStep.class,
MvcEventPropertiesStep.class,
MvcEventInfoStep.class,
MvcMpaPropertiesStep.class, MvcMpaPropertiesStep.class,
MvcMpaSectionsStep.class MvcMpaSectionsStep.class,
MvcNewsPropertiesStep.class,
MvcNewsTextBodyStep.class
); );
} }
@ -61,7 +71,9 @@ public class CmsMvcAuthoringSteps implements MvcAuthoringSteps {
return Set.of( return Set.of(
MediaStepService.class, MediaStepService.class,
MvcArticleTextBodyStepResources.class, MvcArticleTextBodyStepResources.class,
MvcEventInfoStepResources.class,
MpaSectionsResources.class, MpaSectionsResources.class,
MvcNewsTextBodyStepResources.class,
RelatedInfoStepService.class RelatedInfoStepService.class
); );
} }

View File

@ -35,7 +35,6 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Inject; import javax.inject.Inject;
import javax.mvc.Models;
import javax.transaction.Transactional; import javax.transaction.Transactional;
/** /**
@ -56,8 +55,7 @@ public class MvcArticleCreateStep
private static final String FORM_PARAM_INITIAL_LOCALE = "locale"; private static final String FORM_PARAM_INITIAL_LOCALE = "locale";
private static final String FORM_PARAM_SELECTED_WORKFLOW private static final String FORM_PARAM_SELECTED_WORKFLOW = "workflow";
= "workflow";
/** /**
* Provides functions for working with content items. * Provides functions for working with content items.

View File

@ -18,8 +18,6 @@
*/ */
package org.librecms.ui.contenttypes.article; package org.librecms.ui.contenttypes.article;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.libreccm.configuration.ConfigurationManager; import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
@ -27,8 +25,8 @@ import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contenttypes.Article; import org.librecms.contenttypes.Article;
import org.librecms.ui.contentsections.ItemPermissionChecker; import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep; import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
import org.librecms.ui.contentsections.ContentSectionNotFoundException; import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.documents.CmsEditorUtil;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException; import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi; import org.librecms.ui.contentsections.documents.DocumentUi;
@ -52,7 +50,6 @@ import javax.ws.rs.PathParam;
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef; import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
import java.util.StringTokenizer;
/** /**
* Authoring step for editing the main text of an {@link Article}. * Authoring step for editing the main text of an {@link Article}.
@ -144,6 +141,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
* @param sectionIdentifier * @param sectionIdentifier
* @param documentPath * @param documentPath
* @param localeParam * @param localeParam
*
* @return The template for showing a preview of the text. * @return The template for showing a preview of the text.
*/ */
@GET @GET
@ -351,16 +349,16 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
); );
articleTextBodyStepModel.setTitleValues( articleTextBodyStepModel.setTitleValues(
getArticle() getArticle()
.getTitle() .getTitle()
.getValues() .getValues()
.entrySet() .entrySet()
.stream() .stream()
.collect( .collect(
Collectors.toMap( Collectors.toMap(
entry -> entry.getKey().toString(), entry -> entry.getKey().toString(),
Map.Entry::getValue Map.Entry::getValue
)
) )
)
); );
articleTextBodyStepModel.setTextValues( articleTextBodyStepModel.setTextValues(
getArticle() getArticle()
@ -382,7 +380,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
.getValues() .getValues()
.entrySet() .entrySet()
.stream() .stream()
.map(this::buildVariantRow) .map(CmsEditorUtil::buildVariantRow)
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
@ -404,18 +402,4 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
return (Article) getDocument(); return (Article) getDocument();
} }
private CmsEditorLocaleVariantRow buildVariantRow(
final Map.Entry<Locale, String> entry
) {
final CmsEditorLocaleVariantRow variant
= new CmsEditorLocaleVariantRow();
variant.setLocale(entry.getKey().toString());
final Document document = Jsoup.parseBodyFragment(entry.getValue());
variant.setWordCount(
new StringTokenizer(document.body().text()).countTokens()
);
return variant;
}
} }

View File

@ -74,7 +74,7 @@ public class MvcArticleTextBodyStepModel {
this.textValues = new HashMap<>(textValues); this.textValues = new HashMap<>(textValues);
} }
/** /**
* Gets the locales for which the main text has not been defined yet. * Gets the locales for which the main text has not been defined yet.
* *
* @return The locales for which the main text has not been defined yet. * @return The locales for which the main text has not been defined yet.

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.libreccm.ui.AbstractMessagesBean;
import org.librecms.contenttypes.Event;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
* Message bundle for the authorings steps for editing an {@link Event}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsEventMessageBundle")
public class EventMessageBundle extends AbstractMessagesBean {
@Override
public String getMessageBundle() {
return EventStepsConstants.BUNDLE;
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
/**
* Constants for the authoring steps for editing an {@link Event}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public final class EventStepsConstants {
private EventStepsConstants() {
// Nothing
}
public static final String BUNDLE
= "org.librecms.ui.contenttypes.EventBundle";
}

View File

@ -0,0 +1,340 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contenttypes.Event;
import org.librecms.ui.contentsections.documents.AbstractMvcDocumentCreateStep;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Date;
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;
/**
* Describes the create step for an {@link Event}
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsEventCreateStep")
public class MvcEventCreateStep
extends AbstractMvcDocumentCreateStep<Event> {
private static final String FORM_PARAM_NAME = "name";
private static final String FORM_PARAM_TITLE = "title";
private static final String FORM_PARAM_STARTDATE = "startDate";
private static final String FORM_PARAM_SUMMARY = "summary";
private static final String FORM_PARAM_INITIAL_LOCALE = "locale";
private static final String FORM_PARAM_SELECTED_WORKFLOW = "workflow";
/**
* Provides functions for working with content items.
*/
@Inject
private ContentItemManager itemManager;
/**
* Used to save the event.
*/
@Inject
private ContentItemRepository itemRepo;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
/**
* Name of the event.
*/
private String name;
/**
* Title of the event.
*/
private String title;
/**
* The start date of the event (ISO 8601 string)
*/
private String startDate;
/**
* Summary of the event.
*/
private String summary;
/**
* The initial locale of the event.
*/
private String initialLocale;
/**
* The workflow to use for the new event.
*/
private String selectedWorkflow;
@Override
public String getDocumentType() {
return Event.class.getName();
}
@Override
public String getDescription() {
return globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.description");
}
@Override
public String getBundle() {
return EventStepsConstants.BUNDLE;
}
public String getName() {
return name;
}
public String getTitle() {
return title;
}
public String getStartDate() {
return startDate;
}
public String getSummary() {
return summary;
}
public String getInitialLocale() {
return initialLocale;
}
@Transactional(Transactional.TxType.REQUIRED)
public String getSelectedWorkflow() {
if (selectedWorkflow == null || selectedWorkflow.isEmpty()) {
return getContentSection()
.getContentTypes()
.stream()
.filter(
type -> type.getContentItemClass().equals(
Event.class.getName()
)
)
.findAny()
.map(type -> type.getDefaultWorkflow())
.map(
workflow -> globalizationHelper.getValueFromLocalizedString(
workflow.getName()
)
)
.orElse("");
} else {
return selectedWorkflow;
}
}
@Override
public String showCreateStep() {
return "org/librecms/ui/contenttypes/event/create-event.xhtml";
}
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
@Override
public String createItem(final Map<String, String[]> formParams) {
if (!formParams.containsKey(FORM_PARAM_NAME)
|| formParams.get(FORM_PARAM_NAME) == null
|| formParams.get(FORM_PARAM_NAME).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.name.error.missing")
);
return showCreateStep();
}
name = formParams.get(FORM_PARAM_NAME)[0];
if (!name.matches("^([a-zA-Z0-9_-]*)$")) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.name.error.invalid")
);
return showCreateStep();
}
if (!formParams.containsKey(FORM_PARAM_TITLE)
|| formParams.get(FORM_PARAM_TITLE) == null
|| formParams.get(FORM_PARAM_TITLE).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.title.error.missing")
);
return showCreateStep();
}
title = formParams.get(FORM_PARAM_TITLE)[0];
if (!formParams.containsKey(FORM_PARAM_STARTDATE)
|| formParams.get(FORM_PARAM_STARTDATE) == null
|| formParams.get(FORM_PARAM_STARTDATE).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.startdate.error.missing")
);
return showCreateStep();
}
startDate = formParams.get(FORM_PARAM_STARTDATE)[0];
final DateTimeFormatter isoDateTimeFormatter
= DateTimeFormatter.ISO_DATE_TIME.withZone(ZoneId.systemDefault());
final LocalDateTime startDateTime;
try {
startDateTime = LocalDateTime.parse(
startDate,
isoDateTimeFormatter
);
} catch (DateTimeParseException ex) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.startdate.error.malformed")
);
return showCreateStep();
}
if (!formParams.containsKey(FORM_PARAM_SUMMARY)
|| formParams.get(FORM_PARAM_SUMMARY) == null
|| formParams.get(FORM_PARAM_SUMMARY).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.summary.error.missing")
);
return showCreateStep();
}
summary = formParams.get(FORM_PARAM_SUMMARY)[0];
if (!formParams.containsKey(FORM_PARAM_INITIAL_LOCALE)
|| formParams.get(FORM_PARAM_INITIAL_LOCALE) == null
|| formParams.get(FORM_PARAM_INITIAL_LOCALE).length == 0) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.initial_locale.error.missing")
);
return showCreateStep();
}
final Locale locale = new Locale(
formParams.get(FORM_PARAM_INITIAL_LOCALE)[0]
);
if (!formParams.containsKey(FORM_PARAM_SELECTED_WORKFLOW)
|| formParams.get(FORM_PARAM_SELECTED_WORKFLOW) == null
|| formParams.get(FORM_PARAM_SELECTED_WORKFLOW).length == 0) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.none_selected")
);
return showCreateStep();
}
selectedWorkflow = formParams.get(FORM_PARAM_SELECTED_WORKFLOW)[0];
final Optional<Workflow> workflowResult = getContentSection()
.getWorkflowTemplates()
.stream()
.filter(template -> template.getUuid().equals(selectedWorkflow))
.findAny();
if (!workflowResult.isPresent()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.error.not_available")
);
return showCreateStep();
}
if (!getMessages().isEmpty()) {
return showCreateStep();
}
final Event event = itemManager.createContentItem(
name,
getContentSection(),
getFolder(),
workflowResult.get(),
Event.class,
locale
);
event.getTitle().putValue(locale, title);
event.setStartDate(
Date.from(
startDateTime.toInstant(
ZoneId.systemDefault().getRules().getOffset(startDateTime)
)
)
);
event.getDescription().putValue(locale, summary);
itemRepo.save(event);
return String.format(
"redirect:/%s/documents/%s/%s/@event-basicproperties",
getContentSectionLabel(),
getFolderPath(),
name
);
}
}

View File

@ -0,0 +1,943 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.l10n.GlobalizationHelper;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contenttypes.Event;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.CmsEditorUtil;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi;
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.mvc.Controller;
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;
/**
* Authoring step for editing the localizable information of an event.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "event-info")
@Controller
@MvcAuthoringStepDef(
bundle = EventStepsConstants.BUNDLE,
descriptionKey = "authoringsteps.info.description",
labelKey = "authoringstep.info.label",
supportedDocumentType = Event.class
)
public class MvcEventInfoStep extends AbstractMvcAuthoringStep {
@Inject
private EventMessageBundle eventMessageBundle;
@Inject
private ConfigurationManager confManager;
@Inject
private ContentItemRepository itemRepo;
@Inject
private DocumentUi documentUi;
@Inject
private GlobalizationHelper globalizationHelper;
@Inject
private ItemPermissionChecker itemPermissionChecker;
@Inject
private MvcEventInfoStepEventDateModel eventDateModel;
@Inject
private MvcEventInfoStepLocationModel locationModel;
@Inject
private MvcEventInfoStepMainContributorModel mainContributorModel;
@Inject
private MvcEventInfoStepEventTypeModel eventTypeModel;
@Override
public Class<MvcEventInfoStep> getStepClass() {
return MvcEventInfoStep.class;
}
@GET
@Path("/")
@Transactional(Transactional.TxType.REQUIRED)
public String showStep(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
return "org/librecms/ui/contenttypes/event/event-info.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
eventMessageBundle.getMessage("event.edit.denied")
);
}
}
// EventDate
@GET
@Path("/eventdate/view/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String viewEventDate(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
eventDateModel.setSelectedLocale(new Locale(localeParam).toString());
return "org/librecms/ui/contenttypes/event/eventdate/view.xhtml";
}
@POST
@Path("/eventdate/add")
@Transactional(Transactional.TxType.REQUIRED)
public String addEventDateValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final String value;
if (getEvent().getEventDate().getAvailableLocales().isEmpty()) {
value = "";
} else {
value = globalizationHelper.getValueFromLocalizedString(
getEvent().getText()
);
}
final Locale locale = new Locale(localeParam);
getEvent().getEventDate().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@GET
@Path("/eventdate/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editEventDateValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
eventDateModel.setSelectedLocale(
new Locale(localeParam).toString()
);
return "org/librecms/ui/contenttypes/event/eventdate/edit.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/eventdate/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editEventDateValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getEventDate().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/eventdate/remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeEventDateValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getEventDate().removeValue(locale);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
// Location
@GET
@Path("/location/view/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String viewLocation(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
locationModel.setSelectedLocale(new Locale(localeParam).toString());
return "org/librecms/ui/contenttypes/event/location/view.xhtml";
}
@POST
@Path("/location/add")
@Transactional(Transactional.TxType.REQUIRED)
public String addLocationValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final String value;
if (getEvent().getLocation().getAvailableLocales().isEmpty()) {
value = "";
} else {
value = globalizationHelper.getValueFromLocalizedString(
getEvent().getLocation()
);
}
final Locale locale = new Locale(localeParam);
getEvent().getLocation().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@GET
@Path("/location/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editLocationValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
locationModel.setSelectedLocale(new Locale(localeParam).toString());
return "org/librecms/ui/contenttypes/event/location/edit.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/location/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editLocationValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getLocation().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/location/remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeLocationValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getLocation().removeValue(locale);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
// Main Contributor
@GET
@Path("/main-contributor/view/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String viewMainContributor(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
mainContributorModel.setSelectedLocale(
new Locale(localeParam).toString()
);
return "org/librecms/ui/contenttypes/event/main-contributor/view.xhtml";
}
@POST
@Path("/main-contributor/add")
@Transactional(Transactional.TxType.REQUIRED)
public String addMainContributorValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final String value;
if (getEvent()
.getMainContributor()
.getAvailableLocales()
.isEmpty()) {
value = "";
} else {
value = globalizationHelper.getValueFromLocalizedString(
getEvent().getMainContributor()
);
}
final Locale locale = new Locale(localeParam);
getEvent().getMainContributor().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@GET
@Path("/main-contributor/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editMainContributorValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
mainContributorModel.setSelectedLocale(
new Locale(localeParam).toString()
);
return "org/librecms/ui/contenttypes/event/main-contributor/edit.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/main-contributor/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editMainContributorValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getMainContributor().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/main-contributor/remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeMainContributorValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getMainContributor().removeValue(locale);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
// Event Type
@GET
@Path("/eventtype/view/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String viewEventType(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
eventTypeModel.setSelectedLocale(new Locale(localeParam).toString());
return "org/librecms/ui/contenttypes/event/eventtype/view.xhtml";
}
@POST
@Path("/eventtype/add")
@Transactional(Transactional.TxType.REQUIRED)
public String addEventTypeValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final String value;
if (getEvent().getEventType().getAvailableLocales().isEmpty()) {
value = "";
} else {
value = globalizationHelper.getValueFromLocalizedString(
getEvent().getEventType()
);
}
final Locale locale = new Locale(localeParam);
getEvent().getEventType().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@GET
@Path("/eventtype/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editEventTypeValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
eventTypeModel.setSelectedLocale(new Locale(localeParam).toString());
return "org/librecms/ui/contenttypes/event/eventtype/edit.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/eventtype/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editEventTypeValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getEventType().putValue(locale, value);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@POST
@Path("/eventtype/remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeEventTypeValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getEvent())) {
final Locale locale = new Locale(localeParam);
getEvent().getEventType().removeValue(locale);
itemRepo.save(getEvent());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getEvent(),
getLabel()
);
}
}
@Override
public void init() throws ContentSectionNotFoundException,
DocumentNotFoundException {
super.init();
final boolean canEdit = itemPermissionChecker.canEditItem(getEvent());
if (canEdit) {
eventDateModel.setCanEdit(canEdit);
eventDateModel.setEventDateValues(
getEvent()
.getEventDate()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
eventDateModel.setVariants(
getEvent()
.getEventDate()
.getValues()
.entrySet()
.stream()
.map(CmsEditorUtil::buildVariantRow)
.collect(Collectors.toList())
);
final Set<Locale> eventDateLocales = getEvent()
.getEventDate()
.getAvailableLocales();
eventDateModel.setUnusedLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !eventDateLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
locationModel.setCanEdit(canEdit);
locationModel.setLocationValues(
getEvent()
.getLocation()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
locationModel.setVariants(
getEvent()
.getLocation()
.getValues()
.entrySet()
.stream()
.map(CmsEditorUtil::buildVariantRow)
.collect(Collectors.toList())
);
final Set<Locale> locationLocales = getEvent()
.getLocation()
.getAvailableLocales();
locationModel.setUnusedLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !locationLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
mainContributorModel.setCanEdit(canEdit);
mainContributorModel.setContributorValues(
getEvent()
.getMainContributor()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
mainContributorModel.setVariants(
getEvent()
.getMainContributor()
.getValues()
.entrySet()
.stream()
.map(CmsEditorUtil::buildVariantRow)
.collect(Collectors.toList())
);
final Set<Locale> contributorLocales = getEvent()
.getMainContributor()
.getAvailableLocales();
mainContributorModel.setUnusedLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !contributorLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
eventTypeModel.setCanEdit(canEdit);
eventTypeModel.setEventTypeValues(
getEvent()
.getEventType()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
eventTypeModel.setVariants(
getEvent()
.getEventType()
.getValues()
.entrySet()
.stream()
.map(CmsEditorUtil::buildVariantRow)
.collect(Collectors.toList())
);
final Set<Locale> eventTypeLocales = getEvent()
.getEventType()
.getAvailableLocales();
eventTypeModel.setUnusedLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !eventTypeLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
}
}
private Event getEvent() {
return (Event) getDocument();
}
}

View File

@ -0,0 +1,114 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsEventInfoStepEventDate")
public class MvcEventInfoStepEventDateModel {
private boolean canEdit;
private Map<String, String> eventDateValues;
private List<CmsEditorLocaleVariantRow> variants;
private List<String> unusedLocales;
private String selectedLocale;
public Map<String, String> getEventDateValues() {
return Optional
.ofNullable(eventDateValues)
.map(Collections::unmodifiableMap)
.orElse(Collections.emptyMap());
}
protected void setEventDateValues(
final Map<String, String> eventDateValues
) {
this.eventDateValues = Optional
.ofNullable(eventDateValues)
.map(values -> new HashMap<>(values))
.map(values -> (Map<String, String>) values)
.orElse(Collections.emptyMap());
}
public List<CmsEditorLocaleVariantRow> getVariants() {
return Optional
.ofNullable(variants)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
this.variants = Optional
.ofNullable(variants)
.map(list -> new ArrayList<>(list))
.map(list -> (List<CmsEditorLocaleVariantRow>) list)
.orElse(Collections.emptyList());
}
public List<String> getUnusedLocales() {
return Optional
.ofNullable(unusedLocales)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setUnusedLocales(final List<String> unusedLocales) {
this.unusedLocales = Optional
.ofNullable(unusedLocales)
.map(list -> new ArrayList<>(list))
.map(list -> (List<String>) list)
.orElse(Collections.emptyList());
}
public String getSelectedLocale() {
return selectedLocale;
}
protected void setSelectedLocale(final String selectedLocale) {
this.selectedLocale = selectedLocale;
}
public boolean getCanEdit() {
return canEdit;
}
protected void setCanEdit(final boolean canEdit) {
this.canEdit = canEdit;
}
}

View File

@ -0,0 +1,114 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsEventInfoStepEventType")
public class MvcEventInfoStepEventTypeModel {
private boolean canEdit;
private Map<String, String> eventTypeValues;
private List<CmsEditorLocaleVariantRow> variants;
private List<String> unusedLocales;
private String selectedLocale;
public Map<String, String> getEventTypeValues() {
return Optional
.ofNullable(eventTypeValues)
.map(Collections::unmodifiableMap)
.orElse(Collections.emptyMap());
}
protected void setEventTypeValues(
final Map<String, String> eventTypeValues
) {
this.eventTypeValues = Optional
.ofNullable(eventTypeValues)
.map(values -> new HashMap<>(values))
.map(values -> (Map<String, String>) values)
.orElse(Collections.emptyMap());
}
public List<CmsEditorLocaleVariantRow> getVariants() {
return Optional
.ofNullable(variants)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
this.variants = Optional
.ofNullable(variants)
.map(list -> new ArrayList<>(list))
.map(list -> (List<CmsEditorLocaleVariantRow>) list)
.orElse(Collections.emptyList());
}
public List<String> getUnusedLocales() {
return Optional
.ofNullable(unusedLocales)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setUnusedLocales(final List<String> unusedLocales) {
this.unusedLocales = Optional
.ofNullable(unusedLocales)
.map(list -> new ArrayList<>(list))
.map(list -> (List<String>) list)
.orElse(Collections.emptyList());
}
public String getSelectedLocale() {
return selectedLocale;
}
protected void setSelectedLocale(final String selectedLocale) {
this.selectedLocale = selectedLocale;
}
public boolean getCanEdit() {
return canEdit;
}
protected void setCanEdit(final boolean canEdit) {
this.canEdit = canEdit;
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsEventInfoStepLocation")
public class MvcEventInfoStepLocationModel {
private boolean canEdit;
private Map<String, String> locationValues;
private List<CmsEditorLocaleVariantRow> variants;
private List<String> unusedLocales;
private String selectedLocale;
public Map<String, String> getLocationValues() {
return Optional
.ofNullable(locationValues)
.map(Collections::unmodifiableMap)
.orElse(Collections.emptyMap());
}
protected void setLocationValues(final Map<String, String> locationValues) {
this.locationValues = Optional
.ofNullable(locationValues)
.map(values -> new HashMap<>(values))
.map(values -> (Map<String, String>) values)
.orElse(Collections.emptyMap());
}
public List<CmsEditorLocaleVariantRow> getVariants() {
return Optional
.ofNullable(variants)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
this.variants = Optional
.ofNullable(variants)
.map(list -> new ArrayList<>(list))
.map(list -> (List<CmsEditorLocaleVariantRow>) list)
.orElse(Collections.emptyList());
}
public List<String> getUnusedLocales() {
return Optional
.ofNullable(unusedLocales)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setUnusedLocales(final List<String> unusedLocales) {
this.unusedLocales = Optional
.ofNullable(unusedLocales)
.map(list -> new ArrayList<>(list))
.map(list -> (List<String>) list)
.orElse(Collections.emptyList());
}
public String getSelectedLocale() {
return selectedLocale;
}
protected void setSelectedLocale(final String selectedLocale) {
this.selectedLocale = selectedLocale;
}
public boolean getCanEdit() {
return canEdit;
}
protected void setCanEdit(final boolean canEdit) {
this.canEdit = canEdit;
}
}

View File

@ -0,0 +1,114 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsEventInfoStepMainContributor")
public class MvcEventInfoStepMainContributorModel {
private boolean canEdit;
private Map<String, String> contributorValues;
private List<CmsEditorLocaleVariantRow> variants;
private List<String> unusedLocales;
private String selectedLocale;
public Map<String, String> getContributorValues() {
return Optional
.ofNullable(contributorValues)
.map(Collections::unmodifiableMap)
.orElse(Collections.emptyMap());
}
protected void setContributorValues(
final Map<String, String> contributorValues
) {
this.contributorValues = Optional
.ofNullable(contributorValues)
.map(values -> new HashMap<>(values))
.map(values -> (Map<String, String>) values)
.orElse(Collections.emptyMap());
}
public List<CmsEditorLocaleVariantRow> getVariants() {
return Optional
.ofNullable(variants)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
this.variants = Optional
.ofNullable(variants)
.map(list -> new ArrayList<>(list))
.map(list -> (List<CmsEditorLocaleVariantRow>) list)
.orElse(Collections.emptyList());
}
public List<String> getUnusedLocales() {
return Optional
.ofNullable(unusedLocales)
.map(Collections::unmodifiableList)
.orElse(Collections.emptyList());
}
protected void setUnusedLocales(final List<String> unusedLocales) {
this.unusedLocales = Optional
.ofNullable(unusedLocales)
.map(list -> new ArrayList<>(list))
.map(list -> (List<String>) list)
.orElse(Collections.emptyList());
}
public String getSelectedLocale() {
return selectedLocale;
}
protected void setSelectedLocale(final String selectedLocale) {
this.selectedLocale = selectedLocale;
}
public boolean getCanEdit() {
return canEdit;
}
protected void setCanEdit(final boolean canEdit) {
this.canEdit = canEdit;
}
}

View File

@ -0,0 +1,374 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentSection;
import org.librecms.contenttypes.Event;
import org.librecms.ui.contentsections.ContentSectionsUi;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.ForbiddenException;
import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "event-info-resources")
public class MvcEventInfoStepResources {
@Inject
private ContentItemRepository itemRepo;
@Inject
private ContentSectionsUi sectionsUi;
@Inject
private ItemPermissionChecker itemPermissionChecker;
// Event Date
@GET
@Path("/eventdate/wordcount/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String getEventDateWordCount(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
final String text = event
.getEventDate()
.getValue(new Locale(localeParam));
final Document jsoupDoc = Jsoup.parseBodyFragment(text);
final long result = new StringTokenizer(
jsoupDoc.body().text()
).countTokens();
return Long.toString(result);
} else {
throw new ForbiddenException();
}
}
@GET
@Path("/eventdate/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String viewEventDateValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
return event.getEventDate().getValue(new Locale(localeParam));
} else {
throw new ForbiddenException();
}
}
// Location
@GET
@Path("/location/wordcount/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String getLocationWordCount(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
final String text = event
.getLocation()
.getValue(new Locale(localeParam));
final Document jsoupDoc = Jsoup.parseBodyFragment(text);
final long result = new StringTokenizer(
jsoupDoc.body().text()
).countTokens();
return Long.toString(result);
} else {
throw new ForbiddenException();
}
}
@GET
@Path("/location/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String viewLocationValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
return event.getLocation().getValue(new Locale(localeParam));
} else {
throw new ForbiddenException();
}
}
// Main Contributor
@GET
@Path("/main-contributor/wordcount/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String getMainContributorWordCount(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
final String text = event
.getMainContributor()
.getValue(new Locale(localeParam));
final Document jsoupDoc = Jsoup.parseBodyFragment(text);
final long result = new StringTokenizer(
jsoupDoc.body().text()
).countTokens();
return Long.toString(result);
} else {
throw new ForbiddenException();
}
}
@GET
@Path("/main-contributor/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String viewMainContributorValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
return event.getMainContributor().getValue(new Locale(localeParam));
} else {
throw new ForbiddenException();
}
}
// Event Type
@GET
@Path("/eventtype/wordcount/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String getEventTypeWordCount(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
final String text = event
.getEventType()
.getValue(new Locale(localeParam));
final Document jsoupDoc = Jsoup.parseBodyFragment(text);
final long result = new StringTokenizer(
jsoupDoc.body().text()
).countTokens();
return Long.toString(result);
} else {
throw new ForbiddenException();
}
}
@GET
@Path("/eventtype/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String viewEventTypeValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof Event)) {
throw new NotFoundException();
}
final Event event = (Event) document;
if (itemPermissionChecker.canEditItem(event)) {
return event.getEventType().getValue(new Locale(localeParam));
} else {
throw new ForbiddenException();
}
}
}

View File

@ -0,0 +1,668 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.AuthorizationRequired;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.FolderManager;
import org.librecms.contenttypes.Event;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi;
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
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.DefaultValue;
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;
/**
* Authoring step for editing the basic properties of an {@link Event}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "event-basicproperties")
@Controller
@MvcAuthoringStepDef(
bundle = EventStepsConstants.BUNDLE,
descriptionKey = "authoringsteps.basicproperties.description",
labelKey = "authoringsteps.basicproperties.label",
supportedDocumentType = Event.class
)
public class MvcEventPropertiesStep extends AbstractMvcAuthoringStep {
@Inject
private EventMessageBundle eventMessageBundle;
/**
* Used for retrieving and saving the events.
*/
@Inject
private ContentItemRepository itemRepo;
/**
* Provides functions for working with content items.
*/
@Inject
private ContentItemManager itemManager;
@Inject
private DocumentUi documentUi;
/**
* Provides functions for working with folders.
*/
@Inject
private FolderManager folderManager;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
@Inject
private ItemPermissionChecker itemPermissionChecker;
@Inject
private MvcEventPropertiesStepModel eventPropertiesStepModel;
@Inject
private Models models;
@Override
public Class<MvcEventPropertiesStep> getStepClass() {
return MvcEventPropertiesStep.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void init() throws ContentSectionNotFoundException,
DocumentNotFoundException {
super.init();
eventPropertiesStepModel.setName(getDocument().getDisplayName());
final Set<Locale> titleLocales = getDocument()
.getTitle()
.getAvailableLocales();
eventPropertiesStepModel.setTitleValues(
getDocument()
.getTitle()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
entry -> entry.getValue()
)
)
);
eventPropertiesStepModel.setUnusedTitleLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !titleLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
eventPropertiesStepModel.setDescriptionValues(
getDocument()
.getDescription()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
entry -> entry.getValue()
)
)
);
final Set<Locale> descriptionLocales = getDocument()
.getDescription()
.getAvailableLocales();
eventPropertiesStepModel.setUnusedDescriptionLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !descriptionLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
final Event event = (Event) getDocument();
final DateTimeFormatter isoDateFormatter
= DateTimeFormatter.ISO_LOCAL_DATE.withZone(ZoneId.systemDefault());
final DateTimeFormatter isoTimeFormatter
= DateTimeFormatter.ISO_TIME.withZone(ZoneId.systemDefault());
final DateTimeFormatter isoDateTimeFormatter
= DateTimeFormatter.ISO_LOCAL_DATE_TIME
.withZone(ZoneId.systemDefault());
eventPropertiesStepModel.setStartDateTime(
Optional
.ofNullable(event.getStartDate())
.map(startDate -> startDate.toInstant())
.map(startDate -> isoDateTimeFormatter.format(startDate))
.orElse("")
);
eventPropertiesStepModel.setFormattedStartDateTime(
Optional
.ofNullable(event.getStartDate())
.map(startDate -> startDate.toInstant())
.map(
startDate -> String.format(
"%s %s",
isoDateFormatter.format(startDate),
isoTimeFormatter.format(startDate)
)
)
.orElse("")
);
eventPropertiesStepModel.setEndDateTime(
Optional
.ofNullable(event.getEndDate())
.map(endDate -> endDate.toInstant())
.map(endDate -> isoDateTimeFormatter.format(endDate))
.orElse("")
);
eventPropertiesStepModel.setFormattedEndDateTime(
Optional
.ofNullable(event.getEndDate())
.map(endDate -> endDate.toInstant())
.map(
endDate -> String.format(
"%s %s",
isoDateFormatter.format(endDate),
isoTimeFormatter.format(endDate)
)
)
.orElse("")
);
eventPropertiesStepModel.setMapLink(event.getMapLink());
}
@GET
@Path("/")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String showStep(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
return "org/librecms/ui/contenttypes/event/event-basic-properties.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
eventMessageBundle.getMessage("event.edit.denied")
);
}
}
/**
* Updates the name of the current event.
*
* @param sectionIdentifier
* @param documentPath
* @param name
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/name")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String updateName(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("name") @DefaultValue("") final String name
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
if (name.isEmpty() || name.matches("\\s*")) {
models.put("nameMissing", true);
return showStep(sectionIdentifier, documentPath);
}
getDocument().setDisplayName(name);
itemRepo.save(getDocument());
updateDocumentPath();
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
@POST
@Path("/eventdatetime")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String updateEventDateTime(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("startDateTime")
final String startDateTime,
@FormParam("endDateTime")
final String endDateTime
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Event event = (Event) getDocument();
final DateTimeFormatter isoDateTimeFormatter
= DateTimeFormatter.ISO_DATE_TIME
.withZone(ZoneId.systemDefault());
event.setStartDate(
Date.from(
ZonedDateTime.parse(
startDateTime,
isoDateTimeFormatter
).toInstant()
)
);
event.setEndDate(
Date.from(
ZonedDateTime.parse(
endDateTime,
isoDateTimeFormatter
).toInstant()
)
);
itemRepo.save(event);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
@POST
@Path("/maplink")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String updateMapLink(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("mapLink")
final String mapLink
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Event event = (Event) getDocument();
event.setMapLink(mapLink);
itemRepo.save(event);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Updates a localized title of the event.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to update.
* @param value The updated title value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/title/@add")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String addTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Updates a localized title of the event.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to update.
* @param value The updated title value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/title/@edit/{locale}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String editTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Removes a localized title of the event.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to remove.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/title/@remove/{locale}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String removeTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().removeValue(locale);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Adds a localized description to the event.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale of the description.
* @param value The description value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/description/@add")
@Transactional(Transactional.TxType.REQUIRED)
public String addDescription(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Updates a localized description of the event.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to update.
* @param value The updated description value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/description/@edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editDescription(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Removes a localized description of the event.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to remove.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/description/@remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeDescription(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().removeValue(locale);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
}

View File

@ -0,0 +1,156 @@
/*
* Copyright (C) 2022 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.contenttypes.event;
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("CmsEventPropertiesStep")
public class MvcEventPropertiesStepModel {
private String name;
private Map<String, String> titleValues;
private List<String> unusedTitleLocales;
private Map<String, String> descriptionValues;
private List<String> unusedDescriptionLocales;
private String startDateTime;
private String formattedStartDateTime;
private String endDateTime;
private String formattedEndDateTime;
private String mapLink;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public Map<String, String> getTitleValues() {
return Collections.unmodifiableMap(titleValues);
}
public void setTitleValues(final Map<String, String> titleValues) {
this.titleValues = new HashMap<>(titleValues);
}
public List<String> getUnusedTitleLocales() {
return Collections.unmodifiableList(unusedTitleLocales);
}
public void setUnusedTitleLocales(List<String> unusedTitleLocales) {
this.unusedTitleLocales = new ArrayList<>(unusedTitleLocales);
}
public Map<String, String> getDescriptionValues() {
return Collections.unmodifiableMap(descriptionValues);
}
public void setDescriptionValues(
final Map<String, String> descriptionValues
) {
this.descriptionValues = new HashMap<>(descriptionValues);
}
public List<String> getUnusedDescriptionLocales() {
return Collections.unmodifiableList(unusedDescriptionLocales);
}
public void setUnusedDescriptionLocales(
final List<String> unusedDescriptionLocales
) {
this.unusedDescriptionLocales = new ArrayList<>(
unusedDescriptionLocales
);
}
public String getStartDateTime() {
return startDateTime;
}
public void setStartDateTime(final String startDateTime) {
this.startDateTime = startDateTime;
}
public String getFormattedStartDateTime() {
return formattedStartDateTime;
}
public void setFormattedStartDateTime(final String formattedStartDateTime) {
this.formattedStartDateTime = formattedStartDateTime;
}
public boolean getHasStartDate() {
return !startDateTime.isBlank();
}
public String getEndDateTime() {
return endDateTime;
}
public void setEndDateTime(final String endDateTime) {
this.endDateTime = endDateTime;
}
public String getFormattedEndDateTime() {
return formattedEndDateTime;
}
public void setFormattedEndDateTime(final String formattedEndDateTime) {
this.formattedEndDateTime = formattedEndDateTime;
}
public boolean getHasEndDate() {
return !endDateTime.isBlank();
}
public String getMapLink() {
return mapLink;
}
public void setMapLink(final String mapLink) {
this.mapLink = mapLink;
}
public boolean getHasMapLink() {
return !mapLink.isBlank();
}
}

View File

@ -0,0 +1,401 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentItemInitializer;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contenttypes.Article;
import org.librecms.contenttypes.News;
import org.librecms.ui.contentsections.documents.AbstractMvcDocumentCreateStep;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
import java.time.format.ResolverStyle;
import java.util.Date;
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;
import static java.time.temporal.ChronoField.HOUR_OF_DAY;
import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsNewsCreateStep")
public class MvcNewsCreateStep
extends AbstractMvcDocumentCreateStep<News> {
private static final String FORM_PARAM_NAME = "name";
private static final String FORM_PARAM_TITLE = "title";
private static final String FORM_PARAM_SUMMARY = "summary";
private static final String FORM_PARAM_INITIAL_LOCALE = "locale";
private static final String FORM_PARAM_SELECTED_WORKFLOW = "workflow";
private static final String FORM_PARAM_RELEASE_DATE = "releaseDate";
/**
* Provides functions for working with content items.
*/
@Inject
private ContentItemManager itemManager;
/**
* Used to save the news.
*/
@Inject
private ContentItemRepository itemRepo;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
/**
* Name of the news.
*/
private String name;
/**
* Title of the news.
*/
private String title;
/**
* Summary of the news.
*/
private String summary;
/**
* The initial locale of the news.
*/
private String initialLocale;
/**
* The workflow to use for the new news.
*/
private String selectedWorkflow;
/**
* The release date of the news as ISO 8601 date/time string
*/
private String releaseDate;
public MvcNewsCreateStep() {
super();
final DateTimeFormatter dateTimeFormatter
= new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.append(DateTimeFormatter.ISO_LOCAL_DATE)
.appendLiteral('T')
.appendValue(HOUR_OF_DAY, 2)
.appendLiteral(':')
.appendValue(MINUTE_OF_HOUR, 2)
.appendLiteral(':')
.appendValue(SECOND_OF_MINUTE, 2)
.toFormatter()
.withZone(ZoneId.systemDefault());
releaseDate = dateTimeFormatter.format(LocalDateTime.now());
}
@Override
public String getDocumentType() {
return News.class.getName();
}
@Override
public String getDescription() {
return globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.description");
}
@Override
public String getBundle() {
return NewsStepsConstants.BUNDLE;
}
public String getName() {
return name;
}
public String getTitle() {
return title;
}
public String getSummary() {
return summary;
}
public String getInitialLocale() {
return initialLocale;
}
public String getReleaseDate() {
return releaseDate;
}
@Transactional(Transactional.TxType.REQUIRED)
public String getSelectedWorkflow() {
if (selectedWorkflow == null || selectedWorkflow.isEmpty()) {
return getContentSection()
.getContentTypes()
.stream()
.filter(
type -> type.getContentItemClass().equals(
Article.class.getName()
)
)
.findAny()
.map(type -> type.getDefaultWorkflow())
.map(
workflow -> globalizationHelper.getValueFromLocalizedString(
workflow.getName()
)
)
.orElse("");
} else {
return selectedWorkflow;
}
}
@Override
public String showCreateStep() {
return "org/librecms/ui/contenttypes/news/create-news.xhtml";
}
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
@Override
public String createItem(final Map<String, String[]> formParams) {
if (!formParams.containsKey(FORM_PARAM_NAME)
|| formParams.get(FORM_PARAM_NAME) == null
|| formParams.get(FORM_PARAM_NAME).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.name.error.missing")
);
return showCreateStep();
}
name = formParams.get(FORM_PARAM_NAME)[0];
if (!name.matches("^([a-zA-Z0-9_-]*)$")) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.name.error.invalid")
);
return showCreateStep();
}
if (!formParams.containsKey(FORM_PARAM_TITLE)
|| formParams.get(FORM_PARAM_TITLE) == null
|| formParams.get(FORM_PARAM_TITLE).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.title.error.missing")
);
return showCreateStep();
}
title = formParams.get(FORM_PARAM_TITLE)[0];
if (!formParams.containsKey(FORM_PARAM_SUMMARY)
|| formParams.get(FORM_PARAM_SUMMARY) == null
|| formParams.get(FORM_PARAM_SUMMARY).length == 0) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.summary.error.missing")
);
return showCreateStep();
}
summary = formParams.get(FORM_PARAM_SUMMARY)[0];
if (!formParams.containsKey(FORM_PARAM_INITIAL_LOCALE)
|| formParams.get(FORM_PARAM_INITIAL_LOCALE) == null
|| formParams.get(FORM_PARAM_INITIAL_LOCALE).length == 0) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.initial_locale.error.missing")
);
return showCreateStep();
}
final Locale locale = new Locale(
formParams.get(FORM_PARAM_INITIAL_LOCALE)[0]
);
if (!formParams.containsKey(FORM_PARAM_RELEASE_DATE)
|| formParams.get(FORM_PARAM_RELEASE_DATE) == null
|| formParams.get(FORM_PARAM_RELEASE_DATE).length == 0) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.releasedate.error.missing")
);
return showCreateStep();
}
releaseDate = formParams.get(FORM_PARAM_RELEASE_DATE)[0];
final DateTimeFormatter isoDateTimeFormatter
= DateTimeFormatter.ISO_DATE_TIME.withZone(ZoneId.systemDefault());
final LocalDateTime releaseDateTime;
try {
releaseDateTime = LocalDateTime.parse(
releaseDate,
isoDateTimeFormatter
);
} catch (DateTimeParseException ex) {
addMessage(
"danger",
globalizationHelper
.getLocalizedTextsUtil(getBundle())
.getText("createstep.releasedate.error.malformed")
);
return showCreateStep();
}
if (!formParams.containsKey(FORM_PARAM_SELECTED_WORKFLOW)
|| formParams.get(FORM_PARAM_SELECTED_WORKFLOW) == null
|| formParams.get(FORM_PARAM_SELECTED_WORKFLOW).length == 0) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.none_selected")
);
return showCreateStep();
}
selectedWorkflow = formParams.get(FORM_PARAM_SELECTED_WORKFLOW)[0];
final Optional<Workflow> workflowResult = getContentSection()
.getWorkflowTemplates()
.stream()
.filter(template -> template.getUuid().equals(selectedWorkflow))
.findAny();
if (workflowResult.isEmpty()) {
addMessage(
"danger",
globalizationHelper.getLocalizedTextsUtil(
getBundle()
).getText("createstep.workflow.error.not_available")
);
return showCreateStep();
}
if (!getMessages().isEmpty()) {
return showCreateStep();
}
final News news = itemManager.createContentItem(
name,
getContentSection(),
getFolder(),
workflowResult.get(),
News.class,
new NewsInitializer(
locale,
title,
summary,
Date.from(
releaseDateTime.toInstant(
ZoneId
.systemDefault()
.getRules()
.getOffset(releaseDateTime)
)
)
),
locale
);
itemRepo.save(news);
return String.format(
"redirect:/%s/documents/%s/%s/@news-basicproperties",
getContentSectionLabel(),
getFolderPath(),
name
);
}
private class NewsInitializer implements ContentItemInitializer<News> {
private final Locale locale;
private final String title;
private final String description;
private final Date releaseDate;
public NewsInitializer(
final Locale locale,
final String title,
final String description,
final Date releaseDate
) {
this.locale = locale;
this.title = title;
this.description = description;
this.releaseDate = releaseDate;
}
@Override
public void initializeValues(final News news) {
news.getTitle().putValue(locale, title);
news.getDescription().putValue(locale, description);
news.setReleaseDate(releaseDate);
}
}
}

View File

@ -0,0 +1,618 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.FolderManager;
import org.librecms.contenttypes.News;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi;
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
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.DefaultValue;
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;
/**
* Authoring step for editing the basic properties of a {@link News} item.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "news-basicproperties")
@Controller
@MvcAuthoringStepDef(
bundle = NewsStepsConstants.BUNDLE,
descriptionKey = "authoringsteps.basicproperties.description",
labelKey = "authoringsteps.basicproprties.label",
supportedDocumentType = News.class
)
public class MvcNewsPropertiesStep extends AbstractMvcAuthoringStep {
@Inject
private NewsMessageBundle newsMessageBundle;
/**
* Used for retrieving and saving the news.
*/
@Inject
private ContentItemRepository itemRepo;
/**
* Provides functions for working with content items.
*/
@Inject
private ContentItemManager itemManager;
@Inject
private DocumentUi documentUi;
/**
* Provides functions for working with folders.
*/
@Inject
private FolderManager folderManager;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
@Inject
private ItemPermissionChecker itemPermissionChecker;
@Inject
private MvcNewsPropertiesStepModel newsPropertiesStepModel;
@Inject
private Models models;
@Override
public Class<MvcNewsPropertiesStep> getStepClass() {
return MvcNewsPropertiesStep.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void init() throws ContentSectionNotFoundException,
DocumentNotFoundException {
super.init();
newsPropertiesStepModel.setName(getDocument().getDisplayName());
newsPropertiesStepModel.setTitleValues(
getDocument()
.getTitle()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
final Set<Locale> titleLocales = getDocument()
.getTitle()
.getAvailableLocales();
newsPropertiesStepModel.setUnusedTitleLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !titleLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
newsPropertiesStepModel.setDescriptionValues(
getDocument()
.getDescription()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
final Set<Locale> descriptionLocales = getDocument()
.getDescription()
.getAvailableLocales();
newsPropertiesStepModel.setUnusedDescriptionLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !descriptionLocales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
final News news = (News) getDocument();
final DateTimeFormatter isoDateFormatter
= DateTimeFormatter.ISO_LOCAL_DATE.withZone(ZoneId.systemDefault());
final DateTimeFormatter isoTimeFormatter
= DateTimeFormatter.ISO_TIME.withZone(ZoneId.systemDefault());
final DateTimeFormatter isoDateTimeFormatter
= DateTimeFormatter.ISO_LOCAL_DATE_TIME
.withZone(ZoneId.systemDefault());
newsPropertiesStepModel.setReleaseDate(
Optional
.ofNullable(news.getReleaseDate())
.map(date -> date.toInstant())
.map(date -> isoDateTimeFormatter.format(date))
.orElse("")
);
newsPropertiesStepModel.setFormattedReleaseDate(
Optional
.ofNullable(news.getReleaseDate())
.map(date -> date.toInstant())
.map(
date -> String.format(
"%s %s",
isoDateFormatter.format(date),
isoTimeFormatter.format(date)
)
)
.orElse("")
);
}
@GET
@Path("/")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String showStep(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
return "org/librecms/ui/contenttypes/news/news-basic-properties.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
newsMessageBundle.getMessage("news.edit.denied")
);
}
}
/**
* Updates the name of the current news.
*
* @param sectionIdentifier
* @param documentPath
* @param name
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/name")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String updateName(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("name") @DefaultValue("") final String name
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
if (name.isEmpty() || name.isBlank()) {
models.put("nameMissing", true);
return showStep(sectionIdentifier, documentPath);
}
getDocument().setDisplayName(name);
itemRepo.save(getDocument());
updateDocumentPath();
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Adds a localized title to a news.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to update.
* @param value The updated title value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/title/@add")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String addTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Updates a localized title of the news.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to update.
* @param value The updated title value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/title/@edit/{locale}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String editTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Removes a localized title of the news.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to remove.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/title/@remove/{locale}")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String removeTitle(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getTitle().removeValue(locale);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Adds a localized description to the news.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale of the description.
* @param value The description value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/description/@add")
@Transactional(Transactional.TxType.REQUIRED)
public String addDescription(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Updates a localized description of the news.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to update.
* @param value The updated description value.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/description/@edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editDescription(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().putValue(locale, value);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
/**
* Removes a localized description of the news.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale to remove.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/description/@remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeDescription(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
final Locale locale = new Locale(localeParam);
getDocument().getDescription().removeValue(locale);
itemRepo.save(getDocument());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
@POST
@Path("/releasedate")
@AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED)
public String updateReleaseDate(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("releaseDate") @DefaultValue("") final String releaseDate
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getDocument())) {
if (releaseDate.isBlank()) {
models.put("releaseDateMissing", true);
return showStep(sectionIdentifier, documentPath);
}
final News news = (News) getDocument();
final DateTimeFormatter isoDateTimeFormatter
= DateTimeFormatter.ISO_DATE_TIME.withZone(
ZoneId.systemDefault()
);
final LocalDateTime releaseDateTime;
try {
releaseDateTime = LocalDateTime.parse(
releaseDate,
isoDateTimeFormatter
);
} catch (DateTimeParseException ex) {
models.put("releaseDateInvalid", true);
return showStep(sectionIdentifier, documentPath);
}
news.setReleaseDate(
Date.from(
releaseDateTime.toInstant(
ZoneId.systemDefault().getRules().getOffset(
releaseDateTime
)
)
)
);
itemRepo.save(news);
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getDocument(),
getLabel()
);
}
}
}

View File

@ -0,0 +1,116 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
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("CmsNewsPropertiesStep")
public class MvcNewsPropertiesStepModel {
private String name;
private Map<String, String> titleValues;
private List<String> unusedTitleLocales;
private Map<String, String> descriptionValues;
private List<String> unusedDescriptionLocales;
private String releaseDate;
private String formattedReleaseDate;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public Map<String, String> getTitleValues() {
return Collections.unmodifiableMap(titleValues);
}
public void setTitleValues(final Map<String, String> titleValues) {
this.titleValues = new HashMap<>(titleValues);
}
public List<String> getUnusedTitleLocales() {
return Collections.unmodifiableList(unusedTitleLocales);
}
public void setUnusedTitleLocales(List<String> unusedTitleLocales) {
this.unusedTitleLocales = new ArrayList<>(unusedTitleLocales);
}
public Map<String, String> getDescriptionValues() {
return Collections.unmodifiableMap(descriptionValues);
}
public void setDescriptionValues(
final Map<String, String> descriptionValues
) {
this.descriptionValues = new HashMap<>(descriptionValues);
}
public List<String> getUnusedDescriptionLocales() {
return Collections.unmodifiableList(unusedDescriptionLocales);
}
public void setUnusedDescriptionLocales(
final List<String> unusedDescriptionLocales
) {
this.unusedDescriptionLocales = new ArrayList<>(
unusedDescriptionLocales
);
}
public String getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(final String releaseDate) {
this.releaseDate = releaseDate;
}
public String getFormattedReleaseDate() {
return formattedReleaseDate;
}
public void setFormattedReleaseDate(final String formattedReleaseDate) {
this.formattedReleaseDate = formattedReleaseDate;
}
}

View File

@ -0,0 +1,393 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contenttypes.News;
import org.librecms.ui.contentsections.ContentSectionNotFoundException;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.AbstractMvcAuthoringStep;
import org.librecms.ui.contentsections.documents.CmsEditorUtil;
import org.librecms.ui.contentsections.documents.DocumentNotFoundException;
import org.librecms.ui.contentsections.documents.DocumentUi;
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.mvc.Controller;
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;
/**
* Authoring step for editing the main text of an {@link News}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "news-text")
@Controller
@MvcAuthoringStepDef(
bundle = NewsStepsConstants.BUNDLE,
descriptionKey = "authoringsteps.text.description",
labelKey = "authoringsteps.text.label",
supportedDocumentType = News.class
)
public class MvcNewsTextBodyStep extends AbstractMvcAuthoringStep {
@Inject
private NewsMessageBundle newsMessageBundle;
@Inject
private ConfigurationManager confManager;
/**
* Used for retrieving and saving the news.
*/
@Inject
private ContentItemRepository itemRepo;
@Inject
private DocumentUi documentUi;
/**
* Provides functions for working with {@link LocalizedString}s.
*/
@Inject
private GlobalizationHelper globalizationHelper;
@Inject
private ItemPermissionChecker itemPermissionChecker;
@Inject
private MvcNewsTextBodyStepModel newsTextBodyStepModel;
@Override
public Class<MvcNewsTextBodyStep> getStepClass() {
return MvcNewsTextBodyStep.class;
}
@GET
@Path("/")
@Transactional(Transactional.TxType.REQUIRED)
public String showStep(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getNews())) {
return "org/librecms/ui/contenttypes/news/news-text/available-languages.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getNews(),
newsMessageBundle.getMessage("news.edit.denied")
);
}
}
/**
* View a preview of the text.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam
*
* @return The template for showing a preview of the text.
*/
@GET
@Path("/view/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String viewText(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
newsTextBodyStepModel.setSelectedLocale(
new Locale(localeParam).toString()
);
return "org/librecms/ui/contenttypes/news/news-text/view.xhtml";
}
/**
* Adds a localized main text.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale of the text.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/add")
@Transactional(Transactional.TxType.REQUIRED)
public String addTextValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@FormParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getNews())) {
final String value;
if (getNews().getText().getAvailableLocales().isEmpty()) {
value = "";
} else {
value = globalizationHelper.getValueFromLocalizedString(
getNews().getText()
);
}
final Locale locale = new Locale(localeParam);
getNews().getText().putValue(locale, value);
itemRepo.save(getNews());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getNews(),
getLabel()
);
}
}
@GET
@Path("/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editTextValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getNews())) {
newsTextBodyStepModel.setSelectedLocale(
new Locale(localeParam).toString()
);
return "org/librecms/ui/contenttypes/news/news-text/edit.xhtml";
} else {
return documentUi.showAccessDenied(
getContentSection(),
getNews(),
newsMessageBundle.getMessage("news.edit.denied")
);
}
}
/**
* Updates a localized main text.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale of the text.
* @param value The text.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/edit/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String editTextValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam,
@FormParam("value") final String value
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getNews())) {
final Locale locale = new Locale(localeParam);
getNews().getText().putValue(locale, value);
itemRepo.save(getNews());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getNews(),
getLabel()
);
}
}
/**
* Removes a localized main text.
*
* @param sectionIdentifier
* @param documentPath
* @param localeParam The locale of the text.
*
* @return A redirect to this authoring step.
*/
@POST
@Path("/remove/{locale}")
@Transactional(Transactional.TxType.REQUIRED)
public String removeTextValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath,
@PathParam("locale") final String localeParam
) {
try {
init();
} catch (ContentSectionNotFoundException ex) {
return ex.showErrorMessage();
} catch (DocumentNotFoundException ex) {
return ex.showErrorMessage();
}
if (itemPermissionChecker.canEditItem(getNews())) {
final Locale locale = new Locale(localeParam);
getNews().getText().removeValue(locale);
itemRepo.save(getNews());
return buildRedirectPathForStep();
} else {
return documentUi.showAccessDenied(
getContentSection(),
getNews(),
getLabel()
);
}
}
@Override
protected void init() throws ContentSectionNotFoundException,
DocumentNotFoundException {
super.init();
if (itemPermissionChecker.canEditItem(getNews())) {
newsTextBodyStepModel.setCanEdit(
itemPermissionChecker.canEditItem(getNews())
);
newsTextBodyStepModel.setTitleValues(
getNews()
.getTitle()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
newsTextBodyStepModel.setTextValues(
getNews()
.getText()
.getValues()
.entrySet()
.stream()
.collect(
Collectors.toMap(
entry -> entry.getKey().toString(),
Map.Entry::getValue
)
)
);
newsTextBodyStepModel.setVariants(
getNews()
.getText()
.getValues()
.entrySet()
.stream()
.map(CmsEditorUtil::buildVariantRow)
.collect(Collectors.toList())
);
final Set<Locale> locales = getNews()
.getText()
.getAvailableLocales();
newsTextBodyStepModel.setUnusedLocales(
globalizationHelper
.getAvailableLocales()
.stream()
.filter(locale -> !locales.contains(locale))
.map(Locale::toString)
.collect(Collectors.toList())
);
}
}
private News getNews() {
return (News) getDocument();
}
}

View File

@ -0,0 +1,114 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
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("CmsNewsTextBodyStep")
public class MvcNewsTextBodyStepModel {
private boolean canEdit;
private Map<String, String> titleValues;
private Map<String, String> textValues;
private List<CmsEditorLocaleVariantRow> variants;
private List<String> unusedLocales;
private String selectedLocale;
public Map<String, String> getTitleValues() {
return Collections.unmodifiableMap(titleValues);
}
protected void setTitleValues(final Map<String, String> titleValues) {
this.titleValues = new HashMap<>(titleValues);
}
public String getTitle() {
return titleValues.get(selectedLocale);
}
/**
* Get all localized values of the main text.
*
* @return The localized values of the main text.
*/
public Map<String, String> getTextValues() {
return Collections.unmodifiableMap(textValues);
}
protected void setTextValues(final Map<String, String> textValues) {
this.textValues = new HashMap<>(textValues);
}
/**
* Gets the locales for which the main text has not been defined yet.
*
* @return The locales for which the main text has not been defined yet.
*/
public List<CmsEditorLocaleVariantRow> getVariants() {
return Collections.unmodifiableList(variants);
}
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
this.variants = new ArrayList<>(variants);
}
public List<String> getUnusedLocales() {
return Collections.unmodifiableList(unusedLocales);
}
protected void setUnusedLocales(final List<String> unusedLocales) {
this.unusedLocales = new ArrayList<>(unusedLocales);
}
public String getSelectedLocale() {
return selectedLocale;
}
protected void setSelectedLocale(final String selectedLocale) {
this.selectedLocale = selectedLocale;
}
public boolean getCanEdit() {
return canEdit;
}
protected void setCanEdit(final boolean canEdit) {
this.canEdit = canEdit;
}
}

View File

@ -0,0 +1,143 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentSection;
import org.librecms.contenttypes.News;
import org.librecms.ui.contentsections.ContentSectionsUi;
import org.librecms.ui.contentsections.ItemPermissionChecker;
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
import java.util.Locale;
import java.util.StringTokenizer;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.ForbiddenException;
import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
* Resources used by the editor for {@link News#text}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "news-text-resources")
public class MvcNewsTextBodyStepResources {
/**
* Used for retrieving and saving the news.
*/
@Inject
private ContentItemRepository itemRepo;
@Inject
private ContentSectionsUi sectionsUi;
@Inject
private ItemPermissionChecker itemPermissionChecker;
@GET
@Path("/variants/wordcount/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String getWordCount(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof News)) {
throw new NotFoundException();
}
final News news = (News) document;
if (itemPermissionChecker.canEditItem(news)) {
final String text = news
.getText()
.getValue(new Locale(localeParam));
final Document jsoupDoc = Jsoup.parseBodyFragment(text);
final long result = new StringTokenizer(
jsoupDoc.body().text()
).countTokens();
return Long.toString(result);
} else {
throw new ForbiddenException();
}
}
@GET
@Path("/variants/{locale}")
@Produces(MediaType.TEXT_HTML)
@Transactional(Transactional.TxType.REQUIRED)
public String viewTextValue(
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPathParam,
@PathParam("locale") final String localeParam
) {
final ContentSection contentSection = sectionsUi
.findContentSection(sectionIdentifier)
.orElseThrow(
() -> new NotFoundException()
);
final ContentItem document = itemRepo
.findByPath(contentSection, documentPathParam)
.orElseThrow(
() -> new NotFoundException()
);
if (!(document instanceof News)) {
throw new NotFoundException();
}
final News news = (News) document;
if (itemPermissionChecker.canEditItem(news)) {
return news.getText().getValue(new Locale(localeParam));
} else {
throw new ForbiddenException();
}
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
import org.libreccm.ui.AbstractMessagesBean;
import org.librecms.contenttypes.News;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
* Message Bundle for the authoring steps for editing a {@link News}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Named("CmsNewsMessageBundle")
public class NewsMessageBundle extends AbstractMessagesBean {
@Override
protected String getMessageBundle() {
return NewsStepsConstants.BUNDLE;
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2022 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.contenttypes.news;
/**
* Constants for the authoring steps for editing a {@link News}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public final class NewsStepsConstants {
private NewsStepsConstants() {
// Nothing
}
public static final String BUNDLE = "org.librecms.ui.contenttypes.NewsBundle";
}

View File

@ -189,6 +189,13 @@
shortDescription="Info about the available variants. Must be a List of CmsEditorLocaleVariantRow objects." shortDescription="Info about the available variants. Must be a List of CmsEditorLocaleVariantRow objects."
type="java.util.List" type="java.util.List"
/> />
<cc:attribute
name="variantsId"
default=""
required="false"
shortDescription="ID for the variants component. Required if multiple instances of this component are used on the same page."
type="String"
/>
<cc:attribute <cc:attribute
name="viewPageUrl" name="viewPageUrl"
required="true" required="true"
@ -227,7 +234,7 @@
<div class="text-right"> <div class="text-right">
<button <button
class="btn btn-secondary" class="btn btn-secondary"
data-target="##{cc.attrs.editorId}-dialog" data-target="##{cc.attrs.variantsId}-dialog"
data-toggle="modal" data-toggle="modal"
type="button" type="button"
> >
@ -236,10 +243,10 @@
</button> </button>
</div> </div>
<div <div
aria-labelledby="#{cc.attrs.editorId}-dialog-title" aria-labelledby="#{cc.attrs.variantsId}-dialog-title"
aria-hidden="true" aria-hidden="true"
class="modal fade" class="modal fade"
id="#{cc.attrs.editorId}-dialog" id="#{cc.attrs.variantsId}-dialog"
tabindex="-1" tabindex="-1"
> >
<div class="modal-dialog"> <div class="modal-dialog">
@ -255,7 +262,7 @@
> >
<h2 <h2
class="modal-title" class="modal-title"
id="#{cc.attrs.editorId}-dialog-title" id="#{cc.attrs.variantsId}-dialog-title"
> >
#{cc.attrs.addDialogTitle} #{cc.attrs.addDialogTitle}
</h2> </h2>
@ -265,7 +272,7 @@
> >
<h3 <h3
class="modal-title" class="modal-title"
id="#{cc.attrs.editorId}-dialog-title" id="#{cc.attrs.variantsId}-dialog-title"
> >
#{cc.attrs.addDialogTitle} #{cc.attrs.addDialogTitle}
</h3> </h3>
@ -275,7 +282,7 @@
> >
<h4 <h4
class="modal-title" class="modal-title"
id="#{cc.attrs.editorId}-dialog-title" id="#{cc.attrs.variantsId}-dialog-title"
> >
#{cc.attrs.addDialogTitle} #{cc.attrs.addDialogTitle}
</h4> </h4>
@ -285,7 +292,7 @@
> >
<h5 <h5
class="modal-title" class="modal-title"
id="#{cc.attrs.editorId}-dialog-title" id="#{cc.attrs.variantsId}-dialog-title"
> >
#{cc.attrs.addDialogTitle} #{cc.attrs.addDialogTitle}
</h5> </h5>
@ -295,7 +302,7 @@
> >
<h6 <h6
class="modal-title" class="modal-title"
id="#{cc.attrs.editorId}-dialog-title" id="#{cc.attrs.variantsId}-dialog-title"
> >
#{cc.attrs.addDialogTitle} #{cc.attrs.addDialogTitle}
</h6> </h6>
@ -320,13 +327,13 @@
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label <label
for="#{cc.attrs.editorId}-form-locale-select" for="#{cc.attrs.variantsId}-form-locale-select"
> >
#{cc.attrs.addDialogLocaleSelectLabel} #{cc.attrs.addDialogLocaleSelectLabel}
</label> </label>
<select <select
aria-describedby="#{cc.attrs.editorId}-form-locale-select-help" aria-describedby="#{cc.attrs.variantsId}-form-locale-select-help"
id="#{cc.attrs.editorId}-form-locale-select" id="#{cc.attrs.variantsId}-form-locale-select"
name="locale" name="locale"
required="true" required="true"
> >
@ -341,7 +348,7 @@
</select> </select>
<small <small
class="form-text text-muted" class="form-text text-muted"
id="#{cc.attrs.editorId}-form-locale-select-help" id="#{cc.attrs.variantsId}-form-locale-select-help"
> >
#{cc.attrs.addDialogLocaleSelectHelp} #{cc.attrs.addDialogLocaleSelectHelp}
</small> </small>
@ -423,7 +430,7 @@
</a> </a>
<button <button
class="btn btn-danger" class="btn btn-danger"
data-target="##{cc.attrs.editorId}-#{variant.locale}-remove-dialog" data-target="##{cc.attrs.variantsId}-#{variant.locale}-remove-dialog"
data-toggle="modal" data-toggle="modal"
type="button" type="button"
> >
@ -435,11 +442,11 @@
</span> </span>
</button> </button>
<div <div
aria-describedby="#{cc.attrs.editorId}-#{variant.locale}-remove-dialog-title" aria-describedby="#{cc.attrs.variantsId}-#{variant.locale}-remove-dialog-title"
aria-hidden="true" aria-hidden="true"
class="modal fade" class="modal fade"
data-backdrop="static" data-backdrop="static"
id="#{cc.attrs.editorId}-#{variant.locale}-remove-dialog" id="#{cc.attrs.variantsId}-#{variant.locale}-remove-dialog"
tabindex="-1" tabindex="-1"
> >
<div class="modal-dialog"> <div class="modal-dialog">

View File

@ -8,7 +8,7 @@
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml"> <ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="authoringStep" <ui:param name="authoringStep"
value="/libreccm/@contentsections/info/documents/test-article/@article-text" /> value="/libreccm/@contentsections/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text" />
<ui:define name="authoringStep"> <ui:define name="authoringStep">
<h2>#{CmsArticleMessageBundle['textstep.header']}</h2> <h2>#{CmsArticleMessageBundle['textstep.header']}</h2>

View File

@ -20,7 +20,7 @@
<c:if test="#{CmsArticleTextBodyStep.canEdit}"> <c:if test="#{CmsArticleTextBodyStep.canEdit}">
<div class="text-right"> <div class="text-right">
<a class="btn btn-secondary" <a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/#{CmsArticleTextBodyStep.selectedLocale}/@edit"> href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/@edit/#{CmsArticleTextBodyStep.selectedLocale}">
<bootstrap:svgIcon icon="pen" /> <bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{CmsArticleMessageBundle['textstep.languages.edit']}</span> <span class="sr-only">#{CmsArticleMessageBundle['textstep.languages.edit']}</span>
</a> </a>

View File

@ -0,0 +1,90 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/contentsection.xhtml">
<ui:define name="main">
<div class="container">
<h1>${CmsEventMessageBundle["createform.title"]}</h1>
<c:forEach items="#{CmsEventCreateStep.messages.entrySet()}"
var="message">
<div class="alert alert-#{message.key}"
role="alert">
#{message.value}
</div>
</c:forEach>
<form action="#{mvc.basePath}/#{CmsEventCreateStep.contentSectionLabel}/documents/#{CmsEventCreateStep.folderPath}@create/#{CmsEventCreateStep.documentType}"
method="post">
<bootstrap:formGroupText
help="#{CmsEventMessageBundle['createform.name.help']}"
inputId="name"
label="#{CmsEventMessageBundle['createform.name.label']}"
name="name"
pattern="^([a-zA-Z0-9_-]*)$"
required="true"
/>
<bootstrap:formGroupSelect
help="#{CmsEventMessageBundle['createform.initial_locale.help']}"
inputId="locale"
label="#{CmsEventMessageBundle['createform.initial_locale.label']}"
name="locale"
options="#{CmsEventCreateStep.availableLocales}"
required="true"
selectedOptions="#{[CmsEventCreateStep.initialLocale]}"
/>
<bootstrap:formGroupText
help="#{CmsEventMessageBundle['createform.title.help']}"
inputId="title"
label="#{CmsEventMessageBundle['createform.title.label']}"
name="title"
required="true"
/>
<bootstrap:formGroupDateTime
help="#{CmsEventMessageBundle['createform.startdate.help']}"
inputId="startDate"
label="#{CmsEventMessageBundle['createform.startdate.label']}"
name="startDate"
required="true"
/>
<bootstrap:formGroupTextarea
cols="80"
help="#{CmsEventMessageBundle['createform.summary.help']}"
inputId="summary"
label="#{CmsEventMessageBundle['createform.summary.label']}"
name="summary"
required="true"
rows="16"
/>
<bootstrap:formGroupSelect
help="#{CmsEventMessageBundle['createform.workflow.help']}"
inputId="workflow"
label="#{CmsEventMessageBundle['createform.workflow.label']}"
name="workflow"
options="#{CmsEventCreateStep.availableWorkflows}"
selectedOptions="#{[CmsEventCreateStep.selectedWorkflow]}"
/>
<a class="btn btn-warning"
href="#{mvc.basePath}/#{CmsEventCreateStep.contentSectionLabel}/documentsfolders/#{CmsEventCreateStep.folderPath}">
#{CmsEventMessageBundle['createform.cancel']}
</a>
<button class="btn btn-success"
type="submit">
#{CmsEventMessageBundle['createform.submit']}
</button>
</form>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,230 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="authoringStep"
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties" />
<ui:define name="authoringStep">
<h2>#{CmsEventMessageBundle.getMessage('basicproperties.header', [CmsEventPropertiesStep.name])}</h2>
<h3>#{CmsEventMessageBundle['basicproperties.name.header']}</h3>
<div class="d-flex">
<pre class="mr-2">#{CmsEventPropertiesStep.name}</pre>
<c:if test="#{CmsSelectedDocumentModel.canEdit}">
<button class="btn btn-primary btn-sm"
data-toggle="modal"
data-target="#name-edit-dialog"
type="button">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">
#{CmsEventMessageBundle['basicproperties.name.edit']}
</span>
</button>
</c:if>
</div>
<c:if test="#{CmsSelectedDocumentModel.canEdit}">
<div aria-hidden="true"
aria-labelledby="name-edit-dialog-title"
class="modal fade"
id="name-edit-dialog"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/name"
class="modal-content"
method="post">
<div class="modal-header">
<h4 class="modal-title"
id="name-edit-dialog-title">
#{CmsEventMessageBundle['basicproperties.name.edit.title']}
</h4>
<button aria-label="#{CmsEventMessageBundle['basicproperties.name.edit.close']}"
class="close"
data-dismiss="modal"
type="button">
<bootstrap:svgIcon icon="x" />
</button>
</div>
<div class="modal-body">
<bootstrap:formGroupText
help="#{CmsEventMessageBundle['basicproperties.name.help']}"
inputId="name"
label="#{CmsEventMessageBundle['basicproperties.name.label']}"
name="name"
pattern="^([a-zA-Z0-9_-]*)$"
required="true"
value="#{CmsEventPropertiesStep.name}"/>
</div>
<div class="modal-footer">
<button class="btn btn-warning"
data-dismiss="modal"
type="button">
#{CmsEventMessageBundle['basicproperties.name.edit.close']}
</button>
<button class="btn btn-success"
type="submit">
#{CmsEventMessageBundle['basicproperties.name.edit.submit']}
</button>
</div>
</form>
</div>
</div>
</c:if>
<libreccm:localizedStringEditor
addButtonLabel="#{CmsEventMessageBundle['basicproperties.title.add']}"
addDialogCancelLabel="#{CmsEventMessageBundle['basicproperties.title.add.cancel']}"
addDialogLocaleSelectHelp="#{CmsEventMessageBundle['basicproperties.title.add.locale.help']}"
addDialogLocaleSelectLabel="#{CmsEventMessageBundle['basicproperties.title.add.locale.label']}"
addDialogSubmitLabel="#{CmsEventMessageBundle['basicproperties.title.add.submit']}"
addDialogTitle="#{CmsEventMessageBundle['basicproperties.title.add.header']}"
addDialogValueHelp="#{CmsEventMessageBundle['basicproperties.title.add.value.help']}"
addDialogValueLabel="#{CmsEventMessageBundle['basicproperties.title.add.value.label']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/title/@add"
editButtonLabel="#{CmsEventMessageBundle['basicproperties.title.edit']}"
editDialogCancelLabel="#{CmsEventMessageBundle['basicproperties.title.edit.cancel']}"
editDialogSubmitLabel="#{CmsEventMessageBundle['basicproperties.title.edit.submit']}"
editDialogTitle="#{CmsEventMessageBundle['basicproperties.title.edit.header']}"
editDialogValueHelp="#{CmsEventMessageBundle['basicproperties.title.edit.value.help']}"
editDialogValueLabel="#{CmsEventMessageBundle['basicproperties.title.edit.value.label']}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/title/@edit"
editorId="title-editor"
hasUnusedLocales="#{!CmsEventPropertiesStep.unusedTitleLocales.isEmpty()}"
headingLevel="3"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
readOnly="#{!CmsSelectedDocumentModel.canEdit}"
removeButtonLabel="#{CmsEventMessageBundle['basicproperties.title.remove']}"
removeDialogCancelLabel="#{CmsEventMessageBundle['basicproperties.title.remove.cancel']}"
removeDialogSubmitLabel="#{CmsEventMessageBundle['basicproperties.title.remove.submit']}"
removeDialogText="#{CmsEventMessageBundle['basicproperties.title.remove.text']}"
removeDialogTitle="#{CmsEventMessageBundle['basicproperties.title.remove.header']}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/title/@remove"
title="#{CmsEventMessageBundle['basicproperties.title.header']}"
unusedLocales="#{CmsEventPropertiesStep.unusedTitleLocales}"
values="#{CmsEventPropertiesStep.titleValues}"
/>
<div class="d-flex">
<h3 class="mr-2">#{CmsEventMessageBundle['basicproperties.eventdatetime.header']}</h3>
<button class="btn btn-primary btn-sm"
data-toggle="modal"
data-target="#eventdatetime-edit-dialog"
type="button">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">
#{CmsEventMessageBundle['basicproperties.eventdatetime.edit']}
</span>
</button>
</div>
<dl>
<dt>#{CmsEventMessageBundle['basicproperties.startdate']}</dt>
<dd>
#{CmsEventPropertiesStep.hasStartDate ? CmsEventPropertiesStep.formattedStartDateTime : CmsEventMessageBundle['basicproperties.startdate.none']}
</dd>
<dt>#{CmsEventMessageBundle['basicproperties.enddate']}</dt>
<dd>
#{CmsEventPropertiesStep.hasEndDate ? CmsEventPropertiesStep.formattedEndDateTime : CmsEventMessageBundle['basicproperties.enddate.none']}
</dd>
</dl>
<div aria-hidden="true"
aria-labelledby="eventdatetime-edit-dialog-title"
class="modal fade"
id="eventdatetime-edit-dialog"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/eventdatetime"
class="modal-content"
method="post">
<div class="modal-header">
<h4 class="modal-title"
id="eventdatetime-edit-dialog-title">
#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.title']}
</h4>
<button aria-label="#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.close']}"
class="close"
data-dismiss="modal"
type="button">
<bootstrap:svgIcon icon="x" />
</button>
</div>
<div class="modal-body">
<bootstrap:formGroupDateTime
help="#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.startdate.help']}"
inputId="startDateTime"
label="#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.startdate.label']}"
name="startDateTime"
required="true"
value="#{CmsEventPropertiesStep.startDateTime}"
/>
<bootstrap:formGroupDateTime
help="#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.enddate.help']}"
inputId="endDateTime"
label="#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.enddate.label']}"
name="endDateTime"
required="true"
value="#{CmsEventPropertiesStep.endDateTime}"
/>
</div>
<div class="modal-footer">
<button class="btn btn-warning"
data-dismiss="modal"
type="button">
#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.close']}
</button>
<button class="btn btn-success"
type="submit">
#{CmsEventMessageBundle['basicproperties.eventdatetime.edit.dialog.submit']}
</button>
</div>
</form>
</div>
</div>
<libreccm:localizedStringEditor
addButtonLabel="#{CmsEventMessageBundle['basicproperties.description.add']}"
addDialogCancelLabel="#{CmsEventMessageBundle['basicproperties.description.add.cancel']}"
addDialogLocaleSelectHelp="#{CmsEventMessageBundle['basicproperties.description.add.locale.help']}"
addDialogLocaleSelectLabel="#{CmsEventMessageBundle['basicproperties.description.add.locale.label']}"
addDialogSubmitLabel="#{CmsEventMessageBundle['basicproperties.description.add.submit']}"
addDialogTitle="#{CmsEventMessageBundle['basicproperties.description.add.header']}"
addDialogValueHelp="#{CmsEventMessageBundle['basicproperties.description.add.value.help']}"
addDialogValueLabel="#{CmsEventMessageBundle['basicproperties.description.add.value.label']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/description/@add"
editButtonLabel="#{CmsEventMessageBundle['basicproperties.description.edit']}"
editDialogCancelLabel="#{CmsEventMessageBundle['basicproperties.description.edit.cancel']}"
editDialogSubmitLabel="#{CmsEventMessageBundle['basicproperties.description.edit.submit']}"
editDialogTitle="#{CmsEventMessageBundle['basicproperties.description.edit.header']}"
editDialogValueHelp="#{CmsEventMessageBundle['basicproperties.description.edit.value.help']}"
editDialogValueLabel="#{CmsEventMessageBundle['basicproperties.description.edit.value.label']}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/description/@edit"
editorId="description-editor"
hasUnusedLocales="#{!CmsEventPropertiesStep.unusedDescriptionLocales.isEmpty()}"
headingLevel="3"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
readOnly="#{!CmsSelectedDocumentModel.canEdit}"
removeButtonLabel="#{CmsEventMessageBundle['basicproperties.description.remove']}"
removeDialogCancelLabel="#{CmsEventMessageBundle['basicproperties.description.remove.cancel']}"
removeDialogSubmitLabel="#{CmsEventMessageBundle['basicproperties.description.remove.submit']}"
removeDialogText="#{CmsEventMessageBundle['basicproperties.description.remove.text']}"
removeDialogTitle="#{CmsEventMessageBundle['basicproperties.description.remove.header']}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-basicproperties/description/@remove"
title="#{CmsEventMessageBundle['basicproperties.description.header']}"
unusedLocales="#{CmsEventPropertiesStep.unusedDescriptionLocales}"
values="#{CmsEventPropertiesStep.descriptionValues}"
useTextarea="true"
/>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,86 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="authoringStep"
value="/libreccm/@contentsections/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info" />
<ui:define name="authoringStep">
<h2>#{CmsEventMessageBundle['eventinfo_step.header']}</h2>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['eventdate.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsAdminMessages['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/edit"
hasUnusedLocales="#{!CmsEventInfoStepEventDate.unusedLocales.isEmpty()}"
headingLevel="3"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['eventdate.editor.header']}"
unusedLocales="#{CmsEventInfoStepEventDate.unusedLocales}"
variants="#{CmsEventInfoStepEventDate.variants}"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/view"
/>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['location.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsAdminMessages['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/edit"
hasUnusedLocales="#{!CmsEventInfoStepLocation.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['location.editor.header']}"
unusedLocales="#{CmsEventInfoStepLocation.unusedLocales}"
variants="#{CmsEventInfoStepLocation.variants}"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/view"
/>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['main_contributor.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsAdminMessages['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/edit"
hasUnusedLocales="#{!CmsEventInfoStepMainContributor.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['main_contributor.editor.header']}"
unusedLocales="#{CmsEventInfoStepMainContributor.unusedLocales}"
variants="#{CmsEventInfoStepMainContributor.variants}"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/view"
/>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['eventtype.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsAdminMessages['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/edit"
hasUnusedLocales="#{!CmsEventInfoStepEventType.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['eventtype.editor.header']}"
unusedLocales="#{CmsEventInfoStepEventType.unusedLocales}"
variants="#{CmsEventInfoStepEventType.variants}"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/view"
/>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/cms-editor.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,89 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="authoringStep"
value="/libreccm/@contentsections/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info" />
<ui:define name="authoringStep">
<h2>#{CmsEventMessageBundle['eventinfo_step.header']}</h2>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['eventdate.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsEventMessageBundle['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/edit"
hasUnusedLocales="#{!CmsEventInfoStepEventDate.unusedLocales.isEmpty()}"
headingLevel="3"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['eventdate.editor.header']}"
unusedLocales="#{CmsEventInfoStepEventDate.unusedLocales}"
variants="#{CmsEventInfoStepEventDate.variants}"
variantsId="eventdate"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/view"
/>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['location.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsEventMessageBundle['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/edit"
hasUnusedLocales="#{!CmsEventInfoStepLocation.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['location.editor.header']}"
unusedLocales="#{CmsEventInfoStepLocation.unusedLocales}"
variants="#{CmsEventInfoStepLocation.variants}"
variantsId="location"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/view"
/>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['main_contributor.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsEventMessageBundle['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/edit"
hasUnusedLocales="#{!CmsEventInfoStepMainContributor.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['main_contributor.editor.header']}"
unusedLocales="#{CmsEventInfoStepMainContributor.unusedLocales}"
variants="#{CmsEventInfoStepMainContributor.variants}"
variantsId="maincontributor"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/view"
/>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsEventMessageBundle['eventtype.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsEventMessageBundle['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/edit"
hasUnusedLocales="#{!CmsEventInfoStepEventType.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/edit-source"
title="#{CmsEventMessageBundle['eventtype.editor.header']}"
unusedLocales="#{CmsEventInfoStepEventType.unusedLocales}"
variants="#{CmsEventInfoStepEventType.variants}"
variantsId="eventtype"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/view"
/>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/cms-editor.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.eventdate.header.edit',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepEventDate.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepEventDate.canEdit}">
<librecms:cmsEditor
backUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info"
baseUrl="#{mvc.basePath}"
canEdit="#{CmsEventInfoStepEventDate.canEdit}"
contentSection="#{ContentSectionModel.sectionName}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info/eventdate/edit"
editorId="cms-event-eventdate-editor"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
selectedLocale="#{CmsEventInfoStepEventDate.selectedLocale}"
title="#{CmsEventMessageBundle['eventinfo_step.eventdate.editor.header']}"
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info-resources/eventdate"
/>
</c:if>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/event-info-step-eventdate.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
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/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.eventdate.header.view',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepEventDate.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepEventDate.canEdit}">
<div class="text-right">
<a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventdate/edit">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.edit']}</span>
</a>
</div>
</c:if>
<div class="cms-text-preview article-text border p-2">
<h:outputText escape="false"
value="#{CmsEventInfoStepEventDate.eventDateValues.get(CmsEventInfoStepEventDate.selectedLocale)}" />
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.eventtype.header.edit',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepEventType.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepEventType.canEdit}">
<librecms:cmsEditor
backUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info"
baseUrl="#{mvc.basePath}"
canEdit="#{CmsEventInfoStepEventType.canEdit}"
contentSection="#{ContentSectionModel.sectionName}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info/eventtype/edit"
editorId="cms-event-eventtype-editor"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
selectedLocale="#{CmsEventInfoStepEventType.selectedLocale}"
title="#{CmsEventMessageBundle['eventinfo_step.eventtype.editor.header']}"
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info-resources/eventtype"
/>
</c:if>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/event-info-step-eventtype.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
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/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.eventtype.header.view',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepEventType.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepEventType.canEdit}">
<div class="text-right">
<a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/eventtype/edit">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.edit']}</span>
</a>
</div>
</c:if>
<div class="cms-text-preview article-text border p-2">
<h:outputText escape="false"
value="#{CmsEventInfoStepEventType.eventTypeValues.get(CmsEventInfoStepEventType.selectedLocale)}" />
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.location.header.edit',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepLocation.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepLocation.canEdit}">
<librecms:cmsEditor
backUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info"
baseUrl="#{mvc.basePath}"
canEdit="#{CmsEventInfoStepLocation.canEdit}"
contentSection="#{ContentSectionModel.sectionName}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info/location/edit"
editorId="cms-event-location-editor"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
selectedLocale="#{CmsEventInfoStepLocation.selectedLocale}"
title="#{CmsEventMessageBundle['eventinfo_step.location.editor.header']}"
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info-resources/location"
/>
</c:if>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/event-info-step-location.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,41 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
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/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.location.header.view',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepLocation.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepLocation.canEdit}">
<div class="text-right">
<a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/location/edit">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.edit']}</span>
</a>
</div>
</c:if>
<div class="cms-text-preview article-text border p-2">
<h:outputText escape="false"
value="#{CmsEventInfoStepLocation.locationValues.get(CmsEventInfoStepLocation.selectedLocale)}" />
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,45 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.main_contributor.header.edit',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepMainContributor.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepMainContributor.canEdit}">
<librecms:cmsEditor
backUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info"
baseUrl="#{mvc.basePath}"
canEdit="#{CmsEventInfoStepMainContributor.canEdit}"
contentSection="#{ContentSectionModel.sectionName}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info/main-contributor/edit"
editorId="cms-event-maincontributor-editor"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
selectedLocale="#{CmsEventInfoStepMainContributor.selectedLocale}"
title="#{CmsEventMessageBundle['eventinfo_step.main_contributor.editor.header']}"
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info-resources/main-contributor"
/>
</c:if>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/event-info-step-maincontributor.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
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/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemName}/@event-info">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.back']}</span>
</a>
<h2>#{CmsEventMessageBundle.getMessage('eventinfo_step.main_contributor.header.view',[CmsSelectedDocumentModel.itemName, CmsEventInfoStepMainContributor.selectedLocale])}</h2>
</div>
<c:if test="#{CmsEventInfoStepMainContributor.canEdit}">
<div class="text-right">
<a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@event-info/main-contributor/edit">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{CmsEventMessageBundle['eventinfo_step.edit']}</span>
</a>
</div>
</c:if>
<div class="cms-text-preview article-text border p-2">
<h:outputText escape="false"
value="#{CmsEventInfoStepMainContributor.mainContributorValues.get(CmsEventInfoStepMainContributor.selectedLocale)}" />
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,96 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/contentsection.xhtml">
<ui:define name="main">
<div class="container">
<h1>#{CmsNewsMessageBundle['createform.title']}</h1>
<c:forEach items="#{CmsNewsCreateStep.messages.entrySet()}"
var="message">
<div class="alert alert-#{message.key}" role="alert">
#{message.value}
</div>
</c:forEach>
<form action="#{mvc.basePath}/#{CmsNewsCreateStep.contentSectionLabel}/documents/#{CmsNewsCreateStep.folderPath}@create/#{CmsNewsCreateStep.documentType}"
method="post">
<bootstrap:formGroupText
help="#{CmsNewsMessageBundle['createform.name.help']}"
inputId="name"
label="#{CmsNewsMessageBundle['createform.name.label']}"
name="name"
pattern="^([a-zA-Z0-9_-]*)$"
required="true"
value="#{CmsNewsCreateStep.name}"
/>
<bootstrap:formGroupSelect
help="#{CmsNewsMessageBundle['createform.initial_locale.help']}"
inputId="locale"
label="#{CmsNewsMessageBundle['createform.initial_locale.label']}"
name="locale"
options="#{CmsNewsCreateStep.availableLocales}"
required="true"
selectedOptions="#{[CmsNewsCreateStep.initialLocale]}"
/>
<bootstrap:formGroupText
help="#{CmsNewsMessageBundle['createform.title.help']}"
inputId="title"
label="#{CmsNewsMessageBundle['createform.title.label']}"
name="title"
required="true"
value="#{CmsNewsCreateStep.title}"
/>
<bootstrap:formGroupTextarea
cols="80"
help="#{CmsNewsMessageBundle['createform.summary.help']}"
inputId="summary"
label="#{CmsNewsMessageBundle['createform.summary.label']}"
name="summary"
required="true"
rows="16"
value="#{CmsNewsCreateStep.summary}"
/>
<bootstrap:formGroupDateTime
help="#{CmsNewsMessageBundle['createform.releasedate.help']}"
inputId="releaseDate"
label="#{CmsNewsMessageBundle['createform.releasedate.label']}"
name="releaseDate"
value="#{CmsNewsCreateStep.releaseDate}"
/>
<bootstrap:formGroupSelect
help="#{CmsNewsMessageBundle['createform.workflow.help']}"
inputId="workflow"
label="#{CmsNewsMessageBundle['createform.workflow.label']}"
name="workflow"
options="#{CmsNewsCreateStep.availableWorkflows}"
selectedOptions="#{[CmsNewsCreateStep.selectedWorkflow]}"
/>
<a class="btn btn-warning"
href="#{mvc.basePath}/#{CmsNewsCreateStep.contentSectionLabel}/documentfolders/#{CmsNewsCreateStep.folderPath}">
#{CmsNewsMessageBundle['createform.cancel']}
</a>
<button class="btn btn-success"
type="submit">
#{CmsNewsMessageBundle['createform.submit']}
</button>
</form>
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,214 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="authoringStep"
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties" />
<ui:define name="authoringStep">
<h2>#{CmsNewsMessageBundle.getMessage('basicproperties.header', [CmsNewsPropertiesStep.name])}</h2>
<h3>#{CmsNewsMessageBundle['basicproeperties.name.header']}</h3>
<div class="d-flex">
<pre class="mr-2">#{CmsNewsPropertiesStep.name}</pre>
<c:if test="#{CmsSelectedDocumentModel.canEdit}">
<button class="btn btn-primary btn-sm"
data-toggle="modal"
data-target="#name-edit-dialog"
type="button">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">
#{CmsNewsMessageBundle['basicproperties.name.edit']}
</span>
</button>
</c:if>
</div>
<c:if test="#{CmsSelectedDocumentModel.canEdit}">
<div aria-hidden="true"
aria-labelledby="name-edit-dialog-title"
class="modal fade"
id="name-edit-dialog"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/name"
class="modal-content"
method="post">
<div class="modal-header">
<h4 class="modal-title"
id="name-edit-dialog-title">
#{CmsNewsMessageBundle['basicproperties.name.edit.title']}
</h4>
<button aria-label="#{CmsNewsMessageBundle['basicproperties.name.edit.close']}"
class="close"
data-dismiss="modal"
type="button">
<bootstrap:svgIcon icon="x" />
</button>
</div>
<div class="modal-body">
<bootstrap:formGroupText
help="#{CmsNewsMessageBundle['basicproperties.name.help']}"
inputId="name"
label="#{CmsNewsMessageBundle['basicproperties.name.label']}"
name="name"
pattern="^([a-zA-Z0-9_-]*)$"
required="true"
value="#{CmsNewsPropertiesStep.name}"/>
</div>
<div class="modal-footer">
<button class="btn btn-warning"
data-dismiss="modal"
type="button">
#{CmsNewsMessageBundle['basicproperties.name.edit.close']}
</button>
<button class="btn btn-success"
type="submit">
#{CmsNewsMessageBundle['basicproperties.name.edit.submit']}
</button>
</div>
</form>
</div>
</div>
</c:if>
<h3>#{CmsNewsMessageBundle['basicproperties.releasedate.header']}</h3>
<div class="d-flex">
<p class="mr-2">#{CmsNewsPropertiesStep.formattedReleaseDate}</p>
<c:if test="#{CmsSelectedDocumentModel.canEdit}">
<button class="btn btn-primary btn-sm"
data-toggle="modal"
data-target="#releasedate-edit-dialog"
type="button">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">
#{CmsNewsMessageBundle['basicproperties.releasedate.edit']}
</span>
</button>
</c:if>
</div>
<c:if test="#{CmsSelectedDocumentModel.canEdit}">
<div aria-hidden="true"
aria-labelledby="releasedate-edit-dialog-title"
class="modal fade"
id="releasedate-edit-dialog"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/releasedate"
class="modal-content"
method="post">
<div class="modal-header">
<h4 class="modal-title"
id="releasedate-edit-dialog-title">
#{CmsNewsMessageBundle['basicproperties.releasedate.edit.title']}
</h4>
<button aria-label="#{CmsNewsMessageBundle['basicproperties.releasedate.edit.close']}"
class="close"
data-dismiss="modal"
type="button">
<bootstrap:svgIcon icon="x" />
</button>
</div>
<div class="modal-body">
<bootstrap:formGroupDateTime
help="#{CmsNewsMessageBundle['basicproperties.releasedate.help']}"
inputId="releaseDate"
label="#{CmsNewsMessageBundle['basicproperties.releasedate.label']}"
name="releaseDate"
required="true"
value="#{CmsNewsPropertiesStep.releaseDate}"/>
</div>
<div class="modal-footer">
<button class="btn btn-warning"
data-dismiss="modal"
type="button">
#{CmsNewsMessageBundle['basicproperties.releasedate.edit.close']}
</button>
<button class="btn btn-success"
type="submit">
#{CmsNewsMessageBundle['basicproperties.releasedate.edit.submit']}
</button>
</div>
</form>
</div>
</div>
</c:if>
<libreccm:localizedStringEditor
addButtonLabel="#{CmsNewsMessageBundle['basicproperties.title.add']}"
addDialogCancelLabel="#{CmsNewsMessageBundle['basicproperties.title.add.cancel']}"
addDialogLocaleSelectHelp="#{CmsNewsMessageBundle['basicproperties.title.add.locale.help']}"
addDialogLocaleSelectLabel="#{CmsNewsMessageBundle['basicproperties.title.add.locale.label']}"
addDialogSubmitLabel="#{CmsNewsMessageBundle['basicproperties.title.add.submit']}"
addDialogTitle="#{CmsNewsMessageBundle['basicproperties.title.add.header']}"
addDialogValueHelp="#{CmsNewsMessageBundle['basicproperties.title.add.value.help']}"
addDialogValueLabel="#{CmsNewsMessageBundle['basicproperties.title.add.value.label']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/title/@add"
editButtonLabel="#{CmsNewsMessageBundle['basicproperties.title.edit']}"
editDialogCancelLabel="#{CmsNewsMessageBundle['basicproperties.title.edit.cancel']}"
editDialogSubmitLabel="#{CmsNewsMessageBundle['basicproperties.title.edit.submit']}"
editDialogTitle="#{CmsNewsMessageBundle['basicproperties.title.edit.header']}"
editDialogValueHelp="#{CmsNewsMessageBundle['basicproperties.title.edit.value.help']}"
editDialogValueLabel="#{CmsNewsMessageBundle['basicproperties.title.edit.value.label']}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/title/@edit"
editorId="title-editor"
hasUnusedLocales="#{!CmsNewsPropertiesStep.unusedTitleLocales.isEmpty()}"
headingLevel="3"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
readOnly="#{!CmsSelectedDocumentModel.canEdit}"
removeButtonLabel="#{CmsNewsMessageBundle['basicproperties.title.remove']}"
removeDialogCancelLabel="#{CmsNewsMessageBundle['basicproperties.title.remove.cancel']}"
removeDialogSubmitLabel="#{CmsNewsMessageBundle['basicproperties.title.remove.submit']}"
removeDialogText="#{CmsNewsMessageBundle['basicproperties.title.remove.text']}"
removeDialogTitle="#{CmsNewsMessageBundle['basicproperties.title.remove.header']}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/title/@remove"
title="#{CmsNewsMessageBundle['basicproperties.title.header']}"
unusedLocales="#{CmsNewsPropertiesStep.unusedTitleLocales}"
values="#{CmsNewsPropertiesStep.titleValues}"
/>
<libreccm:localizedStringEditor
addButtonLabel="#{CmsNewsMessageBundle['basicproperties.description.add']}"
addDialogCancelLabel="#{CmsNewsMessageBundle['basicproperties.description.add.cancel']}"
addDialogLocaleSelectHelp="#{CmsNewsMessageBundle['basicproperties.description.add.locale.help']}"
addDialogLocaleSelectLabel="#{CmsNewsMessageBundle['basicproperties.description.add.locale.label']}"
addDialogSubmitLabel="#{CmsNewsMessageBundle['basicproperties.description.add.submit']}"
addDialogTitle="#{CmsNewsMessageBundle['basicproperties.description.add.header']}"
addDialogValueHelp="#{CmsNewsMessageBundle['basicproperties.description.add.value.help']}"
addDialogValueLabel="#{CmsNewsMessageBundle['basicproperties.description.add.value.label']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/description/@add"
editButtonLabel="#{CmsNewsMessageBundle['basicproperties.description.edit']}"
editDialogCancelLabel="#{CmsNewsMessageBundle['basicproperties.description.edit.cancel']}"
editDialogSubmitLabel="#{CmsNewsMessageBundle['basicproperties.description.edit.submit']}"
editDialogTitle="#{CmsNewsMessageBundle['basicproperties.description.edit.header']}"
editDialogValueHelp="#{CmsNewsMessageBundle['basicproperties.description.edit.value.help']}"
editDialogValueLabel="#{CmsNewsMessageBundle['basicproperties.description.edit.value.label']}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/description/@edit"
editorId="description-editor"
hasUnusedLocales="#{!CmsNewsPropertiesStep.unusedDescriptionLocales.isEmpty()}"
headingLevel="3"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
readOnly="#{!CmsSelectedDocumentModel.canEdit}"
removeButtonLabel="#{CmsNewsMessageBundle['basicproperties.description.remove']}"
removeDialogCancelLabel="#{CmsNewsMessageBundle['basicproperties.description.remove.cancel']}"
removeDialogSubmitLabel="#{CmsNewsMessageBundle['basicproperties.description.remove.submit']}"
removeDialogText="#{CmsNewsMessageBundle['basicproperties.description.remove.text']}"
removeDialogTitle="#{CmsNewsMessageBundle['basicproperties.description.remove.header']}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-basicproperties/description/@remove"
title="#{CmsNewsMessageBundle['basicproperties.description.header']}"
unusedLocales="#{CmsNewsPropertiesStep.unusedDescriptionLocales}"
values="#{CmsNewsPropertiesStep.descriptionValues}"
useTextarea="true"
/>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:param name="authoringStep"
value="/libreccm/@contentsections/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text" />
<ui:define name="authoringStep">
<h2>#{CmsNewsMessageBundle['textstep.header']}</h2>
<librecms:cmsEditorVariants
addButtonLabel="#{CmsNewsMessageBundle['text.editor.add_variant']}"
addDialogLocaleSelectHelp="#{CmsNewsMessageBundle['text.editor.add.locale.help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/add"
canEdit="#{CmsSelectedDocumentModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/edit"
hasUnusedLocales="#{!CmsNewsTextBodyStep.unusedLocales.isEmpty()}"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/edit-source"
title="#{CmsNewsMessageBundle['text.editor.header']}"
unusedLocales="#{CmsNewsTextBodyStep.unusedLocales}"
variants="#{CmsNewsTextBodyStep.variants}"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/view"
/>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/cms-editor.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,43 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsNewsMessageBundle['textstep.back']}</span>
</a>
<h2>#{CmsNewsMessageBundle.getMessage('textstep.header.edit',[CmsNewsTextBodyStep.selectedLocale])}</h2>
</div>
<c:if test="#{CmsNewsTextBodyStep.canEdit}">
<librecms:cmsEditor
backUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text"
baseUrl="#{mvc.basePath}"
canEdit="#{CmsNewsTextBodyStep.canEdit}"
contentSection="#{ContentSectionModel.sectionName}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/edit"
editorId="cms-news-text-editor"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
selectedLocale="#{CmsNewsTextBodyStep.selectedLocale}"
title="#{CmsNewsMessageBundle['text.editor.header']}"
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text-resources/variants"
/>
</c:if>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/news-text-step.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
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/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm algin-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{CmsNewsMessageBundle['textstep.back']}</span>
</a>
<h2>#{CmsNewsMessageBundle.getMessage('textstep.header.view',[CmsNewsTextBodyStep.title, CmsNewsTextBodyStep.selectedLocale])}</h2>
</div>
<c:if test="#{CmsNewsTextBodyStep.canEdit}">
<div class="text-right">
<a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@news-text/#{CmsNewsTextBodyStep.selectedLocale}/@edit">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{CmsNewsMessageBundle['textstep.languages.edit']}</span>
</a>
</div>
</c:if>
<div class="cms-text-preview news-text border p-2">
<h:outputText escape="false"
value="#{CmsNewsTextBodyStep.textValues.get(CmsNewsTextBodyStep.selectedLocale)}" />
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1 @@
alter table ccm_cms.events alter COLUMN start_date drop not null;

View File

@ -0,0 +1 @@
alter table ccm_cms.news alter COLUMN news_date type timestamp;

View File

@ -0,0 +1 @@
alter table ccm_cms.news_aud alter COLUMN news_date type timestamp;

View File

@ -0,0 +1 @@
alter table ccm_cms.events alter COLUMN start_date drop not null;

View File

@ -0,0 +1 @@
alter table ccm_cms.news alter COLUMN news_date type timestamp;

View File

@ -0,0 +1 @@
alter table ccm_cms.news_aud alter COLUMN news_date type timestamp;

View File

@ -0,0 +1,117 @@
authoringsteps.basicproperties.description=General properties of an event, for example the start and end of the event.
authoringsteps.basicproperties.label=Basic Properties
authoringsteps.info.description=Extended information about the event, for example about the location.
authoringstep.info.label=Event Info
createstep.description=Creates a new event.
createstep.name.error.missing=The name of the event is missing.
createstep.name.error.invalid=The name of the event is not valid. The name can only contain the letters a to z and A to Z, numbers (0 to 9), the underscore ("_") and the dash ("-").
createstep.title.error.missing=The title of the event is missing.
createstep.summary.error.missing=The summary of the event is missing.
createstep.initial_locale.error.missing=The initial locale of the event is missing.
createstep.workflow.none_selected=No workflow was selected.
createstep.workflow.error.not_available=The selected workflow is not available.
createform.title=Create a new event
createform.name.help=The name of the new event. Can only contain the letters a to z and A to Z, numbers, the underscore ("_") and the dash ("-").
createform.name.label=Name
createform.initial_locale.help=The initial locale of the new event. All localizable provided using this form is created for the selected language.
createform.title.help=The title of the new event.
createform.title.label=Title
createform.summary.help=A short summary of the new event.
createform.workflow.label=Summary
createform.cancel=Cancel
createform.submit=Create new event
eventinfo_step.header=Event Information
eventdate.editor.header=Additonal information about the date of the event
eventdate.editor.add_variant=Add language
location.editor.add_variant=Add language
location.editor.header=Information about the location of the event
main_contributor.editor.add_variant=Add language
main_contributor.editor.header=Information about the organizer of the event
eventtype.editor.add_variant=Add language
eventtype.editor.header=Information about the type of the event
eventinfo_step.back=Back
eventinfo_step.eventdate.header.view=Viewing information about event date of event {0} for language {1}
eventinfo_step.edit=Edit
eventinfo_step.eventtype.header.view=Showing information about event type of event {0} for language {1}
eventinfo_step.location.header.view=Showing information about location of event {0} for language {1}
eventinfo_step.main_contributor.header.view=Showing information about organizer of event {0} for language {1}
eventinfo_step.eventdate.header.edit=Edit information about event date of event {0} for language {1}
eventinfo_step.eventdate.editor.header=Information about the date of the event
eventinfo_step.eventtype.header.edit=Edit information about the type of event {0} for language {1}
eventinfo_step.eventtype.editor.header=Information about the type of event
eventinfo_step.main_contributor.header.edit=Edit information about the organizer of event {0} for language {1}
eventinfo_step.location.editor.header=Informatio about the location of the event
eventinfo_step.location.header.edit=Edit information about the location of event {0} for language {1}
eventinfo_step.main_contributor.editor.header=Information about the organizier of the event
createform.initial_locale.label=Initial Locale
createform.summary.label=Summary
createform.workflow.help=The workflow to use for the new event.
basicproperties.eventdatetime.header=Start and End of the Event
basicproperties.startdate=Start of the event
basicproperties.enddate=End of the event
createform.startdate.help=Date and time of the start of the event.
createform.startdate.label=Start of the event
createstep.startdate.error.missing=The start of event set.
basicproperties.startdate.edit=Edit start of event
basicproperties.enddate.edit=Edit end of event
basicproperties.eventdatetime.edit=Edit
createstep.startdate.error.malformed=The date/time for the start of the event is malformed.
basicproperties.header=Edit basic properties of event {0}
basicproperties.name.header=Name
basicproperties.name.edit=Edit name
basicproperties.description.header=Description
basicproperties.name.edit.close=Cancel
basicproperties.name.edit.title=Edit name of event
basicproperties.name.help=The name of the event. Can only contain the letters a to z and A to Z, numbers, the underscore ("_") and the dash ("-").
basicproperties.name.label=Name
basicproperties.name.edit.submit=Update name of event
basicproperties.title.add=Add locale
basicproperties.title.add.cancel=Cancel
basicproperties.title.add.locale.help=The language to add.
basicproperties.title.add.locale.label=Locale
basicproperties.title.add.submit=Add locale
basicproperties.title.add.header=Add title locale
basicproperties.title.add.value.help=The localized title of the event.
basicproperties.title.add.value.label=Title
basicproperties.title.edit=Edit
basicproperties.title.edit.cancel=Cancel
basicproperties.title.edit.submit=Save
basicproperties.title.edit.header=Edit title
basicproperties.title.edit.value.help=The localized title of the event.
basicproperties.title.edit.value.label=Title
basicproperties.title.remove=Remove
basicproperties.title.remove.cancel=Cancel
basicproperties.title.remove.submit=Remove
basicproperties.title.remove.text=Are you sure to remove the localized title for the folloing locale?
basicproperties.title.remove.header=Remove localized title
basicproperties.title.header=Title
basicproperties.description.add=Add localized description
basicproperties.description.add.cancel=Cancel
basicproperties.description.add.locale.help=The locale of the localized description.
basicproperties.description.add.locale.label=Locale
basicproperties.description.add.submit=Add localized description
basicproperties.description.add.header=Add localized description
basicproperties.description.add.value.help=The localized description.
basicproperties.description.add.value.label=Description
basicproperties.description.edit=Edit
basicproperties.description.edit.cancel=Cancel
basicproperties.description.edit.submit=Submit
basicproperties.description.edit.header=Edit localized description
basicproperties.description.edit.value.help=The localized description.
basicproperties.description.edit.value.label=Description
basicproperties.description.remove=Remove
basicproperties.description.remove.cancel=Cancel
basicproperties.description.remove.submit=Remove localized description
basicproperties.description.remove.text=Are you sure to remove the localized description for this locale?
basicproperties.description.remove.header=Remove localized description
basicproperties.startdate.none=Start of event is missing.
basicproperties.enddate.none=End of event is missing
basicproperties.eventdatetime.edit.dialog.title=Edit start and end of the event
basicproperties.eventdatetime.edit.dialog.close=Cancel
basicproperties.eventdatetime.edit.dialog.startdate.help=Start of the event (date and time).
basicproperties.eventdatetime.edit.dialog.startdate.label=Start
basicproperties.eventdatetime.edit.dialog.enddate.help=The end of the event (date and time)
basicproperties.eventdatetime.edit.dialog.enddate.label=End
basicproperties.eventdatetime.edit.dialog.submit=Submit
text.editor.add.locale.help=The language to add.

View File

@ -0,0 +1,117 @@
authoringsteps.basicproperties.description=Basiseigenschaften einer Veranstaltung, z.B. das Datum der Veranstaltung
authoringsteps.basicproperties.label=Basiseigenschaften
authoringsteps.info.description=Weitere Informationen \u00fcber die Veranstaltung, z.B. \u00fcber den Veranstaltungsort.
authoringstep.info.label=Informationen zur Veranstaltung
createstep.description=Legt eine neue Veranstaltung an.
createstep.name.error.missing=Der Name der Veranstaltung wurde nicht angegeben.
createstep.name.error.invalid=Der Name der Veranstaltung ist nicht valide. Der Name darf nur die Buchstaben a bis z und A bis Z, Ziffern (0 to 9), den Unterstrich ("_") und den Bindestrich ("-") enthalten.
createstep.title.error.missing=Der Titel der Veranstaltung wurde nicht angegeben.
createstep.summary.error.missing=Es wurde keine Zusammenfassung der Veranstaltung angegeben.
createstep.initial_locale.error.missing=Die initale Sprache f\u00fcr die Veranstaltung wurde nicht angegeben.
createstep.workflow.none_selected=Es wurde kein Arbeitsablauf ausgew\u00e4hlt.
createstep.workflow.error.not_available=Der ausgew\u00e4hlte Arbeitsablauf ist nicht verf\u00fcgbar.
createform.title=Eine neue Veranstaltung anlegen
createform.name.help=Der Name der neuen Veranstaltung. Darf nur die Buchstaben a bis z, A bis Z, Ziffern, den Bindestrich ("-") und den Unterstrich ("_") enthalten.
createform.name.label=Name
createform.initial_locale.help=Initiale Sprache
createform.title.help=Der Titel der neuen Veranstaltung.
createform.title.label=Titel
createform.summary.help=Eine kurze Zusammenfassung der neuen Veranstaltung.
createform.workflow.label=Zusammenfassung
createform.cancel=Abbrechen
createform.submit=Neue Veranstaltung anlegen
eventinfo_step.header=Informationen \u00fcber die Veranstaltung
eventdate.editor.header=Zus\u00e4tzliche Informationen \u00fcber den Zeitpunkt der Veranstaltung
eventdate.editor.add_variant=Sprache hinzuf\u00fcgen
location.editor.add_variant=Sprache hinzuf\u00fcgen
location.editor.header=Informationen \u00fcber den Veranstaltungsort
main_contributor.editor.add_variant=Sprache hinzuf\u00fcgen
main_contributor.editor.header=Informationen \u00fcber den Veranstalter
eventtype.editor.add_variant=Sprache hinzuf\u00fcgen
eventtype.editor.header=Informationen \u00fcber die Art der Veranstaltung
eventinfo_step.back=Zur\u00fcck
eventinfo_step.eventdate.header.view=Zeige Informationen \u00fcber Veranstaltungsdatum in Sprache {1} f\u00fcr Veranstaltung {0}
eventinfo_step.edit=Bearbeiten
eventinfo_step.eventtype.header.view=Zeige Informationen \u00fcber den Typ der Veranstaltung {0} in Sprache {1}
eventinfo_step.location.header.view=Zeige Informationen \u00fcber Veranstaltungsort f\u00fcr Veranstaltung {0} in Sprache {1}
eventinfo_step.main_contributor.header.view=Zeige Informationen \u00fcber Veranstalter der Veranstaltung {0} f\u00fcr Sprache {1}
eventinfo_step.eventdate.header.edit=Informationen \u00fcber den Zeitpunkt der Veranstaltung {0} f\u00fcr Sprache {1} bearbeiten
eventinfo_step.eventdate.editor.header=Informationen \u00fcber den Zeitpunkt der Veranstaltung
eventinfo_step.eventtype.header.edit=Informationen \u00fcber die Art der Veranstaltung {0} f\u00fcr Sprache {1} bearbeiten
eventinfo_step.eventtype.editor.header=Informationen \u00fcber die Art der Veranstaltung
eventinfo_step.main_contributor.header.edit=Informationen \u00fcber den Veranstalter der Veranstaltung {0} f\u00fcr Sprache {1} bearbeiten
eventinfo_step.location.editor.header=Informationen \u00fcber den Ort der Veranstaltung
eventinfo_step.location.header.edit=Informationen \u00fcber den Ort der Veranstaltung {0} f\u00fcr Sprache {1} bearbeiten
eventinfo_step.main_contributor.editor.header=Informationen \u00fcber den Veranstalter
createform.initial_locale.label=Initial Locale
createform.summary.label=Zusammenfassung
createform.workflow.help=Der Arbeitsablauf, der f\u00fcr die neue Veranstaltung verwendet wird.
basicproperties.eventdatetime.header=Beginn und Ende der Veranstaltung
basicproperties.startdate=Beginn der Veranstaltung
basicproperties.enddate=Ende der Veranstaltung
createform.startdate.help=Datum und Uhrzeit des Beginns der Veranstaltung.
createform.startdate.label=Beginn der Veranstaltung
createstep.startdate.error.missing=Der Beginn der Veranstaltugn wurde nicht angegeben.
basicproperties.startdate.edit=Beginn der Veranstaltung bearbeiten
basicproperties.enddate.edit=Ende der Veranstaltung bearbeiten
basicproperties.eventdatetime.edit=Bearbeiten
createstep.startdate.error.malformed=Der Zeitpunkt f\u00fcr den Beginn der Veranstaltung ist keine valide Datums-/Zeitangabe.
basicproperties.header=Basiseigenschaften der Veranstaltung {0} bearbeiten
basicproperties.name.header=Name
basicproperties.name.edit=Name bearbeiten
basicproperties.description.header=Beschreibung
basicproperties.name.edit.close=Abbrechen
basicproperties.name.edit.title=Name der Veranstaltung bearbeiten
basicproperties.name.help=Der Name der Veranstaltung. Darf nur die Buchstaben a bis z, A bis Z, Ziffern, den Bindestrich ("-") und den Unterstrich ("_") enthalten.
basicproperties.name.label=Name
basicproperties.name.edit.submit=Name der Veranstaltung aktualisieren
basicproperties.title.add=Sprache hinzuf\u00fcgen
basicproperties.title.add.cancel=Abbrechen
basicproperties.title.add.locale.help=Die Sprache, die hinzugef\u00fcgt wird.
basicproperties.title.add.locale.label=Sprache
basicproperties.title.add.submit=Sprache hinzuf\u00fcgen
basicproperties.title.add.header=Titel f\u00fcr Sprache hinzuf\u00fcgen
basicproperties.title.add.value.help=Der lokalisierte Titel der Veranstaltung.
basicproperties.title.add.value.label=Titel
basicproperties.title.edit=Bearbeiten
basicproperties.title.edit.cancel=Abbrechen
basicproperties.title.edit.submit=Speichern
basicproperties.title.edit.header=Titel bearbeiten
basicproperties.title.edit.value.help=Der lokalisierte Titel der Veranstaltung.
basicproperties.title.edit.value.label=Titel
basicproperties.title.remove=Entfernen
basicproperties.title.remove.cancel=Abbrechen
basicproperties.title.remove.submit=Entfernen
basicproperties.title.remove.text=Sind Sie sicher, dass den lokalisierten Titel f\u00fcr diese Sprache entfernen wollen?
basicproperties.title.remove.header=Lokalisierten Titel entfernen
basicproperties.title.header=Titel
basicproperties.description.add=Lokalisierte Beschreibung hinzuf\u00fcgen
basicproperties.description.add.cancel=Abbrechen
basicproperties.description.add.locale.help=Die Sprache der lokalisierten Beschreibung.
basicproperties.description.add.locale.label=Sprache
basicproperties.description.add.submit=Lokalisierte Beschreibung hinzuf\u00fcgen
basicproperties.description.add.header=Lokalisierte Beschreibung hinzuf\u00fcgen
basicproperties.description.add.value.help=Die lokalisierte Beschreibung.
basicproperties.description.add.value.label=Beschreibung
basicproperties.description.edit=Bearbeiten
basicproperties.description.edit.cancel=Abbrechen
basicproperties.description.edit.submit=Speichern
basicproperties.description.edit.header=Lokalisierte Beschreibung bearbeiten
basicproperties.description.edit.value.help=Die lokalisierte Beschreibung.
basicproperties.description.edit.value.label=Beschreibung
basicproperties.description.remove=Entfernen
basicproperties.description.remove.cancel=Abbrechen
basicproperties.description.remove.submit=Lokalisierte Beschreibung entfernen
basicproperties.description.remove.text=Sind Sie sicher, dass Sie die lokalisierte Beschreibung f\u00fcr diese Sprache entfernen wollen?
basicproperties.description.remove.header=Lokalisierte Beschreibung entfernen
basicproperties.startdate.none=Es wurde keine Begin angegeben.
basicproperties.enddate.none=Es wurde keine Ende der Veranstaltung angegeben.
basicproperties.eventdatetime.edit.dialog.title=Beginn und Ende der Veranstaltung bearbeiten
basicproperties.eventdatetime.edit.dialog.close=Abbrechen
basicproperties.eventdatetime.edit.dialog.startdate.help=Beginn und Ende der Veranstaltung (Datum und Uhrzeit)
basicproperties.eventdatetime.edit.dialog.startdate.label=Beginn
basicproperties.eventdatetime.edit.dialog.enddate.help=Ende der Veranstaltung (Datum und Uhrzeit)
basicproperties.eventdatetime.edit.dialog.enddate.label=Ende
basicproperties.eventdatetime.edit.dialog.submit=Speichern
text.editor.add.locale.help=Die Sprache, die hinzugef\u00fcgt werden soll.

View File

@ -0,0 +1,109 @@
createstep.description=Creates a new news item.
createstep.name.error.missing=The name of the new news item is missing.
createstep.name.error.invalid=The provided name is invalid.
createstep.summary.error.missing=The summary of the new news item is missing.
createstep.title.error.missing=No title was provided for the new news item.
createstep.initial_locale.error.missing=No locale was selected.
createstep.releasedate.error.missing=The release date is missing.
createstep.releasedate.error.malformed=The release date is not a valid date/time.
createstep.workflow.none_selected=No workflow was selected.
createstep.workflow.error.not_available=The selected workflow is not available.
authoringsteps.basicproperties.description=Edit the basic properties of a news item.
authoringsteps.basicproprties.label=Basic properties
news.edit.denied=Access denied
authoringsteps.text.description=Edit the main text of a news.
authoringsteps.text.label=Main text
createform.title=Create a new news item
createform.name.help=The name of the new item. May only contain letter (a to z and A to Z, numbers, the underscore ("_") and the dash ("-").
createform.name.label=Name
createform.initial_locale.help=The initial locale of the new news item. All localizable values provided in this form are created for the selected locale.
createform.initial_locale.label=Locale
createform.title.help=The title of the news
createform.title.label=Title
createform.summary.help=A short summary of the news.
createform.summary.label=Summary
createform.workflow.help=The workflow to use for the news.
createform.workflow.label=Workflow
createform.releasedate.help=The release date of the news.
createform.releasedate.label=Release date
createform.cancel=Cancel
createform.submit=Create news
basicproperties.header=Edit basic properties of news {0}
basicproeperties.name.header=Name
basicproperties.name.edit=Edit name
basicproperties.name.edit.title=Edit name
basicproperties.name.edit.close=Cancel
basicproperties.name.help=The name of the news item. May only contain letter (a to z and A to Z, numbers, the underscore ("_") and the dash ("-").
basicproperties.name.label=Name
basicproperties.name.edit.submit=Submit
basicproperties.releasedate.header=Release Date
basicproperties.releasedate.edit=Edit release date
basicproperties.releasedate.edit.title=Edit release date
basicproperties.releasedate.edit.close=Cancel
basicproperties.releasedate.help=The release date of the news.
basicproperties.releasedate.label=Release date
basicproperties.releasedate.edit.submit=Submit
basicproperties.title.add=Add localized title
basicproperties.title.add.cancel=Cancel
basicproperties.title.add.locale.help=The locale of the new localized title.
basicproperties.title.add.locale.label=Title
basicproperties.title.add.submit=Add title value
basicproperties.title.add.header=Add localized title
basicproperties.title.add.value.help=The new localized title.
basicproperties.title.add.value.label=Localized title
basicproperties.title.edit=Edit
basicproperties.title.edit.cancel=Cancel
basicproperties.title.edit.submit=Save
basicproperties.title.edit.header=Edit localized title
basicproperties.title.edit.value.help=The localized title.
basicproperties.title.edit.value.label=Localized title
basicproperties.title.remove=Remove
basicproperties.title.remove.cancel=Cancel
basicproperties.title.remove.submit=Remove localized title
basicproperties.title.remove.text=Are your sure to remove the localized title for the following locale:
basicproperties.title.remove.header=Remove localized title
basicproperties.description.add=Add localized summary
basicproperties.description.add.cancel=Cancel
basicproperties.description.add.locale.help=The locale of the new localized summary.
basicproperties.description.add.locale.label=Locale
basicproperties.description.add.submit=Add localized summary
basicproperties.description.add.header=Add localized summary
basicproperties.description.add.value.help=The new localized summary.
basicproperties.description.add.value.label=Localized summary
basicproperties.description.edit=Edit
basicproperties.description.edit.cancel=Cancel
basicproperties.description.edit.submit=Save
basicproperties.description.edit.header=Edit localized summary
basicproperties.description.edit.value.help=The localized summary.
basicproperties.description.edit.value.label=Localized summary
basicproperties.description.remove=Remove
basicproperties.description.remove.cancel=Cancel
basicproperties.description.remove.submit=Remove localized summary
basicproperties.description.remove.text=Are you sure to remove the localized summary for this following locale?
basicproperties.description.remove.header=Remove localized summary
textstep.header.languages=Text of the Article - Available languages
textstep.languages.add_language.help=Select the language to add
textstep.languages.add_language.label=Add language
textstep.languages.add_language.submit=Add
textstep.languages.view=View
textstep.languages.edit=Edit
textstep.languages.remove=Remove
textstep.languages.remove.cancel=Cancel
textstep.languages.remove.confirm=Remove locale
textstep.languages.remove.title=Confirm removal of locale {0}
textstep.languages.remove.message=Are you sure to remove the text for locale {0}?
textstep.languages.th.language=Language
textstep.languages.th.actions=Actions
textstep.languages.none=No texts available
textstep.header.edit=Edit text for locale {0}
textstep.header.view=Text of Article {0} for locale {1}
textstep.back=Back to available languages
text.editor.add_variant=Add language
text.editor.add.locale.help=The language of the new variant.
text.editor.edit.value.help=The text of the article.
text.editor.edit.value.label=Text
textstep.header=Text of the News
basicproperties.title.header=Title
basicproperties.description.header=Summary
text.editor.header=Main text

View File

@ -0,0 +1,116 @@
createstep.description=Erstelle eine Neuigkeit (News)
createstep.name.error.missing=Der Name des neuen Items vom Type News wurde nicht angegeben.
createstep.name.error.invalid=Der angegebene Name is nicht zul\u00e4ssig.
createstep.summary.error.missing=Es wurde keine Zusammenfassung angegeben.
createstep.title.error.missing=Es wurde keine Titel angegeben.
createstep.initial_locale.error.missing=Es wurde keine Sprache ausgew\u00e4lt.
createstep.releasedate.error.missing=Es wurde kein Erscheinungsdatum angegeben.
createstep.releasedate.error.malformed=Das Erscheinungsdatum ist keine valide Datums-/Zeitangabe.
createstep.workflow.none_selected=Es wurde keine Arbeitsablauf ausgew\u00e4hlt.
createstep.workflow.error.not_available=Der ausgew\u00e4hlte Arbeitsablauf ist nicht verf\u00fcgbar.
authoringsteps.basicproperties.description=Bearbeiten der Basiseigenschaften einer Neuigkeit (News).
authoringsteps.basicproprties.label=Basiseigenschaften
news.edit.denied=Zugriff verweigert
authoringsteps.text.description=Haupttext einer News bearbeiten.
authoringsteps.text.label=Haupttext
createform.title=Neue Neuigkeit (News) anlegen
createform.name.help=Der Name des neuen Dokumentes. Darf nur Buchstaben (a bis z und A bis Z), Ziffern, den Unterstrich ("_") und den Bindestrich ("-") enthalten.
createform.name.label=Name
createform.initial_locale.help=Die initale Sprache der neuen News. Alle lokaliserbaren Eigenschaften aus diesem Formualar werden f\u00fcr die ausgew\u00e4hlte Sprache angelegt.
createform.initial_locale.label=Sprache
createform.title.help=Der Titel der News
createform.title.label=Titel
createform.summary.help=Eine kurze Zusammenfassung der News.
createform.summary.label=Zusammenfassung
createform.workflow.help=Der Arbeitsablauf der f\u00fcr die News genutzt wird.
createform.workflow.label=Arbeitsablauf
createform.releasedate.help=Das Erscheinungsdatum der News.
createform.releasedate.label=Erscheinungsdatum
createform.cancel=Abbrechen
createform.submit=News anlegen
basicproperties.header=Basiseigenschaften der News {0} bearbeiten
basicproeperties.name.header=Name
basicproperties.name.edit=Name bearbeiten
basicproperties.name.edit.title=Name bearbeiten
basicproperties.name.edit.close=Abbrechen
basicproperties.name.help=Der Name der News. Darf nur Buchstaben (a bis z und A bis Z), Ziffern, den Unterstrich ("_") und den Bindestrich ("-") enthalten.
basicproperties.name.label=Name
basicproperties.name.edit.submit=Speichern
basicproperties.releasedate.header=Erscheinungsdatum
basicproperties.releasedate.edit=Erscheinungsdatum bearbeiten
basicproperties.releasedate.edit.title=Erscheinungsdatum bearbeiten
basicproperties.releasedate.edit.close=Abbrechen
basicproperties.releasedate.help=Das Erscheinungsdatum der News.
basicproperties.releasedate.label=Erscheinungsdatum
basicproperties.releasedate.edit.submit=Speichern
basicproperties.title.add=Hinzuf\u00fcgen
basicproperties.title.add.cancel=Abbrechen
basicproperties.name.label=Name
basicproperties.header=Basiseigenschaften des Artikels {0}
basicproperties.name.edit.title=Name bearbeiten
basicproperties.name.edit.close=Abbrechen
basicproperties.name.edit.submit=Speichern
basicproperties.title.add=Lokalisierten Titel hinzuf\u00fcgen
basicproperties.title.add.cancel=Abbrechen
basicproperties.title.add.locale.help=The locale of the new localized title.
basicproperties.title.add.locale.label=Titel
basicproperties.title.add.submit=Titel hinzuf\u00fcgen
basicproperties.title.add.header=Lokalisierten Titel hinzuf\u00fcgen
basicproperties.title.add.value.help=Der neue lokalisierte Titel.
basicproperties.title.add.value.label=Lokalisierter Titel
basicproperties.title.edit=Bearbeiten
basicproperties.title.edit.cancel=Abbrechen
basicproperties.title.edit.submit=Speichern
basicproperties.title.edit.header=Lokalisierten Titel bearbeiten
basicproperties.title.edit.value.help=Der lokalisierte Titel.
basicproperties.title.edit.value.label=Lokalisierter Titel
basicproperties.title.remove=Entfernen
basicproperties.title.remove.cancel=Abbrechen
basicproperties.title.remove.submit=Lokalisierten Titel entfernen
basicproperties.title.remove.text=Sind Sie sicher, dass Sie den lokalisierten Titel f\u00fcr folgende Sprachen l\u00f6schen wollen?
basicproperties.title.remove.header=Lokalisierten Titel entfernen
basicproperties.description.add=Lokalisierte Zusammenfassung hinzuf\u00fcgen
basicproperties.description.add.cancel=Abbrechen
basicproperties.description.add.locale.help=Die Sprache der neuen lokalisierten Zusammenfassung.
basicproperties.description.add.locale.label=Sprache
basicproperties.description.add.submit=Lokaliserte Zusammenfassung hinzuf\u00fcgen
basicproperties.description.add.header=Lokalisierte Zusammenfassung hinzuf\u00fcgen
basicproperties.description.add.value.help=Die neue lokalisierte Beschreibung.
basicproperties.description.add.value.label=Lokalisierte Zusammenfassung
basicproperties.description.edit=Bearbeiten
basicproperties.description.edit.cancel=Abbrechen
basicproperties.description.edit.submit=Speichern
basicproperties.description.edit.header=Lokalisierte Zusammenfassung bearbeiten
basicproperties.description.edit.value.help=Die lokalisierte Zusammenfassung.
basicproperties.description.edit.value.label=Lokalisierte Zusammenfassung
basicproperties.description.remove=Entfernen
basicproperties.description.remove.cancel=Abbrechen
basicproperties.description.remove.submit=Lokalisierte Zusammenfassung entfernen
basicproperties.description.remove.text=Sind Sie sicher, dass Sie die lokalisierte Zusammenfassung f\u00fcr die folgende Sprach entfernen wollen?
basicproperties.description.remove.header=Lokalisierte Zusammenfassung entfernen
textstep.header=Haupttext des News
textstep.header.languages=Haupttext des Artikels - Sprachen
textstep.languages.add_language.help=W\u00e4hlen Sie die hinzuzuf\u00fcgende Sprache
textstep.languages.add_language.label=Sprache hinzuf\u00fcgen
textstep.languages.add_language.submit=Hinzuf\u00fcgen
textstep.languages.view=Ansehen
textstep.languages.edit=Bearbeiten
textstep.languages.remove=Entfernen
textstep.languages.remove.cancel=Abbrechen
textstep.languages.remove.confirm=Sprache entfernen
textstep.languages.remove.message=Sind Sie sicher, dass Sie den Text f\u00fcr die Sprache {0} entfernen wollen?
textstep.languages.remove.title=Entfernen der Sprache {0} best\u00e4tigen
textstep.languages.th.language=Sprache
textstep.languages.th.actions=Aktionen
textstep.languages.none=Keine Texte vorhandenen
textstep.header.edit=Text f\u00fcr Sprache {0} bearbeiten
textstep.header.view=Text des Artikels {0} f\u00fcr Sprache {1}
textstep.back=Zur\u00fcck zur Liste der verf\u00fcgbaren Sprachen
text.editor.add_variant=Sprache hinzuf\u00fcgen
text.editor.add.locale.help=Die Sprache der neuen Variante.
text.editor.edit.value.help=Der Text des Artikels.
text.editor.edit.value.label=Text
basicproperties.title.header=Titel
basicproperties.description.header=Zusammenfassung
text.editor.header=Haupttext

View File

@ -0,0 +1,52 @@
import { CmsEditorBuilder, CmsEditor } from "./cms-editor";
document.addEventListener("DOMContentLoaded", (event) => {
const editorElem = document.querySelector("#cms-event-eventdate-editor");
if (editorElem) {
const saveUrl = editorElem.getAttribute("data-save-url");
const variantUrl = editorElem.getAttribute("data-variant-url");
if (!saveUrl) {
console.error("saveUrl is null");
return;
}
if (!variantUrl) {
console.error("variantUrl is null");
return;
}
const builder = new CmsEditorBuilder(
editorElem as HTMLElement,
saveUrl,
variantUrl
);
builder
.buildEditor()
.then((editor) => {
const submitButton = document.querySelector(
".cms-editor-save-button"
);
if (submitButton) {
submitButton.addEventListener("click", (event) => {
event.preventDefault();
console.log("HTML output of editor: ");
console.log(editor.getEditor().getHTML());
});
} else {
console.error("Save button not found.")
}
})
.catch((error) => {
console.error(error);
console.trace(error);
});
} else {
console.error("Editor element not found.")
}
});

View File

@ -0,0 +1,52 @@
import { CmsEditorBuilder, CmsEditor } from "./cms-editor";
document.addEventListener("DOMContentLoaded", (event) => {
const editorElem = document.querySelector("#cms-event-eventtype-editor");
if (editorElem) {
const saveUrl = editorElem.getAttribute("data-save-url");
const variantUrl = editorElem.getAttribute("data-variant-url");
if (!saveUrl) {
console.error("saveUrl is null");
return;
}
if (!variantUrl) {
console.error("variantUrl is null");
return;
}
const builder = new CmsEditorBuilder(
editorElem as HTMLElement,
saveUrl,
variantUrl
);
builder
.buildEditor()
.then((editor) => {
const submitButton = document.querySelector(
".cms-editor-save-button"
);
if (submitButton) {
submitButton.addEventListener("click", (event) => {
event.preventDefault();
console.log("HTML output of editor: ");
console.log(editor.getEditor().getHTML());
});
} else {
console.error("Save button not found.")
}
})
.catch((error) => {
console.error(error);
console.trace(error);
});
} else {
console.error("Editor element not found.")
}
});

View File

@ -0,0 +1,52 @@
import { CmsEditorBuilder, CmsEditor } from "./cms-editor";
document.addEventListener("DOMContentLoaded", (event) => {
const editorElem = document.querySelector("#cms-event-location-editor");
if (editorElem) {
const saveUrl = editorElem.getAttribute("data-save-url");
const variantUrl = editorElem.getAttribute("data-variant-url");
if (!saveUrl) {
console.error("saveUrl is null");
return;
}
if (!variantUrl) {
console.error("variantUrl is null");
return;
}
const builder = new CmsEditorBuilder(
editorElem as HTMLElement,
saveUrl,
variantUrl
);
builder
.buildEditor()
.then((editor) => {
const submitButton = document.querySelector(
".cms-editor-save-button"
);
if (submitButton) {
submitButton.addEventListener("click", (event) => {
event.preventDefault();
console.log("HTML output of editor: ");
console.log(editor.getEditor().getHTML());
});
} else {
console.error("Save button not found.")
}
})
.catch((error) => {
console.error(error);
console.trace(error);
});
} else {
console.error("Editor element not found.")
}
});

View File

@ -0,0 +1,52 @@
import { CmsEditorBuilder, CmsEditor } from "./cms-editor";
document.addEventListener("DOMContentLoaded", (event) => {
const editorElem = document.querySelector("#cms-event-maincontributor-editor");
if (editorElem) {
const saveUrl = editorElem.getAttribute("data-save-url");
const variantUrl = editorElem.getAttribute("data-variant-url");
if (!saveUrl) {
console.error("saveUrl is null");
return;
}
if (!variantUrl) {
console.error("variantUrl is null");
return;
}
const builder = new CmsEditorBuilder(
editorElem as HTMLElement,
saveUrl,
variantUrl
);
builder
.buildEditor()
.then((editor) => {
const submitButton = document.querySelector(
".cms-editor-save-button"
);
if (submitButton) {
submitButton.addEventListener("click", (event) => {
event.preventDefault();
console.log("HTML output of editor: ");
console.log(editor.getEditor().getHTML());
});
} else {
console.error("Save button not found.")
}
})
.catch((error) => {
console.error(error);
console.trace(error);
});
} else {
console.error("Editor element not found.")
}
});

View File

@ -0,0 +1,52 @@
import { CmsEditorBuilder, CmsEditor } from "./cms-editor";
document.addEventListener("DOMContentLoaded", (event) => {
const editorElem = document.querySelector("#cms-news-text-editor");
if (editorElem) {
const saveUrl = editorElem.getAttribute("data-save-url");
const variantUrl = editorElem.getAttribute("data-variant-url");
if (!saveUrl) {
console.error("saveUrl is null");
return;
}
if (!variantUrl) {
console.error("variantUrl is null");
return;
}
const builder = new CmsEditorBuilder(
editorElem as HTMLElement,
saveUrl,
variantUrl
);
builder
.buildEditor()
.then((editor) => {
const submitButton = document.querySelector(
".cms-editor-save-button"
);
if (submitButton) {
submitButton.addEventListener("click", (event) => {
event.preventDefault();
console.log("HTML output of editor: ");
console.log(editor.getEditor().getHTML());
});
} else {
console.error("Save button not found.")
}
})
.catch((error) => {
console.error(error);
console.trace(error);
});
} else {
console.error("Editor element not found.")
}
});

View File

@ -7,7 +7,12 @@ module.exports = {
entry: { entry: {
"cms-admin": "./src/main/typescript/content-sections/cms-admin.ts", "cms-admin": "./src/main/typescript/content-sections/cms-admin.ts",
"article-text-step": "./src/main/typescript/content-sections/article-text-step.ts", "article-text-step": "./src/main/typescript/content-sections/article-text-step.ts",
"mpa-section-edit-text": "./src/main/typescript/content-sections/mpa-section-edit-text.ts" "event-info-step-eventdate": "./src/main/typescript/content-sections/event-info-step-eventdate.ts",
"event-info-step-eventtype": "./src/main/typescript/content-sections/event-info-step-eventtype.ts",
"event-info-step-location": "./src/main/typescript/content-sections/event-info-step-location.ts",
"event-info-step-maincontributor": "./src/main/typescript/content-sections/event-info-step-maincontributor.ts",
"mpa-section-edit-text": "./src/main/typescript/content-sections/mpa-section-edit-text.ts",
"news-text-step": "./src/main/typescript/content-sections/news-text-step.ts"
}, },
output: { output: {
filename: "[name].js", filename: "[name].js",

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://xmlns.jcp.org/jsf/composite">
<cc:interface shortDescription="Component for a form grouo with an HTML datetime-local input field">
<cc:attribute name="help"
required="true"
shortDescription="A short description of the input field"
type="String" />
<cc:attribute name="inputId"
required="true"
shortDescription="The ID of the input field."
type="String" />
<cc:attribute name="label"
required="true"
shortDescription="The label of the input field."
type="String" />
<cc:attribute name="max"
required="false"
shortDescription="The latest acceptable data"
type="String" />
<cc:attribute name="min"
required="false"
shortDescription="The earlist acceptable data"
type="String" />
<cc:attribute name="name"
required="true"
shortDescription="The name of the input field. This is also the name which is used to send the value of the input to the server."
type="String" />
<cc:attribute default="false"
name="required"
shortDescription="Is the field required?"
required="false"
type="boolean" />
<cc:attribute default="60"
name="step"
required="false"
shortDescription="The stepping interval (in seconds)"
type="int" />
<cc:attribute name="value"
required="false"
shortDescription="Value of the input field"
type="String" />
</cc:interface>
<cc:implementation>
<div class="form-group">
<label for="#{cc.attrs.inputId}">${cc.attrs.label}</label>
<input aria-describedby="#{cc.attrs.inputId}-help"
id="#{cc.attrs.inputId}"
max="#{cc.attrs.max}"
min="#{cc.attrs.min}"
name="#{cc.attrs.name}"
step="#{cc.attrs.step}"
type="datetime-local"
value="#{cc.attrs.value}" />
<small class="form-text text-muted"
id="#{cc.attrs.inputId}-help">
#{cc.attrs.help}
</small>
</div>
</cc:implementation>
</html>