diff --git a/ccm-cms-types-externallink/application.xml b/ccm-cms-types-externallink/application.xml new file mode 100644 index 000000000..fd43efa1d --- /dev/null +++ b/ccm-cms-types-externallink/application.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + The Content Typ externalLink for the APLAWS+ CMS. + + diff --git a/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl b/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl new file mode 100644 index 000000000..933368d09 --- /dev/null +++ b/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl @@ -0,0 +1,28 @@ +// +// Copyright (C) 2005 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 +// +// $Id: EForm.pdl 1494 2007-03-19 14:58:34Z apevec $ +model com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.ContentPage; + +object type ExternalLink extends ContentPage { + String [0..1] url = ct_extLinks.url VARCHAR(2000); + String [0..1] description = ct_extLinks.description; + + reference key (ct_extLinks.extLink_id); +} diff --git a/ccm-cms-types-externallink/sql/ccm-cms-types-externallink/oracle-se-create.sql b/ccm-cms-types-externallink/sql/ccm-cms-types-externallink/oracle-se-create.sql new file mode 100644 index 000000000..d1e8ba599 --- /dev/null +++ b/ccm-cms-types-externallink/sql/ccm-cms-types-externallink/oracle-se-create.sql @@ -0,0 +1,21 @@ +-- +-- Copyright (C) 2005 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 +-- +-- $Id: oracle-se-create.sql 1494 2007-03-19 14:58:34Z apevec $ +@ ddl/oracle-se/create.sql +@ ddl/oracle-se/deferred.sql + diff --git a/ccm-cms-types-externallink/sql/ccm-cms-types-externallink/postgres-create.sql b/ccm-cms-types-externallink/sql/ccm-cms-types-externallink/postgres-create.sql new file mode 100644 index 000000000..2e29dd276 --- /dev/null +++ b/ccm-cms-types-externallink/sql/ccm-cms-types-externallink/postgres-create.sql @@ -0,0 +1,22 @@ +-- +-- Copyright (C) 2005 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 +-- +-- $Id: postgres-create.sql 1494 2007-03-19 14:58:34Z apevec $ +begin; +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql +end; diff --git a/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml new file mode 100644 index 000000000..cdc377dbc --- /dev/null +++ b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + diff --git a/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink-item.jsp b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink-item.jsp new file mode 100644 index 000000000..21a4bdb9e --- /dev/null +++ b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink-item.jsp @@ -0,0 +1,18 @@ + + + + + + CMSContext ctx = CMS.getContext(); + if (ctx.hasContentItem()) { + EForm eform = (EForm) ctx.getContentItem(); + String url = eform.getURL(); + if (url != null && url.length() > 0) { + response.sendRedirect(url); + } + } + + diff --git a/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink2-item.jsp b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink2-item.jsp new file mode 100644 index 000000000..3b37d3df4 --- /dev/null +++ b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink2-item.jsp @@ -0,0 +1,21 @@ +<%@page import="com.arsdigita.camden.cms.contenttypes.EForm,com.arsdigita.cms.CMS,com.arsdigita.cms.CMSContext" %> +<% + CMSContext ctx = CMS.getContext(); + if (ctx.hasContentItem()) { + EForm eform = (EForm) ctx.getContentItem(); + String url = eform.getURL(); + String title = eform.getTitle(); + if (url != null && url.length() > 0) { +%> + + + + + + <%= title %> + + +<% + } + } +%> diff --git a/ccm-cms-types-externallink/src/ccm-cms-types-externallink.config b/ccm-cms-types-externallink/src/ccm-cms-types-externallink.config new file mode 100644 index 000000000..adfdba100 --- /dev/null +++ b/ccm-cms-types-externallink/src/ccm-cms-types-externallink.config @@ -0,0 +1,4 @@ + + + + diff --git a/ccm-cms-types-externallink/src/ccm-cms-types-externallink.load b/ccm-cms-types-externallink/src/ccm-cms-types-externallink.load new file mode 100644 index 000000000..eeb52f55e --- /dev/null +++ b/ccm-cms-types-externallink/src/ccm-cms-types-externallink.load @@ -0,0 +1,16 @@ + + + +
+
+ + + +
+ + + + + + + diff --git a/ccm-cms-types-externallink/src/ccm-cms-types-externallink.upgrade b/ccm-cms-types-externallink/src/ccm-cms-types-externallink.upgrade new file mode 100644 index 000000000..f8070cf50 --- /dev/null +++ b/ccm-cms-types-externallink/src/ccm-cms-types-externallink.upgrade @@ -0,0 +1,2 @@ + + diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EForm.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EForm.java new file mode 100644 index 000000000..8923a6714 --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EForm.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2005 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.camden.cms.contenttypes; + +import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.ContentType; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.UncheckedWrapperException; +import java.math.BigDecimal; + + +/** + * This content type represents an redirect to an external form or an other resource identified by + * an URL. + * + * The item stores a description text about the form/resource and an URL. + * + * @version $Id: EForm.java 2570 2013-11-19 12:49:34Z jensp $ + */ +public class EForm extends ContentPage { + + /** + * PDL property name for definition + */ + public static final String URL = "url"; + public static final String DESCRIPTION = "description"; + + /** + * Data object type for this domain object + */ + public static final String BASE_DATA_OBJECT_TYPE + = "com.arsdigita.camden.cms.contenttypes.EForm"; + /** + * Data object type for this domain object (for CMS compatibility) + */ + public static final String TYPE = BASE_DATA_OBJECT_TYPE; + + /** + * Default Constructor. Creates a new eForm item. + */ + public EForm() { + this(BASE_DATA_OBJECT_TYPE); + try { + setContentType(ContentType.findByAssociatedObjectType(BASE_DATA_OBJECT_TYPE)); + } catch (DataObjectNotFoundException ex) { + throw new UncheckedWrapperException("EForm type not registered", ex); + } + } + + /** + * Creates an eForm object for an item in the database. + * + * @param id The id of the eForm to retrieve from the database. + * + * @throws DataObjectNotFoundException + */ + public EForm(final BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + /** + * Creates an eForm object for an item in the database. + * + * @param oid The {@link OID} of the item to retrieve from the database. + * + * @throws DataObjectNotFoundException + */ + public EForm(final OID oid) + throws DataObjectNotFoundException { + super(oid); + } + + /** + * Wraps an {@link DataObject} into an {@code EForm} domain object. + * + * @param obj + */ + public EForm(final DataObject obj) { + super(obj); + } + + /** + * Creates a new domain object for an subtype of EForm. + * + * @param type + */ + public EForm(final String type) { + super(type); + } + + /** + * Retrieve the target URL for this e-Form object. + * + * @return The URL to redirect to. + */ + public String getURL() { + return (String) get(URL); + } + + /** + * Set the target URL for this e-Form object. + * + * @return + */ + public void setURL(final String url) { + set(URL, url); + } + + /** + * Retrieve the description for the resource the URL is pointing to. + * + * + * @return Description about the URL this EForm is redirecting to. + */ + @Override + public String getDescription() { + return (String) get(DESCRIPTION); + } + + /** + * Set the description for this e-Form object. + * + */ + @Override + public void setDescription(final String description) { + set(DESCRIPTION, description); + } + +} diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormInitializer.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormInitializer.java new file mode 100644 index 000000000..7a32f2829 --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormInitializer.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2005 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.camden.cms.contenttypes; + +import com.arsdigita.cms.contenttypes.ContentTypeInitializer; + +/** + * Runtime initialization for the eForm content type, executes at each + * system startup. + * + * Just uses the super class methods. + * + * This is done by runtimeRuntime startup method which runs the init() methods + * of all initializers (this one just using the parent implementation). + * + * @author Alan Pevec + * @version $Id: EFormInitializer.java 2570 2013-11-19 12:49:34Z jensp $ + */ +public class EFormInitializer extends ContentTypeInitializer { + + /** + * Constructor, just sets the PDL manifest file and object type string. + */ + public EFormInitializer() { + super("ccm-lbc-eforms.pdl.mf", + EForm.BASE_DATA_OBJECT_TYPE); + } + +} diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormLoader.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormLoader.java new file mode 100644 index 000000000..2fe1e9b56 --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormLoader.java @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2005 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.camden.cms.contenttypes; + +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader; +import com.arsdigita.cms.lifecycle.LifecycleDefinition; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.ResourceParameter; +import com.arsdigita.workflow.simple.WorkflowTemplate; +import java.io.InputStream; + +/** + * Loader executes nonrecurring once at install time and loads the e-Form contenttype package + * persistently into database. + * + * It uses the base class to create the database schema and the required table entries for the + * contenttype. + * + * NOTE: Configuration parameters used at load time MUST be part of Loader class and can not + * delegated to a Config object (derived from AbstractConfig). They will (and can) not be persisted + * into an registry object (file). + * + * @author Alan Pevec + * @version $Id: EFormLoader.java 2570 2013-11-19 12:49:34Z jensp $ + */ +public class EFormLoader extends AbstractContentTypeLoader { + + /** + * Defines the xml file containing the EForm content types property definitions. + */ + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml" + }; + + /** + * Configures a special default template to register at install time. + */ + private final Parameter m_template = new ResourceParameter( + "com.arsdigita.camden.cms.contenttypes.eform.defaulttemplate", + Parameter.REQUIRED, + "/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp"); + + /** + * Constructor, just registers Loader parameter. + */ + public EFormLoader() { + register(m_template); + } + + /** + * Provides the of EForm contenttype property definitions. + * + * The file defines the types name as displayed in content center select box and the authoring + * steps. These are loaded into database. + * + * Implements the method of the parent class. + * + * @return String array of fully qualified file names + */ + @Override + public String[] getTypes() { + return TYPES; + } + + /** + * Overwrites base class to register its own specific default template. + * + * @param section + * @param type + * @param ld + * @param wf + */ + @Override + protected void prepareSection(final ContentSection section, + final ContentType type, + final LifecycleDefinition ld, + final WorkflowTemplate wf) { + super.prepareSection(section, type, ld, wf); + + setDefaultTemplate("EFormDefaultTemplate", + "eform-item", + (InputStream) get(m_template), + section, type, ld, wf); + + } + +} diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources.properties b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources.properties new file mode 100644 index 000000000..b32e9b749 --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources.properties @@ -0,0 +1,9 @@ +# EventResources.properties +# +eform.authoring.basic_properties.description=Edit the title, name, location (URL), and description +# +camden.cms.contenttypes.eform.name=Name (URL): +camden.cms.contenttypes.eform.title=Title: +# +camden.cms.contenttypes.eform.description=Form description: +camden.cms.contenttypes.eform.location=Location (remote URL): diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources_de.properties b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources_de.properties new file mode 100644 index 000000000..de342eb36 --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources_de.properties @@ -0,0 +1,11 @@ +# EventResources_de.properties +# Alle deutschem Umlaute muessen als UTF-8 eingetragen werden: +eform.authoring.basic_properties.description=Bearbeitung des Titels, Namens, Ort (URL) und Beschreibung +# +# useless here, must be transferred to CMSResources +# +camden.cms.contenttypes.eform.name=Name (URL): +camden.cms.contenttypes.eform.title=Titel: +# +camden.cms.contenttypes.eform.description=Formularbeschreibung: +camden.cms.contenttypes.eform.location=Ort (Ziel URL): diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources_en.properties b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources_en.properties new file mode 100644 index 000000000..24c743c3c --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/EFormResources_en.properties @@ -0,0 +1,9 @@ +# EventResources.properties +# +eform.authoring.basic_properties.description=Edit the title, name, location (URL), and description +# +camden.cms.contenttypes.eform.name=Name (URL): +camden.cms.contenttypes.eform.title=Title: +# +camden.cms.contenttypes.eform.description=Additional date description: +camden.cms.contenttypes.eform.location=Location (remote URL): diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/ui/EFormPropertiesStep.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/ui/EFormPropertiesStep.java new file mode 100644 index 000000000..e20cc9e10 --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/ui/EFormPropertiesStep.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2005 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.camden.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.camden.cms.contenttypes.EForm; +import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg; +import com.arsdigita.cms.ItemSelectionModel; +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 com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * Authoring step to view/edit the simple attributes of the EForm content type (and its subclasses). + */ +public class EFormPropertiesStep extends SimpleEditStep { + + /** + * The name of the editing sheet added to this step + */ + public static final String EDIT_SHEET_NAME = "edit"; + + /** + * Constructor. + * + * @param itemModel + * @param parent + */ + public EFormPropertiesStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + super(itemModel, parent); + + final BasicPageForm editSheet = new EFormPropertyForm(itemModel); + add(EDIT_SHEET_NAME, + GlobalizationUtil.globalize("cms.ui.edit"), + new WorkflowLockedComponentAccess(editSheet, itemModel), + editSheet.getSaveCancelSection().getCancelButton()); + + setDisplayComponent(getEFormPropertySheet(itemModel)); + } + + /** + * Returns a component that displays the properties of the EForm content item 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 + * + * Method add deprecated, use add(GlobalizedMessage label, String attribute) instead (but + * probably Camden doesn't use globalized strings). + */ + public static Component getEFormPropertySheet(final ItemSelectionModel itemModel) { + + final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); + + sheet.add(EFormGlobalizedMsg.getName(), EForm.NAME); + sheet.add(EFormGlobalizedMsg.getTitle(), EForm.TITLE); + sheet.add(EFormGlobalizedMsg.getLocation(), EForm.URL); + sheet.add(EFormGlobalizedMsg.getDescription(), EForm.DESCRIPTION); + + return sheet; + } + +} diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/ui/EFormPropertyForm.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/ui/EFormPropertyForm.java new file mode 100644 index 000000000..6ba2cbeda --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/ui/EFormPropertyForm.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2005 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.camden.cms.contenttypes.ui; + +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.camden.cms.contenttypes.EForm; +import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.ui.authoring.BasicPageForm; + +/** + * Form to edit the basic properties of an EForm. + * + * Used by EFormPropertiesStep authoring kit step. + *
+ * This form can be extended to create forms for EForm subclasses. + */ +public class EFormPropertyForm extends BasicPageForm + implements FormProcessListener, FormInitListener { + + /** + * Name of this form + */ + public static final String ID = "eform_edit"; // formerly "eFormEdit" + + private TextField url; + private TextArea description; + + /** + * Creates a new form to edit the EForm object specified by the item selection model passed in. + * + * @param itemModel The ItemSelectionModel to use to obtain the EForm to work on + */ + public EFormPropertyForm(final ItemSelectionModel itemModel) { + super(ID, itemModel); + } + + /** + * Adds widgets to the forms basic properties (name and title). + */ + @Override + protected void addWidgets() { + super.addWidgets(); + + add(new Label(EFormGlobalizedMsg.getLocation())); + url = new TextField(EForm.URL); + url.setSize(40); + add(url); + + add(new Label(EFormGlobalizedMsg.getDescription())); + description = new TextArea(EForm.DESCRIPTION, 5, 40, TextArea.SOFT); + add(description); + } + + /** + * Form initialisation hook. Fills widgets with data. + * + * @param fse FormSectionEvent provided by caller + */ + @Override + public void init(final FormSectionEvent fse) { + final EForm site = (EForm) super.initBasicWidgets(fse); + + final PageState state = fse.getPageState(); + url.setValue(state, site.getURL()); + description.setValue(state, site.getDescription()); + } + + /** + * Form processing hook. Saves EForm object. + * + * @param fse + */ + @Override + public void process(final FormSectionEvent fse) { + final EForm site = (EForm) super.processBasicWidgets(fse); + + final PageState state = fse.getPageState(); + // save only if save button was pressed + if (site != null + && getSaveCancelSection().getSaveButton().isSelected(state)) { + site.setURL((String) url.getValue(state)); + site.setDescription((String) description.getValue(state)); + } + } + +} diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/util/EFormGlobalizedMsg.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/util/EFormGlobalizedMsg.java new file mode 100644 index 000000000..cf876352c --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/util/EFormGlobalizedMsg.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2013 University of Bremen. 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.camden.cms.contenttypes.util; + +import com.arsdigita.globalization.Globalized; +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * Compilation of methods to simplify the handling of globalizing keys. + * Basically it adds the name of package's resource bundle files to the + * globalize methods and forwards to GlobalizedMessage, shortening the + * method invocation in the various application classes. + * + * @author pb + */ +public class EFormGlobalizedMsg implements Globalized { + + /** Name of Java resource files to handle CMS's globalisation. */ + final public static String BUNDLE_NAME = + "com.arsdigita.camden.cms.contenttypes.EFormResources"; + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getTitle() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.title", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getLocation() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.location", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getDescription() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.description", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getName() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.name", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message based on its key and using + * the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage get(String key) { + + return new GlobalizedMessage(key, BUNDLE_NAME); + + } + + +} diff --git a/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java b/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java index 3232b44c9..8867683bb 100755 --- a/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java +++ b/ccm-core/src/com/arsdigita/kernel/ResourceTypeConfig.java @@ -243,7 +243,7 @@ public class ResourceTypeConfig { PageState state = e.getPageState(); if (m_buttons.getCancelButton().isSelected(state)) { - fireCompletionEvent(state) + fireCompletionEvent(state); throw new FormProcessException(KernelGlobalizationUtil.globalize( "kernel.cancelled")); }