Neuen Content Typ ccm-ldn-types-councillor angelegt (Herkunft von contrib-coventry-ccm-ldn-coventry-councillor / person).
git-svn-id: https://svn.libreccm.org/ccm/trunk@1644 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
de26b1e1c9
commit
37a0b45da5
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<ccm:application name="ccm-ldn-coventry-councillor"
|
||||
prettyName="Red Hat CCM Content Types"
|
||||
version="1.0.1"
|
||||
release="3"
|
||||
webapp="ROOT"
|
||||
xmlns:ccm="http://ccm.redhat.com/ccm-project">
|
||||
|
||||
<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:requires name="ccm-ldn-coventry-person" version="1.0.1"/>
|
||||
</ccm:dependencies>
|
||||
|
||||
<ccm:directories>
|
||||
<ccm:directory name="pdl"/>
|
||||
<ccm:directory name="sql"/>
|
||||
<ccm:directory name="src"/>
|
||||
<ccm:directory name="web"/>
|
||||
</ccm:directories>
|
||||
|
||||
<ccm:contacts>
|
||||
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||
</ccm:contacts>
|
||||
|
||||
<ccm:description>
|
||||
The Address Content Type for the Red Hat CCM CMS.
|
||||
</ccm:description>
|
||||
|
||||
</ccm:application>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<ccm:application name="ccm-ldn-coventry-person"
|
||||
prettyName="Red Hat CCM Content Types"
|
||||
version="1.0.1"
|
||||
release="3"
|
||||
webapp="ROOT"
|
||||
xmlns:ccm="http://ccm.redhat.com/ccm-project">
|
||||
|
||||
<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:directory name="web"/>
|
||||
</ccm:directories>
|
||||
|
||||
<ccm:contacts>
|
||||
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||
</ccm:contacts>
|
||||
|
||||
<ccm:description>
|
||||
The Address Content Type for the Red Hat CCM CMS.
|
||||
</ccm:description>
|
||||
|
||||
</ccm:application>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
//
|
||||
// The contents of this file are subject to the CCM Public
|
||||
// License (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of
|
||||
// the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS
|
||||
// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
// implied. See the License for the specific language governing
|
||||
// rights and limitations under the License.
|
||||
//
|
||||
// $Id: Councillor.pdl 1489 2007-03-19 11:39:58Z apevec $
|
||||
// $DateTime: 2004/03/03 15:41:14 $
|
||||
|
||||
model com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.coventry.cms.contenttypes.Person;
|
||||
|
||||
// object type to hold extended attributes of event content type
|
||||
|
||||
object type Councillor extends com.arsdigita.coventry.cms.contenttypes.Person {
|
||||
String [0..1] position = cov_councillors.position VARCHAR(4000);
|
||||
String [0..1] politicalParty = cov_councillors.political_party VARCHAR(1000);
|
||||
String [0..1] ward = cov_councillors.ward VARCHAR(1000);
|
||||
String [0..1] areaOfResponsibility = cov_councillors.responsibility VARCHAR(1000);
|
||||
String [0..1] termOfOffice = cov_councillors.term_of_office VARCHAR(1000);
|
||||
String [0..1] surgeryDetails = cov_councillors.surgery_details VARCHAR(4000);
|
||||
reference key (cov_councillors.item_id);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
//
|
||||
// The contents of this file are subject to the CCM Public
|
||||
// License (the "License"); you may not use this file except in
|
||||
// compliance with the License. You may obtain a copy of
|
||||
// the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
//
|
||||
// Software distributed under the License is distributed on an "AS
|
||||
// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
// implied. See the License for the specific language governing
|
||||
// rights and limitations under the License.
|
||||
//
|
||||
// $Id: Person.pdl 1489 2007-03-19 11:39:58Z apevec $
|
||||
// $DateTime: 2004/03/31 03:36:22 $
|
||||
|
||||
model com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.TextPage;
|
||||
|
||||
// object type to hold extended attributes of event content type
|
||||
|
||||
object type Person extends TextPage {
|
||||
String [0..1] description = cov_persons.description VARCHAR(4000);
|
||||
String [0..1] contactDetails = cov_persons.contact_details VARCHAR(4000);
|
||||
reference key (cov_persons.item_id);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--
|
||||
-- Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
--
|
||||
-- The contents of this file are subject to the CCM Public
|
||||
-- License (the "License"); you may not use this file except in
|
||||
-- compliance with the License. You may obtain a copy of
|
||||
-- the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
--
|
||||
-- Software distributed under the License is distributed on an "AS
|
||||
-- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
-- implied. See the License for the specific language governing
|
||||
-- rights and limitations under the License.
|
||||
--
|
||||
-- $Id: oracle-se-create.sql 1489 2007-03-19 11:39:58Z apevec $
|
||||
-- $DateTime: 2003/12/19 15:16:08 $
|
||||
|
||||
@@ ddl/oracle-se/create.sql
|
||||
|
||||
@@ ddl/oracle-se/deferred.sql
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--
|
||||
-- Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
--
|
||||
-- The contents of this file are subject to the CCM Public
|
||||
-- License (the "License"); you may not use this file except in
|
||||
-- compliance with the License. You may obtain a copy of
|
||||
-- the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
--
|
||||
-- Software distributed under the License is distributed on an "AS
|
||||
-- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
-- implied. See the License for the specific language governing
|
||||
-- rights and limitations under the License.
|
||||
--
|
||||
-- $Id: oracle-se-create.sql 1489 2007-03-19 11:39:58Z apevec $
|
||||
-- $DateTime: 2003/12/19 15:16:08 $
|
||||
|
||||
@@ ddl/oracle-se/create.sql
|
||||
|
||||
@@ ddl/oracle-se/deferred.sql
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--
|
||||
-- Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
--
|
||||
-- The contents of this file are subject to the CCM Public
|
||||
-- License (the "License"); you may not use this file except in
|
||||
-- compliance with the License. You may obtain a copy of
|
||||
-- the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
--
|
||||
-- Software distributed under the License is distributed on an "AS
|
||||
-- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
-- implied. See the License for the specific language governing
|
||||
-- rights and limitations under the License.
|
||||
--
|
||||
-- $Id: postgres-create.sql 1489 2007-03-19 11:39:58Z apevec $
|
||||
-- $DateTime: 2003/12/19 15:16:08 $
|
||||
|
||||
\i ddl/postgres/create.sql
|
||||
|
||||
\i ddl/postgres/deferred.sql
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
--
|
||||
-- Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
--
|
||||
-- The contents of this file are subject to the CCM Public
|
||||
-- License (the "License"); you may not use this file except in
|
||||
-- compliance with the License. You may obtain a copy of
|
||||
-- the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
--
|
||||
-- Software distributed under the License is distributed on an "AS
|
||||
-- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
-- implied. See the License for the specific language governing
|
||||
-- rights and limitations under the License.
|
||||
--
|
||||
-- $Id: postgres-create.sql 1489 2007-03-19 11:39:58Z apevec $
|
||||
-- $DateTime: 2003/12/19 15:16:08 $
|
||||
|
||||
\i ddl/postgres/create.sql
|
||||
|
||||
\i ddl/postgres/deferred.sql
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?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="Coventry Councillor"
|
||||
description="A Coventry councillor type"
|
||||
objectType="com.arsdigita.coventry.cms.contenttypes.Councillor"
|
||||
classname="com.arsdigita.coventry.cms.contenttypes.Councillor">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step label="Basic Properties"
|
||||
description= "Edit the name, description, position, political party, ward, area of responsibility, contact and surgery details and term of office"
|
||||
component="com.arsdigita.coventry.cms.contenttypes.ui.CouncillorPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?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="Coventry Person"
|
||||
description="A Coventry person type"
|
||||
objectType="com.arsdigita.coventry.cms.contenttypes.Person"
|
||||
classname="com.arsdigita.coventry.cms.contenttypes.Person">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step label="Basic Properties"
|
||||
description= "Edit the title, name, start date, date/time, location, lead, main contributor, type, map link, and cost"
|
||||
component="com.arsdigita.coventry.cms.contenttypes.ui.PersonPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||
<xrd:adapter objectType="com.arsdigita.coventry.cms.contenttypes.Councillor" extends="com.arsdigita.cms.TextPage" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
|
||||
<xrd:associations rule="include">
|
||||
<xrd:property name="/object/textAsset"/>
|
||||
</xrd:associations>
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||
<xrd:adapter objectType="com.arsdigita.coventry.cms.contenttypes.Person" extends="com.arsdigita.cms.ContentPage" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
|
||||
<xrd:associations rule="include">
|
||||
<xrd:property name="/object/textAsset"/>
|
||||
</xrd:associations>
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<!-- nothing yet -->
|
||||
</registry>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<load>
|
||||
<requires>
|
||||
<table name="inits"/>
|
||||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<table name="cov_persons"/>
|
||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<table name="cov_councillors"/>
|
||||
<initializer class="com.arsdigita.coventry.cms.contenttypes.CouncillorInitializer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
<schema directory="ccm-ldn-coventry-councillor"/>
|
||||
<data class="com.arsdigita.coventry.cms.contenttypes.CouncillorLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<!-- nothing yet -->
|
||||
</registry>
|
||||
|
|
@ -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="cov_persons"/>
|
||||
<initializer class="com.arsdigita.coventry.cms.contenttypes.PersonInitializer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
<schema directory="ccm-ldn-coventry-person"/>
|
||||
<data class="com.arsdigita.coventry.cms.contenttypes.PersonLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
||||
/**
|
||||
* This content type represents an event.
|
||||
*
|
||||
* @version $Revision: #3 $ $Date: 2004/04/08 $
|
||||
**/
|
||||
public class Councillor extends Person {
|
||||
|
||||
private final static org.apache.log4j.Logger s_log =
|
||||
org.apache.log4j.Logger.getLogger(Councillor.class);
|
||||
|
||||
/** PDL property name for event date */
|
||||
public static final String POSITION = "position";
|
||||
public static final String POLITICAL_PARTY = "politicalParty";
|
||||
public static final String WARD = "ward";
|
||||
public static final String AREA_OF_RESPONSIBILITY = "areaOfResponsibility";
|
||||
public static final String TERM_OF_OFFICE = "termOfOffice";
|
||||
public static final String SURGERY_DETAILS = "surgeryDetails";
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.coventry.cms.contenttypes.Councillor";
|
||||
|
||||
public Councillor() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public Councillor(OID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Councillor(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public Councillor(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
// Accessors
|
||||
public String getPosition() {
|
||||
return (String)get(POSITION);
|
||||
}
|
||||
|
||||
public void setPosition(String position) {
|
||||
set(POSITION, position);
|
||||
}
|
||||
|
||||
public String getPoliticalParty() {
|
||||
return (String) get(POLITICAL_PARTY);
|
||||
}
|
||||
|
||||
public void setPoliticalParty(String politicalParty) {
|
||||
set(POLITICAL_PARTY, politicalParty);
|
||||
}
|
||||
|
||||
public String getWard() {
|
||||
return (String) get(WARD);
|
||||
}
|
||||
|
||||
public void setWard(String ward) {
|
||||
set(WARD, ward);
|
||||
}
|
||||
|
||||
public String getAreaOfResponsibility() {
|
||||
return (String) get(AREA_OF_RESPONSIBILITY);
|
||||
}
|
||||
|
||||
public void setAreaOfResponsibility(String areasOfResponsibility) {
|
||||
set(AREA_OF_RESPONSIBILITY, areasOfResponsibility);
|
||||
}
|
||||
|
||||
public String getTermOfOffice() {
|
||||
return (String)get(TERM_OF_OFFICE);
|
||||
}
|
||||
|
||||
public void setTermOfOffice(String termOfOffice) {
|
||||
set(TERM_OF_OFFICE, termOfOffice);
|
||||
}
|
||||
|
||||
public String getSurgeryDetails() {
|
||||
return (String) get(SURGERY_DETAILS);
|
||||
}
|
||||
|
||||
public void setSurgeryDetails(String surgeryDetails) {
|
||||
set(SURGERY_DETAILS, surgeryDetails);
|
||||
}
|
||||
|
||||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.*;import com.arsdigita.cms.ContentType;
|
||||
|
||||
import com.arsdigita.db.*;
|
||||
import com.arsdigita.persistence.pdl.*;
|
||||
import com.arsdigita.runtime.*;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.domain.DomainObjectInstantiator;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* The CMS initializer.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id: CouncillorInitializer.java 1489 2007-03-19 11:39:58Z apevec $
|
||||
*/
|
||||
public class CouncillorInitializer extends ContentTypeInitializer {
|
||||
public final static String versionId =
|
||||
"$Id: CouncillorInitializer.java 1489 2007-03-19 11:39:58Z apevec $" +
|
||||
"$Author: apevec $" +
|
||||
"$DateTime: 2004/03/03 22:35:47 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(CouncillorInitializer.class);
|
||||
|
||||
public CouncillorInitializer() {
|
||||
super("ccm-ldn-coventry-councillor.pdl.mf", Councillor.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public String getTraversalXML() {
|
||||
return "WEB-INF/traversal-adapters/com/arsdigita/coventry/cms/contenttypes/Councillor.xml";
|
||||
}
|
||||
|
||||
public String[] getStylesheets() {
|
||||
return new String[] { "/__ccm__/themes/coventry/types/Councillor.xsl" };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
|
||||
|
||||
/**
|
||||
* Loader.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id: CouncillorLoader.java 1489 2007-03-19 11:39:58Z apevec $
|
||||
*/
|
||||
public class CouncillorLoader extends AbstractContentTypeLoader {
|
||||
public final static String versionId =
|
||||
"$Id: CouncillorLoader.java 1489 2007-03-19 11:39:58Z apevec $" +
|
||||
"$Author: apevec $" +
|
||||
"$DateTime: 2003/12/19 16:20:50 $";
|
||||
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/coventry/cms/contenttypes/Councillor.xml"
|
||||
};
|
||||
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
||||
/**
|
||||
* This content type represents a Coventry Person.
|
||||
*
|
||||
* @version $Revision: #5 $ $Date: 2004/04/08 $
|
||||
**/
|
||||
public class Person extends TextPage {
|
||||
|
||||
private final static org.apache.log4j.Logger s_log =
|
||||
org.apache.log4j.Logger.getLogger(Person.class);
|
||||
|
||||
public static final String CONTACT_DETAILS = "contactDetails";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.coventry.cms.contenttypes.Person";
|
||||
|
||||
public Person() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public Person(OID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Person(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public Person(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return (String)get(DESCRIPTION);
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
set(DESCRIPTION, description);
|
||||
}
|
||||
|
||||
public static final int SUMMARY_LENGTH = 200;
|
||||
public String getSearchSummary() {
|
||||
return com.arsdigita.util.StringUtils.truncateString(getDescription(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
}
|
||||
|
||||
public String getContactDetails() {
|
||||
return (String) get(CONTACT_DETAILS);
|
||||
}
|
||||
|
||||
public void setContactDetails(String contactDetails) {
|
||||
set(CONTACT_DETAILS, contactDetails);
|
||||
}
|
||||
|
||||
public String getBodyText() {
|
||||
TextAsset asset = getTextAsset();
|
||||
if (asset == null) {
|
||||
return "";
|
||||
}
|
||||
return asset.getText();
|
||||
}
|
||||
|
||||
public void setBodyText(String body) {
|
||||
TextAsset asset = getTextAsset();
|
||||
if (asset == null) {
|
||||
asset = new TextAsset();
|
||||
asset.setName(getName() + "_text_" + getID());
|
||||
asset.setParent(this);
|
||||
setTextAsset(asset);
|
||||
}
|
||||
asset.setText(body);
|
||||
}
|
||||
|
||||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.*;import com.arsdigita.cms.ContentType;
|
||||
|
||||
import com.arsdigita.db.*;
|
||||
import com.arsdigita.persistence.pdl.*;
|
||||
import com.arsdigita.runtime.*;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.domain.DomainObjectInstantiator;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* The CMS initializer.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id: PersonInitializer.java 1489 2007-03-19 11:39:58Z apevec $
|
||||
*/
|
||||
public class PersonInitializer extends ContentTypeInitializer {
|
||||
public final static String versionId =
|
||||
"$Id: PersonInitializer.java 1489 2007-03-19 11:39:58Z apevec $" +
|
||||
"$Author: apevec $" +
|
||||
"$DateTime: 2004/03/03 19:14:34 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(PersonInitializer.class);
|
||||
|
||||
public PersonInitializer() {
|
||||
super("ccm-ldn-coventry-person.pdl.mf", Person.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public String getTraversalXML() {
|
||||
return "WEB-INF/traversal-adapters/com/arsdigita/coventry/cms/contenttypes/Person.xml";
|
||||
}
|
||||
|
||||
public String[] getStylesheets() {
|
||||
return new String[] { "/__ccm__/themes/coventry/types/Person.xsl" };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002, 2003 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
|
||||
|
||||
/**
|
||||
* Loader.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id: PersonLoader.java 1489 2007-03-19 11:39:58Z apevec $
|
||||
*/
|
||||
public class PersonLoader extends AbstractContentTypeLoader {
|
||||
public final static String versionId =
|
||||
"$Id: PersonLoader.java 1489 2007-03-19 11:39:58Z apevec $" +
|
||||
"$Author: apevec $" +
|
||||
"$DateTime: 2003/12/19 16:20:50 $";
|
||||
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/coventry/cms/contenttypes/Person.xml"
|
||||
};
|
||||
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
|
||||
import com.arsdigita.coventry.cms.contenttypes.Councillor;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class CouncillorEditForm extends PersonEditForm {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger( CouncillorEditForm.class );
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private TextField m_position;
|
||||
private TextField m_politicalParty;
|
||||
private TextField m_areaOfResponsibility;
|
||||
private SingleSelect m_ward;
|
||||
private TextField m_termOfOffice;
|
||||
private CMSDHTMLEditor m_surgeryDetails;
|
||||
|
||||
private CouncillorPropertiesStep m_step;
|
||||
|
||||
public CouncillorEditForm(ItemSelectionModel itemModel) {
|
||||
super("councillorEdit", itemModel);
|
||||
m_itemModel = itemModel;
|
||||
}
|
||||
|
||||
public CouncillorEditForm(ItemSelectionModel itemModel,
|
||||
CouncillorPropertiesStep step) {
|
||||
this(itemModel);
|
||||
|
||||
m_step = step;
|
||||
addSubmissionListener( this );
|
||||
}
|
||||
|
||||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
m_surgeryDetails = new CMSDHTMLEditor(Councillor.SURGERY_DETAILS);
|
||||
m_surgeryDetails.setRows( 10 );
|
||||
add(new Label("Surgery Details:"));
|
||||
add(m_surgeryDetails);
|
||||
|
||||
m_position = new TextField(Councillor.POSITION);
|
||||
add(new Label("Position"));
|
||||
add(m_position);
|
||||
|
||||
m_politicalParty = new TextField(Councillor.POLITICAL_PARTY);
|
||||
add(new Label("Political Party"));
|
||||
add(m_politicalParty);
|
||||
|
||||
m_ward = new SingleSelect(Councillor.WARD);
|
||||
m_ward.addOption( new Option( "Bablake", "Bablake" ) );
|
||||
m_ward.addOption( new Option( "Binley and Willenhall", "Binley and Willenhall" ) );
|
||||
m_ward.addOption( new Option( "Cheylesmore", "Cheylesmore" ) );
|
||||
m_ward.addOption( new Option( "Earlsdon", "Earlsdon" ) );
|
||||
m_ward.addOption( new Option( "Foleshill", "Foleshill" ) );
|
||||
m_ward.addOption( new Option( "Henley", "Henley" ) );
|
||||
m_ward.addOption( new Option( "Holbrook", "Holbrook" ) );
|
||||
m_ward.addOption( new Option( "Longford", "Longford" ) );
|
||||
m_ward.addOption( new Option( "Lower Stoke", "Lower Stoke" ) );
|
||||
m_ward.addOption( new Option( "Radford", "Radford" ) );
|
||||
m_ward.addOption( new Option( "Sherbourne", "Sherbourne" ) );
|
||||
m_ward.addOption( new Option( "St Michael's", "St Michael's" ) );
|
||||
m_ward.addOption( new Option( "Upper Stoke", "Upper Stoke" ) );
|
||||
m_ward.addOption( new Option( "Wainbody", "Wainbody" ) );
|
||||
m_ward.addOption( new Option( "Westwood", "Westwood" ) );
|
||||
m_ward.addOption( new Option( "Whoberley", "Whoberley" ) );
|
||||
m_ward.addOption( new Option( "Woodlands", "Woodlands" ) );
|
||||
m_ward.addOption( new Option( "Wyken", "Wyken" ) );
|
||||
add(new Label("Ward"));
|
||||
add(m_ward);
|
||||
|
||||
m_areaOfResponsibility
|
||||
= new TextField(Councillor.AREA_OF_RESPONSIBILITY);
|
||||
|
||||
add(new Label("Area of Responsibility"));
|
||||
add(m_areaOfResponsibility);
|
||||
|
||||
m_termOfOffice = new TextField(Councillor.TERM_OF_OFFICE);
|
||||
add(new Label("Term of Office"));
|
||||
add(m_termOfOffice);
|
||||
|
||||
}
|
||||
|
||||
public void initCouncillorEdit(FormSectionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
super.initPersonEdit(event);
|
||||
if (m_itemModel.isSelected(state)) {
|
||||
Councillor councillor
|
||||
= (Councillor)m_itemModel.getSelectedObject(state);
|
||||
m_position.setValue(state, councillor.getPosition());
|
||||
m_politicalParty.setValue(state, councillor.getPoliticalParty());
|
||||
m_ward.setValue(state, councillor.getWard());
|
||||
m_termOfOffice.setValue(state, councillor.getTermOfOffice());
|
||||
m_areaOfResponsibility.setValue(state,
|
||||
councillor.getAreaOfResponsibility());
|
||||
m_surgeryDetails.setValue(state, councillor.getSurgeryDetails());
|
||||
}
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent event) throws FormProcessException {
|
||||
initCouncillorEdit(event);
|
||||
}
|
||||
|
||||
/** Cancels streamlined editing. */
|
||||
public void submitted( FormSectionEvent fse ) {
|
||||
if (m_step != null &&
|
||||
getSaveCancelSection().getCancelButton()
|
||||
.isSelected( fse.getPageState())) {
|
||||
m_step.cancelStreamlinedCreation(fse.getPageState());
|
||||
}
|
||||
}
|
||||
|
||||
public Councillor processCouncillorEdit(FormSectionEvent event) {
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
ACSObjectSelectionModel objectModel =
|
||||
(ACSObjectSelectionModel) m_itemModel;
|
||||
|
||||
Class javaClass = objectModel.getJavaClass();
|
||||
String objectType = objectModel.getObjectType();
|
||||
|
||||
s_log.debug( "Starting process Councillor with model using: " +
|
||||
javaClass.getName() + " " + objectType );
|
||||
}
|
||||
|
||||
PageState state = event.getPageState();
|
||||
Councillor councillor = null;
|
||||
|
||||
councillor = (Councillor)super.processPersonEdit(event);
|
||||
if (councillor != null
|
||||
&& getSaveCancelSection().getSaveButton()
|
||||
.isSelected(state)) {
|
||||
|
||||
councillor.setPosition((String)m_position.getValue(state));
|
||||
councillor.setPoliticalParty((String)m_politicalParty.getValue(state));
|
||||
councillor.setWard((String)m_ward.getValue(state));
|
||||
councillor.setTermOfOffice((String)m_termOfOffice.getValue(state));
|
||||
councillor.setAreaOfResponsibility(
|
||||
(String)m_areaOfResponsibility.getValue(state));
|
||||
councillor.setSurgeryDetails((String)m_surgeryDetails.getValue(state));
|
||||
|
||||
if( null != m_step )
|
||||
m_step.maybeForwardToNextStep(event.getPageState());
|
||||
}
|
||||
|
||||
s_log.debug( "Finished process Councillor" );
|
||||
|
||||
return councillor;
|
||||
}
|
||||
|
||||
public void process(FormSectionEvent event) throws FormProcessException {
|
||||
processCouncillorEdit(event);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes.ui;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.ui.ItemPropertySheet;
|
||||
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.coventry.cms.contenttypes.Councillor;
|
||||
|
||||
/**
|
||||
* Authoring step to edit the simple attributes of the Councillor content type (and
|
||||
* its subclasses). The attributes edited are 'name', 'title', 'councillor date',
|
||||
* 'location', 'lead', 'main contributor', 'councillor type', 'map link', and
|
||||
* 'cost'. This authoring step replaces the
|
||||
* <code>com.arsdigita.ui.authoring.PageEdit</code> step for this type.
|
||||
**/
|
||||
public class CouncillorPropertiesStep extends SimpleEditStep {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
|
||||
public CouncillorPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
|
||||
BasicPageForm editSheet = new CouncillorEditForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME, "Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getCouncillorPropertySheet(itemModel));
|
||||
setDefaultEditKey( EDIT_SHEET_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component that displays the properties of the Councillor 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 getCouncillorPropertySheet(ItemSelectionModel
|
||||
itemModel) {
|
||||
ItemPropertySheet sheet = new ItemPropertySheet(itemModel);
|
||||
|
||||
sheet.add("Name: ", Councillor.TITLE);
|
||||
sheet.add("URL: ", Councillor.NAME);
|
||||
sheet.add("Description: ", Councillor.DESCRIPTION);
|
||||
sheet.add("Body Text: ", Councillor.TEXT_ASSET + "." + TextAsset.CONTENT);
|
||||
sheet.add("Contact Details: ", Councillor.CONTACT_DETAILS);
|
||||
sheet.add("Surgery Details: ", Councillor.SURGERY_DETAILS);
|
||||
sheet.add("Position: ", Councillor.POSITION);
|
||||
sheet.add("Political Party: ", Councillor.POLITICAL_PARTY);
|
||||
sheet.add("Ward: ", Councillor.WARD);
|
||||
sheet.add("Area of Responsibility: ", Councillor.AREA_OF_RESPONSIBILITY);
|
||||
sheet.add("Term of Office: ", Councillor.TERM_OF_OFFICE);
|
||||
sheet.add("Surgery Details: ", Councillor.SURGERY_DETAILS);
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
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.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.TrimmedStringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.ui.authoring.NameValidationListener;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
|
||||
import com.arsdigita.coventry.cms.contenttypes.Person;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class PersonEditForm extends BasicPageForm
|
||||
implements FormInitListener, FormProcessListener, FormSubmissionListener {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger( PersonEditForm.class );
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private ItemSelectionModel m_imageModel;
|
||||
private TextArea m_description;
|
||||
private CMSDHTMLEditor m_bodyText;
|
||||
private CMSDHTMLEditor m_contactDetails;
|
||||
|
||||
private PersonPropertiesStep m_step;
|
||||
|
||||
public PersonEditForm(String label, ItemSelectionModel model ) {
|
||||
super( label, model );
|
||||
|
||||
m_itemModel = model;
|
||||
}
|
||||
|
||||
public PersonEditForm(ItemSelectionModel model) {
|
||||
this("personEdit", model);
|
||||
}
|
||||
|
||||
public PersonEditForm(ItemSelectionModel model,
|
||||
PersonPropertiesStep step) {
|
||||
this("personEdit", model, step);
|
||||
}
|
||||
|
||||
public PersonEditForm(String label,
|
||||
ItemSelectionModel model,
|
||||
PersonPropertiesStep step) {
|
||||
this(label, model);
|
||||
|
||||
m_step = step;
|
||||
addSubmissionListener( this );
|
||||
}
|
||||
|
||||
protected void addWidgets() {
|
||||
add(new Label("Name:"));
|
||||
TextField titleWidget = new TextField(new TrimmedStringParameter(TITLE));
|
||||
titleWidget.addValidationListener(new NotNullValidationListener());
|
||||
titleWidget.setOnFocus("if (this.form." + NAME + ".value == '') { " +
|
||||
" defaulting = true; this.form." + NAME +
|
||||
".value = urlize(this.value); }");
|
||||
titleWidget.setOnKeyUp(
|
||||
"if (defaulting) { this.form." + NAME +
|
||||
".value = urlize(this.value) }"
|
||||
);
|
||||
add(titleWidget);
|
||||
|
||||
add(new Label("URL:"));
|
||||
TextField nameWidget = new TextField(new TrimmedStringParameter(NAME));
|
||||
nameWidget.addValidationListener(new NameValidationListener());
|
||||
nameWidget.setOnFocus("defaulting = false");
|
||||
nameWidget.setOnBlur(
|
||||
"if (this.value == '') " +
|
||||
"{ defaulting = true; this.value = urlize(this.form." + TITLE +
|
||||
".value) }"
|
||||
);
|
||||
add(nameWidget);
|
||||
|
||||
m_description = new TextArea(Person.DESCRIPTION);
|
||||
m_description.setRows( 10 );
|
||||
m_description.setCols( 65 );
|
||||
add(new Label("Description:"));
|
||||
add(m_description);
|
||||
|
||||
m_bodyText = new CMSDHTMLEditor("bodyText");
|
||||
m_bodyText.setRows( 10 );
|
||||
add(new Label("Body Text:"));
|
||||
add(m_bodyText);
|
||||
|
||||
m_contactDetails = new CMSDHTMLEditor(Person.CONTACT_DETAILS);
|
||||
m_contactDetails.setRows( 10 );
|
||||
add(new Label("Contact Details:"));
|
||||
add(m_contactDetails);
|
||||
|
||||
addProcessListener(this);
|
||||
addInitListener(this);
|
||||
|
||||
}
|
||||
|
||||
public void initPersonEdit(FormSectionEvent event) {
|
||||
super.initBasicWidgets(event);
|
||||
PageState state = event.getPageState();
|
||||
if (m_itemModel.isSelected(state)) {
|
||||
Person person = (Person)m_itemModel.getSelectedObject(state);
|
||||
m_bodyText.setValue(state, person.getBodyText());
|
||||
m_description.setValue(state, person.getDescription());
|
||||
m_contactDetails.setValue(state, person.getContactDetails());
|
||||
}
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent event) throws FormProcessException {
|
||||
initPersonEdit(event);
|
||||
}
|
||||
|
||||
/** Cancels streamlined editing. */
|
||||
public void submitted( FormSectionEvent fse ) {
|
||||
if (m_step != null &&
|
||||
getSaveCancelSection().getCancelButton()
|
||||
.isSelected( fse.getPageState())) {
|
||||
m_step.cancelStreamlinedCreation(fse.getPageState());
|
||||
}
|
||||
}
|
||||
|
||||
public Person processPersonEdit(FormSectionEvent event) {
|
||||
if( s_log.isDebugEnabled() ) {
|
||||
ACSObjectSelectionModel objectModel =
|
||||
(ACSObjectSelectionModel) m_itemModel;
|
||||
|
||||
Class javaClass = objectModel.getJavaClass();
|
||||
String objectType = objectModel.getObjectType();
|
||||
|
||||
s_log.debug( "Starting process Person with model using: " +
|
||||
javaClass.getName() + " " + objectType );
|
||||
}
|
||||
|
||||
PageState state = event.getPageState();
|
||||
Person person = null;
|
||||
person
|
||||
= (Person) super.processBasicWidgets(event);
|
||||
if (person != null
|
||||
&& getSaveCancelSection().getSaveButton()
|
||||
.isSelected(state)) {
|
||||
|
||||
person.setBodyText((String)m_bodyText.getValue(state));
|
||||
person.setDescription((String)m_description.getValue(state));
|
||||
person.setContactDetails((String)m_contactDetails.getValue(state));
|
||||
|
||||
if( null != m_step )
|
||||
m_step.maybeForwardToNextStep(event.getPageState());
|
||||
}
|
||||
|
||||
s_log.debug( "Finished process Person" );
|
||||
|
||||
return person;
|
||||
}
|
||||
|
||||
public void process(FormSectionEvent event) throws FormProcessException {
|
||||
processPersonEdit(event);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (C) 2001, 2002 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* The contents of this file are subject to the CCM Public
|
||||
* License (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.redhat.com/licenses/ccmpl.html
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.coventry.cms.contenttypes.ui;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.ui.ItemPropertySheet;
|
||||
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.coventry.cms.contenttypes.Person;
|
||||
|
||||
|
||||
/**
|
||||
* Authoring step to edit the simple attributes of the Person content type.
|
||||
**/
|
||||
public class PersonPropertiesStep extends SimpleEditStep {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
|
||||
public PersonPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
|
||||
BasicPageForm editSheet = new PersonEditForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME, "Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getPersonPropertySheet(itemModel));
|
||||
setDefaultEditKey( EDIT_SHEET_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component that displays the properties of the Person 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 getPersonPropertySheet(ItemSelectionModel
|
||||
itemModel) {
|
||||
ItemPropertySheet sheet = new ItemPropertySheet(itemModel);
|
||||
|
||||
sheet.add("Name: ", Person.TITLE);
|
||||
sheet.add("URL: ", Person.NAME);
|
||||
sheet.add("Description: ", Person.DESCRIPTION);
|
||||
sheet.add("Body Text: ", Person.TEXT_ASSET + "." + TextAsset.CONTENT);
|
||||
sheet.add("Contact Details: ", Person.CONTACT_DETAILS);
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE stylesheet [
|
||||
<!ENTITY nbsp " " ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
|
||||
]>
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||
exclude-result-prefixes="cms"
|
||||
version="1.0">
|
||||
|
||||
<xsl:template match="cms:item[objectType='com.arsdigita.coventry.cms.contenttypes.Councillor']"
|
||||
name="cms:CT_graphics_com_arsdigita_coventry_cms_contenttypes_Councillor">
|
||||
<h1><xsl:value-of select="title"/></h1>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="councillorList"
|
||||
summary="Details for councillor {title}">
|
||||
<tr>
|
||||
<xsl:if test="imageAttachments">
|
||||
<td rowspan="3" class="councillorIMG">
|
||||
<xsl:for-each select="imageAttachments">
|
||||
<img border="1" width="75" height="115">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="$dispatcher-prefix"/>/cms-service/stream/image/?image_id=<xsl:value-of select="image/id" />
|
||||
</xsl:attribute>
|
||||
<!--
|
||||
<xsl:if test="image/width">
|
||||
<xsl:attribute name="width"><xsl:value-of select="image/width" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="image/height">
|
||||
<xsl:attribute name="height"><xsl:value-of select="image/height" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
-->
|
||||
<xsl:attribute name="alt"><xsl:value-of select="caption" /></xsl:attribute>
|
||||
</img>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
</xsl:if>
|
||||
|
||||
<th>Position</th>
|
||||
<td>
|
||||
<xsl:choose>
|
||||
<xsl:when test="position">
|
||||
<xsl:value-of select="position"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Political party</th>
|
||||
<td>
|
||||
<xsl:choose>
|
||||
<xsl:when test="politicalParty">
|
||||
<xsl:value-of select="politicalParty"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Term of office</th>
|
||||
<td>
|
||||
<xsl:choose>
|
||||
<xsl:when test="termOfOffice">
|
||||
<xsl:value-of select="termOfOffice"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<xsl:if test="textAsset/content">
|
||||
<p><xsl:value-of select="textAsset/content" disable-output-escaping="yes"/></p>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="contactDetails">
|
||||
<h2>Contact details</h2>
|
||||
<p><xsl:value-of select="contactDetails" disable-output-escaping="yes"/></p>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="surgeryDetails">
|
||||
<h2>Surgery details</h2>
|
||||
<p><xsl:value-of select="surgeryDetails" disable-output-escaping="yes"/></p>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE stylesheet [
|
||||
<!ENTITY nbsp " " ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
|
||||
]>
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||
exclude-result-prefixes="cms"
|
||||
version="1.0">
|
||||
|
||||
<xsl:template match="cms:item[objectType='com.arsdigita.coventry.cms.contenttypes.Person']"
|
||||
name="cms:CT_graphics_com_arsdigita_coventry_cms_contenttypes_Person">
|
||||
<h1><xsl:value-of select="title"/></h1>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="10" class=
|
||||
"councillorList" summary=
|
||||
"List of the councillor and summary details">
|
||||
<tr>
|
||||
<xsl:if test="imageAttachments">
|
||||
<td class="councillorIMG">
|
||||
<xsl:for-each select="imageAttachments">
|
||||
<img border="1">
|
||||
<xsl:attribute name="src"><xsl:value-of select="$dispatcher-prefix"/>/cms-service/stream/image/?image_id=<xsl:value-of select="image/id" /></xsl:attribute>
|
||||
<xsl:if test="image/width">
|
||||
<xsl:attribute name="width"><xsl:value-of select="image/width" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="image/height">
|
||||
<xsl:attribute name="height"><xsl:value-of select="image/height" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:attribute name="alt"><xsl:value-of select="caption" /></xsl:attribute>
|
||||
</img>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="textAsset/content">
|
||||
<td align="left" valign="top"><p><xsl:value-of select="textAsset/content" disable-output-escaping="yes"/></p></td>
|
||||
</xsl:if>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p/>
|
||||
|
||||
<xsl:if test="contactDetails">
|
||||
<h2>Contact details</h2>
|
||||
<p><xsl:value-of select="contactDetails" disable-output-escaping="yes"/></p>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Navigation Default Index Page,Default Navigation Index Page ordering items in ascending order,/templates/ccm-ldn-navigation/navigation/nav-default.jsp
|
||||
Navigation Recent Items,List of items ordered with most recent first,/templates/ccm-ldn-navigation/navigation/nav-recent.jsp
|
||||
Navigation A-Z Items,List of items paginated as A-Z,/templates/ccm-ldn-navigation/navigation/nav-atoz.jsp
|
||||
Navigation Demo Items Page,Demo items page,/templates/ccm-ldn-navigation/navigation/nav-demo.jsp
|
||||
Navigation Default Index Page,Default Navigation Index Page ordering items in ascending order,/templates/ccm-navigation/navigation/nav-default.jsp
|
||||
Navigation Recent Items,List of items ordered with most recent first,/templates/ccm-navigation/navigation/nav-recent.jsp
|
||||
Navigation A-Z Items,List of items paginated as A-Z,/templates/ccm-navigation/navigation/nav-atoz.jsp
|
||||
Navigation Demo Items Page,Demo items page,/templates/ccm-navigation/navigation/nav-demo.jsp
|
||||
|
|
|
|||
Loading…
Reference in New Issue