Author: apevec Date: 2005-10-13 23:11:40 +0200 (Thu, 13 Oct 2005) New Revision: 958 Added: contrib/ccm-ldn-camden-eforms/ contrib/ccm-ldn-camden-eforms/trunk/ contrib/ccm-ldn-camden-eforms/trunk/application.xml contrib/ccm-ldn-camden-eforms/trunk/pdl/ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/cms/ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/cms/contenttypes/EForm.pdl contrib/ccm-ldn-camden-eforms/trunk/sql/ contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/ contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/oracle-se-create.sql contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/postgres-create.sql contrib/ccm-ldn-camden-eforms/trunk/src/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.config contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.load contrib/ccm-ldn-camden-eforms/trunk/src/com/ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EForm.java contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormInitializer.java contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java Log: Camden eForms content type Added: contrib/ccm-ldn-camden-eforms/trunk/application.xml =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/application.xml 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/application.xml 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" + name="ccm-ldn-camden-eforms" + prettyName="Camden eForms Content Type" + version="1.0.0" + release="1" + webapp="ROOT"> + <ccm:dependencies> + <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> + <ccm:requires name="ccm-cms" version="6.1.1" relation="ge"/> + </ccm:dependencies> + <ccm:directories> + <ccm:directory name="pdl"/> + <ccm:directory name="sql"/> + <ccm:directory name="src"/> + </ccm:directories> + <ccm:contacts> + <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> + <ccm:contact uri="mailto:rh...@re..." type="support"/> + </ccm:contacts> + <ccm:description> + The Camden eForms Content Type for the APLAWS+ CMS. + </ccm:description> +</ccm:application> Added: contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/cms/contenttypes/EForm.pdl =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/cms/contenttypes/EForm.pdl 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/pdl/com/arsdigita/camden/cms/contenttypes/EForm.pdl 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,29 @@ +// +// 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$ +// $DateTime$ +model com.arsdigita.camden.cms.contenttypes; + +import com.arsdigita.cms.ContentPage; + +object type EForm extends ContentPage { + String [0..1] url = ct_eform.url VARCHAR(2000); + + reference key (ct_eform.form_id); +} + Added: contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/oracle-se-create.sql =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/oracle-se-create.sql 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/oracle-se-create.sql 2005-10-13 21:11:40 UTC (rev 958) @@ -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$ +-- $DateTime$ +@ ddl/oracle-se/create.sql +@ ddl/oracle-se/deferred.sql + Added: contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/postgres-create.sql =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/postgres-create.sql 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/sql/ccm-ldn-camden-eforms/postgres-create.sql 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,23 @@ +-- +-- 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$ +-- $DateTime$ +begin; +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql +end; Added: contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,24 @@ +<?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-type label="eForm" + description="An item represending an external e-Form" + objectType="com.arsdigita.camden.cms.contenttypes.EForm" + classname="com.arsdigita.camden.cms.contenttypes.EForm"> + + <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> + + <ctd:authoring-step label="Edit Basic Properties" + description="Edit basic properties" + component="com.arsdigita.camden.cms.contenttypes.ui.EFormPropertiesStep" + ordering="1"/> + + <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:content-types> + Added: contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,16 @@ +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" + xmlns:define="/WEB-INF/bebop-define.tld" + xmlns:show="/WEB-INF/bebop-show.tld" + version="1.2"> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.EForm"/> + + <jsp:useBean id="item" scope="request"/> + <jsp:scriptlet> + EForm eform = (EForm) item; + String url = eform.getURL(); + if (url != null && url.length() > 0) { + response.sendRedirect(url); + } + </jsp:scriptlet> + +</jsp:root> Added: contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.config =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.config 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.config 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<registry> + <!-- nothing yet --> +</registry> Added: contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.load =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.load 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/ccm-ldn-camden-eforms.load 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,16 @@ +<load> + <requires> + <table name="inits"/> + <table name="acs_objects"/> + <table name="cms_items"/> + <initializer class="com.arsdigita.cms.Initializer"/> + </requires> + <provides> + <table name="ct_eform"/> + <initializer class="com.arsdigita.camden.cms.contenttypes.EFormInitializer"/> + </provides> + <scripts> + <schema directory="ccm-ldn-camden-eforms"/> + <data class="com.arsdigita.camden.cms.contenttypes.EFormLoader"/> + </scripts> +</load> Added: contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EForm.java =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EForm.java 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EForm.java 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,92 @@ +/* + * 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.ContentType; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.DataObject; + +import java.math.BigDecimal; + +import org.apache.log4j.Logger; + +/** + * This content type represents an e-Form. + * + */ +public class EForm extends ContentPage { + public final static String versionId = + "$Id$" + + "$Author$" + + "$DateTime$"; + + private static final Logger s_log = Logger.getLogger(EForm.class); + + /** PDL property name for definition */ + public static final String URL = "url"; + + /** 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; + + public EForm() { + this( BASE_DATA_OBJECT_TYPE ); + try { + setContentType( + ContentType.findByAssociatedObjectType( + BASE_DATA_OBJECT_TYPE + ) + ); + } catch( DataObjectNotFoundException e ) { + throw new RuntimeException( "EForm type not registered" ); + } + } + + public EForm( BigDecimal id ) + throws DataObjectNotFoundException { + this( new OID( BASE_DATA_OBJECT_TYPE, id ) ); + } + + public EForm( OID id ) + throws DataObjectNotFoundException { + super( id ); + } + + public EForm( DataObject obj ) { + super( obj ); + } + + public EForm( String type ) { + super( type ); + } + + + public String getURL() { + return (String) get(URL); + } + + public void setURL( String url ) { + set(URL, url); + } +} Added: contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormInitializer.java =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormInitializer.java 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormInitializer.java 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,42 @@ +/* + * 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; +import org.apache.log4j.Logger; + +/** + * The eForm content type initializer. + * + * @author Alan Pevec + */ +public class EFormInitializer extends ContentTypeInitializer { + public final static String versionId = + "$Id$" + + "$Author$" + + "$DateTime$"; + + private static final Logger s_log = Logger.getLogger(EFormInitializer.class); + + public EFormInitializer() { + super("ccm-cms-types-eform.pdl.mf", + EForm.BASE_DATA_OBJECT_TYPE); + } + +} Added: contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,81 @@ +/* + * 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.AbstractContentTypeLoader; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.lifecycle.LifecycleDefinition; +import com.arsdigita.workflow.simple.WorkflowTemplate; +import com.arsdigita.util.UncheckedWrapperException; +import java.net.URL; +import java.net.MalformedURLException; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.URLParameter; + + +/** + * e-Form content type loader + * + * @author Alan Pevec + */ +public class EFormLoader extends AbstractContentTypeLoader { + public final static String versionId = + "$Id$" + + "$Author$" + + "$DateTime$"; + + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml" + }; + + private URLParameter m_template; + + public EFormLoader() { + try { + m_template = new URLParameter + ("com.arsdigita.camden.cms.contenttypes.eform.defaulttemplate", + Parameter.REQUIRED, + new URL(null, + "resource:///WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes" + + "/eform-item.jsp")); + } catch (MalformedURLException ex) { + throw new UncheckedWrapperException("cannot parse url", ex); + } + + register(m_template); + } + + public String[] getTypes() { + return TYPES; + } + + 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", + (URL)get(m_template), + section, type,ld, wf); + + } +} Added: contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,75 @@ +/* + * 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.camden.cms.contenttypes.EForm; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; + + +/** + * Authoring step to 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"; + + public EFormPropertiesStep( ItemSelectionModel itemModel, + AuthoringKitWizard parent ) { + super( itemModel, parent ); + + BasicPageForm editSheet; + + editSheet = new EFormPropertyForm( itemModel ); + add( EDIT_SHEET_NAME, "Edit", + new WorkflowLockedComponentAccess(editSheet, itemModel), + editSheet.getSaveCancelSection().getCancelButton() ); + + setDisplayComponent( getEFormPropertySheet( itemModel ) ); + } + + /** + * Returns a component that displays the properties of the + * EForm 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 getEFormPropertySheet( ItemSelectionModel + itemModel ) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel ); + + sheet.add( "Name:", EForm.NAME ); + sheet.add( "Title:", EForm.TITLE ); + sheet.add( "URL:", EForm.URL ); + + return sheet; + } +} + Added: contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java =================================================================== --- contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java 2005-10-12 13:57:05 UTC (rev 957) +++ contrib/ccm-ldn-camden-eforms/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java 2005-10-13 21:11:40 UTC (rev 958) @@ -0,0 +1,89 @@ +/* + * 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.camden.cms.contenttypes.EForm; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.ui.authoring.BasicPageForm; + + +/** + * Form to edit the basic properties of an EForm. This form can be + * extended to create forms for EForm subclasses. + */ +public class EFormPropertyForm extends BasicPageForm + implements FormProcessListener, FormInitListener { + + private TextField m_url; + + /** + * 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(ItemSelectionModel itemModel) { + super("eFormEdit", itemModel); + } + + /** + * Adds widgets to the form. + */ + protected void addWidgets() { + super.addWidgets(); + + add(new Label("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. */ + public void init(FormSectionEvent fse) { + EForm site + = (EForm) super.initBasicWidgets(fse); + + m_url.setValue(fse.getPageState(), + site.getURL()); + } + + /** Form processing hook. Saves EForm object. */ + public void process(FormSectionEvent fse) { + EForm site + = (EForm) 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.save(); + } + } +} |