diff --git a/ccm-cms-types-htmlform/application.xml b/ccm-cms-types-htmlform/application.xml
index d0db36f4d..ffb07fc29 100755
--- a/ccm-cms-types-htmlform/application.xml
+++ b/ccm-cms-types-htmlform/application.xml
@@ -8,7 +8,6 @@
-
diff --git a/ccm-cms-types-htmlform/pdl/com/arsdigita/cms/contenttypes/HTMLForm.pdl b/ccm-cms-types-htmlform/pdl/com/arsdigita/cms/contenttypes/HTMLForm.pdl
index 99fb1ffd8..6141eb5ae 100755
--- a/ccm-cms-types-htmlform/pdl/com/arsdigita/cms/contenttypes/HTMLForm.pdl
+++ b/ccm-cms-types-htmlform/pdl/com/arsdigita/cms/contenttypes/HTMLForm.pdl
@@ -17,5 +17,8 @@
model com.arsdigita.cms.contenttypes;
-object type HTMLForm extends Article {
+object type HTMLForm extends GenericArticle {
+ String [0..1] lead = ct_htmlform.lead VARCHAR(1000);
+
+ reference key (ct_htmlform.item_id);
}
diff --git a/ccm-cms-types-htmlform/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HTMLForm.xml b/ccm-cms-types-htmlform/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HTMLForm.xml
index be4cd1d68..bc6e6be7c 100755
--- a/ccm-cms-types-htmlform/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HTMLForm.xml
+++ b/ccm-cms-types-htmlform/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/HTMLForm.xml
@@ -7,7 +7,7 @@
labelBundle="com.arsdigita.cms.CMSResources"
descriptionKey="cms.contenttypes.shared.basic_properties.description"
descriptionBundle="com.arsdigita.cms.CMSResources"
- component="com.arsdigita.cms.contenttypes.ui.ArticlePropertiesStep"/>
+ component="com.arsdigita.cms.contenttypes.ui.HTMLFormPropertiesStep"/>
diff --git a/ccm-cms-types-htmlform/src/ccm-cms-types-htmlform.load b/ccm-cms-types-htmlform/src/ccm-cms-types-htmlform.load
index 82532289d..279dba1eb 100755
--- a/ccm-cms-types-htmlform/src/ccm-cms-types-htmlform.load
+++ b/ccm-cms-types-htmlform/src/ccm-cms-types-htmlform.load
@@ -4,8 +4,6 @@
-
-
diff --git a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLForm.java b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLForm.java
index de51d88ba..224eb6799 100755
--- a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLForm.java
+++ b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLForm.java
@@ -28,11 +28,14 @@ import java.math.BigDecimal;
*
* @version $Revision: #1 $ $Date: 2004/03/05 $
*/
-public class HTMLForm extends Article {
+public class HTMLForm extends GenericArticle {
private final static org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.getLogger(HTMLForm.class);
+ /** PDL property name for lead */
+ public static final String LEAD = "lead";
+
/** Data object type for this domain object */
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contenttypes.HTMLForm";
@@ -68,4 +71,20 @@ public class HTMLForm extends Article {
Assert.exists(getContentType(), ContentType.class);
}
+
+ public String getLead() {
+ return (String) get( LEAD );
+ }
+
+ public void setLead( String lead ) {
+ set( LEAD, lead );
+ }
+
+ public static final int SUMMARY_LENGTH = 200;
+ public String getSearchSummary() {
+ return com.arsdigita.util.StringUtils.truncateString(getLead(),
+ SUMMARY_LENGTH,
+ true);
+ }
+
}
diff --git a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLFormLoader.java b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLFormLoader.java
index bf1ffa998..58390a235 100755
--- a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLFormLoader.java
+++ b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/HTMLFormLoader.java
@@ -15,8 +15,6 @@
package com.arsdigita.cms.contenttypes;
-import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
-
/**
* Loader.
*
diff --git a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertiesStep.java b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertiesStep.java
new file mode 100644
index 000000000..ece8fa92a
--- /dev/null
+++ b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertiesStep.java
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.HTMLForm;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.ui.authoring.SimpleEditStep;
+import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import java.text.DateFormat;
+
+/**
+ * Authoring step to edit the simple attributes of the HTMLForm content
+ * type (and its subclasses). The attributes edited are 'name', 'title'
+ * and 'lead'. This authoring step replaces
+ * the com.arsdigita.ui.authoring.PageEdit step for this type.
+ */
+public class HTMLFormPropertiesStep extends SimpleEditStep {
+
+ /** The name of the editing sheet added to this step */
+ public static String EDIT_SHEET_NAME = "edit";
+
+ public HTMLFormPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
+ super(itemModel, parent);
+
+ setDefaultEditKey(EDIT_SHEET_NAME);
+
+ BasicPageForm editSheet;
+
+ editSheet = new HTMLFormPropertyForm(itemModel, this);
+ add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel),
+ editSheet.getSaveCancelSection().getCancelButton());
+
+ setDisplayComponent(getHTMLFormPropertySheet(itemModel));
+ }
+
+ /**
+ * Returns a component that displays the properties of the
+ * HTMLForm 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
+ */
+ public static Component getHTMLFormPropertySheet(ItemSelectionModel itemModel) {
+ DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
+
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), HTMLForm.NAME);
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), HTMLForm.TITLE);
+ if (!ContentSection.getConfig().getHideLaunchDate()) {
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.launch_date"),
+ ContentPage.LAUNCH_DATE,
+ new DomainObjectPropertySheet.AttributeFormatter() {
+
+ 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();
+ }
+ }
+ });
+ }
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.lead"), HTMLForm.LEAD);
+
+ return sheet;
+ }
+}
diff --git a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java
new file mode 100644
index 000000000..5a00e6285
--- /dev/null
+++ b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java
@@ -0,0 +1,134 @@
+/*
+ * 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;
+
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.form.TextArea;
+import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
+import com.arsdigita.bebop.parameters.ParameterModel;
+import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.HTMLForm;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.util.GlobalizationUtil;
+
+/**
+ * Form to edit the basic properties of an HTMLForm. This form can be
+ * extended to create forms for HTMLForm subclasses.
+ */
+public class HTMLFormPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
+
+ private final static org.apache.log4j.Logger s_log =
+ org.apache.log4j.Logger.getLogger(HTMLFormPropertyForm.class);
+ private HTMLFormPropertiesStep m_step;
+ public static final String LEAD = "lead";
+
+ /**
+ * Creates a new form to edit the HTMLForm object specified
+ * by the item selection model passed in.
+ * @param itemModel The ItemSelectionModel to use to obtain the
+ * HTMLForm to work on
+ */
+ public HTMLFormPropertyForm(ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ /**
+ * Creates a new form to edit the HTMLForm object specified
+ * by the item selection model passed in.
+ * @param itemModel The ItemSelectionModel to use to obtain the
+ * HTMLForm to work on
+ * @param step The HTMLFormPropertiesStep which controls this form.
+ */
+ public HTMLFormPropertyForm(ItemSelectionModel itemModel, HTMLFormPropertiesStep step) {
+ super(ID, itemModel);
+ m_step = step;
+ addSubmissionListener(this);
+ }
+
+ /**
+ * Adds widgets to the form.
+ */
+ @Override
+ protected void addWidgets() {
+ super.addWidgets();
+
+ add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.lead")));
+ ParameterModel leadParam = new StringParameter(LEAD);
+
+ if (ContentSection.getConfig().mandatoryDescriptions()) {
+ leadParam.addParameterListener(new NotEmptyValidationListener(GlobalizationUtil.globalize("cms.contenttypes.ui.description_missing")));
+ }
+ //leadParam
+ // .addParameterListener( new NotNullValidationListener() );
+ leadParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
+ TextArea lead = new TextArea(leadParam);
+ lead.setCols(40);
+ lead.setRows(5);
+ add(lead);
+ }
+
+ @Override
+ public void validate(FormSectionEvent e) throws FormProcessException {
+ FormData d = e.getFormData();
+ }
+
+ /** Form initialisation hook. Fills widgets with data. */
+ public void init(FormSectionEvent fse) {
+ // Do some initialization hook stuff
+ FormData data = fse.getFormData();
+ HTMLForm htmlform = (HTMLForm) super.initBasicWidgets(fse);
+
+ data.put(LEAD, htmlform.getLead());
+ }
+
+ /** Cancels streamlined editing. */
+ public void submitted(FormSectionEvent fse) {
+ if (m_step != null
+ && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
+ m_step.cancelStreamlinedCreation(fse.getPageState());
+ }
+ }
+
+ /** Form processing hook. Saves Event object. */
+ public void process(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+
+ HTMLForm htmlform = (HTMLForm) super.processBasicWidgets(fse);
+
+ // save only if save button was pressed
+ if (htmlform != null
+ && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
+
+ htmlform.setLead((String) data.get(LEAD));
+ htmlform.save();
+ }
+ if (m_step != null) {
+ m_step.maybeForwardToNextStep(fse.getPageState());
+ }
+ }
+}