- Inlinesite springt jetzt nach dem Anlegen des Items direkt zum bearbeiten der BasicProperties
- Insitesite leitet jetzt zum nächsten Schritt weiter git-svn-id: https://svn.libreccm.org/ccm/trunk@2201 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
20f5c173c7
commit
a97ec7426b
|
|
@ -1,24 +1,26 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
|
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
|
||||||
|
|
||||||
<ctd:content-type label="Inline Site"
|
<ctd:content-type label="Inline Site"
|
||||||
description="Inline view of external site"
|
description="Inline view of external site"
|
||||||
objectType="com.arsdigita.cms.contenttypes.InlineSite"
|
objectType="com.arsdigita.cms.contenttypes.InlineSite"
|
||||||
classname="com.arsdigita.cms.contenttypes.InlineSite">
|
classname="com.arsdigita.cms.contenttypes.InlineSite">
|
||||||
|
|
||||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||||
|
|
||||||
<ctd:authoring-step label="Edit Basic Properties"
|
<ctd:authoring-step label="Edit Basic Properties"
|
||||||
description="Edit basic properties"
|
description="Edit basic properties"
|
||||||
component="com.arsdigita.cms.contenttypes.ui.InlineSitePropertiesStep"
|
component="com.arsdigita.cms.contenttypes.ui.InlineSitePropertiesStep"
|
||||||
ordering="1"/>
|
ordering="1"/>
|
||||||
|
|
||||||
<ctd:authoring-step label="Assign categories"
|
<ctd:authoring-step label="Assign categories"
|
||||||
description="Assign categories"
|
description="Assign categories"
|
||||||
component="com.arsdigita.cms.ui.authoring.ItemCategoryStep"
|
component="com.arsdigita.cms.ui.authoring.ItemCategoryStep"
|
||||||
ordering="2"/>
|
ordering="2"/>
|
||||||
|
|
||||||
</ctd:authoring-kit>
|
</ctd:authoring-kit>
|
||||||
</ctd:content-type>
|
</ctd:content-type>
|
||||||
</ctd:content-types>
|
</ctd:content-types>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,78 +35,73 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.domain.DomainObject;
|
import com.arsdigita.domain.DomainObject;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authoring step to edit the simple attributes of the InlineSite content
|
* Authoring step to edit the simple attributes of the InlineSite content type (and its subclasses).
|
||||||
* type (and its subclasses).
|
|
||||||
*/
|
*/
|
||||||
public class InlineSitePropertiesStep
|
public class InlineSitePropertiesStep extends SimpleEditStep {
|
||||||
extends SimpleEditStep {
|
|
||||||
|
|
||||||
/** The name of the editing sheet added to this step */
|
/**
|
||||||
|
* The name of the editing sheet added to this step
|
||||||
|
*/
|
||||||
public static final String EDIT_SHEET_NAME = "edit";
|
public static final String EDIT_SHEET_NAME = "edit";
|
||||||
|
|
||||||
public InlineSitePropertiesStep( ItemSelectionModel itemModel,
|
public InlineSitePropertiesStep(final ItemSelectionModel itemModel,
|
||||||
AuthoringKitWizard parent ) {
|
final AuthoringKitWizard parent) {
|
||||||
super( itemModel, parent );
|
super(itemModel, parent);
|
||||||
|
|
||||||
BasicPageForm editSheet;
|
final BasicPageForm editSheet = new InlineSitePropertyForm(itemModel, this);
|
||||||
|
add(EDIT_SHEET_NAME, "Edit",
|
||||||
|
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||||
|
editSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||||
|
|
||||||
editSheet = new InlineSitePropertyForm( itemModel );
|
setDisplayComponent(getInlineSitePropertySheet(itemModel));
|
||||||
add( EDIT_SHEET_NAME, "Edit",
|
|
||||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
|
||||||
editSheet.getSaveCancelSection().getCancelButton() );
|
|
||||||
|
|
||||||
setDisplayComponent( getInlineSitePropertySheet( itemModel ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a component that displays the properties of the
|
* Returns a component that displays the properties of the InlineSite specified by the ItemSelectionModel passed in.
|
||||||
* InlineSite specified by the ItemSelectionModel passed in.
|
*
|
||||||
* @param itemModel The ItemSelectionModel to use
|
* @param itemModel The ItemSelectionModel to use
|
||||||
* @pre itemModel != null
|
* @pre itemModel != null
|
||||||
* @return A component to display the state of the basic properties
|
* @return A component to display the state of the basic properties of the release
|
||||||
* of the release
|
|
||||||
*/
|
*/
|
||||||
public static Component getInlineSitePropertySheet( ItemSelectionModel
|
public static Component getInlineSitePropertySheet(final ItemSelectionModel itemModel) {
|
||||||
itemModel ) {
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
|
|
||||||
|
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
||||||
InlineSite.TITLE);
|
InlineSite.TITLE);
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||||
InlineSite.NAME );
|
InlineSite.NAME);
|
||||||
|
|
||||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||||
sheet.add(GlobalizationUtil
|
sheet.add(GlobalizationUtil
|
||||||
.globalize("cms.contenttypes.ui.launch_date"),
|
.globalize("cms.contenttypes.ui.launch_date"),
|
||||||
ContentPage.LAUNCH_DATE,
|
ContentPage.LAUNCH_DATE,
|
||||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||||
|
@Override
|
||||||
@Override
|
public String format(final DomainObject item,
|
||||||
public String format(DomainObject item,
|
final String attribute,
|
||||||
String attribute,
|
final PageState state) {
|
||||||
PageState state) {
|
ContentPage page = (ContentPage) item;
|
||||||
ContentPage page = (ContentPage) item;
|
if (page.getLaunchDate() != null) {
|
||||||
if (page.getLaunchDate() != null) {
|
return DateFormat
|
||||||
return DateFormat
|
.getDateInstance(DateFormat.LONG)
|
||||||
.getDateInstance(DateFormat.LONG)
|
.format(page.getLaunchDate());
|
||||||
.format(page.getLaunchDate());
|
} else {
|
||||||
} else {
|
return (String) GlobalizationUtil
|
||||||
return (String) GlobalizationUtil
|
.globalize("cms.ui.unknown")
|
||||||
.globalize("cms.ui.unknown")
|
.localize();
|
||||||
.localize();
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
|
|
||||||
InlineSite.DESCRIPTION);
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
|
||||||
sheet.add( InlineSiteGlobalizationUtil
|
InlineSite.DESCRIPTION);
|
||||||
.globalize("cms.contenttypes.ui.inlinesite.url"),
|
sheet.add(InlineSiteGlobalizationUtil
|
||||||
InlineSite.URL );
|
.globalize("cms.contenttypes.ui.inlinesite.url"),
|
||||||
|
InlineSite.URL);
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,44 +19,48 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.InlineSite;
|
import com.arsdigita.cms.contenttypes.InlineSite;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form to edit the basic properties of an InlineSite. This form can be
|
* Form to edit the basic properties of an InlineSite. This form can be extended to create forms for InlineSite
|
||||||
* extended to create forms for InlineSite subclasses.
|
* subclasses.
|
||||||
*/
|
*/
|
||||||
public class InlineSitePropertyForm extends BasicPageForm
|
public class InlineSitePropertyForm extends BasicPageForm
|
||||||
implements FormProcessListener, FormInitListener {
|
implements FormProcessListener, FormInitListener {
|
||||||
|
|
||||||
private TextField m_url;
|
private TextField m_url;
|
||||||
private TextArea m_description;
|
private TextArea m_description;
|
||||||
|
private InlineSitePropertiesStep m_step;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new form to edit the InlineSite object specified
|
* Creates a new form to edit the InlineSite object specified by the item selection model passed in.
|
||||||
* by the item selection model passed in.
|
*
|
||||||
* @param itemModel The ItemSelectionModel to use to obtain the
|
* @param itemModel The ItemSelectionModel to use to obtain the InlineSite to work on
|
||||||
* InlineSite to work on
|
|
||||||
*/
|
*/
|
||||||
public InlineSitePropertyForm(ItemSelectionModel itemModel) {
|
public InlineSitePropertyForm(final ItemSelectionModel itemModel) {
|
||||||
|
this(itemModel, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InlineSitePropertyForm(final ItemSelectionModel itemModel, final InlineSitePropertiesStep step) {
|
||||||
super("inlineSiteEdit", itemModel);
|
super("inlineSiteEdit", itemModel);
|
||||||
|
m_step = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -64,50 +68,56 @@ public class InlineSitePropertyForm extends BasicPageForm
|
||||||
*/
|
*/
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description")));
|
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description")));
|
||||||
m_description = new TextArea(ContentPage.DESCRIPTION);
|
m_description = new TextArea(ContentPage.DESCRIPTION);
|
||||||
m_description.setCols(30);
|
m_description.setCols(30);
|
||||||
m_description.setRows(5);
|
m_description.setRows(5);
|
||||||
if (ContentSection.getConfig().mandatoryDescriptions()) {
|
if (ContentSection.getConfig().mandatoryDescriptions()) {
|
||||||
m_description.addValidationListener(
|
m_description.addValidationListener(
|
||||||
new NotEmptyValidationListener(GlobalizationUtil.globalize("cms.contenttypes.ui.description_missing")));
|
new NotEmptyValidationListener(GlobalizationUtil.
|
||||||
}
|
globalize("cms.contenttypes.ui.description_missing")));
|
||||||
m_description.addValidationListener(
|
}
|
||||||
new StringInRangeValidationListener(
|
m_description.addValidationListener(
|
||||||
0,
|
new StringInRangeValidationListener(
|
||||||
4000));
|
0,
|
||||||
add(m_description);
|
4000));
|
||||||
|
add(m_description);
|
||||||
|
|
||||||
add(new Label("URL:"));
|
add(new Label("URL:"));
|
||||||
ParameterModel urlParam
|
ParameterModel urlParam = new StringParameter("url");
|
||||||
= new StringParameter("url");
|
|
||||||
m_url = new TextField(urlParam);
|
m_url = new TextField(urlParam);
|
||||||
m_url.setSize(40);
|
m_url.setSize(40);
|
||||||
add(m_url);
|
add(m_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Form initialisation hook. Fills widgets with data. */
|
/**
|
||||||
|
* Form initialisation hook. Fills widgets with data.
|
||||||
|
*/
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
InlineSite site
|
InlineSite site = (InlineSite) super.initBasicWidgets(fse);
|
||||||
= (InlineSite) super.initBasicWidgets(fse);
|
|
||||||
|
m_url.setValue(fse.getPageState(),
|
||||||
m_url.setValue(fse.getPageState(),
|
|
||||||
site.getURL());
|
site.getURL());
|
||||||
m_description.setValue(fse.getPageState(), site.getDescription());
|
m_description.setValue(fse.getPageState(), site.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Form processing hook. Saves InlineSite object. */
|
/**
|
||||||
|
* Form processing hook. Saves InlineSite object.
|
||||||
|
*/
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
InlineSite site
|
InlineSite site = (InlineSite) super.processBasicWidgets(fse);
|
||||||
= (InlineSite) super.processBasicWidgets(fse);
|
|
||||||
|
|
||||||
// save only if save button was pressed
|
// save only if save button was pressed
|
||||||
if (site != null
|
if (site != null
|
||||||
&& getSaveCancelSection().getSaveButton()
|
&& getSaveCancelSection().getSaveButton()
|
||||||
.isSelected(fse.getPageState())) {
|
.isSelected(fse.getPageState())) {
|
||||||
site.setURL((String)m_url.getValue(fse.getPageState()));
|
site.setURL((String) m_url.getValue(fse.getPageState()));
|
||||||
site.setDescription((String)m_description.getValue(fse.getPageState()));
|
site.setDescription((String) m_description.getValue(fse.getPageState()));
|
||||||
site.save();
|
site.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_step != null) {
|
||||||
|
m_step.maybeForwardToNextStep(fse.getPageState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue