Author: apevec Date: 2005-11-17 21:37:08 +0100 (Thu, 17 Nov 2005) New Revision: 999 Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.2-1.0.3.sql Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationTextContentProvider.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/GeoAreaFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TargetFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TopicFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TypeFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoStep.java Log: final version of Consultation CT: topic, consultationType, targetAudience and geoArea properties are migrated from 0..1 to 0..n Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-11-17 20:37:08 UTC (rev 999) @@ -2,7 +2,7 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-camden-consultation" prettyName="Red Hat CCM Content Types" - version="1.0.2" + version="1.0.3" release="1" webapp="ROOT"> <ccm:dependencies> Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2005-11-17 20:37:08 UTC (rev 999) @@ -25,14 +25,14 @@ String[0..1] purpose = cam_consultations.purpose CLOB; String[0..1] contact = cam_consultations.contact CLOB; - Integer[0..1] topic = cam_consultations.topic; - Integer[0..1] consultationType = cam_consultations.consultation_type; + String[0..1] topic = cam_consultations.topic; + String[0..1] consultationType = cam_consultations.consultation_type; Date[0..1] startDate = cam_consultations.start_date; Date[0..1] completionDate = cam_consultations.completion_date; Date[0..1] resultsDate = cam_consultations.results_date; Boolean[0..1] statutory = cam_consultations.statutory; - Integer[0..1] targetAudience = cam_consultations.target_audience; - Integer[0..1] geoArea = cam_consultations.geo_area; + String[0..1] targetAudience = cam_consultations.target_audience; + String[0..1] geoArea = cam_consultations.geo_area; String[0..1] methodology = cam_consultations.methodology CLOB; String[0..1] feedback = cam_consultations.feedback CLOB; Boolean[1..1] alertSent = cam_consultations.alert_sent; @@ -41,7 +41,7 @@ } association { - Consultation[0..1] methodologyConsultation = + Consultation[0..1] methodologyConsultation = join cms_files.file_id to cam_consult_method_file_map.file_id, join cam_consult_method_file_map.consultation_id @@ -55,7 +55,7 @@ } association { - Consultation[0..1] feedbackConsultation = + Consultation[0..1] feedbackConsultation = join cms_files.file_id to cam_consult_feedback_file_map.file_id, join cam_consult_feedback_file_map.consultation_id @@ -72,8 +72,8 @@ Consultation consultation; do { - select * - from + select * + from (select i.*, co.*, l.start_date_time, row_number() over (order by l.start_date_time desc) as rn from cam_consultations co, cms_items i, @@ -85,20 +85,20 @@ where rn <= :maxCount order by start_date_time desc } map { - consultation.id = consultation_id; - consultation.purpose = purpose; - consultation.contact = contact; - consultation.topic = topic; - consultation.consultationType = consultation_type; - consultation.startDate = start_date; - consultation.completionDate = completion_date; - consultation.resultsDate = results_date; - consultation.statutory = statutory; - consultation.targetAudience = target_audience; - consultation.geoArea = geo_area; - consultation.methodology = methodology; - consultation.feedback = feedback; - consultation.name = name; - consultation.type = type; + consultation.id = consultation_id; + consultation.purpose = purpose; + consultation.contact = contact; + consultation.topic = topic; + consultation.consultationType = consultation_type; + consultation.startDate = start_date; + consultation.completionDate = completion_date; + consultation.resultsDate = results_date; + consultation.statutory = statutory; + consultation.targetAudience = target_audience; + consultation.geoArea = geo_area; + consultation.methodology = methodology; + consultation.feedback = feedback; + consultation.name = name; + consultation.type = type; } } Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-11-17 20:37:08 UTC (rev 999) @@ -22,13 +22,13 @@ import com.arsdigita.kernel.*; object type ConsultationAlert extends ACSObject { - String[0..1] firstNames = cam_consultation_alerts.first_names VARCHAR(100); - String[0..1] lastName = cam_consultation_alerts.last_name VARCHAR(100); - String[1..1] email = cam_consultation_alerts.email VARCHAR(100); - Date[1..1] creationDate = cam_consultation_alerts.creation_date; + String[0..1] firstNames = cam_consultation_alerts.first_names VARCHAR(100); + String[0..1] lastName = cam_consultation_alerts.last_name VARCHAR(100); + String[1..1] email = cam_consultation_alerts.email VARCHAR(100); + Date[1..1] creationDate = cam_consultation_alerts.creation_date; String[1..1] confirmationToken = cam_consultation_alerts.confirmation_token VARCHAR(100); String[1..1] cancellationToken = cam_consultation_alerts.cancellation_token VARCHAR(100); - Boolean[1..1] emailConfirmed = cam_consultation_alerts.email_confirmed; + Boolean[1..1] emailConfirmed = cam_consultation_alerts.email_confirmed; reference key (cam_consultation_alerts.alert_id); } @@ -37,14 +37,14 @@ BigDecimal id; String purpose; String contact; - Integer topic; - Integer consultationType; + String topic; + String consultationType; Date startDate; Date completionDate; Date resultsDate; Boolean statutory; - Integer targetAudience; - Integer geoArea; + String targetAudience; + String geoArea; String methodology; String feedback; String title; Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.2-1.0.3.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.2-1.0.3.sql 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.2-1.0.3.sql 2005-11-17 20:37:08 UTC (rev 999) @@ -0,0 +1,21 @@ +-- upgrade 1.0.2 -> 1.0.3, final version +-- 0..n properties are encoded as a slash separated list of values +create table tmp_CAM_CONSULTATIONS +as select consultation_id, topic, consultation_type, target_audience, geo_area + from CAM_CONSULTATIONS; + +update CAM_CONSULTATIONS set topic=null, consultation_type=null, target_audience=null, geo_area=null; + +alter table CAM_CONSULTATIONS modify ( + topic varchar2(4000), + consultation_type varchar2(4000), + target_audience varchar2(4000), + geo_area varchar2(4000) +); + +update CAM_CONSULTATIONS set geo_area = (select to_char(geo_area) from tmp_CAM_CONSULTATIONS t where t.consultation_id = consultation_id); +update CAM_CONSULTATIONS set target_audience = (select to_char(target_audience) from tmp_CAM_CONSULTATIONS t where t.consultation_id = consultation_id); +update CAM_CONSULTATIONS set consultation_type = (select to_char(consultation_type) from tmp_CAM_CONSULTATIONS t where t.consultation_id = consultation_id); +update CAM_CONSULTATIONS set topic = (select to_char(topic) from tmp_CAM_CONSULTATIONS t where t.consultation_id = consultation_id); + +drop table tmp_CAM_CONSULTATIONS; Modified: contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-11-17 20:37:08 UTC (rev 999) @@ -5,4 +5,7 @@ <version from="1.0.1" to="1.0.2"> <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.1-1.0.2.sql"/> </version> + <version from="1.0.2" to="1.0.3"> + <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.2-1.0.3.sql"/> + </version> </upgrade> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-11-17 20:37:08 UTC (rev 999) @@ -20,6 +20,9 @@ import java.math.BigDecimal; import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.StringTokenizer; import org.apache.log4j.Logger; @@ -33,9 +36,13 @@ import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.Session; +import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.metadata.Property; import com.arsdigita.util.StringUtils; @@ -74,6 +81,8 @@ public static final String FEEDBACK_DOCUMENTS = "feedbackDocuments"; public static final String ALERT_SENT = "alertSent"; + private static final String SEPARATOR = "/"; + private boolean m_wasNew = true; public Consultation() { @@ -122,44 +131,120 @@ set(CONTACT, value); } - public Integer getTopic() { - return (Integer) get(TOPIC); - } - - public GlobalizedMessage getPrettyTopic() { - Integer i = getTopic(); - if (i == null) + public String[] getTopic() { + String value = (String) get(TOPIC); + if (value == null) { return null; - - return ConsultationUtil.globalize("topicOption" + i); + } + List topics = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + while (tok.hasMoreTokens()) { + String topic = tok.nextToken(); + Integer.valueOf(topic); // integer check + topics.add(topic); + } + return (String[]) topics.toArray(new String[0]); } - public static GlobalizedMessage getPrettyTopic(Integer i) { + public String getPrettyTopic() { + return internalGetPrettyTopics((String) get(TOPIC)); + } + + public static String internalGetPrettyTopics(String value) { + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer topics = new StringBuffer(); + topics.append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + topics.append(',').append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); + } + return topics.toString(); + } else { + return " "; + } + } + + private static GlobalizedMessage getPrettyTopic(Integer i) { return ConsultationUtil.globalize("topicOption" + i); } - public void setTopic(Integer value) { - set(TOPIC, value); + public void setTopic(String[] topics) { + if (topics == null || topics.length == 0) { + set(TOPIC, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=topics.length-1; + for (int i=0; i<n; i++) { + String topic = topics[i]; + Integer.valueOf(topic); // integer check + value.append(topic).append(SEPARATOR); + } + String topic = topics[n]; + Integer.valueOf(topic); // integer check + value.append(topic); + set(TOPIC,value.toString()); } - - public Integer getConsultationType() { - return (Integer) get(CONSULTATION_TYPE); + + public String[] getConsultationType() { + String value = (String) get(CONSULTATION_TYPE); + if (value == null) { + return null; + } + List types = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + while (tok.hasMoreTokens()) { + String type = tok.nextToken(); + Integer.valueOf(type); // integer check + types.add(type); + } + return (String[]) types.toArray(new String[0]); } - public GlobalizedMessage getPrettyType() { - Integer i = getConsultationType(); - if (i == null) - return null; - - return ConsultationUtil.globalize("typeOption" + i); + public String getPrettyType() { + return internalGetPrettyTypes((String) get(CONSULTATION_TYPE)); } - public static GlobalizedMessage getPrettyType(Integer i) { + public static String internalGetPrettyTypes(String value) { + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer types = new StringBuffer(); + types.append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + types.append(',').append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); + } + return types.toString(); + } else { + return " "; + } + } + + private static GlobalizedMessage getPrettyType(Integer i) { return ConsultationUtil.globalize("typeOption" + i); } - public void setConsultationType(Integer value) { - set(CONSULTATION_TYPE, value); + public void setConsultationType(String[] types) { + if (types == null || types.length == 0) { + set(CONSULTATION_TYPE, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=types.length-1; + for (int i=0; i<n; i++) { + String type = types[i]; + Integer.valueOf(type); // integer check + value.append(type).append(SEPARATOR); + } + String type = types[n]; + Integer.valueOf(type); // integer check + value.append(type); + set(CONSULTATION_TYPE,value.toString()); } public Date getStartDate() { @@ -206,44 +291,120 @@ set(ALERT_SENT, value); } - public Integer getTargetAudience() { - return (Integer) get(TARGET_AUDIENCE); + public String[] getTargetAudience() { + String value = (String) get(TARGET_AUDIENCE); + if (value == null) { + return null; + } + List targets = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + while (tok.hasMoreTokens()) { + String target = tok.nextToken(); + Integer.valueOf(target); // integer check + targets.add(target); + } + return (String[]) targets.toArray(new String[0]); } - public GlobalizedMessage getPrettyTarget() { - Integer i = getTargetAudience(); - if (i == null) - return null; - - return ConsultationUtil.globalize("targetOption" + i); + public String getPrettyTarget() { + return internalGetPrettyTargets((String) get(TARGET_AUDIENCE)); } + + public static String internalGetPrettyTargets(String value) { + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer targets = new StringBuffer(); + targets.append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + targets.append(',').append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); + } + return targets.toString(); + } else { + return " "; + } + } - public static GlobalizedMessage getPrettyTarget(Integer i) { + private static GlobalizedMessage getPrettyTarget(Integer i) { return ConsultationUtil.globalize("targetOption" + i); } - public void setTargetAudience(Integer value) { - set(TARGET_AUDIENCE, value); + public void setTargetAudience(String[] targets) { + if (targets == null || targets.length == 0) { + set(TARGET_AUDIENCE, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=targets.length-1; + for (int i=0; i<n; i++) { + String target = targets[i]; + Integer.valueOf(target); // integer check + value.append(target).append(SEPARATOR); + } + String target = targets[n]; + Integer.valueOf(target); // integer check + value.append(target); + set(TARGET_AUDIENCE,value.toString()); } - public Integer getGeoArea() { - return (Integer) get(GEO_AREA); + public String[] getGeoArea() { + String value = (String) get(GEO_AREA); + if (value == null) { + return null; + } + List geos = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + while (tok.hasMoreTokens()) { + String geo = tok.nextToken(); + Integer.valueOf(geo); // integer check + geos.add(geo); + } + return (String[]) geos.toArray(new String[0]); } - public GlobalizedMessage getPrettyGeoArea() { - Integer i = getGeoArea(); - if (i == null) - return null; - - return ConsultationUtil.globalize("geoOption" + i); + public String getPrettyGeoArea() { + return internalGetPrettyGeoAreas((String) get(GEO_AREA)); } + + public static String internalGetPrettyGeoAreas(String value) { + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer geos = new StringBuffer(); + geos.append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + geos.append(',').append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); + } + return geos.toString(); + } else { + return " "; + } + } - public static GlobalizedMessage getPrettyGeoArea(Integer i) { + private static GlobalizedMessage getPrettyGeoArea(Integer i) { return ConsultationUtil.globalize("geoOption" + i); } - public void setGeoArea(Integer value) { - set(GEO_AREA, value); + public void setGeoArea(String[] geoAreas) { + if (geoAreas == null || geoAreas.length == 0) { + set(GEO_AREA, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=geoAreas.length-1; + for (int i=0; i<n; i++) { + String geoArea = geoAreas[i]; + Integer.valueOf(geoArea); // integer check + value.append(geoArea).append(SEPARATOR); + } + String geoArea = geoAreas[n]; + Integer.valueOf(geoArea); // integer check + value.append(geoArea); + set(GEO_AREA,value.toString()); } public String getMethodology() { Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-11-17 20:37:08 UTC (rev 999) @@ -3,7 +3,9 @@ import java.lang.reflect.Array; import java.math.BigDecimal; import java.security.GeneralSecurityException; +import java.util.Collection; import java.util.Date; +import java.util.LinkedList; import java.util.Locale; import javax.mail.MessagingException; @@ -298,9 +300,8 @@ Formatter dateFormatter = new DateFormatter(); String itemList = ""; - BigDecimal[] itemIDs = - (BigDecimal[])Array.newInstance(BigDecimal.class, (int)items.size()); - int i = 0; + Collection itemIDs = new LinkedList(); + while (items.next()) { String title = (String)items.get(Consultation.TITLE); String purpose = StringUtils.htmlToText((String)items.get(Consultation.PURPOSE)); @@ -311,30 +312,11 @@ siteURL + Navigation.redirectURL(new OID(Consultation.BASE_DATA_OBJECT_TYPE, id)); - Integer topicId = (Integer)items.get(Consultation.TOPIC); - String topic = null; - if (topicId != null) - topic = - (String)Consultation.getPrettyTopic(topicId).localize(locale); + String topic = Consultation.internalGetPrettyTopics((String)items.get(Consultation.TOPIC)); + String consultationType = Consultation.internalGetPrettyTypes((String)items.get(Consultation.CONSULTATION_TYPE)); + String targetAudience = Consultation.internalGetPrettyTargets((String)items.get(Consultation.TARGET_AUDIENCE)); + String geoArea = Consultation.internalGetPrettyGeoAreas((String)items.get(Consultation.GEO_AREA)); - Integer typeId = (Integer)items.get(Consultation.CONSULTATION_TYPE); - String consultationType = null; - if (typeId != null) - consultationType = - (String)Consultation.getPrettyType(typeId).localize(locale); - - Integer targetId = (Integer)items.get(Consultation.TARGET_AUDIENCE); - String targetAudience = null; - if (targetId != null) - targetAudience = - (String)Consultation.getPrettyTarget(targetId).localize(locale); - - Integer geoId = (Integer)items.get(Consultation.GEO_AREA); - String geoArea = null; - if (geoId != null) - geoArea = - (String)Consultation.getPrettyGeoArea(geoId).localize(locale); - Date startDateDate = (Date)items.get(Consultation.START_DATE); String startDate = null; if (startDateDate != null) @@ -404,7 +386,7 @@ itemList += "\n"; - itemIDs[i++] = id; + itemIDs.add(id); } DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-11-17 20:37:08 UTC (rev 999) @@ -24,14 +24,45 @@ topic=Topic topicOption0=Culture -topicOption1=Environmental Health -topicOption2=Equalities/Diversity +#OLD topicOption1=Environmental Health +topicOption1=Environmental health and consumer protection +#OLD topicOption2=Equalities/Diversity +topicOption2=Equalities/diversity topicOption3=Health -topicOption4=Housing Needs -topicOption5=Leisure Centres +#OLD topicOption4=Housing Needs +topicOption4=Housing +#OLD topicOption5=Leisure Centres +topicOption5=Leisure centres topicOption6=Libraries topicOption7=Planning -topicOption8=Services For Children +#OLD topicOption8=Services For Children +topicOption8=Social care +# NEW from IT 83236 +topicOption9=Anti-social behaviour +topicOption10=Business and the local economy +topicOption11=Children and young people +topicOption12=Communications +topicOption13=Community leadership +topicOption14=Council tax and business rates +topicOption15=Crime and community safety +#Culture +topicOption16=Drugs +topicOption17=Education +#Environmental health and consumer protection +#Equalities/diversity +#Health +#Housing +#Leisure centres +#Libraries +topicOption18=Parking +topicOption19=Parks +#Planning +topicOption20=Quality of life +topicOption21=Quality of the environment +#Social care +topicOption22=Transport +topicOption23=Voluntary sector +topicOption24=Waste Management type=Type typeOption0=Online Questionnaire @@ -40,21 +71,56 @@ typeOption3=Meeting target_audience=Target Audience -targetOption0=Citizens Panel Members -targetOption1=Community/Voluntary Groups -targetOption2=Council Staff -targetOption3=Disabled People -targetOption4=Non-Service Users +#OLD targetOption0=Citizens Panel Members +targetOption0=Citizens panel members +#OLD targetOption1=Community/Voluntary Groups +targetOption1=Community/voluntary groups +#OLD targetOption2=Council Staff +targetOption2=Council staff +#OLD targetOption3=Disabled People +targetOption3=Disabled people +#OLD targetOption4=Non-Service Users +targetOption4=Non-service users targetOption5=Residents -targetOption6=Schools - Parents -targetOption7=Schools - School Staff -targetOption8=Service Users -targetOption9=Specific Black Or Ethnic Minority Group +#OLD targetOption6=Schools - Parents +targetOption6=Parents +#OLD targetOption7=Schools - School Staff +targetOption7=School staff +#OLD targetOption8=Service Users +targetOption8=Service users +#OLD targetOption9=Specific Black Or Ethnic Minority Group +targetOption9=Black and minority ethnic groups +# NEW from IT 83236 +targetOption10=Businesses +targetOption11=Carers +targetOption12=Children +#Citizens panel members +#Community/voluntary groups +#Council staff +targetOption13=Councillors +#Disabled people +targetOption14=Faith communities +targetOption15=Health service users +targetOption16=Lesbian, gay, bisexual and transgender groups +targetOption17=Landlords +targetOption18=Leaseholders +#Non-service users +targetOption19=Older people +targetOption20=Other local service providers +#Parents +targetOption21=Police +targetOption22=Pupils +targetOption23=Residents +#School staff +#Service users +targetOption24=Council tenants +targetOption25=Young people geo_area=Geographical Area geoOption0=Hampstead Town geoOption1=Highgate -geoOption2=Frognal & Fitzjohns +#geoOption2=Frognal & Fitzjohns +geoOption2=Frognal and Fitzjohns geoOption3=Fortune Green geoOption4=West Hampstead geoOption5=Kilburn @@ -66,10 +132,25 @@ geoOption11=Haverstock geoOption12=Camden Town with Primrose Hill geoOption13=Regents Park -geoOption14=St Pancras & Somers Town +#geoOption14=St Pancras & Somers Town +geoOption14=St Pancras and Somers Town geoOption15=Kings Cross -geoOption17=Bloomsbury -geoOption18=Holborn & Covent Garden +geoOption16=Bloomsbury +#geoOption17=Holborn & Covent Garden +geoOption17=Holborn and Covent Garden +# NEW from IT 83236 +geoOption18=Camden-wide +#------------------------------------------- +geoOption19=Adelaide NRA +geoOption20=Camden Central NRA +geoOption21=Caversham NRA +geoOption22=Covent Garden NRA +geoOption23=Gospel Oak NRA +geoOption24=Highgate NRA +geoOption25=Holborn NRA +geoOption26=Kilburn NRA +geoOption27=Kings Cross NRA +geoOption28=West Euston NRA methodology=Methodology methodology_documents=Methodology Documents Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationTextContentProvider.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationTextContentProvider.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationTextContentProvider.java 2005-11-17 20:37:08 UTC (rev 999) @@ -59,7 +59,7 @@ private StringBuffer m_text; public ConsultationTextRenderer() { - m_text = new StringBuffer(""); + m_text = new StringBuffer(); } public String getText() { @@ -105,27 +105,22 @@ if ("/object".equals(path)) { String propertyName = property.getName(); - if ("consultationType".equals(propertyName)) - m_text.append(" " - + Consultation.getPrettyType( - (Integer) value).localize(locale)); + m_text.append(Consultation.internalGetPrettyTypes( + (String) value)); else if ("topic".equals(propertyName)) - m_text.append(" " - + Consultation.getPrettyTopic( - (Integer) value).localize(locale)); + m_text.append(Consultation.internalGetPrettyTopics( + (String) value)); else if ("geoArea".equals(propertyName)) - m_text.append(" " - + Consultation.getPrettyGeoArea( - (Integer) value).localize(locale)); + m_text.append(Consultation.internalGetPrettyGeoAreas( + (String) value)); else if ("targetAudience".equals(propertyName)) - m_text.append(" " - + Consultation.getPrettyTarget( - (Integer) value).localize(locale)); + m_text.append(Consultation.internalGetPrettyTargets( + (String) value)); else - m_text.append(" " + value); + m_text.append(' ').append(value); } else - m_text.append(" " + value); + m_text.append(' ').append(value); } } } @@ -162,7 +157,7 @@ private void appendTextAsset(TextAsset asset) { String content = asset.getText(); if (content != null) { - m_text.append(" " + StringUtils.htmlToText(content)); + m_text.append(' ').append(StringUtils.htmlToText(content)); } } @@ -184,7 +179,7 @@ s_log.debug("Converted file is: " + converted); } - m_text.append(" ").append(converted); + m_text.append(' ').append(converted); } catch (ConversionException e) { s_log.error("Error converting FileAsset " + asset.getOID() + " with MimeType " + asset.getMimeType(), e); Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/GeoAreaFormatter.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/GeoAreaFormatter.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/GeoAreaFormatter.java 2005-11-17 20:37:08 UTC (rev 999) @@ -1,5 +1,6 @@ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.persistence.DataAssociation; import com.arsdigita.xml.Formatter; /** @@ -16,7 +17,7 @@ if (value == null) return ""; - return (String)Consultation.getPrettyGeoArea((Integer)value).localize(); + return Consultation.internalGetPrettyGeoAreas((String) value); } } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TargetFormatter.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TargetFormatter.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TargetFormatter.java 2005-11-17 20:37:08 UTC (rev 999) @@ -1,5 +1,6 @@ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.persistence.DataAssociation; import com.arsdigita.xml.Formatter; /** @@ -16,7 +17,7 @@ if (value == null) return ""; - return (String)Consultation.getPrettyTarget((Integer)value).localize(); + return Consultation.internalGetPrettyTargets((String) value); } } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TopicFormatter.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TopicFormatter.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TopicFormatter.java 2005-11-17 20:37:08 UTC (rev 999) @@ -1,5 +1,6 @@ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.persistence.DataAssociation; import com.arsdigita.xml.Formatter; /** @@ -16,7 +17,8 @@ if (value == null) return ""; - return (String)Consultation.getPrettyTopic((Integer)value).localize(); + return Consultation.internalGetPrettyTopics((String) value); + } } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TypeFormatter.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TypeFormatter.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TypeFormatter.java 2005-11-17 20:37:08 UTC (rev 999) @@ -1,5 +1,6 @@ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.persistence.DataAssociation; import com.arsdigita.xml.Formatter; /** @@ -16,7 +17,7 @@ if (value == null) return ""; - return (String)Consultation.getPrettyType((Integer)value).localize(); + return Consultation.internalGetPrettyTypes((String) value); } } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutForm.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutForm.java 2005-11-17 20:37:08 UTC (rev 999) @@ -33,6 +33,7 @@ import com.arsdigita.bebop.form.CheckboxGroup; import com.arsdigita.bebop.form.DHTMLEditor; import com.arsdigita.bebop.form.Date; +import com.arsdigita.bebop.form.MultipleSelect; import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.parameters.TrimmedStringParameter; @@ -53,8 +54,8 @@ private final static String ID = "FORM_ABOUT"; private ConsultationAboutStep m_step; - private SingleSelect m_topicWidget; - private SingleSelect m_typeWidget; + private MultipleSelect m_topicWidget; + private MultipleSelect m_typeWidget; /** * Creates a new form to edit the Consultation object specified @@ -88,28 +89,23 @@ consultation.setPurpose(data.getString(Consultation.PURPOSE)); consultation.setContact(data.getString(Consultation.CONTACT)); - Integer i = null; - String s = data.getString(Consultation.TOPIC); - if (!"".equals(s)) - i = new Integer(s); - consultation.setTopic(i); + String[] values = (String[]) data.get(Consultation.TOPIC); + consultation.setTopic(values); - i = null; - s = data.getString(Consultation.CONSULTATION_TYPE); - if (!"".equals(s)) - i = new Integer(s); - consultation.setConsultationType(i); + values = (String[]) data.get(Consultation.CONSULTATION_TYPE); + consultation.setConsultationType(values); consultation.setStartDate(data.getDate(Consultation.START_DATE)); consultation.setCompletionDate(data.getDate(Consultation.COMPLETION_DATE)); consultation.setResultsDate(data.getDate(Consultation.RESULTS_DATE)); - String[] statutoryValues = (String[])data.get(Consultation.STATUTORY); + values = (String[])data.get(Consultation.STATUTORY); Boolean statutory = Boolean.FALSE; - if (statutoryValues != null && - statutoryValues.length > 0 && - "1".equals(statutoryValues[0])) + if (values != null && + values.length > 0 && + "1".equals(values[0])) statutory = Boolean.TRUE; consultation.setStatutory(statutory); + consultation.save(); if (m_step != null) @@ -157,18 +153,12 @@ contactWidget.setRows(10); add(contactWidget); - Label labelNone = - new Label(ConsultationUtil.globalize("option_none")); - Option optionNone = new Option("", labelNone); - add(new Label(ConsultationUtil.globalize("topic"))); - m_topicWidget = new SingleSelect(Consultation.TOPIC); - m_topicWidget.addOption(optionNone); + m_topicWidget = new MultipleSelect(Consultation.TOPIC); add(m_topicWidget); add(new Label(ConsultationUtil.globalize("type"))); - m_typeWidget = new SingleSelect(Consultation.CONSULTATION_TYPE); - m_typeWidget.addOption(optionNone); + m_typeWidget = new MultipleSelect(Consultation.CONSULTATION_TYPE); add(m_typeWidget); add(new Label(ConsultationUtil.globalize("start_date"))); Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java 2005-11-15 22:33:41 UTC (rev 998) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java 2005-11-17 20:37:08 UTC (rev 999) @@ -25,6 +25,7 @@ import com.arsdigita.bebop.PageState; import com.arsdigita.camden.cms.contenttypes.Consultation; import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.camden.cms.contenttypes.TopicListFormatter; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicItemForm; @@ -49,7 +50,7 @@ /** The name of the editing sheet added to this step */ public static String EDIT_SHEET_NAME = "SHEET_ABOUT"; - + public ConsultationAboutStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { super( itemModel, parent ); @@ -82,24 +83,16 @@ sheet.add(ConsultationUtil.globalize("contact"), Consultation.CONTACT); sheet.add(ConsultationUtil.globalize("topic"), Consultation.TOPIC, - new AttributeFormatter() { - public String format(DomainObject obj, String attribute, PageState state) { .. |