diff --git a/ccm-simplesurvey/pdl/com/arsdigita/simplesurvey/SimpleSurvey.pdl b/ccm-simplesurvey/pdl/com/arsdigita/simplesurvey/SimpleSurvey.pdl
index 2a01ec325..f6012f896 100755
--- a/ccm-simplesurvey/pdl/com/arsdigita/simplesurvey/SimpleSurvey.pdl
+++ b/ccm-simplesurvey/pdl/com/arsdigita/simplesurvey/SimpleSurvey.pdl
@@ -22,5 +22,6 @@ model com.arsdigita.simplesurvey;
import com.arsdigita.web.Application;
object type SimpleSurvey extends Application {
- reference key (ss_simplesurvey.application_id);
+ // nothing to persist
+ // reference key (ss_simplesurvey.application_id);
}
diff --git a/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/default/6.6.0-6.6.1/drop_app_table.sql b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/default/6.6.0-6.6.1/drop_app_table.sql
new file mode 100644
index 000000000..93d2bde62
--- /dev/null
+++ b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/default/6.6.0-6.6.1/drop_app_table.sql
@@ -0,0 +1,23 @@
+--
+-- 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: drop_app_table.sql pboy $
+
+-- drops table ss_simplesurvey which just contained application type id and is
+-- never used for any action.
+
+drop table ss_simplesurvey ;
diff --git a/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/default/6.6.0-6.6.1/remove_simplesurvey_legacy_entries.sql b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/default/6.6.0-6.6.1/remove_simplesurvey_legacy_entries.sql
new file mode 100644
index 000000000..2a0f9e5b2
--- /dev/null
+++ b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/default/6.6.0-6.6.1/remove_simplesurvey_legacy_entries.sql
@@ -0,0 +1,131 @@
+--
+-- 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: remove_simplesurvey_legacy_entries.sql $
+
+-- ccm-simplesurvey is now initialized as a legacy free type
+-- of application so entries in tables apm_package_types are no longer needed.
+
+
+-- in case there may be several application instances!
+
+-- delete from object_context all entries referring to node_id in site_nodes
+delete from object_context
+ where object_id in
+ (select node_id from site_nodes object_id where object_id in
+ ( select package_id from applications where application_type_id =
+ (select application_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%')
+ )
+ );
+
+-- delete from acs_objects all entries referring to node_id in site_nodes
+alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
+delete from acs_objects
+ where object_id in
+ (select node_id from site_nodes where object_id in
+ ( select package_id from applications where application_type_id =
+ (select application_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%')
+ )
+ );
+
+-- delete all entries in site_nodes referring to a simplesurvey instance
+delete from site_nodes
+ where object_id in
+ (select package_id from applications where application_type_id =
+ (select application_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%')
+ );
+alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
+ FOREIGN KEY (node_id)
+ REFERENCES acs_objects (object_id) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION ;
+
+
+
+-- delete from object_context all entries referring to package_id in apm_packages
+delete from object_context
+ where object_id in
+ (select package_id from apm_packages where package_type_id =
+ (select package_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%')
+ );
+
+-- delete from acs_objects all entries referring to package_id in apm_packages
+alter table apm_packages drop constraint apm_package_package_id_f_46may ;
+alter table applications drop constraint application_package_id_f_cdaho ;
+delete from acs_objects
+ where object_id in
+ (select package_id from apm_packages where package_type_id =
+ (select package_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%')
+ );
+
+-- delete all entries for simplesurvey instances in apm_packages
+-- identified by package_type_id in application_types
+delete from apm_packages
+ where package_type_id =
+ (select package_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%') ;
+
+-- there seem to be no intries for a apm_packages_types entry (row) in
+-- acs_objects or object_context!
+
+-- delete all entries for subsite in apm_package_types identified by
+-- package_type_id in application_types
+alter table application_types drop constraint applica_typ_pac_typ_id_f_v80ma ;
+delete from apm_package_types
+ where package_type_id =
+ (select package_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%') ;
+
+
+-- set package_id to null for all entries referring to a simplesurvey instance
+-- (indicating a new legacy free application)
+update applications
+ set package_id = null
+ where application_type_id =
+ (select application_type_id from application_types
+ where object_type
+ like '%simplesurvey.SimpleSurvey%') ;
+
+-- set package_id to null for all entries referring to a simplesurvey instance
+-- (indicating a new legacy free application)
+update application_types
+ set package_type_id = null
+ where object_type like '%simplesurvey.SimpleSurvey%' ;
+
+alter table application_types add constraint applica_typ_pac_typ_id_f_v80ma
+ FOREIGN KEY (package_type_id)
+ REFERENCES apm_package_types (package_type_id)
+ MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ;
+alter table applications add constraint application_package_id_f_cdaho
+ FOREIGN KEY (package_id)
+ REFERENCES apm_packages (package_id) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION ;
+alter table apm_packages add constraint apm_package_package_id_f_46may
+ FOREIGN KEY (package_id)
+ REFERENCES acs_objects (object_id) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION ;
diff --git a/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-upgrade-5.2.0-5.2.1.sql b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-5.2.0-5.2.1.sql
similarity index 100%
rename from ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-upgrade-5.2.0-5.2.1.sql
rename to ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-5.2.0-5.2.1.sql
diff --git a/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-6.6.0-6.6.1.sql b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-6.6.0-6.6.1.sql
new file mode 100644
index 000000000..c37a11f66
--- /dev/null
+++ b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/oracle-se-6.6.0-6.6.1.sql
@@ -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
+--
+-- $DateTime: 2012/03/27 23:15:09 $
+-- $Id: oracle-se-6.6.0-6.6.1 pboy $
+
+PROMPT Red Hat Enterprise SimpleSurvey 6.6.0 -> 6.6.1 Upgrade Script (Oracle)
+
+-- drop table ss_simplesurvey - not needed anyway
+@@ default/6.6.0-6.6.1/drop_app_table.sql
+
+-- remove legacy compatible bits
+@@ default/6.6.0-6.6.1/remove_simplesurvey_legacy_entries.sql
diff --git a/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/postgres-6.6.0-6.6.1.sql b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/postgres-6.6.0-6.6.1.sql
new file mode 100644
index 000000000..647593ab9
--- /dev/null
+++ b/ccm-simplesurvey/sql/ccm-simplesurvey/upgrade/postgres-6.6.0-6.6.1.sql
@@ -0,0 +1,30 @@
+--
+-- 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
+--
+-- $DateTime: 2010/11/10 23:15:09 $
+
+\echo Red Hat Enterprise SimpleSurvey 6.6.0 -> 6.6.1 Upgrade Script (PostgreSQL)
+
+begin;
+
+-- drop table subsite_app - not needed anyway
+\i default/6.6.0-6.6.1/drop_app_table.sql
+
+-- remove legacy compatible bits
+\i default/6.6.0-6.6.1/remove_simplesurvey_legacy_entries.sql
+
+commit;
diff --git a/ccm-simplesurvey/src/ccm-simplesurvey.upgrade b/ccm-simplesurvey/src/ccm-simplesurvey.upgrade
new file mode 100755
index 000000000..cdacdbd3d
--- /dev/null
+++ b/ccm-simplesurvey/src/ccm-simplesurvey.upgrade
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Initializer.java b/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Initializer.java
index e641e0a1b..1bd50ad00 100755
--- a/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Initializer.java
+++ b/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Initializer.java
@@ -19,13 +19,18 @@
package com.arsdigita.simplesurvey;
import com.arsdigita.db.DbHelper;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.kernel.ACSObjectInstantiator;
+import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.runtime.CompoundInitializer;
-// import com.arsdigita.runtime.LegacyInitializer;
+import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
+import org.apache.log4j.Logger;
+
/**
* Initializes ccm-simplesurvey at each system startup.
*
@@ -34,6 +39,9 @@ import com.arsdigita.runtime.RuntimeConfig;
*/
public class Initializer extends CompoundInitializer {
+ /** Creates a s_logging category with name = to the full name of class */
+ private static Logger s_log = Logger.getLogger(Initializer.class);
+
/**
* Constructor. Delegates to the old initializer system.
*/
@@ -46,6 +54,26 @@ public class Initializer extends CompoundInitializer {
("ccm-simplesurvey.pdl.mf",
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
-// add(new LegacyInitializer("com/arsdigita/simplesurvey/enterprise.init"));
+ }
+
+ /**
+ * Initializes domain-coupling machinery, usually consisting of
+ * registering object instantiators and observers.
+ */
+ @Override
+ public void init(DomainInitEvent e) {
+ s_log.debug("SimpleSurvey Initializer.init(DomainInitEvent) invoked");
+ super.init(e);
+
+ /* Register object instantiator for Workspace (Content Center) */
+ e.getFactory().registerInstantiator
+ (SimpleSurvey.BASE_DATA_OBJECT_TYPE,
+ new ACSObjectInstantiator() {
+ @Override
+ public DomainObject doNewInstance(DataObject dobj) {
+ return new SimpleSurvey(dobj);
+ }
+ } );
+
}
}
diff --git a/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java b/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java
index 0ecc69c98..0c2e976ae 100755
--- a/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java
+++ b/ccm-simplesurvey/src/com/arsdigita/simplesurvey/Loader.java
@@ -54,7 +54,9 @@ public class Loader extends PackageLoader {
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
+
setupSimpleSurveyPackage();
+
}
}.run();
}
@@ -97,35 +99,31 @@ public class Loader extends PackageLoader {
"com.arsdigita.simplesurvey.ui.widgets.RadioEditor" )
);
-
- ApplicationSetup setup = new ApplicationSetup(s_log);
-
- setup.setApplicationObjectType(SimpleSurvey.BASE_DATA_OBJECT_TYPE);
- setup.setKey("simplesurvey");
- setup.setTitle("Simple Survey");
- // setup.setDescription("Simple Survey");
- setup.setDescription("A simple survey application.");
- setup.setInstantiator(new ACSObjectInstantiator() {
- @Override
- public DomainObject doNewInstance(DataObject dataObject) {
- return new SimpleSurvey(dataObject);
- }
- });
- ApplicationType type = setup.run();
+ /* Create new type legacy free application type
+ * NOTE: The wording in the title parameter of ApplicationType
+ * determines the name of the subdirectory for the XSL stylesheets.
+ * It gets "urlized", i.e. trimming leading and trailing blanks and
+ * replacing blanks between words and illegal characters with an
+ * hyphen and converted to lower case.
+ * "Content Center" will become "content-center". */
+ ApplicationType type = new
+ ApplicationType("Simple Survey",
+ SimpleSurvey.BASE_DATA_OBJECT_TYPE );
+ type.setDescription("An application to conduct a simple survey.");
type.save();
if (!Application.isInstalled(SimpleSurvey.BASE_DATA_OBJECT_TYPE,
"/simplesurvey/")) {
- Application app =
- Application.createApplication(type,
- "simplesurvey",
- "Simplesurvey",
- null);
+ Application app = Application.createApplication(type,
+ "simplesurvey",
+ "Simplesurvey",
+ null);
+ app.setDescription("The default Survey application instance.");
app.save();
}
// Load the widgets types (i.e. description and class names to be
- // instantiated ad runtime) used in survey forms into database.
+ // instantiated at runtime) used in survey forms into database.
FormbuilderSetup fbs = new FormbuilderSetup();
fbs.setup(widgetTypes, null, null);
diff --git a/ccm-simplesurvey/web/__ccm__/apps/simplesurvey/xsl/index.xsl b/ccm-simplesurvey/web/themes/heirloom/apps/simple-survey/xsl/index.xsl
similarity index 51%
rename from ccm-simplesurvey/web/__ccm__/apps/simplesurvey/xsl/index.xsl
rename to ccm-simplesurvey/web/themes/heirloom/apps/simple-survey/xsl/index.xsl
index 87ab9c042..9347d8e70 100755
--- a/ccm-simplesurvey/web/__ccm__/apps/simplesurvey/xsl/index.xsl
+++ b/ccm-simplesurvey/web/themes/heirloom/apps/simple-survey/xsl/index.xsl
@@ -1,7 +1,7 @@
+ version="1.0">
-
+
diff --git a/ccm-simplesurvey/web/packages/simplesurvey/css/simplesurvey.css b/ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/css/simplesurvey.css
similarity index 100%
rename from ccm-simplesurvey/web/packages/simplesurvey/css/simplesurvey.css
rename to ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/css/simplesurvey.css
diff --git a/ccm-simplesurvey/web/packages/simplesurvey/xsl/simplesurvey.xsl b/ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/simplesurvey.xsl
similarity index 75%
rename from ccm-simplesurvey/web/packages/simplesurvey/xsl/simplesurvey.xsl
rename to ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/simplesurvey.xsl
index 647fad80a..425dfa697 100755
--- a/ccm-simplesurvey/web/packages/simplesurvey/xsl/simplesurvey.xsl
+++ b/ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/simplesurvey.xsl
@@ -1,8 +1,8 @@
-
-
+ xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
+ version="1.0">
-
+
diff --git a/ccm-simplesurvey/web/packages/simplesurvey/xsl/survey-response-data.xsl b/ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/survey-response-data.xsl
similarity index 100%
rename from ccm-simplesurvey/web/packages/simplesurvey/xsl/survey-response-data.xsl
rename to ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/survey-response-data.xsl
diff --git a/ccm-simplesurvey/web/packages/simplesurvey/xsl/view.xsl b/ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/view.xsl
similarity index 100%
rename from ccm-simplesurvey/web/packages/simplesurvey/xsl/view.xsl
rename to ccm-simplesurvey/web/themes/heirloom/packages/simple-survey/xsl/view.xsl