diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/EventTextBody.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/EventTextBody.java
new file mode 100644
index 000000000..4e61d814a
--- /dev/null
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/EventTextBody.java
@@ -0,0 +1,122 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui.authoring;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.form.Option;
+import com.arsdigita.bebop.form.SingleSelect;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
+import com.arsdigita.kernel.KernelConfig;
+
+import org.libreccm.cdi.utils.CdiUtil;
+import org.librecms.contentsection.ContentItemRepository;
+import org.librecms.contenttypes.Event;
+
+import java.util.Locale;
+
+import static com.arsdigita.cms.ui.authoring.TextBody.*;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class EventTextBody extends TextBody {
+
+ private final ItemSelectionModel itemSelectionModel;
+ private final StringParameter selectedLanguageParam;
+
+ public EventTextBody(final ItemSelectionModel itemSelectionModel,
+ final AuthoringKitWizard authoringKitWizard,
+ final StringParameter selectedLanguageParam) {
+
+ super(itemSelectionModel, selectedLanguageParam);
+
+ this.itemSelectionModel = itemSelectionModel;
+ this.selectedLanguageParam = selectedLanguageParam;
+
+ // Rest the component when it is hidden
+ authoringKitWizard
+ .getList()
+ .addActionListener(event -> reset(event.getPageState()));
+
+ // Set the right component access on the forms
+ final Component uploadComponent = getComponent(FILE_UPLOAD);
+ if (uploadComponent != null) {
+ setComponentAccess(FILE_UPLOAD,
+ new WorkflowLockedComponentAccess(
+ uploadComponent, itemSelectionModel));
+ }
+ final Component textEntryComponent = getComponent(TEXT_ENTRY);
+ setComponentAccess(TEXT_ENTRY,
+ new WorkflowLockedComponentAccess(
+ textEntryComponent, itemSelectionModel));
+ }
+
+ /**
+ * Adds the options for the mime type select widget of
+ * GenericArticleForm and sets the default mime type.
+ *
+ * @param mimeSelect
+ */
+ @Override
+ protected void setMimeTypeOptions(final SingleSelect mimeSelect) {
+ mimeSelect.addOption(new Option("text/html", "HTML Text"));
+ mimeSelect.setOptionSelected("text/html");
+ }
+
+ protected Event getSelectedEvent(final PageState state) {
+
+ return (Event) itemSelectionModel.getSelectedItem(state);
+ }
+
+ @Override
+ protected String getTextPropertyName() {
+
+ return "text";
+ }
+
+ @Override
+ public String getText(final PageState state) {
+
+ final Event event = getSelectedEvent(state);
+
+ final String selectedLanguage = (String) state
+ .getValue(selectedLanguageParam);
+ final Locale selectedLocale;
+ if (selectedLanguage == null) {
+ selectedLocale = KernelConfig.getConfig().getDefaultLocale();
+ } else {
+ selectedLocale = new Locale(selectedLanguage);
+ }
+
+ return event.getText().getValue(selectedLocale);
+
+ }
+
+ @Override
+ protected void updateText(final PageState state, final String text) {
+
+ final Event event = getSelectedEvent(state);
+ final String selectedLanguage = (String) state.getValue(
+ selectedLanguageParam);
+ final Locale selectedLocale;
+ if (selectedLanguage == null) {
+ selectedLocale = KernelConfig.getConfig().getDefaultLocale();
+ } else {
+ selectedLocale = new Locale(selectedLanguage);
+ }
+
+ event.getText().addValue(selectedLocale, text);
+ final ContentItemRepository itemRepo = CdiUtil
+ .createCdiUtil()
+ .findBean(ContentItemRepository.class);
+ itemRepo.save(event);
+ }
+
+}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewsTextBody.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewsTextBody.java
index 962e8d482..868afacb3 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewsTextBody.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewsTextBody.java
@@ -51,7 +51,6 @@ public class NewsTextBody extends TextBody {
setComponentAccess(TEXT_ENTRY,
new WorkflowLockedComponentAccess(
textEntryComponent, itemSelectionModel));
-
}
/**
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java b/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
index 2bad74863..1459bbc57 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
@@ -19,6 +19,7 @@
package org.librecms.contenttypes;
import com.arsdigita.cms.contenttypes.ui.EventPropertiesStep;
+import com.arsdigita.cms.ui.authoring.EventTextBody;
import com.arsdigita.cms.ui.contenttypes.EventCreateForm;
import java.io.Serializable;
@@ -65,6 +66,15 @@ import static org.librecms.CmsConstants.*;
descriptionKey = "cms.contenttypes.shared.basic_properties"
+ ".description",
order = 1)
+ ,
+ @AuthoringStep(
+ component = EventTextBody.class,
+ labelBundle = "org.librecms.CmsResources",
+ labelKey = "cms.contenttypes.shared.body_text.title",
+ descriptionBundle = "org.librecms.CmsResources",
+ descriptionKey = "cms.contenttypes.shared.body_text.description",
+ order = 2
+ )
})
public class Event extends ContentItem implements Serializable {