CCM NG/ccm-cms:
- Cleanup of package structure for authoring steps. All classes for authoring content items are now in com.arsdigita.cms.ui.authoring and its subpackages.
- All parts of the step for managing the sections of a MultiPartArticle have been ported. Everything complies but is not tested yet!
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4871 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
parent
504f1f40e5
commit
ca0f982fe8
|
|
@ -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 <a href="mailto:dturner@arsdigita.com">Dave Turner</a>
|
|
||||||
* @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");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -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 <a href="mailto:dturner@arsdigita.com">Dave Turner</a>
|
|
||||||
* @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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -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<MultiPartArticleSection> 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<MultiPartArticleSection> 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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -44,7 +44,7 @@ import com.arsdigita.cms.CMS;
|
||||||
import org.librecms.contentsection.ContentSection;
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
|
||||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
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.FolderCreateForm;
|
||||||
import com.arsdigita.cms.ui.folder.FolderEditorForm;
|
import com.arsdigita.cms.ui.folder.FolderEditorForm;
|
||||||
import com.arsdigita.cms.ui.folder.FolderManipulator;
|
import com.arsdigita.cms.ui.folder.FolderManipulator;
|
||||||
|
|
|
||||||
|
|
@ -163,14 +163,8 @@ public abstract class BasicPageForm extends BasicItemForm {
|
||||||
final ContentItem item = getItemSelectionModel()
|
final ContentItem item = getItemSelectionModel()
|
||||||
.getSelectedObject(state);
|
.getSelectedObject(state);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
// Preset fields
|
// Preset fields
|
||||||
|
|
@ -244,15 +238,9 @@ public abstract class BasicPageForm extends BasicItemForm {
|
||||||
.getSelectedObject(state);
|
.getSelectedObject(state);
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
// Update attributes
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
item.getName().addValue(selectedLocale, (String) data.get(NAME));
|
item.getName().addValue(selectedLocale, (String) data.get(NAME));
|
||||||
item.getTitle().addValue(selectedLocale, (String) data.get(TITLE));
|
item.getTitle().addValue(selectedLocale, (String) data.get(TITLE));
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -32,6 +32,7 @@ import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
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
|
* Creates a new form to edit the Article object specified by the item
|
||||||
* selection model passed in.
|
* selection model passed in.
|
||||||
*
|
*
|
||||||
* @param itemModel The ItemSelectionModel to use to obtain the Article to
|
* @param itemModel The ItemSelectionModel to use to obtain the
|
||||||
* work on
|
* Article to work on
|
||||||
* @param selectedLanguageParam
|
* @param selectedLanguageParam
|
||||||
*/
|
*/
|
||||||
public ArticlePropertyForm(final ItemSelectionModel itemModel,
|
public ArticlePropertyForm(final ItemSelectionModel itemModel,
|
||||||
|
|
@ -73,9 +74,10 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
|
||||||
* Creates a new form to edit the Article object specified by the item
|
* Creates a new form to edit the Article object specified by the item
|
||||||
* selection model passed in.
|
* selection model passed in.
|
||||||
*
|
*
|
||||||
* @param itemModel The ItemSelectionModel to use to obtain the Article
|
* @param itemModel The ItemSelectionModel to use to obtain the
|
||||||
* to work on
|
* Article to work on
|
||||||
* @param propertiesStep The ArticlePropertiesStep which controls this form.
|
* @param propertiesStep The ArticlePropertiesStep which controls
|
||||||
|
* this form.
|
||||||
* @param selectedLanguageParam
|
* @param selectedLanguageParam
|
||||||
*/
|
*/
|
||||||
public ArticlePropertyForm(
|
public ArticlePropertyForm(
|
||||||
|
|
@ -137,14 +139,8 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final Article article = (Article) super.initBasicWidgets(event);
|
final Article article = (Article) super.initBasicWidgets(event);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
data.put(LEAD, article.getDescription().getValue(selectedLocale));
|
data.put(LEAD, article.getDescription().getValue(selectedLocale));
|
||||||
}
|
}
|
||||||
|
|
@ -177,14 +173,8 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
|
||||||
&& getSaveCancelSection().getSaveButton()
|
&& getSaveCancelSection().getSaveButton()
|
||||||
.isSelected(event.getPageState())) {
|
.isSelected(event.getPageState())) {
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
article
|
article
|
||||||
.getDescription()
|
.getDescription()
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.PageState;
|
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.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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;
|
import org.librecms.contenttypes.Article;
|
||||||
|
|
||||||
|
|
@ -113,16 +116,12 @@ public class ArticleTextBody extends TextBody {
|
||||||
final String text) {
|
final String text) {
|
||||||
|
|
||||||
final Article article = getSelectedArticle(state);
|
final Article article = getSelectedArticle(state);
|
||||||
final String selectedLanguage = (String) state.getValue(
|
|
||||||
selectedLanguageParam);
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
final Locale selectedLocale;
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
article.getText().addValue(selectedLocale, text);
|
article.getText().addValue(selectedLocale, text);
|
||||||
|
|
||||||
final ContentItemRepository itemRepo = CdiUtil
|
final ContentItemRepository itemRepo = CdiUtil
|
||||||
.createCdiUtil()
|
.createCdiUtil()
|
||||||
.findBean(ContentItemRepository.class);
|
.findBean(ContentItemRepository.class);
|
||||||
|
|
@ -151,14 +150,8 @@ public class ArticleTextBody extends TextBody {
|
||||||
|
|
||||||
final Article article = getSelectedArticle(state);
|
final Article article = getSelectedArticle(state);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return article.getText().getValue(selectedLocale);
|
return article.getText().getValue(selectedLocale);
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
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.CMSDHTMLEditor;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
|
|
@ -433,14 +434,8 @@ public class EventPropertyForm
|
||||||
}
|
}
|
||||||
endDateField.addYear(endDate);
|
endDateField.addYear(endDate);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
data.put(LEAD, item.getDescription().getValue(selectedLocale));
|
data.put(LEAD, item.getDescription().getValue(selectedLocale));
|
||||||
data.put(START_DATE, startDate);
|
data.put(START_DATE, startDate);
|
||||||
|
|
@ -507,14 +502,8 @@ public class EventPropertyForm
|
||||||
if (item != null
|
if (item != null
|
||||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
final java.util.Date startDate = (java.util.Date) data
|
final java.util.Date startDate = (java.util.Date) data
|
||||||
.get(START_DATE);
|
.get(START_DATE);
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.PageState;
|
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.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
|
|
@ -86,14 +89,8 @@ public class EventTextBody extends TextBody {
|
||||||
|
|
||||||
final Event event = getSelectedEvent(state);
|
final Event event = getSelectedEvent(state);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return event.getText().getValue(selectedLocale);
|
return event.getText().getValue(selectedLocale);
|
||||||
|
|
||||||
|
|
@ -103,14 +100,9 @@ public class EventTextBody extends TextBody {
|
||||||
protected void updateText(final PageState state, final String text) {
|
protected void updateText(final PageState state, final String text) {
|
||||||
|
|
||||||
final Event event = getSelectedEvent(state);
|
final Event event = getSelectedEvent(state);
|
||||||
final String selectedLanguage = (String) state.getValue(
|
|
||||||
selectedLanguageParam);
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
final Locale selectedLocale;
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getText().addValue(selectedLocale, text);
|
event.getText().addValue(selectedLocale, text);
|
||||||
final ContentItemRepository itemRepo = CdiUtil
|
final ContentItemRepository itemRepo = CdiUtil
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.ColumnPanel;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -28,13 +28,12 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import org.librecms.contentsection.Folder;
|
import org.librecms.contentsection.Folder;
|
||||||
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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 org.librecms.contenttypes.MultiPartArticle;
|
||||||
|
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
|
|
@ -108,7 +107,6 @@ public class MultiPartArticleEditForm extends MultiPartArticleForm
|
||||||
|
|
||||||
// final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
|
// final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
|
||||||
// .getSelectedObject(state);
|
// .getSelectedObject(state);
|
||||||
|
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final ContentItemRepository itemRepo = cdiUtil
|
final ContentItemRepository itemRepo = cdiUtil
|
||||||
.findBean(ContentItemRepository.class);
|
.findBean(ContentItemRepository.class);
|
||||||
|
|
@ -127,14 +125,8 @@ public class MultiPartArticleEditForm extends MultiPartArticleForm
|
||||||
final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
|
final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
|
||||||
.getSelectedObject(state);
|
.getSelectedObject(state);
|
||||||
|
|
||||||
final Locale selectedLocale;
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
final String selectedLanguage = (String) state
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
.getValue(selectedLanguageParam);
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String newName = (String) data.get(MultiPartArticleForm.NAME);
|
final String newName = (String) data.get(MultiPartArticleForm.NAME);
|
||||||
final String oldName = article.getName().getValue(selectedLocale);
|
final String oldName = article.getName().getValue(selectedLocale);
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.ColumnPanel;
|
||||||
import com.arsdigita.bebop.Embedded;
|
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.TrimmedStringParameter;
|
||||||
import com.arsdigita.bebop.parameters.URLTokenValidationListener;
|
import com.arsdigita.bebop.parameters.URLTokenValidationListener;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.arsdigita.cms.CMSConfig;
|
import org.arsdigita.cms.CMSConfig;
|
||||||
|
|
@ -138,13 +136,13 @@ public abstract class MultiPartArticleForm
|
||||||
titleWidget.setLabel(new GlobalizedMessage("cms.contenttypes.ui.title",
|
titleWidget.setLabel(new GlobalizedMessage("cms.contenttypes.ui.title",
|
||||||
CmsConstants.CMS_BUNDLE));
|
CmsConstants.CMS_BUNDLE));
|
||||||
titleWidget.addValidationListener(new NotNullValidationListener());
|
titleWidget.addValidationListener(new NotNullValidationListener());
|
||||||
titleWidget.setOnFocus("if (this.form." + NAME + ".value == '') { "
|
titleWidget.setOnFocus(String.format(
|
||||||
+ " defaulting = true; this.form." + NAME
|
"if (this.form.%s.value == '') { "
|
||||||
+ ".value = urlize(this.value); }");
|
+ " defaulting = true; this.form.%s.value = urlize(this.value); }",
|
||||||
titleWidget.setOnKeyUp(
|
NAME, NAME));
|
||||||
"if (defaulting) { this.form." + NAME
|
titleWidget.setOnKeyUp(String.format(
|
||||||
+ ".value = urlize(this.value) }"
|
"if (defaulting) { this.form.%s.value = urlize(this.value) }",
|
||||||
);
|
NAME));
|
||||||
add(titleWidget);
|
add(titleWidget);
|
||||||
|
|
||||||
//add(new Label(GlobalizationUtil
|
//add(new Label(GlobalizationUtil
|
||||||
|
|
@ -156,11 +154,11 @@ public abstract class MultiPartArticleForm
|
||||||
nameWidget.addValidationListener(new NotNullValidationListener());
|
nameWidget.addValidationListener(new NotNullValidationListener());
|
||||||
nameWidget.addValidationListener(new URLTokenValidationListener());
|
nameWidget.addValidationListener(new URLTokenValidationListener());
|
||||||
nameWidget.setOnFocus("defaulting = false");
|
nameWidget.setOnFocus("defaulting = false");
|
||||||
nameWidget.setOnBlur(
|
nameWidget.setOnBlur(String.format(
|
||||||
"if (this.value == '') "
|
"if (this.value == '') { "
|
||||||
+ "{ defaulting = true; this.value = urlize(this.form." + TITLE
|
+ "defaulting = true; this.value = urlize(this.form.%s.value) "
|
||||||
+ ".value) }"
|
+ "}",
|
||||||
);
|
TITLE));
|
||||||
add(nameWidget);
|
add(nameWidget);
|
||||||
|
|
||||||
if (!CMSConfig.getConfig().isHideLaunchDate()) {
|
if (!CMSConfig.getConfig().isHideLaunchDate()) {
|
||||||
|
|
@ -233,14 +231,8 @@ public abstract class MultiPartArticleForm
|
||||||
final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
|
final MultiPartArticle article = (MultiPartArticle) itemSelectionModel
|
||||||
.getSelectedObject(state);
|
.getSelectedObject(state);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
data.put(NAME, article.getName().getValue(selectedLocale));
|
data.put(NAME, article.getName().getValue(selectedLocale));
|
||||||
|
|
@ -269,14 +261,8 @@ public abstract class MultiPartArticleForm
|
||||||
.getSelectedObject(state);
|
.getSelectedObject(state);
|
||||||
|
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
article.getName().addValue(selectedLocale,
|
article.getName().addValue(selectedLocale,
|
||||||
(String) data.get(NAME));
|
(String) data.get(NAME));
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.ContentItem;
|
||||||
import org.librecms.contentsection.ContentItemManager;
|
import org.librecms.contentsection.ContentItemManager;
|
||||||
|
|
@ -16,8 +16,9 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.contentsection.ContentItemRepository;
|
||||||
import org.librecms.contenttypes.MultiPartArticle;
|
import org.librecms.contenttypes.MultiPartArticle;
|
||||||
import org.librecms.contenttypes.MultiPartArticleSection;
|
import org.librecms.contenttypes.MultiPartArticleSection;
|
||||||
|
|
@ -35,7 +36,7 @@ import javax.transaction.Transactional;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class MultiPartArticleSectionStepController {
|
class MultiPartArticleSectionStepController {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemRepository itemRepo;
|
private ContentItemRepository itemRepo;
|
||||||
|
|
@ -47,7 +48,7 @@ public class MultiPartArticleSectionStepController {
|
||||||
private MultiPartArticleSectionManager sectionManager;
|
private MultiPartArticleSectionManager sectionManager;
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public List<MultiPartArticleSection> retrieveSections(
|
protected List<MultiPartArticleSection> retrieveSections(
|
||||||
final MultiPartArticle forArticle) {
|
final MultiPartArticle forArticle) {
|
||||||
|
|
||||||
final MultiPartArticle article = itemRepo
|
final MultiPartArticle article = itemRepo
|
||||||
|
|
@ -61,7 +62,24 @@ public class MultiPartArticleSectionStepController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public void moveToFirst(final MultiPartArticle article,
|
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 MultiPartArticleSection section) {
|
||||||
|
|
||||||
final MultiPartArticle theArticle = itemRepo
|
final MultiPartArticle theArticle = itemRepo
|
||||||
|
|
@ -77,7 +95,28 @@ public class MultiPartArticleSectionStepController {
|
||||||
"No MultiPartArticleSection with ID %d in the database.",
|
"No MultiPartArticleSection with ID %d in the database.",
|
||||||
section.getSectionId())));
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.ActionLink;
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
|
|
@ -25,21 +25,16 @@ import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SingleSelectionModel;
|
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.TableActionEvent;
|
||||||
import com.arsdigita.bebop.event.TableActionListener;
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
import com.arsdigita.bebop.parameters.LongParameter;
|
import com.arsdigita.bebop.parameters.LongParameter;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.bebop.table.TableColumn;
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.ui.ResettableContainer;
|
import com.arsdigita.cms.ui.authoring.ResettableContainer;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.PermissionChecker;
|
import org.libreccm.security.PermissionChecker;
|
||||||
|
|
@ -149,7 +144,7 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
|
||||||
final Label emptyView = new Label(new GlobalizedMessage(
|
final Label emptyView = new Label(new GlobalizedMessage(
|
||||||
"cms.contenttypes.ui.mparticle.no_sections_yet",
|
"cms.contenttypes.ui.mparticle.no_sections_yet",
|
||||||
CmsConstants.CMS_BUNDLE));
|
CmsConstants.CMS_BUNDLE));
|
||||||
sectionTable.setEmptyView(this);
|
sectionTable.setEmptyView(emptyView);
|
||||||
|
|
||||||
moveSectionLabel = new Label(new GlobalizedMessage(
|
moveSectionLabel = new Label(new GlobalizedMessage(
|
||||||
"cms.contenttypes.ui.mparticle.section.title",
|
"cms.contenttypes.ui.mparticle.section.title",
|
||||||
|
|
@ -185,14 +180,10 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
|
||||||
} else {
|
} else {
|
||||||
beginLink.setVisible(state, true);
|
beginLink.setVisible(state, true);
|
||||||
moveSectionLabel.setVisible(state, true);
|
moveSectionLabel.setVisible(state, true);
|
||||||
final String selectedLanguage = (String) state
|
|
||||||
.getValue(selectedLanguageParam);
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
final Locale selectedLocale;
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
final Object[] parameterObj = {
|
final Object[] parameterObj = {
|
||||||
moveSectionModel
|
moveSectionModel
|
||||||
.getSelectedSection(state)
|
.getSelectedSection(state)
|
||||||
|
|
@ -297,7 +288,8 @@ public class MultiPartArticleSectionsStep extends ResettableContainer {
|
||||||
"cms.contenttypes.ui.mparticle.delete_section",
|
"cms.contenttypes.ui.mparticle.delete_section",
|
||||||
CmsConstants.CMS_BUNDLE)));
|
CmsConstants.CMS_BUNDLE)));
|
||||||
sectionDeleteForm = new SectionDeleteForm(selectedArticleModel,
|
sectionDeleteForm = new SectionDeleteForm(selectedArticleModel,
|
||||||
selectedSectionModel);
|
selectedSectionModel,
|
||||||
|
selectedLanguageParam);
|
||||||
sectionDeleteForm.addSubmissionListener(event -> {
|
sectionDeleteForm.addSubmissionListener(event -> {
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
@ -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 <a href="mailto:dturner@arsdigita.com">Dave Turner</a>
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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 <a href="mailto:dturner@arsdigita.com">Dave Turner</a>
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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;
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.PageState;
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
|
@ -16,40 +16,36 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.ControlLink;
|
import com.arsdigita.bebop.ControlLink;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.Table;
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.Text;
|
||||||
import com.arsdigita.bebop.event.TableActionEvent;
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
import com.arsdigita.bebop.event.TableActionListener;
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
import com.arsdigita.bebop.table.TableCellRenderer;
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
import com.arsdigita.bebop.table.TableColumn;
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.bebop.table.TableColumnModel;
|
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 org.librecms.contentsection.ContentItem;
|
||||||
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
import org.librecms.contenttypes.MultiPartArticleSection;
|
|
||||||
import org.librecms.contenttypes.MultiPartArticle;
|
import org.librecms.contenttypes.MultiPartArticle;
|
||||||
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
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.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.PermissionChecker;
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
|
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||||
import org.librecms.contenttypes.MultiPartArticleSection;
|
import org.librecms.contenttypes.MultiPartArticleSection;
|
||||||
import org.librecms.contenttypes.MultiPartArticleSectionRepository;
|
import org.librecms.contenttypes.MultiPartArticleSectionRepository;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,9 +57,6 @@ import java.util.Objects;
|
||||||
*/
|
*/
|
||||||
public class SectionTable extends Table {
|
public class SectionTable extends Table {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager
|
|
||||||
.getLogger(SectionTable.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index of the title column
|
* Index of the title column
|
||||||
*/
|
*/
|
||||||
|
|
@ -127,10 +120,10 @@ public class SectionTable extends Table {
|
||||||
model.get(2).setCellRenderer(new SectionTableCellRenderer(true));
|
model.get(2).setCellRenderer(new SectionTableCellRenderer(true));
|
||||||
model.get(3).setCellRenderer(new SectionTableCellRenderer(true));
|
model.get(3).setCellRenderer(new SectionTableCellRenderer(true));
|
||||||
|
|
||||||
setModelBuilder(
|
super.setModelBuilder(
|
||||||
new SectionTableModelBuilder(selectedArticleModel, moveSectionModel));
|
new SectionTableModelBuilder(selectedArticleModel, moveSectionModel));
|
||||||
|
|
||||||
addTableActionListener(new TableActionListener() {
|
super.addTableActionListener(new TableActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cellSelected(final TableActionEvent event) {
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
|
@ -213,56 +206,58 @@ public class SectionTable extends Table {
|
||||||
this.selectedSectionModel = selectedSectionModel;
|
this.selectedSectionModel = selectedSectionModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SectionTableCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SectionTableCellRenderer extends LockableImpl
|
|
||||||
implements TableCellRenderer {
|
implements TableCellRenderer {
|
||||||
|
|
||||||
private boolean m_active;
|
private boolean active;
|
||||||
|
|
||||||
public SectionTableCellRenderer() {
|
public SectionTableCellRenderer() {
|
||||||
this(false);
|
this(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SectionTableCellRenderer(boolean active) {
|
public SectionTableCellRenderer(final boolean active) {
|
||||||
m_active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getComponent(Table table, PageState state,
|
public Component getComponent(final Table table,
|
||||||
Object value, boolean isSelected,
|
final PageState state,
|
||||||
Object key, int row, int column) {
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
|
||||||
Component ret;
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
SecurityManager sm = CMS.getSecurityManager(state);
|
final PermissionChecker permissionChecker = cdiUtil
|
||||||
ContentItem item = (ContentItem) selectedArticleModel
|
.findBean(PermissionChecker.class);
|
||||||
.getSelectedObject(
|
|
||||||
|
final ContentItem article = selectedArticleModel.getSelectedObject(
|
||||||
state);
|
state);
|
||||||
|
|
||||||
boolean active = m_active && sm.canAccess(state.getRequest(),
|
boolean createLink = active
|
||||||
SecurityManager.EDIT_ITEM,
|
&& permissionChecker
|
||||||
item);
|
.isPermitted(ItemPrivileges.EDIT, article);
|
||||||
|
|
||||||
|
final Component ret;
|
||||||
if (value instanceof Label) {
|
if (value instanceof Label) {
|
||||||
if (active) {
|
if (createLink) {
|
||||||
ret = new ControlLink((Component) value);
|
ret = new ControlLink((Component) value);
|
||||||
} else {
|
} else {
|
||||||
ret = (Component) value;
|
ret = (Component) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
// Backwards compatibility, should be removed asap!
|
// Backwards compatibility, should be removed asap!
|
||||||
if (active) {
|
if (createLink) {
|
||||||
ret = new ControlLink(value.toString());
|
ret = new ControlLink(value.toString());
|
||||||
} else {
|
} else {
|
||||||
ret = new Label(value.toString());
|
ret = new Text(value.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = new Label(MPArticleGlobalizationUtil.globalize(
|
ret = new Label(new GlobalizedMessage(
|
||||||
"cms.contenttypes.ui.mparticle.section_table.link_not_defined"),
|
"cms.contenttypes.ui.mparticle.section_table.link_not_defined",
|
||||||
|
CmsConstants.CMS_BUNDLE),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* 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.PageState;
|
||||||
import com.arsdigita.bebop.Table;
|
import com.arsdigita.bebop.Table;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.BoxPanel;
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.authoring;
|
package com.arsdigita.cms.ui.authoring.news;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.Component;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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.FormData;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
@ -34,6 +34,7 @@ import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import org.librecms.contenttypes.News;
|
import org.librecms.contenttypes.News;
|
||||||
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SelectedLanguageUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
|
|
@ -175,14 +176,8 @@ public class NewsPropertyForm extends BasicPageForm
|
||||||
releaseDate = item.getReleaseDate();
|
releaseDate = item.getReleaseDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
releaseDateSelector.addYear(releaseDate);
|
releaseDateSelector.addYear(releaseDate);
|
||||||
data.put(NEWS_DATE, releaseDate);
|
data.put(NEWS_DATE, releaseDate);
|
||||||
|
|
@ -223,14 +218,8 @@ public class NewsPropertyForm extends BasicPageForm
|
||||||
.getSaveButton()
|
.getSaveButton()
|
||||||
.isSelected(event.getPageState())) {
|
.isSelected(event.getPageState())) {
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
.getValue(selectedLanguageParam);
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
final Locale selectedLocale;
|
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
item.setReleaseDate((java.util.Date) data.get(NEWS_DATE));
|
item.setReleaseDate((java.util.Date) data.get(NEWS_DATE));
|
||||||
item
|
item
|
||||||
|
|
@ -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.Component;
|
||||||
import com.arsdigita.bebop.PageState;
|
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.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
|
|
@ -80,30 +83,19 @@ public class NewsTextBody extends TextBody {
|
||||||
|
|
||||||
final News news = getSelectedNews(state);
|
final News news = getSelectedNews(state);
|
||||||
|
|
||||||
final String selectedLanguage = (String) state
|
return news
|
||||||
.getValue(selectedLanguageParam);
|
.getText()
|
||||||
final Locale selectedLocale;
|
.getValue(SelectedLanguageUtil
|
||||||
if (selectedLanguage == null) {
|
.selectedLocale(state, selectedLanguageParam));
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return news.getText().getValue(selectedLocale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateText(final PageState state, final String text) {
|
protected void updateText(final PageState state, final String text) {
|
||||||
|
|
||||||
final News news = getSelectedNews(state);
|
final News news = getSelectedNews(state);
|
||||||
final String selectedLanguage = (String) state.getValue(
|
|
||||||
selectedLanguageParam);
|
final Locale selectedLocale = SelectedLanguageUtil
|
||||||
final Locale selectedLocale;
|
.selectedLocale(state, selectedLanguageParam);
|
||||||
if (selectedLanguage == null) {
|
|
||||||
selectedLocale = KernelConfig.getConfig().getDefaultLocale();
|
|
||||||
} else {
|
|
||||||
selectedLocale = new Locale(selectedLanguage);
|
|
||||||
}
|
|
||||||
|
|
||||||
news.getText().addValue(selectedLocale, text);
|
news.getText().addValue(selectedLocale, text);
|
||||||
final ContentItemRepository itemRepo = CdiUtil
|
final ContentItemRepository itemRepo = CdiUtil
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.contenttypes;
|
package org.librecms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.ui.ArticlePropertiesStep;
|
import com.arsdigita.cms.ui.authoring.article.ArticlePropertiesStep;
|
||||||
import com.arsdigita.cms.ui.authoring.ArticleTextBody;
|
import com.arsdigita.cms.ui.authoring.article.ArticleTextBody;
|
||||||
import com.arsdigita.cms.ui.authoring.PageCreateForm;
|
import com.arsdigita.cms.ui.authoring.PageCreateForm;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.contenttypes;
|
package org.librecms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.ui.EventPropertiesStep;
|
import com.arsdigita.cms.ui.authoring.event.EventPropertiesStep;
|
||||||
import com.arsdigita.cms.ui.authoring.EventTextBody;
|
import com.arsdigita.cms.ui.authoring.event.EventTextBody;
|
||||||
import com.arsdigita.cms.ui.contenttypes.EventCreateForm;
|
import com.arsdigita.cms.ui.contenttypes.EventCreateForm;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.contenttypes;
|
package org.librecms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.ui.mparticle.MultiPartArticleCreateForm;
|
import com.arsdigita.cms.ui.authoring.multipartarticle.MultiPartArticleCreateForm;
|
||||||
import com.arsdigita.cms.contenttypes.ui.mparticle.MultiPartArticleEdit;
|
import com.arsdigita.cms.ui.authoring.multipartarticle.MultiPartArticleEdit;
|
||||||
|
import com.arsdigita.cms.ui.authoring.multipartarticle.MultiPartArticleSectionsStep;
|
||||||
|
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
@ -64,6 +65,15 @@ import static org.librecms.CmsConstants.*;
|
||||||
descriptionKey = "cms.contenttypes.shared.basic_properties"
|
descriptionKey = "cms.contenttypes.shared.basic_properties"
|
||||||
+ ".description",
|
+ ".description",
|
||||||
order = 1)
|
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 {
|
public class MultiPartArticle extends ContentItem implements Serializable {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.contenttypes;
|
package org.librecms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.ui.NewsPropertiesStep;
|
import com.arsdigita.cms.ui.authoring.news.NewsPropertiesStep;
|
||||||
import com.arsdigita.cms.ui.authoring.NewsTextBody;
|
import com.arsdigita.cms.ui.authoring.news.NewsTextBody;
|
||||||
import com.arsdigita.cms.ui.contenttypes.NewsCreateForm;
|
import com.arsdigita.cms.ui.contenttypes.NewsCreateForm;
|
||||||
|
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ cms.ui.categories=Categories
|
||||||
cms.ui.new_item=Create new content item
|
cms.ui.new_item=Create new content item
|
||||||
cms.ui.authoring.content_type=Content Type:
|
cms.ui.authoring.content_type=Content Type:
|
||||||
#Language
|
#Language
|
||||||
cms.ui.language.field=Sprache
|
cms.ui.language.field=Language
|
||||||
cms.ui.authoring.workflow=Select a workflow
|
cms.ui.authoring.workflow=Select a workflow
|
||||||
cms.ui.create=Create
|
cms.ui.create=Create
|
||||||
cms.contenttypes.ui.summary=Summary
|
cms.contenttypes.ui.summary=Summary
|
||||||
|
|
@ -351,3 +351,29 @@ cms.ui.upload=Upload
|
||||||
cms.ui.authoring.body=Text
|
cms.ui.authoring.body=Text
|
||||||
cms.ui.article.text=Text
|
cms.ui.article.text=Text
|
||||||
cms.ui.authoring.edit_body_text=Edit 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
|
||||||
|
|
|
||||||
|
|
@ -348,3 +348,29 @@ cms.ui.upload=Hochladen
|
||||||
cms.ui.authoring.body=Text
|
cms.ui.authoring.body=Text
|
||||||
cms.ui.article.text=Text
|
cms.ui.article.text=Text
|
||||||
cms.ui.authoring.edit_body_text=Text bearbeiten
|
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.
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ cms.ui.categories=Categories
|
||||||
cms.ui.new_item=New item
|
cms.ui.new_item=New item
|
||||||
cms.ui.authoring.content_type=Content Type:
|
cms.ui.authoring.content_type=Content Type:
|
||||||
#Language
|
#Language
|
||||||
cms.ui.language.field=Sprache
|
cms.ui.language.field=Language
|
||||||
cms.ui.authoring.workflow=Select a workflow
|
cms.ui.authoring.workflow=Select a workflow
|
||||||
cms.ui.create=Create
|
cms.ui.create=Create
|
||||||
cms.contenttypes.ui.summary=Summary
|
cms.contenttypes.ui.summary=Summary
|
||||||
|
|
@ -307,3 +307,29 @@ cms.ui.upload=Upload
|
||||||
cms.ui.authoring.body=Text
|
cms.ui.authoring.body=Text
|
||||||
cms.ui.article.text=Text
|
cms.ui.article.text=Text
|
||||||
cms.ui.authoring.edit_body_text=Edit 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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue