Author: pboy
Date: 2013-01-10 02:00:06 +0000 (Thu, 10 Jan 2013)
New Revision: 2454
Added:
contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/
contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationAlert.pdl
contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationApp.pdl
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doAnotherThing.sql
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doSomething.sql
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.1.0-6.6.0.sql
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.0-1.0.1/
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.0-1.0.1/cam_consultations.sql
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.1-1.0.2/
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.1-1.0.2/authoring_kits.sql
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/postgres-1.1.0-6.6.0.sql
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationAlert.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationApp.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationConfig.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationConfig_parameter.properties
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/Initializer.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/Loader.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/AlertRemoveForm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/ConsultationAlertConfirm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/ConsultationAlertForm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/ConsultationsFilter.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/ConsultationsList.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/ConsultationsNavigationModel.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/ConsultationsTable.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/admin/
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/admin/BulkDeletionConfirm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/admin/BulkDeletionForm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ui/admin/BulkMobileDeletionForm.java
contrib/camden/ccm-lbc-consultation/web/templates/
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/admin/
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/admin/deleted.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/admin/index.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/alert-new.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/alert-remove.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/alert-sms-trigger.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/alert-trigger.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/alert.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/index.jsp
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/navigation/
contrib/camden/ccm-lbc-consultation/web/themes/
contrib/camden/ccm-lbc-consultation/web/themes/heirloom/
contrib/camden/ccm-lbc-consultation/web/themes/heirloom/contenttypes/
contrib/camden/ccm-lbc-consultation/web/themes/heirloom/contenttypes/Consultation.xsl
Removed:
contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl
contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationApp.pdl
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/oracle-se/
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationApp.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig_parameter.properties
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/AlertRemoveForm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsFilter.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsList.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsNavigationModel.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsTable.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/admin/
contrib/camden/ccm-lbc-consultation/web/packages/
contrib/camden/ccm-lbc-consultation/web/static/
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/templates/
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/www/
contrib/camden/ccm-lbc-consultation/web/templates/consultations/
Modified:
contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql
contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql
contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.config
contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.load
contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.upgrade
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/Consultation.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationLoader.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationCreate.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationHowStep.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesStep.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationResultsStep.java
contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoStep.java
contrib/camden/ccm-lbc-consultation/web/templates/ccm-lbc-consultation/navigation/consultations-index.jsp
Log:
Update basically completed, package compiles, loads, system starts.
Known problems:
* ConsultationConfig,reference to KernelHelper.getSystemAdministratorEmailAddress() crashes the Loader, uncommented for now.
* The consultation application does not show up but delivers an empty page.
Copied: contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationAlert.pdl (from rev 2439, contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl)
===================================================================
--- contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationAlert.pdl (rev 0)
+++ contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationAlert.pdl 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,118 @@
+//
+// 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: ConsultationAlert.pdl 23 2005-08-02 14:11:47Z clasohm $
+
+model com.arsdigita.camden.cms.consultation;
+
+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[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;
+ String[0..1] mobileNumber = cam_consultation_alerts.mobile_number VARCHAR(100);
+ String[0..1] mobilePin = cam_consultation_alerts.mobile_pin VARCHAR(10);
+ Boolean[0..1] mobileConfirmed = cam_consultation_alerts.mobile_confirmed;
+
+ reference key (cam_consultation_alerts.alert_id);
+}
+
+query newSMSConsultations {
+ BigDecimal id;
+
+ do {
+ select
+ draft.consultation_id
+ from
+ cms_items ci,
+ cam_consultations draft,
+ cam_consultations live
+ where
+ ci.item_id = live.consultation_id
+ and ci.master_id = draft.consultation_id
+ and draft.sms_alert_sent = '0'
+ } map {
+ id = draft.consultation_id;
+ }
+}
+
+data operation setSMSAlertSent {
+ do {
+ update cam_consultations
+ set sms_alert_sent = '1'
+ where consultation_id in :consultationIDs
+ }
+}
+
+
+query newConsultations {
+ BigDecimal id;
+ BigDecimal masterId;
+ String purpose;
+ String contact;
+ String topic;
+ String consultationType;
+ Date startDate;
+ Date completionDate;
+ Date resultsDate;
+ Boolean statutory;
+ String targetAudience;
+ String geoArea;
+ String methodology;
+ String feedback;
+ String title;
+
+ do {
+ select live.*, pa.*, i.master_id
+ from cam_consultations live, cam_consultations draft,
+ cms_pages pa, cms_items i
+ where pa.item_id = live.consultation_id
+ and i.item_id = pa.item_id
+ and i.version = 'live'
+ and draft.consultation_id = i.master_id
+ and draft.alert_sent = '0'
+ } map {
+ id = consultation_id;
+ masterId = master_id;
+ purpose = purpose;
+ contact = contact;
+ topic = topic;
+ consultationType = consultation_type;
+ startDate = start_date;
+ completionDate = completion_date;
+ resultsDate = results_date;
+ statutory = statutory;
+ targetAudience = target_audience;
+ geoArea = geo_area;
+ methodology = methodology;
+ feedback = feedback;
+ title = title;
+ }
+}
+
+data operation setAlertSent {
+ do {
+ update cam_consultations
+ set alert_sent = '1'
+ where consultation_id in :consultationIDs
+ }
+}
Copied: contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationApp.pdl (from rev 2439, contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationApp.pdl)
===================================================================
--- contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationApp.pdl (rev 0)
+++ contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/consultation/ConsultationApp.pdl 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,26 @@
+//
+// 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: ConsultationAlert.pdl 23 2005-08-02 14:11:47Z clasohm $
+
+model com.arsdigita.camden.cms.consultation;
+
+import com.arsdigita.web.Application;
+
+object type ConsultationApp extends Application {
+ reference key (cam_consultation_app.application_id);
+}
Modified: contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl
===================================================================
--- contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2013-01-10 02:00:06 UTC (rev 2454)
@@ -23,20 +23,20 @@
object type Consultation extends ContentPage {
- String[0..1] purpose = cam_consultations.purpose CLOB;
- String[0..1] contact = cam_consultations.contact CLOB;
- String[0..1] topic = cam_consultations.topic;
+ String[0..1] purpose = cam_consultations.purpose CLOB;
+ String[0..1] contact = cam_consultations.contact CLOB;
+ 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;
- 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;
- Boolean[1..1] smsAlertSent = cam_consultations.sms_alert_sent;
+ 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;
+ 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;
+ Boolean[1..1] smsAlertSent = cam_consultations.sms_alert_sent;
reference key (cam_consultations.consultation_id);
}
Deleted: contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl
===================================================================
--- contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2013-01-10 02:00:06 UTC (rev 2454)
@@ -1,118 +0,0 @@
-//
-// 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: ConsultationAlert.pdl 23 2005-08-02 14:11:47Z clasohm $
-
-model com.arsdigita.camden.cms.contenttypes;
-
-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[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;
- String[0..1] mobileNumber = cam_consultation_alerts.mobile_number VARCHAR(100);
- String[0..1] mobilePin = cam_consultation_alerts.mobile_pin VARCHAR(10);
- Boolean[0..1] mobileConfirmed = cam_consultation_alerts.mobile_confirmed;
-
- reference key (cam_consultation_alerts.alert_id);
-}
-
-query newSMSConsultations {
- BigDecimal id;
-
- do {
- select
- draft.consultation_id
- from
- cms_items ci,
- cam_consultations draft,
- cam_consultations live
- where
- ci.item_id = live.consultation_id
- and ci.master_id = draft.consultation_id
- and draft.sms_alert_sent = '0'
- } map {
- id = draft.consultation_id;
- }
-}
-
-data operation setSMSAlertSent {
- do {
- update cam_consultations
- set sms_alert_sent = '1'
- where consultation_id in :consultationIDs
- }
-}
-
-
-query newConsultations {
- BigDecimal id;
- BigDecimal masterId;
- String purpose;
- String contact;
- String topic;
- String consultationType;
- Date startDate;
- Date completionDate;
- Date resultsDate;
- Boolean statutory;
- String targetAudience;
- String geoArea;
- String methodology;
- String feedback;
- String title;
-
- do {
- select live.*, pa.*, i.master_id
- from cam_consultations live, cam_consultations draft,
- cms_pages pa, cms_items i
- where pa.item_id = live.consultation_id
- and i.item_id = pa.item_id
- and i.version = 'live'
- and draft.consultation_id = i.master_id
- and draft.alert_sent = '0'
- } map {
- id = consultation_id;
- masterId = master_id;
- purpose = purpose;
- contact = contact;
- topic = topic;
- consultationType = consultation_type;
- startDate = start_date;
- completionDate = completion_date;
- resultsDate = results_date;
- statutory = statutory;
- targetAudience = target_audience;
- geoArea = geo_area;
- methodology = methodology;
- feedback = feedback;
- title = title;
- }
-}
-
-data operation setAlertSent {
- do {
- update cam_consultations
- set alert_sent = '1'
- where consultation_id in :consultationIDs
- }
-}
Deleted: contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationApp.pdl
===================================================================
--- contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationApp.pdl 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationApp.pdl 2013-01-10 02:00:06 UTC (rev 2454)
@@ -1,7 +0,0 @@
-model com.arsdigita.camden.cms.contenttypes;
-
-import com.arsdigita.web.Application;
-
-object type ConsultationApp extends Application {
- reference key (cam_consultation_app.application_id);
-}
Added: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doAnotherThing.sql
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doAnotherThing.sql (rev 0)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doAnotherThing.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,94 @@
+--
+-- Copyright (C) 2012 Peter Boy 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: upd_system_tables.sql pboy $
+
+-- rename ccm-cms-types-contact to ccm-ldn-types-contact
+-- adjust various system tables to the new name of content type
+
+-- --------------------------------------------
+-- !!! REPLACE BY REQUIRED SQL COMMANDS !!!
+-- --------------------------------------------
+
+alter table init_requirements drop constraint init_requirements_init_f_cmmdn ;
+alter table init_requirements drop constraint init_require_requ_init_f_i6rgg ;
+
+update inits
+ set class_name='com.arsdigita.london.contenttypes.ESDServiceInitializer'
+ where class_name='com.arsdigita.cms.contenttypes.ESDServiceInitializer' ;
+
+update init_requirements
+ set init='com.arsdigita.london.contenttypes.ESDServiceInitializer'
+ where init='com.arsdigita.cms.contenttypes.ESDServiceInitializer' ;
+
+ALTER TABLE init_requirements
+ ADD CONSTRAINT init_requirements_init_f_cmmdn FOREIGN KEY (init)
+ REFERENCES inits (class_name) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION;
+ALTER TABLE init_requirements
+ ADD CONSTRAINT init_require_requ_init_f_i6rgg FOREIGN KEY (required_init)
+ REFERENCES inits (class_name) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION;
+
+
+update content_types
+ set object_type='com.arsdigita.london.contenttypes.ESDService',
+ label='ESD Service',
+ description='An ESDService',
+ classname='com.arsdigita.london.contenttypes.ESDService'
+ where classname='com.arsdigita.cms.contenttypes.ESDService' ;
+
+update authoring_steps
+ set label_key='ESD Service Properties',
+ label_bundle='com.arsdigita.london.contenttypes.ESDServiceResources',
+ description_key='Edit the basic ESDService properties',
+ description_bundle='com.arsdigita.london.contenttypes.ESDServiceResources',
+ component='com.arsdigita.london.contenttypes.ui.ESDServicePropertiesStep'
+ where component='com.arsdigita.cms.contenttypes.ui.ESDServicePropertiesStep' ;
+
+update authoring_steps
+ set label_key='ESD Service Contact',
+ label_bundle='com.arsdigita.london.contenttypes.ESDServiceResources',
+ description_key='Edit/Choose the associated Contact object',
+ description_bundle='com.arsdigita.london.contenttypes.ESDServiceResources',
+ component='com.arsdigita.london.contenttypes.ui.ESDServiceChooseContactStep'
+ where component='com.arsdigita.cms.contenttypes.ui.ESDServiceChooseContactStep' ;
+
+
+
+update acs_objects
+ set (object_type,default_domain_class) =
+ ('com.arsdigita.london.contenttypes.ESDService' ,
+ 'com.arsdigita.london.contenttypes.ESDService' )
+ where default_domain_class like 'com.arsdigita.cms.contenttypes.ESDService' ;
+
+update lucene_docs
+ set type='com.arsdigita.london.contenttypes.ESDService'
+ where type='com.arsdigita.cms.contenttypes.ESDService' ;
+
+update vcx_generic_operations
+ set value=replace(value,'cms.contenttypes.ESDService', 'london.contenttypes.ESDService')
+ where value like '%cms.contenttypes.ESDService%';
+
+update vcx_obj_changes
+ set obj_id=replace(obj_id,'cms.contenttypes.ESDService', 'london.contenttypes.ESDService')
+ where obj_id like '%cms.contenttypes.ESDService%';
+
+update vcx_tags
+ set tagged_oid=replace(tagged_oid,'cms.contenttypes.ESDService', 'london.contenttypes.ESDService')
+ where tagged_oid like '%cms.contenttypes.ESDService%';
+
Added: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doSomething.sql
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doSomething.sql (rev 0)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/default/1.1.0-6.6.0/doSomething.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,47 @@
+--
+-- Copyright (C) 2012 Peter Boy 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: ren_esdservice_table.sql pboy $
+
+-- rename ct_esdservice table to ct_ldn_esdservice table following
+-- ccm naming conventions to make maintenance tasks easier
+
+
+-- --------------------------------------------
+-- !!! REPLACE BY REQUIRED SQL COMMANDS !!!
+-- --------------------------------------------
+
+
+
+-- if we could figure out the old names we could rename constraints too
+-- alter table ct_esdservice drop constraint ... ;
+-- alter table ct_esdservice drop constraint ... ;
+-- alter table ct_esdservice drop constraint ... ;
+
+alter table ct_esdservice RENAME TO ct_ldn_esdservice ;
+
+-- alter table ct_ldn_esdservice
+-- add constraint ct_ldn_esdserv_serv_id_p_5dac0 PRIMARY KEY(service_id);
+-- alter table ct_ldn_esdservice
+-- add constraint ct_ldn_esdserv_cont_id_f_r4d1z FOREIGN KEY (contact_id)
+-- references ct_ldn_contacts (contact_id) MATCH SIMPLE
+-- ON UPDATE NO ACTION ON DELETE NO ACTION;
+-- alter table ct_ldn_esdservice
+-- add constraint ct_ldn_esdserv_serv_id_f_tfkqn FOREIGN KEY (service_id)
+-- references cms_articles (article_id) MATCH SIMPLE
+-- ON UPDATE NO ACTION ON DELETE NO ACTION;
+
Copied: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.0-1.0.1/cam_consultations.sql (from rev 2441, contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql)
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.0-1.0.1/cam_consultations.sql (rev 0)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.0-1.0.1/cam_consultations.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,13 @@
+alter table cam_consultations
+add (alert_sent char(1));
+
+alter table cam_consultations
+add constraint cam_consultat_ale_sent_c_eri9a
+check (alert_sent in ('0', '1'));
+
+update cam_consultations
+set alert_sent = '0';
+
+alter table cam_consultations
+add constraint cam_consultat_ale_sent_c_nn
+check (alert_sent is not null);
Copied: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.1-1.0.2/authoring_kits.sql (from rev 2441, contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql)
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.1-1.0.2/authoring_kits.sql (rev 0)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se/1.0.1-1.0.2/authoring_kits.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,6 @@
+update authoring_kits
+set create_component = 'com.arsdigita.camden.cms.contenttypes.ui.ConsultationCreate'
+where type_id =
+ (select type_id
+ from content_types
+ where object_type = 'com.arsdigita.camden.cms.contenttypes.Consultation');
Modified: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -1 +1 @@
-@ ../oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql
+@ oracle-se/1.0.0-1.0.1/cam_consultations.sql
Modified: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -1 +1 @@
-@ ../oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql
+@ oracle-se/1.0.1-1.0.2/authoring_kits.sql
Copied: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.1.0-6.6.0.sql (from rev 2453, contrib/camden/ccm-lbc-foi/sql/ccm-lbc-foi/upgrade/oracle-se-1.0.4-6.6.0.sql)
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.1.0-6.6.0.sql (rev 0)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/oracle-se-1.1.0-6.6.0.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,21 @@
+--
+-- Copyright (C) 2012 Peter Boy All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: oracle-se-1.1.0-6.6.0.sql pboy $
+
+@@ default/1.1.0-6.6.0/doSomething.sql
+@@ default/1.1.0-6.6.0/doAnotherThing.sql
Copied: contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/postgres-1.1.0-6.6.0.sql (from rev 2453, contrib/camden/ccm-lbc-foi/sql/ccm-lbc-foi/upgrade/postgres-1.0.4-6.6.0.sql)
===================================================================
--- contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/postgres-1.1.0-6.6.0.sql (rev 0)
+++ contrib/camden/ccm-lbc-consultation/sql/ccm-lbc-consultation/upgrade/postgres-1.1.0-6.6.0.sql 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,27 @@
+--
+-- Copyright (C) 2012 Peter Boy All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: postgres-1.1.0-6.6.0.sql pboy $
+
+\echo APLAWS lbc conslultation 1.1.0 -> 6.6.0 Upgrade Script (PostgreSQL)
+
+begin;
+
+\i default/1.1.0-6.6.0/doSomething.sql
+\i default/1.1.0-6.6.0/doAnotherThing.sql
+
+commit;
Modified: contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.config
===================================================================
--- contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.config 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.config 2013-01-10 02:00:06 UTC (rev 2454)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
- <config class="com.arsdigita.camden.cms.contenttypes.ConsultationConfig"
- storage="ccm-lbs-consultation/consultations.properties"/>
+ <config class="com.arsdigita.camden.cms.consultation.ConsultationConfig"
+ storage="ccm-lbs-consultation/consultation.properties"/>
</registry>
Modified: contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.load
===================================================================
--- contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.load 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.load 2013-01-10 02:00:06 UTC (rev 2454)
@@ -8,10 +8,12 @@
</requires>
<provides>
<table name="cam_consultations"/>
+ <initializer class="com.arsdigita.camden.cms.consultation.Initializer"/>
<initializer class="com.arsdigita.camden.cms.contenttypes.ConsultationInitializer"/>
</provides>
<scripts>
<schema directory="ccm-lbc-consultation"/>
<data class="com.arsdigita.camden.cms.contenttypes.ConsultationLoader"/>
+ <data class="com.arsdigita.camden.cms.consultation.Loader"/>
</scripts>
</load>
Modified: contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.upgrade
===================================================================
--- contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.upgrade 2013-01-08 01:05:44 UTC (rev 2453)
+++ contrib/camden/ccm-lbc-consultation/src/ccm-lbc-consultation.upgrade 2013-01-10 02:00:06 UTC (rev 2454)
@@ -11,4 +11,7 @@
<version from="1.0.3" to="1.1.0">
<script sql="ccm-lbc-consultation/upgrade/::database::-1.0.3-1.1.0.sql"/>
</version>
+ <version from="1.1.0" to="6.6.0">
+ <script sql="ccm-lbc-consultation/upgrade/::database::-1.1.0-6.6.0.sql"/>
+ </version>
</upgrade>
Copied: contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationAlert.java (from rev 2439, contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java)
===================================================================
--- contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationAlert.java (rev 0)
+++ contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationAlert.java 2013-01-10 02:00:06 UTC (rev 2454)
@@ -0,0 +1,598 @@
+/*
+ * 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.consultation;
+
+import com.arsdigita.camden.cms.contenttypes.Consultation;
+import com.arsdigita.camden.cms.contenttypes.ConsultationUtil;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.globalization.GlobalizedMessage;
+import com.arsdigita.kernel.ACSObject;
+import com.arsdigita.kernel.security.Crypto;
+import com.arsdigita.mail.Mail;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.DataOperation;
+import com.arsdigita.persistence.DataQuery;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.persistence.Session;
+import com.arsdigita.persistence.SessionManager;
+import com.arsdigita.util.StringUtils;
+import com.arsdigita.web.ParameterMap;
+import com.arsdigita.web.URL;
+import com.arsdigita.web.Web;
+import com.arsdigita.xml.Formatter;
+import com.arsdigita.xml.formatters.DateFormatter;
+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 java.util.Random;
+import javax.mail.MessagingException;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+
+/**
+ * Alert requests for the Camden Consultation content type.
+ * Requests must be confirmed via email before they become
+ * active. Old pending requests are deleted periodically.
+ *
+ * @author Carsten Clasohm
+ * @version $Id: ConsultationAlert.java 25 2005-08-03 16:01:08Z clasohm $
+ */
+public class ConsultationAlert extends ACSObject {
+
+ private static final Logger s_log =
+ Logger.getLogger(ConsultationAlert.class.getName());
+
+ public static final String BASE_DATA_OBJECT_TYPE =
+ "com.arsdigita.camden.cms.contenttypes.ConsultationAlert";
+
+ public static final String FIRST_NAMES = "firstNames";
+ public static final String LAST_NAME = "lastName";
+ public static final String EMAIL = "email";
+ public static final String CREATION_DATE = "creationDate";
+ public static final String CONFIRMATION_TOKEN = "confirmationToken";
+ public static final String CANCELLATION_TOKEN = "cancellationToken";
+ public static final String EMAIL_CONFIRMED = "emailConfirmed";
+ public static final String MOBILE_NUMBER = "mobileNumber";
+ public static final String MOBILE_PIN = "mobilePin";
+ public static final String MOBILE_CONFIRMED = "mobileConfirmed";
+ public final static String CONFIRM_PATH = "/alert.jsp";
+ public final static String CONFIRM_PARAMETER = "co";
+ public final static String CANCEL_PARAMETER = "ca";
+ public final static String CANCEL_SMS_PARAMETER = "cs";
+ public final static String REMOVAL_REQUEST_PARAMETER = "rr";
+
+ public ConsultationAlert() {
+ this(BASE_DATA_OBJECT_TYPE);
+ }
+
+ public ConsultationAlert(OID oid) throws DataObjectNotFoundException {
+ super(oid);
+ }
+
+ public ConsultationAlert(BigDecimal id) throws DataObjectNotFoundException {
+ this(new OID(BASE_DATA_OBJECT_TYPE, id));
+ }
+
+ public ConsultationAlert(DataObject obj) {
+ super(obj);
+ }
+
+ public ConsultationAlert(String type) {
+ super(type);
+
+ setConfirmationToken(getRandomString());
+ setCancellationToken(getRandomString());
+ setEmailConfirmed(Boolean.FALSE);
+ setMobileConfirmed(Boolean.FALSE);
+ setCreationDate(new Date());
+ }
+
+ /**
+ * @return the base PDL object type for this item. Child classes
+ * should override this method to return the correct value.
+ */
+ @Override
+ public String getBaseDataObjectType() {
+ return BASE_DATA_OBJECT_TYPE;
+ }
+
+ public String getFirstNames() {
+ return (String) get(FIRST_NAMES);
+ }
+
+ public void setFirstNames(String value) {
+ set(FIRST_NAMES, value);
+ }
+
+ public String getLastName() {
+ return (String) get(LAST_NAME);
+ }
+
+ public void setLastName(String value) {
+ set(LAST_NAME, value);
+ }
+
+ public String getEmail() {
+ return (String) get(EMAIL);
+ }
+
+ public void setEmail(String value) {
+ set(EMAIL, value);
+ }
+
+ public Date getCreationDate() {
+ return (Date) get(CREATION_DATE);
+ }
+
+ public void setCreationDate(Date value) {
+ set(CREATION_DATE, value);
+ }
+
+ public String getConfirmationToken() {
+ return (String) get(CONFIRMATION_TOKEN);
+ }
+
+ public void setConfirmationToken(String value) {
+ set(CONFIRMATION_TOKEN, value);
+ }
+
+ public String getCancellationToken() {
+ return (String) get(CANCELLATION_TOKEN);
+ }
+
+ public void setCancellationToken(String value) {
+ set(CANCELLATION_TOKEN, value);
+ }
+
+ public Boolean getEmailConfirmed() {
+ return (Boolean) get(EMAIL_CONFIRMED);
+ }
+
+ public void setEmailConfirmed(Boolean value) {
+ set(EMAIL_CONFIRMED, value);
+ }
+
+ public String getMobileNumber() {
+ return (String) get(MOBILE_NUMBER);
+ }
+
+ public void setMobileNumber(String value) {
+ set(MOBILE_NUMBER, value);
+ }
+
+ public String getMobilePin() {
+ return (String) get(MOBILE_PIN);
+ }
+
+ public void randomizePin(int length) {
+ set(MOBILE_PIN, getRandomPin(length));
+ }
+
+ public void clearMobilePin() {
+ set(MOBILE_PIN, null);
+ }
+
+ public Boolean getMobileConfirmed() {
+ return (Boolean) get(MOBILE_CONFIRMED);
+ }
+
+ public void setMobileConfirmed(Boolean value) {
+ set(MOBILE_CONFIRMED, value);
+ }
+
+ private String getRandomString() {
+ byte[] salt = new byte[8];
+ try {
+ Crypto.getRandom().nextBytes(salt);
+ } catch (GeneralSecurityException e) {
+ throw new RuntimeException(e);
+ }
+
+ String result = new String((new Base64()).encode(salt));
+
+ // Convert characters which could be problematic in a URL.
+ result = result.replace('+', 'p').
+ replace('=', 'e').
+ replace('/', 's');
+
+ return result;
+ }
+
+ private String getRandomPin(int length) {
+ StringBuilder pin = new StringBuilder(length);
+ Random random;
+ try {
+ random = Crypto.getRandom();
+ } catch (GeneralSecurityException e) {
+ throw new RuntimeException(e);
+ }
+ for (int i=0; i<length; i++) {
+ pin.append(random.nextInt(10));
+ }
+ return pin.toString();
+ }
+
+
+ public static String confirm(String token) {
+ DataCollection alerts =
+ SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
+ alerts.addEqualsFilter(CONFIRMATION_TOKEN, token);
+
+ String result = null;
+ if (alerts.next()) {
+ ConsultationAlert alert =
+ new ConsultationAlert(alerts.getDataObject());
+ alerts.close();
+
+ result = alert.getEmail();
+
+ alert.setEmailConfirmed(Boolean.TRUE);
+ alert.save();
+ }
+
+ return result;
+ }
+
+ public static String cancel(String token) {
+ DataCollection alerts =
+ SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
+ alerts.addEqualsFilter(CANCELLATION_TOKEN, token);
+
+ String result = null;
+ if (alerts.next()) {
+ ConsultationAlert alert =
+ new ConsultationAlert(alerts.getDataObject());
+ alerts.close();
+
+ result = alert.getEmail();
+
+ alert.delete();
+ }
+
+ return result;
+ }
+
+ public static String cancelSMS(String token) {
+ DataCollection alerts =
+ SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
+ alerts.addEqualsFilter(CANCELLATION_TOKEN, token);
+
+ String result = null;
+ if (alerts.next()) {
+ ConsultationAlert alert =
+ new ConsultationAlert(alerts.getDataObject());
+ alerts.close();
+
+ result = alert.getMobileNumber();
+ alert.setMobileNumber(null);
+ alert.clearMobilePin();
+ alert.setMobileConfirmed(Boolean.FALSE);
+ alert.save();
+ }
+
+ return result;
+ }
+
+
+ public static ConsultationAlert findByEmail(String email) {
+ DataCollection alerts =
+ SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
+ alerts.addEqualsFilter(EMAIL, email);
+
+ ConsultationAlert alert = null;
+ if (alerts.next()) {
+ alert = new ConsultationAlert(alerts.getDataObject());
+ alerts.close();
+ }
+
+ return alert;
+ }
+
+ /**
+ * Deletes alert requests which have not been confirmed, and which
+ * are older than 24h.
+ */
+ public static void purgeUnconfirmed() {
+ Session dbSession = SessionManager.getSession();
+ int dbType = dbSession.getDatabase();
+
+ DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE);
+
+ alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.FALSE);
+ alerts.addFilter("creationDate < current_date - 1");
+
+ while (alerts.next()) {
+ ConsultationAlert alert =
+ new ConsultationAlert(alerts.getDataObject());
+ alert.delete();
+ }
+ }
+
+
+ /**
+ * <p>Sends alert SMS if there are newly published Consultation items
+ * since the last time SMS alerts have been sent.
+ * </p>
+ */
+
+ public static void sendSMSAlerts() {
+ Session dbSession = SessionManager.getSession();
+ Locale locale = Locale.getDefault();
+
+ DataQuery items =
+ dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newSMSConsultations");
+
+ Collection itemIDs = new LinkedList();
+ while (items.next()) {
+ itemIDs.add( (BigDecimal) items.get(Consultation.ID));
+ }
+
+ int itemCount = itemIDs.size();
+ if (itemCount == 0) {
+ return;
+ }
+
+ ConsultationApp app = ConsultationApp.retrieveApplication();
+ String consultationURL = URL.there(app, "", null).getURL();
+
+ // Compose the text of an SMS instance:
+
+ DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE);
+ alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.TRUE);
+ alerts.addEqualsFilter(MOBILE_CONFIRMED, Boolean.TRUE);
+
+ String siteURL = URL.root().getURL();
+ String from = ConsultationUtil.getConfig().getAlertsSenderEmail();
+
+ while (alerts.next()) {
+
+ ConsultationAlert alert = new ConsultationAlert(alerts.getDataObject());
+
+ String[] args = { String.valueOf(itemCount), siteURL, consultationURL,
+ alert.getEmail(), alert.getFirstNames(), alert.getLastName() };
+ // Not sure whether the subject gets through the gateway at all, but just in case
+ String smsSubject = (String) ConsultationUtil.globalize("sms.alert.subject", args).localize(locale);
+ String smsText = (String) ConsultationUtil.globalize("sms.alert.text", args).localize(locale);
+
+ String mobile = alert.getMobileNumber();
+ // Convert mobile number to email2sms gateway address
+ String smsEmail = ConsultationUtil.getConfig().getSMSProvider().getEmail(mobile);
+
+ try {
+ s_log.debug("About to send SMS alert to " + mobile + " using email: " + smsEmail + ", body: " + smsText);
+ Mail.send(smsEmail, from, smsSubject, smsText);
+ } catch (MessagingException ex) {
+ s_log.warn("Exception while sending consultation alert to " +
+ smsEmail + ": " + ex.getMessage());
+ }
+ }
+
+ DataOperation op =
+ dbSession.retrieveDataOperation("com.arsdigita.camden.cms.contenttypes.setSMSAlertSent");
+ op.setParameter("consultationIDs", itemIDs);
+ op.execute();
+ }
+
+
+ /**
+ * <p>Sends alert emails for all published Consultation items
+ * for which no alerts have been sent yet. Only sends an alert
+ * if the item has never been published before. This should be run
+ * once a day.</p>
+ */
+ public static void sendAlerts() {
+ Session dbSession = SessionManager.getSession();
+ Locale locale = Locale.getDefault();
+
+ // First get the list of consultations for which we should send alerts,
+ // and build the text common to all alerts.
+ DataQuery items =
+ dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newConsultations");
+
+ if (items.isEmpty())
+ return;
+
+ String titleLabel =
+ (String)ConsultationUtil.globalize("title").localize(locale);
+ String urlLabel =
+ (String)ConsultationUtil.globalize("url").localize(locale);
+ String statusLabel =
+ (String)ConsultationUtil.globalize("status").localize(locale);
+ String purposeLabel =
+ (String)ConsultationUtil.globalize("purpose").localize(locale);
+ String contactLabel =
+ (String)ConsultationUtil.globalize("contact").localize(locale);
+ String topicLabel =
+ (String)ConsultationUtil.globalize("topic").localize(locale);
+ String typeLabel =
+ (String)ConsultationUtil.globalize("type").localize(locale);
+ String startDateLabel =
+ (String)ConsultationUtil.globalize("start_date").localize(locale);
+ String completionDateLabel =
+ (String)ConsultationUtil.globalize("completion_date").localize(locale);
+ String resultsDateLabel =
+ (String)ConsultationUtil.globalize("results_date").localize(locale);
+ String statutoryLabel =
+ (String)ConsultationUtil.globalize("statutory").localize(locale);
+ String targetAudienceLabel =
+ (String)ConsultationUtil.globalize("target_audience").localize(locale);
+ String geoAreaLabel =
+ (String)ConsultationUtil.globalize("geo_area").localize(locale);
+
+ String siteURL = URL.root().getURL();
+ URL rootURL = URL.root();
+
+ // Remove the trailing slash, if there is one.
+ if (siteURL.endsWith("/"))
+ siteURL = siteURL.substring(0, siteURL.length()-1);
+
+ Formatter dateFormatter = new DateFormatter();
+ String itemList = "";
+ Collection itemIDs = new LinkedList();
+
+ while (items.next()) {
+ String title = (String)items.get(Consultation.TITLE);
+ String purpose = StringUtils.htmlToText((String)items.get(Consultation.PURPOSE));
+ String contact = StringUtils.htmlToText((String)items.get(Consultation.CONTACT));
+ BigDecimal id = (BigDecimal)items.get("masterId");
+
+ OID oid = new OID(Consultation.BASE_DATA_OBJECT_TYPE, id);
+ ParameterMap map = new ParameterMap();
+ map.setParameter("oid", oid.toString());
+ map.setParameter("context", "live");
+ String itemURL = siteURL + (new URL(rootURL.getScheme(),
+ rootURL.getServerName(),
+ rootURL.getServerPort(),
+ "",
+ "",
+ "/redirect/", map )).toString();
+
+ 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));
+
+ Date startDateDate = (Date)items.get(Consultation.START_DATE);
+ String startDate = null;
+ if (startDateDate != null)
+ startDate = dateFormatter.format(startDateDate);
+
+ Date completionDateDate = (Date)items.get(Consultation.COMPLETION_DATE);
+ String completionDate = null;
+ if (completionDateDate != null)
+ completionDate = dateFormatter.format(completionDateDate);
+
+ Date resultsDateDate = (Date)items.get(Consultation.RESULTS_DATE);
+ String resultsDate = null;
+ if (resultsDateDate != null)
+ resultsDate = dateFormatter.format(resultsDateDate);
+
+ GlobalizedMessage statusMsg =
+ Consultation.getStatus(startDateDate, completionDateDate);
+ String status = null;
+ if (statusMsg != null)
+ status = (String)statusMsg.localize(locale);
+
+ Boolean statutoryFlag = (Boolean)items.get(Consultation.STATUTORY);
+ String statutory =
+ (String)GlobalizationUtil.
+ globalize(statutoryFlag != null && statutoryFlag.booleanValue() ? "yes" : "no").
+ localize(locale);
+
+ itemList +=
+ "----------\n\n" +
+ urlLabel + ": " + itemURL + "\n\n" +
+ titleLabel + ": " + title + "\n";
+
+ if (status != null)
+ itemList += statusLabel + ": " + status + "\n";
+
+ if (!"".equals(purpose))
+ itemList += "\n" + purposeLabel + ":\n" + purpose.trim() + "\n";
+
+ if (!"".equals(contact))
+ itemList += "\n" + contactLabel + ":\n" + contact.trim() + "\n";
+
+ itemList += "\n";
+
+ if (topic != null)
+ itemList += topicLabel + ": " + topic + "\n";
+ if (consultationType != null)
+ itemList += typeLabel + ": " + consultationType + "\n";
+ if (startDate != null)
+ itemList += startDateLabel + ": " + startDate + "\n";
+ if (completionDate != null)
+ itemList += completionDateLabel + ": " + completionDate + "\n";
+ if (resultsDate != null)
+ itemList += resultsDateLabel + ": " + resultsDate + "\n";
+ itemList += statutoryLabel + ": " + statutory + "\n";
+ if (targetAudience != null)
+ itemList += targetAudienceLabel + ": " + targetAudience + "\n";
+ if (geoArea != null)
+ itemList += geoAreaLabel + ": " + geoArea + "\n";
+
+ itemList += "\n";
+
+ itemIDs.add(id);
+ }
+
+ DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE);
+ alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.TRUE);
+
+ String siteName = Web.getConfig().getSiteName();
+ String from = ConsultationUtil.getConfig().getAlertsSenderEmail();
+
+ String[] args1 = { siteName };
+ String subject =
+ (String)ConsultationUtil.globalize("alert.subject", args1).localize(locale);
+
+ while (alerts.next()) {
+ String email = (String)alerts.get(EMAIL);
+ String firstNames = (String)alerts.get(FIRST_NAMES);
+ String lastName = (String)alerts.get(LAST_NAME);
+ String cancelToken = (String)alerts.get(CANCELLATION_TOKEN);
+
+ String recipientName = email;
+ if (firstNames != null && !"".equals(firstNames)) {
+ recipientName = firstNames;
+ if (lastName == null && !"".equals(lastName))
+ recipientName += " " + lastName;
+ }
+
+ ConsultationApp app = ConsultationApp.retrieveApplication();
+ ParameterMap parameters = new ParameterMap();
+ parameters.setParameter(ConsultationAlert.CANCEL_PARAMETER,
+ cancelToken);
+ String cancelURL =
+ URL.there(app, ConsultationAlert.CONFIRM_PATH, parameters).getURL();
+
+ String[] args2 =
+ { recipientName, email, siteName, siteURL };
+ String header =
+ (String)ConsultationUtil.globalize("alert.header", args2).localize(locale);
+
+ String[] args3 =
+ { email, cancelURL, siteName, siteURL };
+ String footer =
+ (String)ConsultationUtil.globalize("alert.footer", args3).localize(locale);
+
+ String body = header + "\n\n" + itemList + "----------\n\n" + footer;
+
+ try {
+ s_log.debug("About to send mail to " + email + "\nSubject: " + subject + "\nBody:\n" + body);
+ Mail.send(email, from, subject, body);
+ } catch (MessagingException ex) {
+ s_log.warn("Exception while sending consultation alert to " +
+ email + ": " + ex.getMessage());
+ }
+ }
+
+ DataOperation op =
+ dbSession.retrieveDataOperation("com.arsdigita.camden.cms.contenttypes.setAlertSent");
+ op.setParameter("consultationIDs", itemIDs);
+ op.execute();
+ }
+
+}
Copied: contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/consultation/ConsultationApp.java (from rev 2439, contrib/camden/ccm-lbc-consultation/src/com/arsdigita/camden/cms/contenttypes/ConsultationApp.java)
===================================================================
--- contrib/camden/ccm-lbc-co...
[truncated message content] |