SimpleSurvey umgestellt auf legacy free application. Ebenfalls theme umgestellt.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1554 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-03-27 00:46:55 +00:00
parent f371065415
commit 78057f06a3
14 changed files with 273 additions and 30 deletions

View File

@ -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);
}

View File

@ -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 ;

View File

@ -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 ;

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,5 @@
<upgrade>
<version from="6.6.0" to="6.6.1">
<script sql="ccm-simplesurvey/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade>

View File

@ -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);
}
} );
}
}

View File

@ -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);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
version="1.0">
<xsl:import href="../../../../packages/simplesurvey/xsl/simplesurvey.xsl"/>
<xsl:import href="../../packages/simple-survey/xsl/simplesurvey.xsl"/>
</xsl:stylesheet>

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:simplesurvey="http://www.arsdigita.com/simplesurvey/1.0"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0">
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
version="1.0">
<!-- IMPORT DEFINITIONS ccm-simplesurvey installed as separate web application
<xsl:import href="../../../../ROOT/packages/content-section/xsl/cms.xsl"/>
@ -10,7 +10,7 @@
<!-- IMPORT DEFINITIONS ccm-simplesurvey installed into the main CCM webapp
-->
<xsl:import href="../../../packages/content-section/xsl/cms.xsl"/>
<xsl:import href="../../packages/cms/xsl/cms.xsl"/>
<xsl:import href="view.xsl"/> <!-- Stylesheet for the page for submitting a survey -->
<xsl:import href="survey-response-data.xsl"/> <!-- Stylesheet for the CSV file page -->