diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java.todo b/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java.todo
deleted file mode 100755
index fd560dc80..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionDeleteForm.java.todo
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui.mparticle;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.ArticleSection;
-import com.arsdigita.cms.contenttypes.MultiPartArticle;
-import com.arsdigita.cms.contenttypes.util.MPArticleGlobalizationUtil;
-import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.util.Assert;
-
-import org.apache.log4j.Logger;
-import org.librecms.contenttypes.MultiPartArticleSection;
-
-/**
- * A form to confirm deletion of a single section of a MultiPartArticle.
- *
- * @author Dave Turner
- * @version $Id: SectionDeleteForm.java 287 2005-02-22 00:29:02Z sskracic $
- */
-public class SectionDeleteForm extends Form
- implements FormInitListener, FormSubmissionListener, FormProcessListener {
-
- private final static Logger log = Logger.getLogger(SectionDeleteForm.class
- .getName());
-
- protected ItemSelectionModel m_selArticle;
- protected ItemSelectionModel m_selSection;
- protected SaveCancelSection m_saveCancelSection;
- private Label m_sectionNameLabel;
-
- /**
- *
- * @param selArticle
- * @param selSection
- */
- public SectionDeleteForm(
- final ItemSelectionModel selArticle,
- final SectionSelectionModel extends MultiPartArticleSection> selSection) {
- super("SectionDeleteForm", new ColumnPanel(2));
- m_selArticle = selArticle;
- m_selSection = selSection;
-
- ColumnPanel panel = (ColumnPanel) getPanel();
- panel.setBorder(false);
- panel.setPadColor("#FFFFFF");
- panel.setColumnWidth(1, "20%");
- panel.setColumnWidth(2, "80%");
- panel.setWidth("100%");
-
- m_sectionNameLabel = new Label("Section Name");
- add(m_sectionNameLabel, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- addSaveCancelSection();
-
- addInitListener(this);
- addSubmissionListener(this);
- addProcessListener(this);
- }
-
- /**
- *
- * @return
- */
- protected SaveCancelSection addSaveCancelSection() {
- m_saveCancelSection = new SaveCancelSection();
- m_saveCancelSection.getSaveButton().setButtonLabel(
- GlobalizationUtil.globalize("cms.ui.delete"));
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- return m_saveCancelSection;
- }
-
- @Override
- public void init(FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
-
- ArticleSection section = (ArticleSection) m_selSection
- .getSelectedObject(state);
-
- if (section == null) {
- log.error("No section selected");
- } else {
- m_sectionNameLabel.setLabel(section.getTitle(), state);
- }
- }
-
- @Override
- public void submitted(FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
-
- if (m_saveCancelSection.getCancelButton().isSelected(state)) {
- throw new FormProcessException(
- "Submission cancelled",
- MPArticleGlobalizationUtil.globalize(
- "cms.contenttypes.ui.mparticle.submission_cancelled")
- );
- }
- }
-
- @Override
- public void process(FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
-
- MultiPartArticle article = (MultiPartArticle) m_selArticle
- .getSelectedObject(state);
- ArticleSection section = (ArticleSection) m_selSection
- .getSelectedObject(state);
-
- Assert.exists(article, MultiPartArticle.class);
- Assert.exists(section, ArticleSection.class);
-
- article.removeSection(section);
-
- log.info("section " + m_selSection.getSelectedKey(state) + " delete");
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java.todo b/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java.todo
deleted file mode 100755
index b2f501ad2..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionEditForm.java.todo
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
- *
- * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui.mparticle;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.form.CheckboxGroup;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.bebop.parameters.TrimmedStringParameter;
-import com.arsdigita.cms.ReusableImageAsset;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.TextAsset;
-import com.arsdigita.cms.contenttypes.ArticleSection;
-import com.arsdigita.cms.contenttypes.MultiPartArticle;
-import com.arsdigita.cms.ui.CMSDHTMLEditor;
-import com.arsdigita.cms.contenttypes.util.MPArticleGlobalizationUtil;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.UncheckedWrapperException;
-
-import org.apache.log4j.Logger;
-import org.librecms.contenttypes.MultiPartArticleSection;
-
-import java.math.BigDecimal;
-
-/**
- * Form to edit an ArticleSection for a MultiPartArticle.
- *
- * @author Dave Turner
- * @version $Id: SectionEditForm.java 1423 2006-12-19 22:08:04Z apevec $
- */
-public class SectionEditForm extends Form {
-
- private final static Logger log = Logger.getLogger(SectionEditForm.class);
-
- private ItemSelectionModel m_selArticle;
- private ItemSelectionModel m_selSection;
-
- private BigDecimalParameter m_imageParam;
- private ItemSelectionModel m_selImage;
-
- private BigDecimalParameter m_textParam;
- private ItemSelectionModel m_selText;
- private MultiPartArticleViewSections m_container;
-
- private SaveCancelSection m_saveCancelSection;
- private ImageUploadSection m_imageUpload;
-
- public static final String TITLE = "title";
- public static final String TEXT = "text";
- public static final String IMAGE = "image";
- public static final String PAGE_BREAK = "pageBreak";
-
- private static final String TEXT_PARAM = "textParam";
- private static final String IMAGE_PARAM = "imageParam";
-
- /**
- * Constructor.
- *
- * @param selArticle the current article
- * @param selSection the current section
- */
- public SectionEditForm(ItemSelectionModel selArticle,
- ItemSelectionModel selSection) {
- this(selArticle, selSection, null);
- }
-
- /**
- * Constructor.
- *
- * @param selArticle the current article
- * @param selSection the current section
- * @param sectionsStep container which this form is added to
- */
- public SectionEditForm(
- final ItemSelectionModel selArticle,
- final SectionSelectionModel extends MultiPartArticleSection> selSection,
- final MultiPartArticleSectionsStep sectionsStep,
- final StringParameter selectedLanguageParam) {
-
- super("SectionEditForm", new ColumnPanel(2));
- m_selArticle = selArticle;
- m_selSection = selSection;
- m_container = sectionsStep;
-
- m_imageParam = new BigDecimalParameter(IMAGE_PARAM);
- m_selImage = new ItemSelectionModel(ReusableImageAsset.class.getName(),
- ReusableImageAsset.BASE_DATA_OBJECT_TYPE,
- m_imageParam);
-
- m_textParam = new BigDecimalParameter(TEXT_PARAM);
- m_selText = new ItemSelectionModel(TextAsset.class.getName(),
- TextAsset.BASE_DATA_OBJECT_TYPE,
- m_textParam);
-
- setMethod(Form.POST);
- setEncType("multipart/form-data");
-
- ColumnPanel panel = (ColumnPanel) getPanel();
- panel.setBorder(false);
- panel.setPadColor("#FFFFFF");
- panel.setColumnWidth(1, "20%");
- panel.setColumnWidth(2, "80%");
- panel.setWidth("100%");
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(new SectionInitListener());
- addSubmissionListener(new SectionSubmissionListener());
- addProcessListener(new SectionProcessListener());
- }
-
- /**
- * Instantiate and add a save/cancel section to the form.
- *
- * @return the SaveCancelSection that was added
- */
- protected SaveCancelSection addSaveCancelSection() {
- m_saveCancelSection = new SaveCancelSection();
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- return m_saveCancelSection;
- }
-
- /**
- * Returns the save/cancel section from this form.
- */
- public SaveCancelSection getSaveCancelSection() {
- return m_saveCancelSection;
- }
-
- /**
- * Add form widgets for a Section.
- */
- protected void addWidgets() {
-
- //add(new Label(MPArticleGlobalizationUtil
- // .globalize("cms.contenttypes.ui.mparticle.section.title")));
- TextField titleWidget = new TextField(
- new TrimmedStringParameter(TITLE));
- titleWidget.addValidationListener(new NotNullValidationListener());
- titleWidget.setLabel(MPArticleGlobalizationUtil
- .globalize("cms.contenttypes.ui.mparticle.section.title"));
- add(titleWidget);
-
- //add(new Label(MPArticleGlobalizationUtil
- // .globalize("cms.contenttypes.ui.mparticle.section.text")),
- // ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH);
- CMSDHTMLEditor textWidget = new CMSDHTMLEditor(
- new TrimmedStringParameter(TEXT));
- textWidget.setLabel(MPArticleGlobalizationUtil
- .globalize("cms.contenttypes.ui.mparticle.section.text"));
- textWidget.setRows(40);
- textWidget.setCols(70);
- textWidget.setWrap(CMSDHTMLEditor.SOFT);
- add(textWidget,
- ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH);
-
- //add(new Label(MPArticleGlobalizationUtil
- // .globalize("cms.contenttypes.ui.mparticle.section.image")),
- // ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- m_imageUpload = new ImageUploadSection("image", m_selImage);
- m_imageUpload.setLabel(MPArticleGlobalizationUtil
- .globalize("cms.contenttypes.ui.mparticle.section.image"));
- add(m_imageUpload, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
-
- //add(new Label());
- CheckboxGroup pageBreak = new CheckboxGroup(PAGE_BREAK);
- pageBreak.addOption(new Option("true",
- new Label(MPArticleGlobalizationUtil
- .globalize(
- "cms.contenttypes.ui.mparticle.section.create_break"))));
- add(pageBreak);
- }
-
- /**
- * Utility method to create a Section from the form data supplied.
- *
- * @param event
- * @param article
- *
- * @return
- */
- protected ArticleSection createSection(FormSectionEvent event,
- MultiPartArticle article) {
-
- PageState state = event.getPageState();
- FormData data = event.getFormData();
-
- ArticleSection section = new ArticleSection();
-
- section.setTitle((String) data.get(TITLE));
- section.setName(article.getName() + ": " + (String) data.get(TITLE));
- section.setContentSection(article.getContentSection());
-
- return section;
- }
-
- /**
- *
- * @param p
- */
- @Override
- public void register(Page p) {
- super.register(p);
- p.addGlobalStateParam(m_imageParam);
- p.addGlobalStateParam(m_textParam);
- }
-
- /**
- * Initialize the form. If there is a selected section, ie. this is an
- * 'edit' step rather than a 'create new' step, load the data into the form
- * fields.
- */
- private class SectionInitListener implements FormInitListener {
-
- @Override
- public void init(FormSectionEvent event)
- throws FormProcessException {
- PageState state = event.getPageState();
- FormData data = event.getFormData();
- m_selImage.setSelectedObject(state, null);
- m_selText.setSelectedObject(state, null);
-
- if (m_selSection.getSelectedKey(state) != null) {
- BigDecimal id = new BigDecimal(m_selSection
- .getSelectedKey(state).toString());
- try {
- // retrieve the selected Section from the persistence layer
- ArticleSection section = new ArticleSection(id);
-
- data.put(TITLE, section.getTitle());
-
- TextAsset t = section.getText();
- if (t != null) {
- m_selText.setSelectedObject(state, t);
- data.put(TEXT, t.getText());
- }
-
- ReusableImageAsset img = section.getImage();
- if (img != null) {
- m_selImage.setSelectedObject(state, img);
- }
-
- if (section.isPageBreak()) {
- data.put(PAGE_BREAK, new Object[]{"true"});
- }
-
- } catch (DataObjectNotFoundException ex) {
- log.error("Section(" + id + ") could not be found");
- }
- }
-
- // Wait until the image selection model is updated before
- // initializing the image section
- m_imageUpload.initImageUpload(event);
- }
-
- }
-
- /**
- * Called on form submission. Check to see if the user clicked the cancel
- * button. If they did, don't continue with the form.
- */
- private class SectionSubmissionListener implements FormSubmissionListener {
-
- @Override
- public void submitted(FormSectionEvent event)
- throws FormProcessException {
- PageState state = event.getPageState();
-
- if (m_saveCancelSection.getCancelButton()
- .isSelected(state) && m_container != null) {
- m_container.onlyShowComponent(
- state, MultiPartArticleViewSections.SECTION_TABLE
- + m_container.getTypeIDStr());
- throw new FormProcessException(
- "Submission cancelled",
- MPArticleGlobalizationUtil.globalize(
- "cms.contenttypes.ui.mparticle.submission_cancelled")
- );
- } else if (m_imageUpload.getDeleteImageButton().isSelected(state)) {
- BigDecimal id = new BigDecimal(m_selSection
- .getSelectedKey(state).toString());
- log.debug("deleting image for MPA section " + id);
- try {
- ArticleSection section = new ArticleSection(id);
- section.setImage(null);
- } catch (DataObjectNotFoundException ex) {
- log.error("Section(" + id + ") could not be found");
- }
-
- }
- }
-
- }
-
- /**
- * Called after form has been validated. Create the new ArticleSection and
- * assign it to the current MultiPartArticle.
- */
- private class SectionProcessListener implements FormProcessListener {
-
- @Override
- public void process(FormSectionEvent event)
- throws FormProcessException {
- PageState state = event.getPageState();
- FormData data = event.getFormData();
-
- // retrieve the current MultiPartArticle
- BigDecimal id = new BigDecimal(
- m_selArticle.getSelectedKey(state).toString());
- MultiPartArticle article = null;
-
- try {
- article = new MultiPartArticle(id);
- } catch (DataObjectNotFoundException ex) {
- throw new UncheckedWrapperException(ex);
- }
-
- // get the selected section to update or create a new one
- ArticleSection section = (ArticleSection) m_selSection
- .getSelectedObject(state);
- if (section == null) {
- section = createSection(event, article);
- article.addSection(section);
- }
-
- section.setTitle((String) data.get(TITLE));
-
- Object[] pageBreakVal = (Object[]) data.get(PAGE_BREAK);
- boolean pageBreak;
- if (pageBreakVal == null || pageBreakVal.length == 0 || !"true"
- .equals(pageBreakVal[0])) {
- pageBreak = false;
- } else {
- pageBreak = true;
- }
- section.setPageBreak(pageBreak);
-
- // get the image asset
- ReusableImageAsset reusableImageAsset = m_imageUpload
- .processImageUpload(event);
- if (reusableImageAsset != null) {
- section.setImage(reusableImageAsset);
- m_selImage.setSelectedObject(state, reusableImageAsset);
- }
-
- // get the text asset
- TextAsset textAsset = (TextAsset) m_selText.getSelectedObject(state);
- if (textAsset == null) {
- textAsset = new TextAsset();
- textAsset.setName(section.getName() + " text");
- m_selText.setSelectedObject(state, textAsset);
- section.setText(textAsset);
- }
-
- String text = (String) data.get(TEXT);
- if (text == null) {
- text = "";
- }
-
- textAsset.setText(text);
- if (m_container != null) {
- m_container.onlyShowComponent(
- state,
- MultiPartArticleViewSections.SECTION_TABLE + m_container
- .getTypeIDStr());
- }
- }
-
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTableModel.java.todo b/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTableModel.java.todo
deleted file mode 100644
index 9f3ea83eb..000000000
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTableModel.java.todo
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.arsdigita.cms.contenttypes.ui.mparticle;
-
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-import org.arsdigita.cms.CMSConfig;
-import org.libreccm.cdi.utils.CdiUtil;
-import org.librecms.CmsConstants;
-import org.librecms.contenttypes.MultiPartArticle;
-import org.librecms.contenttypes.MultiPartArticleSection;
-
-import java.util.Iterator;
-import java.util.List;
-
-class SectionTableModel implements TableModel {
-
- private final TableColumnModel columnModel;
- private final SectionTable sectionTable;
- private final PageState pageState;
- private final SectionSelectionModel extends MultiPartArticleSection> moveSectionModel;
-
- private final Iterator iterator;
- private MultiPartArticleSection currentSection;
-
- /**
- * Constructor.
- *
- * @param sectionTable
- * @param pageState
- * @param article
- * @param moveSectionModel
- */
- public SectionTableModel(
- final Table sectionTable,
- final PageState pageState,
- final MultiPartArticle article,
- final SectionSelectionModel extends MultiPartArticleSection> moveSectionModel) {
-
- this.pageState = pageState;
- this.sectionTable = (SectionTable) sectionTable;
- this.moveSectionModel = moveSectionModel;
-
- columnModel = sectionTable.getColumnModel();
-
- final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
- final MultiPartArticleSectionStepController controller = cdiUtil
- .findBean(MultiPartArticleSectionStepController.class);
-
- final List sections = controller
- .retrieveSections(article);
- iterator = sections.iterator();
- }
-
- /**
- * Return the number of columns this TableModel has.
- */
- @Override
- public int getColumnCount() {
- return columnModel.size();
- }
-
- /**
- * Move to the next row and return true if the model is now positioned on a
- * valid row.
- */
- @Override
- public boolean nextRow() {
-
- if (iterator.hasNext()) {
- currentSection = iterator.next();
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Return the data element for the given column and the current row.
- */
- @Override
- public Object getElementAt(final int columnIndex) {
-
- if (columnModel == null) {
- return null;
- }
- // match columns by (symbolic) index, makes for easier reordering
- switch (columnIndex) {
- case SectionTable.COL_INDEX_TITLE:
- return currentSection.getTitle();
- case SectionTable.COL_INDEX_EDIT:
- //return "edit";
- return new Label(new GlobalizedMessage(
- "cms.contenttypes.ui.mparticle.section_table.link_edit",
- CmsConstants.CMS_BUNDLE));
- case SectionTable.COL_INDEX_DELETE:
- // return "delete";
- return new Label(new GlobalizedMessage(
- "cms.contenttypes.ui.mparticle.section_table.link_delete",
- CmsConstants.CMS_BUNDLE));
- case SectionTable.COL_INDEX_MOVE:
- if (moveSectionModel.getSelectedKey(pageState) == null) {
- // return "move";
- return new Label(new GlobalizedMessage(
- "cms.contenttypes.ui.mparticle.section_table.link_move",
- CmsConstants.CMS_BUNDLE));
- } else {
- // return "move below here";
- return new Label(new GlobalizedMessage(
- "cms.contenttypes.ui.mparticle.section_table.link_move_below",
- CmsConstants.CMS_BUNDLE));
- }
- default:
- return null;
- }
- }
-
- /**
- * Return the key for the given column and the current row.
- */
- @Override
- public Object getKeyAt(final int columnIndex) {
- return currentSection.getSectionId();
- }
-
-}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java
index 67173e9fa..e20ccb72b 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/FlatItemList.java
@@ -44,7 +44,7 @@ import com.arsdigita.cms.CMS;
import org.librecms.contentsection.ContentSection;
import com.arsdigita.cms.ui.authoring.CreationSelector;
-import com.arsdigita.cms.ui.authoring.NewItemForm;
+import com.arsdigita.cms.ui.authoring.news.NewItemForm;
import com.arsdigita.cms.ui.folder.FolderCreateForm;
import com.arsdigita.cms.ui.folder.FolderEditorForm;
import com.arsdigita.cms.ui.folder.FolderManipulator;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/BasicPageForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/BasicPageForm.java
index 352a6fea5..3a969e3e5 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/BasicPageForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/BasicPageForm.java
@@ -163,14 +163,8 @@ public abstract class BasicPageForm extends BasicItemForm {
final ContentItem item = getItemSelectionModel()
.getSelectedObject(state);
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
if (item != null) {
// Preset fields
@@ -244,15 +238,9 @@ public abstract class BasicPageForm extends BasicItemForm {
.getSelectedObject(state);
if (item != null) {
- // Update attributes
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
item.getName().addValue(selectedLocale, (String) data.get(NAME));
item.getTitle().addValue(selectedLocale, (String) data.get(TITLE));
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ResettableContainer.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ResettableContainer.java
similarity index 99%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ResettableContainer.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ResettableContainer.java
index a0cb49645..357674f6e 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ResettableContainer.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ResettableContainer.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Page;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticlePropertiesStep.java
similarity index 98%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticlePropertiesStep.java
index a60d190a4..d991c8fde 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticlePropertiesStep.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticlePropertiesStep.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.article;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.parameters.StringParameter;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticlePropertyForm.java
similarity index 85%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticlePropertyForm.java
index 68c19ba7e..4c36b27e5 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticlePropertyForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.article;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
@@ -32,6 +32,7 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig;
@@ -60,8 +61,8 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
* Creates a new form to edit the Article object specified by the item
* selection model passed in.
*
- * @param itemModel The ItemSelectionModel to use to obtain the Article to
- * work on
+ * @param itemModel The ItemSelectionModel to use to obtain the
+ * Article to work on
* @param selectedLanguageParam
*/
public ArticlePropertyForm(final ItemSelectionModel itemModel,
@@ -73,20 +74,21 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
* Creates a new form to edit the Article object specified by the item
* selection model passed in.
*
- * @param itemModel The ItemSelectionModel to use to obtain the Article
- * to work on
- * @param propertiesStep The ArticlePropertiesStep which controls this form.
+ * @param itemModel The ItemSelectionModel to use to obtain the
+ * Article to work on
+ * @param propertiesStep The ArticlePropertiesStep which controls
+ * this form.
* @param selectedLanguageParam
*/
public ArticlePropertyForm(
final ItemSelectionModel itemModel,
final ArticlePropertiesStep propertiesStep,
final StringParameter selectedLanguageParam) {
-
+
super(itemModel, propertiesStep, selectedLanguageParam);
-
+
Objects.requireNonNull(selectedLanguageParam);
-
+
this.propertiesStep = propertiesStep;
this.selectedLanguageParam = selectedLanguageParam;
addSubmissionListener(this);
@@ -137,14 +139,8 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
final PageState state = event.getPageState();
final Article article = (Article) super.initBasicWidgets(event);
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
data.put(LEAD, article.getDescription().getValue(selectedLocale));
}
@@ -177,14 +173,8 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
&& getSaveCancelSection().getSaveButton()
.isSelected(event.getPageState())) {
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
article
.getDescription()
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ArticleTextBody.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticleTextBody.java
similarity index 88%
rename from ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ArticleTextBody.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticleTextBody.java
index 9f5361c1c..b7b7221b7 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/ArticleTextBody.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/ArticleTextBody.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.ui.authoring;
+package com.arsdigita.cms.ui.authoring.article;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
@@ -24,6 +24,9 @@ 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.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
+import com.arsdigita.cms.ui.authoring.TextBody;
import org.librecms.contenttypes.Article;
@@ -113,16 +116,12 @@ public class ArticleTextBody extends TextBody {
final String text) {
final Article article = getSelectedArticle(state);
- final String selectedLanguage = (String) state.getValue(
- selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
article.getText().addValue(selectedLocale, text);
+
final ContentItemRepository itemRepo = CdiUtil
.createCdiUtil()
.findBean(ContentItemRepository.class);
@@ -151,14 +150,8 @@ public class ArticleTextBody extends TextBody {
final Article article = getSelectedArticle(state);
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
return article.getText().getValue(selectedLocale);
}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertiesStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/GenericArticlePropertiesStep.java
similarity index 99%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertiesStep.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/GenericArticlePropertiesStep.java
index 0d89a9cd1..41f0bd928 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertiesStep.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/GenericArticlePropertiesStep.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.article;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/GenericArticlePropertyForm.java
similarity index 98%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/GenericArticlePropertyForm.java
index 724e76ab7..dbfedcbd9 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/article/GenericArticlePropertyForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.article;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventPropertiesStep.java
similarity index 99%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventPropertiesStep.java
index a106048ad..a26917db9 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/EventPropertiesStep.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventPropertiesStep.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.event;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventPropertyForm.java
similarity index 96%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventPropertyForm.java
index f7fe41f6e..d8f337c34 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventPropertyForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.event;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
@@ -41,6 +41,7 @@ import org.librecms.contenttypes.Event;
import com.arsdigita.cms.ui.CMSDHTMLEditor;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig;
@@ -433,14 +434,8 @@ public class EventPropertyForm
}
endDateField.addYear(endDate);
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
data.put(LEAD, item.getDescription().getValue(selectedLocale));
data.put(START_DATE, startDate);
@@ -507,14 +502,8 @@ public class EventPropertyForm
if (item != null
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
final java.util.Date startDate = (java.util.Date) data
.get(START_DATE);
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/event/EventTextBody.java
similarity index 82%
rename from ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/EventTextBody.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventTextBody.java
index 4e61d814a..250a9e4e4 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/EventTextBody.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/event/EventTextBody.java
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
-package com.arsdigita.cms.ui.authoring;
+package com.arsdigita.cms.ui.authoring.event;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
@@ -11,6 +11,9 @@ 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.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
+import com.arsdigita.cms.ui.authoring.TextBody;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.kernel.KernelConfig;
@@ -86,14 +89,8 @@ public class EventTextBody extends TextBody {
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);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
return event.getText().getValue(selectedLocale);
@@ -103,15 +100,10 @@ public class EventTextBody extends TextBody {
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);
- }
-
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
+
event.getText().addValue(selectedLocale, text);
final ContentItemRepository itemRepo = CdiUtil
.createCdiUtil()
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleCreateForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleCreateForm.java
similarity index 99%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleCreateForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleCreateForm.java
index cd03a7233..9e3270d26 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleCreateForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleCreateForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormData;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEdit.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleEdit.java
similarity index 98%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEdit.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleEdit.java
index 7cd49a9a1..891ff8e23 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEdit.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleEdit.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.parameters.StringParameter;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleEditForm.java
similarity index 92%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleEditForm.java
index fdc365945..dee3e4cb3 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleEditForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleEditForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
@@ -28,13 +28,12 @@ import com.arsdigita.bebop.parameters.StringParameter;
import org.librecms.contentsection.Folder;
import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import org.librecms.contenttypes.MultiPartArticle;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.kernel.KernelConfig;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.CmsConstants;
@@ -108,7 +107,6 @@ public class MultiPartArticleEditForm extends MultiPartArticleForm
// final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
// .getSelectedObject(state);
-
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ContentItemRepository itemRepo = cdiUtil
.findBean(ContentItemRepository.class);
@@ -127,14 +125,8 @@ public class MultiPartArticleEditForm extends MultiPartArticleForm
final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
.getSelectedObject(state);
- final Locale selectedLocale;
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
final String newName = (String) data.get(MultiPartArticleForm.NAME);
final String oldName = article.getName().getValue(selectedLocale);
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleForm.java
similarity index 90%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleForm.java
index 1c869bd70..4edcdd0a3 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Embedded;
@@ -39,16 +39,14 @@ import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.bebop.parameters.TrimmedStringParameter;
import com.arsdigita.bebop.parameters.URLTokenValidationListener;
import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.web.Web;
import com.arsdigita.xml.Element;
import java.util.Date;
import java.util.Locale;
-import javax.servlet.ServletException;
-
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.arsdigita.cms.CMSConfig;
@@ -138,13 +136,13 @@ public abstract class MultiPartArticleForm
titleWidget.setLabel(new GlobalizedMessage("cms.contenttypes.ui.title",
CmsConstants.CMS_BUNDLE));
titleWidget.addValidationListener(new NotNullValidationListener());
- titleWidget.setOnFocus("if (this.form." + NAME + ".value == '') { "
- + " defaulting = true; this.form." + NAME
- + ".value = urlize(this.value); }");
- titleWidget.setOnKeyUp(
- "if (defaulting) { this.form." + NAME
- + ".value = urlize(this.value) }"
- );
+ titleWidget.setOnFocus(String.format(
+ "if (this.form.%s.value == '') { "
+ + " defaulting = true; this.form.%s.value = urlize(this.value); }",
+ NAME, NAME));
+ titleWidget.setOnKeyUp(String.format(
+ "if (defaulting) { this.form.%s.value = urlize(this.value) }",
+ NAME));
add(titleWidget);
//add(new Label(GlobalizationUtil
@@ -156,11 +154,11 @@ public abstract class MultiPartArticleForm
nameWidget.addValidationListener(new NotNullValidationListener());
nameWidget.addValidationListener(new URLTokenValidationListener());
nameWidget.setOnFocus("defaulting = false");
- nameWidget.setOnBlur(
- "if (this.value == '') "
- + "{ defaulting = true; this.value = urlize(this.form." + TITLE
- + ".value) }"
- );
+ nameWidget.setOnBlur(String.format(
+ "if (this.value == '') { "
+ + "defaulting = true; this.value = urlize(this.form.%s.value) "
+ + "}",
+ TITLE));
add(nameWidget);
if (!CMSConfig.getConfig().isHideLaunchDate()) {
@@ -233,14 +231,8 @@ public abstract class MultiPartArticleForm
final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
.getSelectedObject(state);
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
if (article != null) {
data.put(NAME, article.getName().getValue(selectedLocale));
@@ -269,14 +261,8 @@ public abstract class MultiPartArticleForm
.getSelectedObject(state);
if (article != null) {
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
article.getName().addValue(selectedLocale,
(String) data.get(NAME));
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleFormController.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleFormController.java
similarity index 97%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleFormController.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleFormController.java
index a1d9e1703..803a91461 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleFormController.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleFormController.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemManager;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleSectionStepController.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleSectionStepController.java
similarity index 57%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleSectionStepController.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleSectionStepController.java
index 99cd6f85d..3b469701e 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleSectionStepController.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleSectionStepController.java
@@ -16,8 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
+import org.bouncycastle.asn1.cmp.ProtectedPart;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contenttypes.MultiPartArticle;
import org.librecms.contenttypes.MultiPartArticleSection;
@@ -35,7 +36,7 @@ import javax.transaction.Transactional;
* @author Jens Pelzetter
*/
@RequestScoped
-public class MultiPartArticleSectionStepController {
+class MultiPartArticleSectionStepController {
@Inject
private ContentItemRepository itemRepo;
@@ -47,7 +48,7 @@ public class MultiPartArticleSectionStepController {
private MultiPartArticleSectionManager sectionManager;
@Transactional(Transactional.TxType.REQUIRED)
- public List retrieveSections(
+ protected List retrieveSections(
final MultiPartArticle forArticle) {
final MultiPartArticle article = itemRepo
@@ -61,8 +62,25 @@ public class MultiPartArticleSectionStepController {
}
@Transactional(Transactional.TxType.REQUIRED)
- public void moveToFirst(final MultiPartArticle article,
- final MultiPartArticleSection section) {
+ protected MultiPartArticleSection addSection(
+ final MultiPartArticle article) {
+
+ final MultiPartArticle theArticle = itemRepo
+ .findById(article.getObjectId(),
+ MultiPartArticle.class)
+ .orElseThrow(() -> new IllegalArgumentException(String.format(
+ "No MultiPartArticle with ID %d in the database.",
+ article.getObjectId())));
+
+ final MultiPartArticleSection section = new MultiPartArticleSection();
+ sectionManager.addSectionToMultiPartArticle(section, theArticle);
+
+ return section;
+ }
+
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected void removeSection(final MultiPartArticle article,
+ final MultiPartArticleSection section) {
final MultiPartArticle theArticle = itemRepo
.findById(article.getObjectId(),
@@ -77,7 +95,28 @@ public class MultiPartArticleSectionStepController {
"No MultiPartArticleSection with ID %d in the database.",
section.getSectionId())));
- sectionManager.moveToFirst(article, section);
+ sectionManager.removeSectionFromMultiPartArticle(theSection,
+ theArticle);
+ }
+
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected void moveToFirst(final MultiPartArticle article,
+ final MultiPartArticleSection section) {
+
+ final MultiPartArticle theArticle = itemRepo
+ .findById(article.getObjectId(),
+ MultiPartArticle.class)
+ .orElseThrow(() -> new IllegalArgumentException(String.format(
+ "No MultiPartArticle with ID %d in the database.",
+ article.getObjectId())));
+
+ final MultiPartArticleSection theSection = sectionRepo
+ .findById(section.getSectionId())
+ .orElseThrow(() -> new IllegalArgumentException(String.format(
+ "No MultiPartArticleSection with ID %d in the database.",
+ section.getSectionId())));
+
+ sectionManager.moveToFirst(theArticle, theSection);
}
}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleSectionsStep.java.todo b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleSectionsStep.java
similarity index 93%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleSectionsStep.java.todo
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleSectionsStep.java
index 3cc8bcb2e..d3a10d08e 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleSectionsStep.java.todo
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/MultiPartArticleSectionsStep.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.ColumnPanel;
@@ -25,21 +25,16 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.TableActionEvent;
import com.arsdigita.bebop.event.TableActionListener;
import com.arsdigita.bebop.parameters.LongParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.ui.ResettableContainer;
-import com.arsdigita.cms.dispatcher.Utilities;
+import com.arsdigita.cms.ui.authoring.ResettableContainer;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.kernel.KernelConfig;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.security.PermissionChecker;
@@ -149,7 +144,7 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
final Label emptyView = new Label(new GlobalizedMessage(
"cms.contenttypes.ui.mparticle.no_sections_yet",
CmsConstants.CMS_BUNDLE));
- sectionTable.setEmptyView(this);
+ sectionTable.setEmptyView(emptyView);
moveSectionLabel = new Label(new GlobalizedMessage(
"cms.contenttypes.ui.mparticle.section.title",
@@ -185,14 +180,10 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
} else {
beginLink.setVisible(state, true);
moveSectionLabel.setVisible(state, true);
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
+
final Object[] parameterObj = {
moveSectionModel
.getSelectedSection(state)
@@ -297,7 +288,8 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
"cms.contenttypes.ui.mparticle.delete_section",
CmsConstants.CMS_BUNDLE)));
sectionDeleteForm = new SectionDeleteForm(selectedArticleModel,
- selectedSectionModel);
+ selectedSectionModel,
+ selectedLanguageParam);
sectionDeleteForm.addSubmissionListener(event -> {
final PageState state = event.getPageState();
@@ -368,9 +360,9 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
@Override
public void register(final Page page) {
-
+
super.register(page);
-
+
page.addGlobalStateParam(moveSectionParam);
page.setVisibleDefault(beginLink, false);
page.setVisibleDefault(moveSectionLabel, false);
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionDeleteForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionDeleteForm.java
new file mode 100755
index 000000000..ca9cde32f
--- /dev/null
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionDeleteForm.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.ui.authoring.multipartarticle;
+
+import com.arsdigita.bebop.ColumnPanel;
+import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
+import com.arsdigita.globalization.GlobalizedMessage;
+
+import org.librecms.contenttypes.MultiPartArticle;
+
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.libreccm.cdi.utils.CdiUtil;
+import org.librecms.CmsConstants;
+import org.librecms.contenttypes.MultiPartArticleSection;
+
+import java.util.Locale;
+
+/**
+ * A form to confirm deletion of a single section of a MultiPartArticle.
+ *
+ * @author Dave Turner
+ * @author Jens Pelzetter
+ */
+public class SectionDeleteForm extends Form
+ implements FormInitListener, FormSubmissionListener, FormProcessListener {
+
+ private final static Logger LOGGER = LogManager
+ .getLogger(SectionDeleteForm.class.getName());
+
+ private final ItemSelectionModel selectedArticleModel;
+ private final SectionSelectionModel extends MultiPartArticleSection> selectedSectionModel;
+ private final SaveCancelSection saveCancelSection;
+ private final Label sectionNameLabel;
+
+ private final StringParameter selectedLanguageParam;
+
+ public SectionDeleteForm(
+ final ItemSelectionModel selectedArticleModel,
+ final SectionSelectionModel extends MultiPartArticleSection> selectedSectionModel,
+ final StringParameter selectedLanguageParam) {
+
+ super("SectionDeleteForm", new ColumnPanel(2));
+ this.selectedArticleModel = selectedArticleModel;
+ this.selectedSectionModel = selectedSectionModel;
+ this.selectedLanguageParam = selectedLanguageParam;
+
+ final ColumnPanel panel = (ColumnPanel) super.getPanel();
+ panel.setBorder(false);
+ panel.setPadColor("#FFFFFF");
+ panel.setColumnWidth(1, "20%");
+ panel.setColumnWidth(2, "80%");
+ panel.setWidth("100%");
+
+ sectionNameLabel = new Label(new GlobalizedMessage(
+ "cms.contenttypes.ui.mparticle.section_name"));
+ super.add(sectionNameLabel, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
+
+ saveCancelSection = new SaveCancelSection();
+ saveCancelSection
+ .getSaveButton()
+ .setButtonLabel(new GlobalizedMessage("cms.ui.delete",
+ CmsConstants.CMS_BUNDLE));
+ super.add(saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
+
+ super.addInitListener(this);
+ super.addSubmissionListener(this);
+ super.addProcessListener(this);
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ final MultiPartArticleSection section = selectedSectionModel
+ .getSelectedSection(state);
+
+ if (section == null) {
+ LOGGER.error("No section selected");
+ } else {
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
+
+ sectionNameLabel.setLabel(
+ section.getTitle().getValue(selectedLocale),
+ state);
+ }
+ }
+
+ @Override
+ public void submitted(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ if (saveCancelSection
+ .getCancelButton()
+ .isSelected(state)) {
+
+ throw new FormProcessException(
+ "Submission cancelled",
+ new GlobalizedMessage(
+ "cms.contenttypes.ui.mparticle.submission_cancelled",
+ CmsConstants.CMS_BUNDLE));
+ }
+ }
+
+ @Override
+ public void process(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ final MultiPartArticle article = (MultiPartArticle) selectedArticleModel
+ .getSelectedObject(state);
+ final MultiPartArticleSection section = selectedSectionModel
+ .getSelectedSection(state);
+
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final MultiPartArticleSectionStepController controller = cdiUtil
+ .findBean(MultiPartArticleSectionStepController.class);
+
+ controller.removeSection(article, section);
+
+ LOGGER.info("section {} deleted",
+ selectedSectionModel.getSelectedKey(state));
+ }
+
+}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionEditForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionEditForm.java
new file mode 100755
index 000000000..76eb8c113
--- /dev/null
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionEditForm.java
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.ui.authoring.multipartarticle;
+
+import com.arsdigita.bebop.ColumnPanel;
+import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.form.CheckboxGroup;
+import com.arsdigita.bebop.form.Option;
+import com.arsdigita.bebop.parameters.LongParameter;
+import com.arsdigita.bebop.parameters.NotNullValidationListener;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.bebop.parameters.TrimmedStringParameter;
+import com.arsdigita.cms.ItemSelectionModel;
+
+import org.librecms.contenttypes.MultiPartArticle;
+
+import com.arsdigita.cms.ui.CMSDHTMLEditor;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
+import com.arsdigita.globalization.GlobalizedMessage;
+
+import org.libreccm.cdi.utils.CdiUtil;
+import org.librecms.CmsConstants;
+import org.librecms.contenttypes.MultiPartArticleSection;
+import org.librecms.contenttypes.MultiPartArticleSectionRepository;
+
+import java.util.Locale;
+
+/**
+ * Form to edit an ArticleSection for a MultiPartArticle.
+ *
+ * @author Dave Turner
+ * @author Jens Pelzetter
+ */
+public class SectionEditForm extends Form {
+
+
+ public static final String TITLE = "title";
+ public static final String TEXT = "text";
+ public static final String IMAGE = "image";
+ public static final String PAGE_BREAK = "pageBreak";
+
+ private static final String TEXT_PARAM = "textParam";
+ private static final String IMAGE_PARAM = "imageParam";
+
+ private final ItemSelectionModel selectedArticleModel;
+ private final SectionSelectionModel extends MultiPartArticleSection> selectedSectionModel;
+ private final StringParameter selectedLanguageParam;
+
+ private LongParameter textParameter;
+ private ItemSelectionModel selectedTextModel;
+ private MultiPartArticleSectionsStep sectionsStep;
+
+ private SaveCancelSection saveCancelSection;
+
+ public SectionEditForm(
+ final ItemSelectionModel selectedArticleModel,
+ final SectionSelectionModel extends MultiPartArticleSection> selectedSectionModel,
+ final StringParameter selectedLanguageParam) {
+
+ this(selectedArticleModel,
+ selectedSectionModel,
+ null,
+ selectedLanguageParam);
+ }
+
+ public SectionEditForm(
+ final ItemSelectionModel selectedArticleModel,
+ final SectionSelectionModel extends MultiPartArticleSection> selectedSectionModel,
+ final MultiPartArticleSectionsStep sectionsStep,
+ final StringParameter selectedLanguageParam) {
+
+ super("SectionEditForm", new ColumnPanel(2));
+ this.selectedArticleModel = selectedArticleModel;
+ this.selectedSectionModel = selectedSectionModel;
+ this.sectionsStep = sectionsStep;
+ this.selectedLanguageParam = selectedLanguageParam;
+
+ super.setMethod(Form.POST);
+ super.setEncType("multipart/form-data");
+
+ final ColumnPanel panel = (ColumnPanel) super.getPanel();
+ panel.setBorder(false);
+ panel.setPadColor("#FFFFFF");
+ panel.setColumnWidth(1, "20%");
+ panel.setColumnWidth(2, "80%");
+ panel.setWidth("100%");
+
+ addWidgets();
+ saveCancelSection = new SaveCancelSection();
+ add(saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
+
+ addInitListener(new SectionInitListener());
+ addSubmissionListener(new SectionSubmissionListener());
+ addProcessListener(new SectionProcessListener());
+ }
+
+ public SaveCancelSection getSaveCancelSection() {
+ return saveCancelSection;
+ }
+
+ /**
+ * Add form widgets for a Section.
+ */
+ private void addWidgets() {
+
+ final TextField titleWidget = new TextField(
+ new TrimmedStringParameter(TITLE));
+ titleWidget.addValidationListener(new NotNullValidationListener());
+ titleWidget.setLabel(
+ new GlobalizedMessage("cms.contenttypes.ui.mparticle.section.title",
+ CmsConstants.CMS_BUNDLE));
+ add(titleWidget);
+
+ final CMSDHTMLEditor textWidget = new CMSDHTMLEditor(
+ new TrimmedStringParameter(TEXT));
+ textWidget.setLabel(
+ new GlobalizedMessage("cms.contenttypes.ui.mparticle.section.text",
+ CmsConstants.CMS_BUNDLE));
+ textWidget.setRows(40);
+ textWidget.setCols(70);
+ textWidget.setWrap(CMSDHTMLEditor.SOFT);
+ add(textWidget, ColumnPanel.LEFT | ColumnPanel.FULL_WIDTH);
+
+ final CheckboxGroup pageBreak = new CheckboxGroup(PAGE_BREAK);
+ pageBreak.addOption(
+ new Option("true",
+ new Label(new GlobalizedMessage(
+ "cms.contenttypes.ui.mparticle.section.create_break",
+ CmsConstants.CMS_BUNDLE))));
+ add(pageBreak);
+ }
+
+ /**
+ * Utility method to create a Section from the form data supplied.
+ *
+ * @param event
+ * @param article
+ *
+ * @return
+ */
+ protected MultiPartArticleSection createSection(final FormSectionEvent event,
+ final MultiPartArticle article) {
+
+ final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+
+ final MultiPartArticleSection section = new MultiPartArticleSection();
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
+
+ section.getTitle().addValue(selectedLocale, (String) data.get(TITLE));
+
+ return section;
+ }
+
+ @Override
+ public void register(final Page page) {
+ super.register(page);
+ page.addGlobalStateParam(textParameter);
+ }
+
+ /**
+ * Initialise the form. If there is a selected section, ie. this is an
+ * 'edit' step rather than a 'create new' step, load the data into the form
+ * fields.
+ */
+ private class SectionInitListener implements FormInitListener {
+
+ @Override
+ public void init(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final MultiPartArticleSectionRepository sectionRepo = cdiUtil
+ .findBean(MultiPartArticleSectionRepository.class);
+
+ if (selectedSectionModel.getSelectedKey(state) != null) {
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
+
+ final MultiPartArticleSection section = selectedSectionModel
+ .getSelectedSection(state);
+
+ data.put(TITLE, section.getTitle().getValue(selectedLocale));
+ data.put(TEXT, section.getText().getValue(selectedLocale));
+
+ if (section.isPageBreak()) {
+ data.put(PAGE_BREAK, new Object[]{"true"});
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Called on form submission. Check to see if the user clicked the cancel
+ * button. If they did, don't continue with the form.
+ */
+ private class SectionSubmissionListener implements FormSubmissionListener {
+
+ @Override
+ public void submitted(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+
+ if (saveCancelSection
+ .getCancelButton()
+ .isSelected(state)
+ && sectionsStep != null) {
+
+ sectionsStep.onlyShowComponent(
+ state,
+ MultiPartArticleSectionsStep.SECTION_TABLE
+ + sectionsStep.getTypeIDStr());
+
+ throw new FormProcessException(
+ "Submission cancelled",
+ new GlobalizedMessage(
+ "cms.contenttypes.ui.mparticle.submission_cancelled",
+ CmsConstants.CMS_BUNDLE)
+ );
+ }
+ }
+
+ }
+
+ /**
+ * Called after form has been validated. Create the new ArticleSection and
+ * assign it to the current MultiPartArticle.
+ */
+ private class SectionProcessListener implements FormProcessListener {
+
+ @Override
+ public void process(final FormSectionEvent event)
+ throws FormProcessException {
+
+ final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final MultiPartArticleSectionStepController controller = cdiUtil
+ .findBean(MultiPartArticleSectionStepController.class);
+ final MultiPartArticleSectionRepository sectionRepo = cdiUtil
+ .findBean(MultiPartArticleSectionRepository.class);
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
+
+ final MultiPartArticle article
+ = (MultiPartArticle) selectedArticleModel
+ .getSelectedItem(state);
+
+ // get the selected section to update or create a new one
+ final MultiPartArticleSection section;
+ if (selectedSectionModel.getSelectedKey(state) == null) {
+ section = new MultiPartArticleSection();
+ controller.addSection(article);
+ } else {
+ section = selectedSectionModel.getSelectedSection(state);
+ }
+
+ section.getTitle().addValue(selectedLocale,
+ (String) data.get(TITLE));
+
+ final Object[] pageBreakVal = (Object[]) data.get(PAGE_BREAK);
+ final boolean pageBreak;
+ if (pageBreakVal == null
+ || pageBreakVal.length == 0
+ || !"true".equals(pageBreakVal[0])) {
+ pageBreak = false;
+ } else {
+ pageBreak = true;
+ }
+ section.setPageBreak(pageBreak);
+
+ final String text;
+ if (data.get(TEXT) == null) {
+ text = "";
+ } else {
+ text = (String) data.get(TEXT);
+ }
+ section.getText().addValue(selectedLocale, text);
+
+ sectionRepo.save(section);
+ }
+
+ }
+
+}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionPreviewPanel.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionPreviewPanel.java
similarity index 94%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionPreviewPanel.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionPreviewPanel.java
index 90dc0883b..d453033b8 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionPreviewPanel.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionPreviewPanel.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.BoxPanel;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionSelectionModel.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionSelectionModel.java
similarity index 98%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionSelectionModel.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionSelectionModel.java
index 2050a44e8..41a4e6253 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionSelectionModel.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionSelectionModel.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java.todo b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionTable.java
similarity index 84%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java.todo
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionTable.java
index ba02531a0..bd0f89c6e 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTable.java.todo
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionTable.java
@@ -16,40 +16,36 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table;
+import com.arsdigita.bebop.Text;
import com.arsdigita.bebop.event.TableActionEvent;
import com.arsdigita.bebop.event.TableActionListener;
import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
import org.librecms.contentsection.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.globalization.GlobalizedMessage;
-import org.librecms.contenttypes.MultiPartArticleSection;
import org.librecms.contenttypes.MultiPartArticle;
import com.arsdigita.util.LockableImpl;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.libreccm.cdi.utils.CdiUtil;
+import org.libreccm.security.PermissionChecker;
import org.librecms.CmsConstants;
+import org.librecms.contentsection.privileges.ItemPrivileges;
import org.librecms.contenttypes.MultiPartArticleSection;
import org.librecms.contenttypes.MultiPartArticleSectionRepository;
-import java.math.BigDecimal;
import java.util.Objects;
/**
@@ -61,9 +57,6 @@ import java.util.Objects;
*/
public class SectionTable extends Table {
- private static final Logger LOGGER = LogManager
- .getLogger(SectionTable.class);
-
/**
* Index of the title column
*/
@@ -127,10 +120,10 @@ public class SectionTable extends Table {
model.get(2).setCellRenderer(new SectionTableCellRenderer(true));
model.get(3).setCellRenderer(new SectionTableCellRenderer(true));
- setModelBuilder(
+ super.setModelBuilder(
new SectionTableModelBuilder(selectedArticleModel, moveSectionModel));
- addTableActionListener(new TableActionListener() {
+ super.addTableActionListener(new TableActionListener() {
@Override
public void cellSelected(final TableActionEvent event) {
@@ -207,62 +200,64 @@ public class SectionTable extends Table {
public void setSectionModel(
final SectionSelectionModel extends MultiPartArticleSection> selectedSectionModel) {
-
+
Objects.requireNonNull(selectedSectionModel);
this.selectedSectionModel = selectedSectionModel;
}
-
-
- /**
- *
- */
- public class SectionTableCellRenderer extends LockableImpl
+ private class SectionTableCellRenderer
+ extends LockableImpl
implements TableCellRenderer {
- private boolean m_active;
+ private boolean active;
public SectionTableCellRenderer() {
this(false);
}
- public SectionTableCellRenderer(boolean active) {
- m_active = active;
+ public SectionTableCellRenderer(final boolean active) {
+ this.active = active;
}
@Override
- public Component getComponent(Table table, PageState state,
- Object value, boolean isSelected,
- Object key, int row, int column) {
+ public Component getComponent(final Table table,
+ final PageState state,
+ final Object value,
+ final boolean isSelected,
+ final Object key,
+ final int row,
+ final int column) {
- Component ret;
- SecurityManager sm = CMS.getSecurityManager(state);
- ContentItem item = (ContentItem) selectedArticleModel
- .getSelectedObject(
- state);
+ final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
+ final PermissionChecker permissionChecker = cdiUtil
+ .findBean(PermissionChecker.class);
- boolean active = m_active && sm.canAccess(state.getRequest(),
- SecurityManager.EDIT_ITEM,
- item);
+ final ContentItem article = selectedArticleModel.getSelectedObject(
+ state);
+ boolean createLink = active
+ && permissionChecker
+ .isPermitted(ItemPrivileges.EDIT, article);
+
+ final Component ret;
if (value instanceof Label) {
- if (active) {
+ if (createLink) {
ret = new ControlLink((Component) value);
} else {
ret = (Component) value;
}
-
} else if (value instanceof String) {
// Backwards compatibility, should be removed asap!
- if (active) {
+ if (createLink) {
ret = new ControlLink(value.toString());
} else {
- ret = new Label(value.toString());
+ ret = new Text(value.toString());
}
} else {
- ret = new Label(MPArticleGlobalizationUtil.globalize(
- "cms.contenttypes.ui.mparticle.section_table.link_not_defined"),
+ ret = new Label(new GlobalizedMessage(
+ "cms.contenttypes.ui.mparticle.section_table.link_not_defined",
+ CmsConstants.CMS_BUNDLE),
false);
}
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTableModelBuilder.java.todo b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionTableModelBuilder.java
similarity index 97%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTableModelBuilder.java.todo
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionTableModelBuilder.java
index f98843a28..7f1e039b1 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/mparticle/SectionTableModelBuilder.java.todo
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/multipartarticle/SectionTableModelBuilder.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.contenttypes.ui.mparticle;
+package com.arsdigita.cms.ui.authoring.multipartarticle;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewItemForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewItemForm.java
similarity index 99%
rename from ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewItemForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewItemForm.java
index 026da0a76..9e7a9f4d0 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewItemForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewItemForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.ui.authoring;
+package com.arsdigita.cms.ui.authoring.news;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Form;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewItemFormController.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewItemFormController.java
similarity index 98%
rename from ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewItemFormController.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewItemFormController.java
index 978c70fa2..e0f4f684d 100644
--- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewItemFormController.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewItemFormController.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
-package com.arsdigita.cms.ui.authoring;
+package com.arsdigita.cms.ui.authoring.news;
import java.util.Collections;
import java.util.List;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/NewsPropertiesStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsPropertiesStep.java
similarity index 99%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/NewsPropertiesStep.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsPropertiesStep.java
index c84fe2be2..021af1c9c 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/NewsPropertiesStep.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsPropertiesStep.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.news;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/NewsPropertyForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsPropertyForm.java
similarity index 91%
rename from ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/NewsPropertyForm.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsPropertyForm.java
index 19821e3d7..c2b89d33a 100755
--- a/ccm-cms/src/main/java/com/arsdigita/cms/contenttypes/ui/NewsPropertyForm.java
+++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsPropertyForm.java
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-package com.arsdigita.cms.contenttypes.ui;
+package com.arsdigita.cms.ui.authoring.news;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.PageState;
@@ -34,6 +34,7 @@ import com.arsdigita.cms.ItemSelectionModel;
import org.librecms.contenttypes.News;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig;
@@ -107,9 +108,9 @@ public class NewsPropertyForm extends BasicPageForm
final StringParameter selectedLanguageParam) {
super(ID, itemSelectionModel, selectedLanguageParam);
-
+
Objects.requireNonNull(selectedLanguageParam);
-
+
this.propertiesStep = propertiesStep;
this.selectedLanguageParam = selectedLanguageParam;
addSubmissionListener(this);
@@ -175,14 +176,8 @@ public class NewsPropertyForm extends BasicPageForm
releaseDate = item.getReleaseDate();
}
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
releaseDateSelector.addYear(releaseDate);
data.put(NEWS_DATE, releaseDate);
@@ -223,14 +218,8 @@ public class NewsPropertyForm extends BasicPageForm
.getSaveButton()
.isSelected(event.getPageState())) {
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
item.setReleaseDate((java.util.Date) data.get(NEWS_DATE));
item
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/news/NewsTextBody.java
similarity index 79%
rename from ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/NewsTextBody.java
rename to ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/news/NewsTextBody.java
index 868afacb3..1e7eb7c8e 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/news/NewsTextBody.java
@@ -1,4 +1,4 @@
-package com.arsdigita.cms.ui.authoring;
+package com.arsdigita.cms.ui.authoring.news;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
@@ -6,6 +6,9 @@ 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.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
+import com.arsdigita.cms.ui.authoring.TextBody;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.kernel.KernelConfig;
@@ -77,33 +80,22 @@ public class NewsTextBody extends TextBody {
@Override
public String getText(final PageState state) {
-
- final News news = getSelectedNews(state);
-
- final String selectedLanguage = (String) state
- .getValue(selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
- return news.getText().getValue(selectedLocale);
+ final News news = getSelectedNews(state);
+
+ return news
+ .getText()
+ .getValue(SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam));
}
@Override
protected void updateText(final PageState state, final String text) {
final News news = getSelectedNews(state);
- final String selectedLanguage = (String) state.getValue(
- selectedLanguageParam);
- final Locale selectedLocale;
- if (selectedLanguage == null) {
- selectedLocale = KernelConfig.getConfig().getDefaultLocale();
- } else {
- selectedLocale = new Locale(selectedLanguage);
- }
+
+ final Locale selectedLocale = SelectedLanguageUtil
+ .selectedLocale(state, selectedLanguageParam);
news.getText().addValue(selectedLocale, text);
final ContentItemRepository itemRepo = CdiUtil
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java b/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java
index 5101b08e2..9b0fb7efc 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java
@@ -18,8 +18,8 @@
*/
package org.librecms.contenttypes;
-import com.arsdigita.cms.contenttypes.ui.ArticlePropertiesStep;
-import com.arsdigita.cms.ui.authoring.ArticleTextBody;
+import com.arsdigita.cms.ui.authoring.article.ArticlePropertiesStep;
+import com.arsdigita.cms.ui.authoring.article.ArticleTextBody;
import com.arsdigita.cms.ui.authoring.PageCreateForm;
import java.io.Serializable;
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 1459bbc57..d084c8278 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
@@ -18,8 +18,8 @@
*/
package org.librecms.contenttypes;
-import com.arsdigita.cms.contenttypes.ui.EventPropertiesStep;
-import com.arsdigita.cms.ui.authoring.EventTextBody;
+import com.arsdigita.cms.ui.authoring.event.EventPropertiesStep;
+import com.arsdigita.cms.ui.authoring.event.EventTextBody;
import com.arsdigita.cms.ui.contenttypes.EventCreateForm;
import java.io.Serializable;
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java b/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java
index 7e6478399..ac59a52cb 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java
@@ -18,8 +18,9 @@
*/
package org.librecms.contenttypes;
-import com.arsdigita.cms.contenttypes.ui.mparticle.MultiPartArticleCreateForm;
-import com.arsdigita.cms.contenttypes.ui.mparticle.MultiPartArticleEdit;
+import com.arsdigita.cms.ui.authoring.multipartarticle.MultiPartArticleCreateForm;
+import com.arsdigita.cms.ui.authoring.multipartarticle.MultiPartArticleEdit;
+import com.arsdigita.cms.ui.authoring.multipartarticle.MultiPartArticleSectionsStep;
import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString;
@@ -64,6 +65,15 @@ import static org.librecms.CmsConstants.*;
descriptionKey = "cms.contenttypes.shared.basic_properties"
+ ".description",
order = 1)
+ ,
+ @AuthoringStep(
+ component = MultiPartArticleSectionsStep.class,
+ labelBundle = "org.librecms.CmsResources",
+ labelKey = "cms.contenttypes.shared.body_text.title",
+ descriptionBundle
+ = "com.arsdigita.cms.contenttypes.MultiPartArticleResources",
+ descriptionKey = "mparticle.authoring.body_text.description",
+ order = 2)
})
public class MultiPartArticle extends ContentItem implements Serializable {
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/News.java b/ccm-cms/src/main/java/org/librecms/contenttypes/News.java
index 5aba581a9..a9765be2b 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/News.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/News.java
@@ -18,8 +18,8 @@
*/
package org.librecms.contenttypes;
-import com.arsdigita.cms.contenttypes.ui.NewsPropertiesStep;
-import com.arsdigita.cms.ui.authoring.NewsTextBody;
+import com.arsdigita.cms.ui.authoring.news.NewsPropertiesStep;
+import com.arsdigita.cms.ui.authoring.news.NewsTextBody;
import com.arsdigita.cms.ui.contenttypes.NewsCreateForm;
import org.hibernate.envers.Audited;
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties
index 2b67a44e2..b68554ba2 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties
@@ -284,7 +284,7 @@ cms.ui.categories=Categories
cms.ui.new_item=Create new content item
cms.ui.authoring.content_type=Content Type:
#Language
-cms.ui.language.field=Sprache
+cms.ui.language.field=Language
cms.ui.authoring.workflow=Select a workflow
cms.ui.create=Create
cms.contenttypes.ui.summary=Summary
@@ -351,3 +351,29 @@ cms.ui.upload=Upload
cms.ui.authoring.body=Text
cms.ui.article.text=Text
cms.ui.authoring.edit_body_text=Edit text
+cms.contenttypes.ui.mparticle.section_name=Name of section
+mparticle.authoring.body_text.description=Edit the body text in sections
+cms.contenttypes.ui.mparticle.submission_cancelled=Canceled
+cms.contenttypes.ui.mparticle.an_item_with_this_name_already_exists=An item with this name already exists
+cms.contenttypes.ui.mparticle.section_table.link_edit=Edit
+cms.contenttypes.ui.mparticle.section_table.link_delete=Delete
+cms.contenttypes.ui.mparticle.section_table.link_move=Move
+cms.contenttypes.ui.mparticle.section_table.link_move_below=Move below here
+cms.contenttypes.ui.mparticle.section_table.header_section=Section
+cms.contenttypes.ui.mparticle.section_table.header_edit=Edit
+cms.contenttypes.ui.mparticle.section_table.header_move=Move
+cms.contenttypes.ui.mparticle.section_table.header_delete=Delete
+cms.contenttypes.ui.mparticle.section_table.link_not_defined=(No Action available)
+cms.contenttypes.ui.mparticle.section.title=Title of section
+cms.contenttypes.ui.mparticle.section.text=Text
+cms.contenttypes.ui.mparticle.section.create_break=Create page break after this section
+cms.contenttypes.ui.mparticle.no_sections_yet=No sections yet
+cms.contenttypes.ui.mparticle.move_to_beginning=Move to beginning
+cms.contenttypes.ui.mparticle.move_section_name=Name of section
+cms.contenttypes.ui.mparticle.add_section=Add section
+cms.contenttypes.ui.mparticle.edit_section=Edit section
+cms.contenttypes.ui.mparticle.delete_section=Delete section
+cms.contenttypes.ui.mparticle.view_all_sections=View all sections
+cms.contenttypes.ui.mparticle.add_new_section=Add new section
+cms.contenttypes.ui.mparticle.no_launch_date=Launch date is required
+cms.contenttypes.ui.mparticle.an_item_with_name_already_exists=An item with this name already exists
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties
index 994468bee..683880b78 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties
@@ -348,3 +348,29 @@ cms.ui.upload=Hochladen
cms.ui.authoring.body=Text
cms.ui.article.text=Text
cms.ui.authoring.edit_body_text=Text bearbeiten
+cms.contenttypes.ui.mparticle.section_name=Name des Abschnitts
+mparticle.authoring.body_text.description=Bearbeitung des Haupttextes in Abschnitten
+cms.contenttypes.ui.mparticle.submission_cancelled=Abgebrochen
+cms.contenttypes.ui.mparticle.an_item_with_this_name_already_exists=Ein Dokument mit diesem Namen existiert bereits.
+cms.contenttypes.ui.mparticle.section_table.link_edit=Bearbeiten
+cms.contenttypes.ui.mparticle.section_table.link_delete=L\u00f6schen
+cms.contenttypes.ui.mparticle.section_table.link_move=Verschieben
+cms.contenttypes.ui.mparticle.section_table.link_move_below=Hinter diesen Abschnitt verschieben
+cms.contenttypes.ui.mparticle.section_table.header_section=Abschnitt
+cms.contenttypes.ui.mparticle.section_table.header_edit=Bearbeiten
+cms.contenttypes.ui.mparticle.section_table.header_move=Verschieben
+cms.contenttypes.ui.mparticle.section_table.header_delete=L\u00f6schen
+cms.contenttypes.ui.mparticle.section_table.link_not_defined=(Keine Operation verf\u00fcgbar)
+cms.contenttypes.ui.mparticle.section.title=Titel des Abschnitts
+cms.contenttypes.ui.mparticle.section.text=Text
+cms.contenttypes.ui.mparticle.section.create_break=Seitenumbruch nach diesem Abschnitt einf\u00fcgen
+cms.contenttypes.ui.mparticle.no_sections_yet=Keine Abschnitte vorhanden
+cms.contenttypes.ui.mparticle.move_to_beginning=An die erste Position verschieben
+cms.contenttypes.ui.mparticle.move_section_name=Name des Abschnitts
+cms.contenttypes.ui.mparticle.add_section=Abschnitt hinzuf\u00fcgen
+cms.contenttypes.ui.mparticle.edit_section=Abschnitt hinzuf\u00fcgen
+cms.contenttypes.ui.mparticle.delete_section=Abschnitt l\u00f6schen
+cms.contenttypes.ui.mparticle.view_all_sections=Alle Abschnitte ansehen
+cms.contenttypes.ui.mparticle.add_new_section=Neuen Abschnitt hinzuf\u00fcgen
+cms.contenttypes.ui.mparticle.no_launch_date=Es wurde kein Ver\u00f6ffentlichungsdatum angegeben
+cms.contenttypes.ui.mparticle.an_item_with_name_already_exists=Ein Dokument mit diesem Namen existiert bereits.
diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties
index dd8807e92..058e7aef8 100644
--- a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties
+++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties
@@ -240,7 +240,7 @@ cms.ui.categories=Categories
cms.ui.new_item=New item
cms.ui.authoring.content_type=Content Type:
#Language
-cms.ui.language.field=Sprache
+cms.ui.language.field=Language
cms.ui.authoring.workflow=Select a workflow
cms.ui.create=Create
cms.contenttypes.ui.summary=Summary
@@ -307,3 +307,29 @@ cms.ui.upload=Upload
cms.ui.authoring.body=Text
cms.ui.article.text=Text
cms.ui.authoring.edit_body_text=Edit text
+cms.contenttypes.ui.mparticle.section_name=Name of section
+mparticle.authoring.body_text.description=Edit the body text in sections
+cms.contenttypes.ui.mparticle.submission_cancelled=Canceled
+cms.contenttypes.ui.mparticle.an_item_with_this_name_already_exists=An item with this name already exists
+cms.contenttypes.ui.mparticle.section_table.link_edit=Edit
+cms.contenttypes.ui.mparticle.section_table.link_delete=Delete
+cms.contenttypes.ui.mparticle.section_table.link_move=Move
+cms.contenttypes.ui.mparticle.section_table.link_move_below=Move below here
+cms.contenttypes.ui.mparticle.section_table.header_section=Section
+cms.contenttypes.ui.mparticle.section_table.header_edit=Edit
+cms.contenttypes.ui.mparticle.section_table.header_move=Move
+cms.contenttypes.ui.mparticle.section_table.header_delete=Delete
+cms.contenttypes.ui.mparticle.section_table.link_not_defined=(No Action available)
+cms.contenttypes.ui.mparticle.section.title=Title of section
+cms.contenttypes.ui.mparticle.section.text=Text
+cms.contenttypes.ui.mparticle.section.create_break=Create page break after this section
+cms.contenttypes.ui.mparticle.no_sections_yet=No sections yet
+cms.contenttypes.ui.mparticle.move_to_beginning=Move to beginning
+cms.contenttypes.ui.mparticle.move_section_name=Name of section
+cms.contenttypes.ui.mparticle.add_section=Add section
+cms.contenttypes.ui.mparticle.edit_section=Edit section
+cms.contenttypes.ui.mparticle.delete_section=Delete section
+cms.contenttypes.ui.mparticle.view_all_sections=View all sections
+cms.contenttypes.ui.mparticle.add_new_section=Add new section
+cms.contenttypes.ui.mparticle.no_launch_date=Launch date is required
+cms.contenttypes.ui.mparticle.an_item_with_name_already_exists=An item with this name already exists