- 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"?>
|
||||
<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"
|
||||
description="Inline view of external site"
|
||||
objectType="com.arsdigita.cms.contenttypes.InlineSite"
|
||||
classname="com.arsdigita.cms.contenttypes.InlineSite">
|
||||
<ctd:content-type label="Inline Site"
|
||||
description="Inline view of external site"
|
||||
objectType="com.arsdigita.cms.contenttypes.InlineSite"
|
||||
classname="com.arsdigita.cms.contenttypes.InlineSite">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step label="Edit Basic Properties"
|
||||
description="Edit basic properties"
|
||||
component="com.arsdigita.cms.contenttypes.ui.InlineSitePropertiesStep"
|
||||
ordering="1"/>
|
||||
<ctd:authoring-step label="Edit Basic Properties"
|
||||
description="Edit basic properties"
|
||||
component="com.arsdigita.cms.contenttypes.ui.InlineSitePropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:authoring-step label="Assign categories"
|
||||
description="Assign categories"
|
||||
component="com.arsdigita.cms.ui.authoring.ItemCategoryStep"
|
||||
ordering="2"/>
|
||||
<ctd:authoring-step label="Assign categories"
|
||||
description="Assign categories"
|
||||
component="com.arsdigita.cms.ui.authoring.ItemCategoryStep"
|
||||
ordering="2"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
</ctd:content-type>
|
||||
</ctd:authoring-kit>
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
||||
|
|
|
|||
|
|
@ -35,78 +35,73 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
|||
import com.arsdigita.domain.DomainObject;
|
||||
import java.text.DateFormat;
|
||||
|
||||
|
||||
/**
|
||||
* Authoring step to edit the simple attributes of the InlineSite content
|
||||
* type (and its subclasses).
|
||||
* Authoring step to edit the simple attributes of the InlineSite content type (and its subclasses).
|
||||
*/
|
||||
public class InlineSitePropertiesStep
|
||||
extends SimpleEditStep {
|
||||
public class InlineSitePropertiesStep 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 InlineSitePropertiesStep( ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent ) {
|
||||
super( itemModel, parent );
|
||||
public InlineSitePropertiesStep(final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard 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 );
|
||||
add( EDIT_SHEET_NAME, "Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton() );
|
||||
|
||||
setDisplayComponent( getInlineSitePropertySheet( itemModel ) );
|
||||
setDisplayComponent(getInlineSitePropertySheet(itemModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component that displays the properties of the
|
||||
* InlineSite specified by the ItemSelectionModel passed in.
|
||||
* Returns a component that displays the properties of the InlineSite specified by the ItemSelectionModel passed in.
|
||||
*
|
||||
* @param itemModel The ItemSelectionModel to use
|
||||
* @pre itemModel != null
|
||||
* @return A component to display the state of the basic properties
|
||||
* of the release
|
||||
* @return A component to display the state of the basic properties of the release
|
||||
*/
|
||||
public static Component getInlineSitePropertySheet( ItemSelectionModel
|
||||
itemModel ) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
|
||||
public static Component getInlineSitePropertySheet(final ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
||||
InlineSite.TITLE);
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||
InlineSite.NAME );
|
||||
InlineSite.NAME);
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
@Override
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if (page.getLaunchDate() != null) {
|
||||
return DateFormat
|
||||
.getDateInstance(DateFormat.LONG)
|
||||
.format(page.getLaunchDate());
|
||||
} else {
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
@Override
|
||||
public String format(final DomainObject item,
|
||||
final String attribute,
|
||||
final PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if (page.getLaunchDate() != null) {
|
||||
return DateFormat
|
||||
.getDateInstance(DateFormat.LONG)
|
||||
.format(page.getLaunchDate());
|
||||
} else {
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
|
||||
InlineSite.DESCRIPTION);
|
||||
sheet.add( InlineSiteGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.inlinesite.url"),
|
||||
InlineSite.URL );
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
|
||||
InlineSite.DESCRIPTION);
|
||||
sheet.add(InlineSiteGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.inlinesite.url"),
|
||||
InlineSite.URL);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,25 +38,29 @@ import com.arsdigita.cms.ItemSelectionModel;
|
|||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Form to edit the basic properties of an InlineSite. This form can be
|
||||
* extended to create forms for InlineSite subclasses.
|
||||
* Form to edit the basic properties of an InlineSite. This form can be extended to create forms for InlineSite
|
||||
* subclasses.
|
||||
*/
|
||||
public class InlineSitePropertyForm extends BasicPageForm
|
||||
implements FormProcessListener, FormInitListener {
|
||||
implements FormProcessListener, FormInitListener {
|
||||
|
||||
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
|
||||
* by the item selection model passed in.
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the
|
||||
* InlineSite to work on
|
||||
* Creates a new form to edit the InlineSite object specified by the item selection model passed in.
|
||||
*
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the 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);
|
||||
m_step = step;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -65,49 +69,55 @@ public class InlineSitePropertyForm extends BasicPageForm
|
|||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description")));
|
||||
m_description = new TextArea(ContentPage.DESCRIPTION);
|
||||
m_description.setCols(30);
|
||||
m_description.setRows(5);
|
||||
if (ContentSection.getConfig().mandatoryDescriptions()) {
|
||||
m_description.addValidationListener(
|
||||
new NotEmptyValidationListener(GlobalizationUtil.globalize("cms.contenttypes.ui.description_missing")));
|
||||
}
|
||||
m_description.addValidationListener(
|
||||
new StringInRangeValidationListener(
|
||||
0,
|
||||
4000));
|
||||
add(m_description);
|
||||
m_description = new TextArea(ContentPage.DESCRIPTION);
|
||||
m_description.setCols(30);
|
||||
m_description.setRows(5);
|
||||
if (ContentSection.getConfig().mandatoryDescriptions()) {
|
||||
m_description.addValidationListener(
|
||||
new NotEmptyValidationListener(GlobalizationUtil.
|
||||
globalize("cms.contenttypes.ui.description_missing")));
|
||||
}
|
||||
m_description.addValidationListener(
|
||||
new StringInRangeValidationListener(
|
||||
0,
|
||||
4000));
|
||||
add(m_description);
|
||||
|
||||
add(new Label("URL:"));
|
||||
ParameterModel urlParam
|
||||
= new StringParameter("url");
|
||||
ParameterModel urlParam = new StringParameter("url");
|
||||
m_url = new TextField(urlParam);
|
||||
m_url.setSize(40);
|
||||
add(m_url);
|
||||
}
|
||||
|
||||
/** Form initialisation hook. Fills widgets with data. */
|
||||
/**
|
||||
* Form initialisation hook. Fills widgets with data.
|
||||
*/
|
||||
public void init(FormSectionEvent fse) {
|
||||
InlineSite site
|
||||
= (InlineSite) super.initBasicWidgets(fse);
|
||||
InlineSite site = (InlineSite) super.initBasicWidgets(fse);
|
||||
|
||||
m_url.setValue(fse.getPageState(),
|
||||
site.getURL());
|
||||
m_description.setValue(fse.getPageState(), site.getDescription());
|
||||
}
|
||||
|
||||
/** Form processing hook. Saves InlineSite object. */
|
||||
/**
|
||||
* Form processing hook. Saves InlineSite object.
|
||||
*/
|
||||
public void process(FormSectionEvent fse) {
|
||||
InlineSite site
|
||||
= (InlineSite) super.processBasicWidgets(fse);
|
||||
InlineSite site = (InlineSite) super.processBasicWidgets(fse);
|
||||
|
||||
// save only if save button was pressed
|
||||
if (site != null
|
||||
&& getSaveCancelSection().getSaveButton()
|
||||
.isSelected(fse.getPageState())) {
|
||||
site.setURL((String)m_url.getValue(fse.getPageState()));
|
||||
site.setDescription((String)m_description.getValue(fse.getPageState()));
|
||||
&& getSaveCancelSection().getSaveButton()
|
||||
.isSelected(fse.getPageState())) {
|
||||
site.setURL((String) m_url.getValue(fse.getPageState()));
|
||||
site.setDescription((String) m_description.getValue(fse.getPageState()));
|
||||
site.save();
|
||||
}
|
||||
|
||||
if (m_step != null) {
|
||||
m_step.maybeForwardToNextStep(fse.getPageState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue