Zweiter Teil subsite, diverse Fehlerkorrekturen, Update Script.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1331 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
4d624f4d88
commit
ea417ba2f7
|
|
@ -2,14 +2,14 @@
|
|||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-subsite"
|
||||
prettyName="Subsite"
|
||||
version="6.6.0"
|
||||
version="6.6.1"
|
||||
release="1"
|
||||
webapp="ROOT">
|
||||
<ccm:dependencies>
|
||||
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-navigation" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-ldn-util" version="6.6.0" relation="ge"/>
|
||||
</ccm:dependencies>
|
||||
<ccm:contacts>
|
||||
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ application context: [webapps]/ccm-ldn-subsite.
|
|||
Now it is installed inside the main APLAWS application context along
|
||||
with all other applications.
|
||||
|
||||
Also, ccm-ldn-subsite is renamed to ccm-subsite.
|
||||
|
||||
If shortcuts should be installed as its own web context again following
|
||||
modifications are necessary:
|
||||
1. remove webapp="xxx" from application.xml
|
||||
2. move the files in this dir to WEB-INF/
|
||||
3. change src/com/ad/london/subsite/Subsite.java
|
||||
3. change src/com/ad/subsite/Subsite.java
|
||||
method getServletContext() as back to "/files"
|
||||
4. edit __ccm__/.../xsl/index.xsl according the comment
|
||||
5. edit in ccm-ldn-aplaws /web/__ccm__/themes/aplaws/subsite.xml
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@ import com.arsdigita.cms.TemplateContext;
|
|||
|
||||
|
||||
object type Site extends ACSObject {
|
||||
String[1..1] title = subsite_site.title VARCHAR(100);
|
||||
String[0..1] description = subsite_site.description VARCHAR(4000);
|
||||
unique String[1..1] hostname = subsite_site.hostname VARCHAR(250);
|
||||
String[0..1] styleDirectory = subsite_site.style_dir VARCHAR(50);
|
||||
String[1..1] title = subsite_sites.title VARCHAR(100);
|
||||
String[0..1] description = subsite_sites.description VARCHAR(4000);
|
||||
unique String[1..1] hostname = subsite_sites.hostname VARCHAR(250);
|
||||
String[0..1] styleDirectory = subsite_sites.style_dir VARCHAR(50);
|
||||
|
||||
Application[1..1] frontPage = join subsite_site.front_page_id
|
||||
Application[1..1] frontPage = join subsite_sites.front_page_id
|
||||
to applications.application_id;
|
||||
component TemplateContext[1..1] templateContext = join subsite_site.template_context
|
||||
component TemplateContext[1..1] templateContext = join subsite_sites.template_context
|
||||
to cms_template_use_contexts.use_context;
|
||||
|
||||
|
||||
reference key (subsite_site.site_id);
|
||||
reference key (subsite_sites.site_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,14 @@
|
|||
// 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: Subsite.pdl pboy $
|
||||
|
||||
model com.arsdigita.subsite;
|
||||
|
||||
import com.arsdigita.web.Application;
|
||||
|
||||
object type Subsite extends Application {
|
||||
reference key (subsite_app.application_id);
|
||||
// nothing to persist
|
||||
// reference key (subsite_app.application_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
--
|
||||
-- Copyright (C) 2011 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 subsite_app which just contained application type id and is
|
||||
-- never used for any action.
|
||||
|
||||
drop table subsite_app ;
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
--
|
||||
-- Copyright (C) 2011 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_legacy_entries.sql $
|
||||
|
||||
-- Subsite 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 '%subsite.Subsite%')
|
||||
)
|
||||
);
|
||||
|
||||
-- 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 '%subsite.Subsite%')
|
||||
)
|
||||
);
|
||||
|
||||
-- delete all entries in site_nodes referring to a subsite 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 '%subsite.Subsite%')
|
||||
);
|
||||
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 'com.arsdigita.subsite.Subsite')
|
||||
);
|
||||
|
||||
-- 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 'com.arsdigita.subsite.Subsite')
|
||||
);
|
||||
|
||||
-- delete all entries for subsite 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 'com.arsdigita.subsite.Subsite') ;
|
||||
|
||||
-- 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 'com.arsdigita.subsite.Subsite') ;
|
||||
|
||||
|
||||
-- set package_id to null for all entries referring to a subsite 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 'com.arsdigita.subsite.Subsite') ;
|
||||
|
||||
-- set package_id to null for all entries referring to a subsite instance
|
||||
-- (indicating a new legacy free application)
|
||||
update application_types
|
||||
set package_type_id = null
|
||||
where object_type like 'com.arsdigita.subsite.Subsite' ;
|
||||
|
||||
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 ;
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
--
|
||||
-- Copyright (C) 2011 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_sites_table.sql pboy $
|
||||
|
||||
-- rename table subsite_site to subsite_sites following ccm naming conventions
|
||||
-- to make maintenance tasks easier
|
||||
|
||||
|
||||
alter table subsite_site drop constraint subsite_site_site_id_p_rz022 ;
|
||||
alter table subsite_site drop constraint subs_sit_templ_context_f_6wdu3 ;
|
||||
alter table subsite_site drop constraint subsit_sit_fron_pag_id_f_4agqx ;
|
||||
alter table subsite_site drop constraint subsite_site_site_id_f_rntkc ;
|
||||
alter table subsite_site drop constraint subsite_site_hostname_u_uy5xf ;
|
||||
|
||||
alter table subsite_site RENAME TO subsite_sites ;
|
||||
|
||||
alter table subsite_sites
|
||||
add constraint subsite_sites_site_id_p_wl5ul PRIMARY KEY (site_id) ;
|
||||
alter table subsite_sites
|
||||
add constraint subs_sit_templ_context_f_mpg0d FOREIGN KEY (template_context)
|
||||
REFERENCES cms_template_use_contexts (use_context)
|
||||
MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION ;
|
||||
alter table subsite_sites
|
||||
add constraint subsi_site_fron_pag_id_f_p5cc6 FOREIGN KEY (front_page_id)
|
||||
REFERENCES applications (application_id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION ;
|
||||
alter table subsite_sites
|
||||
add constraint subsite_sites_site_id_f_nrcet FOREIGN KEY (site_id)
|
||||
REFERENCES acs_objects (object_id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION ;
|
||||
alter table subsite_sites
|
||||
add constraint subsite_sites_hostname_u_hrgra UNIQUE (hostname) ;
|
||||
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
--
|
||||
-- Copyright (C) 2011 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 $
|
||||
|
||||
-- adjust various system tables to the new name of application subsite
|
||||
|
||||
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=replace(class_name,'london.subsite', 'subsite')
|
||||
where class_name like '%london.subsite%' ;
|
||||
|
||||
update init_requirements
|
||||
set init=replace(init,'london.subsite', 'subsite')
|
||||
where init like '%london.subsite%' ;
|
||||
|
||||
update init_requirements
|
||||
set required_init=replace(required_init,'london.subsite', 'subsie')
|
||||
where required_init like '%london.subsite%' ;
|
||||
|
||||
ALTER TABLE ONLY 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 application_types
|
||||
set object_type=replace(object_type,'london.subsite', 'subsite')
|
||||
where object_type like '%london.subsite%' ;
|
||||
|
||||
-- table applications doesn't require an update
|
||||
|
||||
-- table apm_package_types doesn't require an update
|
||||
|
||||
-- table apm_packages doesn't require an update either
|
||||
-- table site_nodes doesn't require an update either
|
||||
|
||||
|
||||
-- update application type in acs_objects
|
||||
update acs_objects
|
||||
set (object_type,default_domain_class) =
|
||||
(replace(object_type,'london.subsite', 'subsite') ,
|
||||
replace(default_domain_class,'london.subsite', 'subsite') )
|
||||
where object_type like '%london.subsite%' ;
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
--
|
||||
-- Copyright (C) 2011 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: 2011/03/27 23:15:09 $
|
||||
-- $Id: oracle-se-6.6.0-6.6.1 pboy $
|
||||
|
||||
@@ default/6.6.0-6.6.1/upd_theme_app_table.sql
|
||||
@@ default/6.6.0-6.6.1/upd_system_tables.sql
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
--
|
||||
-- Copyright (C) 2011 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 ccm-subsite 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
|
||||
|
||||
-- rename table containing defined subsites following ccm naming conventions
|
||||
\i default/6.6.0-6.6.1/ren_sites_table.sql
|
||||
|
||||
-- rename application from london.subsite to subsite
|
||||
\i default/6.6.0-6.6.1/upd_system_tables.sql
|
||||
|
||||
-- remove legacy compatible bits
|
||||
\i default/6.6.0-6.6.1/remove_legacy_entries.sql
|
||||
|
||||
commit;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<upgrade>
|
||||
<version from="6.6.0" to="6.6.1">
|
||||
<script sql="ccm-subsite/upgrade/::database::-6.6.0-6.6.1.sql"/>
|
||||
</version>
|
||||
</upgrade>
|
||||
|
|
@ -39,7 +39,7 @@ import com.arsdigita.templating.PatternStylesheetResolver;
|
|||
import com.arsdigita.xml.XML;
|
||||
|
||||
/**
|
||||
* Initializes the Subsite system
|
||||
* Executes recurring at each system startup and initializes the Subsite system.
|
||||
* @version $Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class Initializer extends CompoundInitializer {
|
||||
|
|
@ -76,17 +76,4 @@ public class Initializer extends CompoundInitializer {
|
|||
|
||||
}
|
||||
|
||||
// TODO - once the core initializers are ported this should be moved
|
||||
// to be a DomainEvent instead of a LegacyInitEvent
|
||||
// public void init(LegacyInitEvent evt) {
|
||||
// super.init(evt);
|
||||
|
||||
// XML.parse(Subsite.getConfig().getTraversalAdapters(),
|
||||
// new TraversalHandler());
|
||||
|
||||
// PatternStylesheetResolver.registerPatternGenerator(
|
||||
// "subsite", new SubsitePatternGenerator()
|
||||
// );
|
||||
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ import com.arsdigita.web.Application;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Loads the subsite application and type
|
||||
* Executes nonrecurring at install time and loads (installs and initializes)
|
||||
* the ccm-subsite module persistently into database.
|
||||
*
|
||||
* @author Daniel Berrange
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
* @version $Id: Loader.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class Loader extends PackageLoader {
|
||||
|
|
@ -51,21 +53,37 @@ public class Loader extends PackageLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* This creates and initializes the subsite admin application
|
||||
* Creates ccm-subsite as a legacy-free application type and initializes
|
||||
* an administration instance. Subsite itself is a filter servlet activated
|
||||
* in web applications web.xml.
|
||||
*/
|
||||
private void createApplication() {
|
||||
ApplicationType type = ApplicationType
|
||||
.createApplicationType("subsite",
|
||||
"CCM Subsite Admin",
|
||||
Subsite.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
/* Create new application type, legacy free application type
|
||||
*
|
||||
* NOTE: The wording in the title parameter of ApplicationType (first
|
||||
* parameter) 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.
|
||||
* Example: "Subsite" will become "subsite".
|
||||
*/
|
||||
ApplicationType type = new ApplicationType
|
||||
("Subsite",
|
||||
Subsite.BASE_DATA_OBJECT_TYPE);
|
||||
type.setDescription("CCM subsite administration");
|
||||
|
||||
Application admin = Application.retrieveApplicationForPath("/admin/");
|
||||
|
||||
Application app =
|
||||
Application.createApplication(type,
|
||||
"subsite",
|
||||
"CCM Subsite Admin",
|
||||
admin);
|
||||
/* Create an application instance as a legacy free app.
|
||||
* Whether a legacy compatible or a legacy free application is
|
||||
* created depends on the type of ApplicationType above. No need to
|
||||
* modify anything here */
|
||||
Application app = Application
|
||||
.createApplication(type,
|
||||
"subsite",
|
||||
"Subsite Administration",
|
||||
admin);
|
||||
app.setDescription("CCM subsite administration GUI");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,13 @@ public class Site extends ACSObject {
|
|||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.subsite.Site";
|
||||
|
||||
/** Title for a subsite, text field. */
|
||||
public static final String TITLE = "title";
|
||||
/** Description for a subsite, text field. */
|
||||
public static final String DESCRIPTION = "description";
|
||||
/** Subsite host name, text field, must be unique. */
|
||||
public static final String HOSTNAME = "hostname";
|
||||
/** Directory containin the theme to be used for the subsite. */
|
||||
public static final String STYLE_DIRECTORY = "styleDirectory";
|
||||
public static final String FRONT_PAGE = "frontPage";
|
||||
public static final String TEMPLATE_CONTEXT = "templateContext";
|
||||
|
|
|
|||
|
|
@ -31,22 +31,19 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class Subsite extends Application {
|
||||
|
||||
/** A logger instance to assist debugging. */
|
||||
private static final Logger s_log = Logger.getLogger(Subsite.class);
|
||||
|
||||
// pdl stuff (constants)
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.subsite.Subsite";
|
||||
public static final String SUBSITE_XML_NS
|
||||
= "http://ccm.redhat.com/subsite/1.0";
|
||||
public static final String SUBSITE_XML_PREFIX
|
||||
= "subsite:";
|
||||
= "com.arsdigita.subsite.Subsite";
|
||||
|
||||
public static final String SUBSITE_XML_NS = "http://ccm.redhat.com/subsite/1.0";
|
||||
|
||||
public static final String SUBSITE_XML_PREFIX = "subsite:";
|
||||
|
||||
private static final SubsiteConfig s_config = new SubsiteConfig();
|
||||
|
||||
static {
|
||||
s_log.debug("Static initalizer starting...");
|
||||
s_config.load();
|
||||
s_log.debug("Static initalizer finished.");
|
||||
}
|
||||
/** Config object containing various parameter */
|
||||
private static final SubsiteConfig s_config = SubsiteConfig.getConfig();
|
||||
|
||||
private static final SubsiteContext s_context = new SubsiteContext();
|
||||
|
||||
|
|
@ -55,33 +52,44 @@ public class Subsite extends Application {
|
|||
*
|
||||
* @post return != null
|
||||
*/
|
||||
public static final SubsiteContext getContext() {
|
||||
public static SubsiteContext getContext() {
|
||||
return s_context;
|
||||
}
|
||||
|
||||
public static final SubsiteConfig getConfig() {
|
||||
/** Service method to provide clients access to configuration. */
|
||||
public static SubsiteConfig getConfig() {
|
||||
return s_config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
public Subsite(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor retrieving subsite from the database usings its OID.
|
||||
*
|
||||
* @param oid the OID of the subsite
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public Subsite(OID oid)
|
||||
throws DataObjectNotFoundException {
|
||||
|
||||
super(oid);
|
||||
}
|
||||
|
||||
// /*
|
||||
// * Application specific method only required if installed in its own
|
||||
// * web application context
|
||||
// */
|
||||
// public String getContextPath() {
|
||||
// return "/ccm-ldn-subsite";
|
||||
// }
|
||||
// /*
|
||||
// * Application specific method only required if installed in its own
|
||||
// * web application context
|
||||
// */
|
||||
// public String getContextPath() {
|
||||
// return "/ccm-ldn-subsite";
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the path name of the location of the applications servlet/JSP.
|
||||
|
|
@ -110,6 +118,7 @@ public class Subsite extends Application {
|
|||
*
|
||||
* @return path name to the applications servlet/JSP
|
||||
*/
|
||||
@Override
|
||||
public String getServletPath() {
|
||||
// return "/files";
|
||||
return "/ccm-subsite/files";
|
||||
|
|
|
|||
|
|
@ -24,12 +24,9 @@ import com.arsdigita.util.parameter.ClassParameter;
|
|||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.ResourceParameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
// import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.london.util.ui.ApplicationCategoryPicker;
|
||||
|
||||
import java.io.InputStream;
|
||||
// import java.io.IOException;
|
||||
// import java.net.URL;
|
||||
// import java.net.MalformedURLException;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
|
@ -38,10 +35,34 @@ import org.apache.log4j.Logger;
|
|||
|
||||
public class SubsiteConfig extends AbstractConfig {
|
||||
|
||||
/** A logger instance to assist debugging. */
|
||||
private static final Logger s_log = Logger.getLogger(SubsiteConfig.class);
|
||||
|
||||
/** Singelton config object. */
|
||||
private static SubsiteConfig s_conf;
|
||||
|
||||
/**
|
||||
* Gain a SubsiteConfig object.
|
||||
*
|
||||
* Singelton pattern, don't instantiate a config object using the
|
||||
* constructor directly!
|
||||
* @return
|
||||
*/
|
||||
public static synchronized SubsiteConfig getConfig() {
|
||||
if (s_conf == null) {
|
||||
s_conf = new SubsiteConfig();
|
||||
s_conf.load();
|
||||
}
|
||||
|
||||
return s_conf;
|
||||
}
|
||||
|
||||
/** */
|
||||
private Map m_themes = new HashMap();
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// Set of configuration parameters
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public final class SubsiteContext {
|
||||
|
||||
/** A logger instance, primarly to assist debugging . */
|
||||
private static final Logger s_log = Logger.getLogger(SubsiteContext.class);
|
||||
|
||||
public static final String SITE_REQUEST_ATTRIBUTE = Site.class.getName();
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.subsite;
|
||||
|
||||
// import com.arsdigita.subsite.Subsite;
|
||||
// import com.arsdigita.util.servlet.HttpHost;
|
||||
import com.arsdigita.web.ServerDynamicHostProvider;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -29,7 +27,9 @@ import java.net.MalformedURLException;
|
|||
|
||||
public class SubsiteDynamicHostProvider extends ServerDynamicHostProvider {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(SubsiteDynamicHostProvider.class);
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SubsiteDynamicHostProvider.class);
|
||||
|
||||
public SubsiteDynamicHostProvider() {
|
||||
super();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class SubsiteFilter extends BaseFilter {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static final Logger s_log = Logger.getLogger(SubsiteFilter.class);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@
|
|||
|
||||
package com.arsdigita.subsite;
|
||||
|
||||
// import com.arsdigita.subsite.Subsite;
|
||||
import com.arsdigita.templating.PatternGenerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author pb
|
||||
*/
|
||||
public class SubsitePatternGenerator implements PatternGenerator {
|
||||
|
||||
public String[] generateValues(String key,
|
||||
|
|
|
|||
|
|
@ -35,12 +35,31 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* Service class for content cneter (CMS) application.
|
||||
*
|
||||
* This class extends the CMS default resolver class and adds subsite
|
||||
* specific functionality.
|
||||
*
|
||||
* Usage: Set CMS parameter
|
||||
* com.arsdigita.cms.default_template_resolver_class = ...
|
||||
* to this class.
|
||||
*/
|
||||
public class SubsiteItemTemplateResolver extends DefaultTemplateResolver {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SubsiteItemTemplateResolver.class);
|
||||
Logger.getLogger(SubsiteItemTemplateResolver.class);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param section
|
||||
* @param item
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected String getDefaultTemplate(ContentSection section,
|
||||
ContentItem item,
|
||||
HttpServletRequest request) {
|
||||
|
|
@ -77,6 +96,11 @@ public class SubsiteItemTemplateResolver extends DefaultTemplateResolver {
|
|||
return super.getDefaultTemplate(section, item, request);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
protected boolean templateExists(String name) {
|
||||
String fullpath = ContentSection.getConfig().getTemplateRoot()
|
||||
+ "/" + name;
|
||||
|
|
@ -89,6 +113,12 @@ public class SubsiteItemTemplateResolver extends DefaultTemplateResolver {
|
|||
return exists;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTemplateContext(HttpServletRequest request) {
|
||||
String context = (String) request.getAttribute("templateContext");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ and open the template in the editor.
|
|||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Package com.arsdigita.london.subsite</title>
|
||||
<title>Package com.arsdigita.subsite</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -21,10 +21,18 @@ package com.arsdigita.subsite.ui;
|
|||
import com.arsdigita.subsite.Subsite;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ControlCenterPanel extends SimpleContainer {
|
||||
|
||||
private SiteSelectionModel m_site;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param site
|
||||
*/
|
||||
public ControlCenterPanel(SiteSelectionModel site) {
|
||||
super(Subsite.SUBSITE_XML_PREFIX + "controlCenter",
|
||||
Subsite.SUBSITE_XML_NS);
|
||||
|
|
|
|||
|
|
@ -18,11 +18,6 @@
|
|||
|
||||
package com.arsdigita.subsite.ui;
|
||||
|
||||
import com.arsdigita.subsite.Site;
|
||||
import com.arsdigita.subsite.Subsite;
|
||||
import com.arsdigita.london.util.ui.CategoryPicker;
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.SaveCancelSection;
|
||||
|
|
@ -47,22 +42,34 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterData;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.london.util.ui.CategoryPicker;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.subsite.Site;
|
||||
import com.arsdigita.subsite.Subsite;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.Classes;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
||||
import java.util.TooManyListenersException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
/**
|
||||
* Class creates the administration input form.
|
||||
*
|
||||
*/
|
||||
public class SiteForm extends Form {
|
||||
|
||||
private SiteSelectionModel m_site;
|
||||
|
||||
/** Input field subsite title */
|
||||
private TextField m_title;
|
||||
private TextField m_hostname;
|
||||
private TextArea m_description;
|
||||
|
|
@ -79,6 +86,7 @@ public class SiteForm extends Form {
|
|||
private final static String OTHER_STYLE_LABEL = "Other (type in box below)";
|
||||
|
||||
/**
|
||||
* Constructor create input widgets and adds them to form.
|
||||
*
|
||||
* @param name
|
||||
* @param site
|
||||
|
|
@ -91,33 +99,35 @@ public class SiteForm extends Form {
|
|||
|
||||
m_site = site;
|
||||
|
||||
/* Setup text input field for subsite title property */
|
||||
m_title = new TextField(new StringParameter("title"));
|
||||
m_title.addValidationListener(new NotNullValidationListener());
|
||||
m_title.setMetaDataAttribute("title", "Title");
|
||||
m_title.setHint("Enter the title of the subsite, upto 80 characters");
|
||||
m_title.setSize(40);
|
||||
add(m_title);
|
||||
add(m_title); // adds title input field to form
|
||||
|
||||
/* Setup text input field for hostname */
|
||||
/* Setup text input field for hostname property */
|
||||
m_hostname = new TextField(new StringParameter("hostname"));
|
||||
m_hostname.addValidationListener(new NotNullValidationListener());
|
||||
m_hostname.addValidationListener(new HostNameValidationListener());
|
||||
m_hostname.setMetaDataAttribute("title", "Hostname");
|
||||
m_hostname.setSize(35);
|
||||
m_hostname.setSize(40);
|
||||
m_hostname.setHint(
|
||||
"Enter the hostname for the subsite, eg business.example.com"
|
||||
);
|
||||
add(m_hostname); // adds hostname input field to form
|
||||
|
||||
/* Setup text input area for description property */
|
||||
m_description = new TextArea(new StringParameter("description"));
|
||||
m_description.addValidationListener(new NotNullValidationListener());
|
||||
m_description.setMetaDataAttribute("title", "Description");
|
||||
m_description.setCols(40);
|
||||
m_description.setCols(45);
|
||||
m_description.setRows(4);
|
||||
m_description.setHint(
|
||||
"Enter a short description for the subsite, upto 4000 characters"
|
||||
);
|
||||
add(m_description);
|
||||
add(m_description); // adds description input field to form
|
||||
|
||||
/* Setup Radio selection group for subsite start page (front page) */
|
||||
m_customHomepage = new RadioGroup("customHome");
|
||||
|
|
@ -143,6 +153,7 @@ public class SiteForm extends Form {
|
|||
}
|
||||
add(m_customHomepage); // adds Radio group start page to form
|
||||
|
||||
/* Setup text inpout field for subsite start page (front page) */
|
||||
m_customHomepage_url = new TextField(
|
||||
new StringParameter("customHomepage_url"));
|
||||
m_customHomepage_url.setMetaDataAttribute("title",
|
||||
|
|
@ -168,6 +179,7 @@ public class SiteForm extends Form {
|
|||
}
|
||||
add(m_themes); // adds themes selection box to form
|
||||
|
||||
/* Setup text input field to manually enter a style direcotry */
|
||||
m_styleDir = new TextField(new StringParameter("styleDir"));
|
||||
m_styleDir.setMetaDataAttribute("title", "XSLT Directory (Other)");
|
||||
m_styleDir.setSize(40);
|
||||
|
|
@ -175,8 +187,9 @@ public class SiteForm extends Form {
|
|||
"Enter the directory for the custom XSLT styles, " +
|
||||
"or leave blank for the default styling"
|
||||
);
|
||||
add(m_styleDir);
|
||||
add(m_styleDir); // adds inputfield style dir to form
|
||||
|
||||
/* Setup selection box for cagtegory domain */
|
||||
m_rootCategory = (CategoryPicker)Classes.newInstance(
|
||||
Subsite.getConfig().getRootCategoryPicker(),
|
||||
new Class[] { String.class },
|
||||
|
|
@ -187,7 +200,7 @@ public class SiteForm extends Form {
|
|||
((Widget)m_rootCategory)
|
||||
.setHint("Select a root navigation category");
|
||||
}
|
||||
add(m_rootCategory);
|
||||
add(m_rootCategory); // adds domain category selection box to form
|
||||
|
||||
m_buttons = new SaveCancelSection();
|
||||
m_buttons.getSaveButton().setHint("Save the details in the form");
|
||||
|
|
@ -341,6 +354,7 @@ public class SiteForm extends Form {
|
|||
*
|
||||
*/
|
||||
private class SiteProcessListener implements FormProcessListener {
|
||||
|
||||
public void process(FormSectionEvent e)
|
||||
throws FormProcessException {
|
||||
PageState state = e.getPageState();
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ import com.arsdigita.persistence.SessionManager;
|
|||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SiteListing extends SimpleComponent {
|
||||
|
||||
private SiteSelectionModel m_site;
|
||||
|
|
@ -37,6 +41,7 @@ public class SiteListing extends SimpleComponent {
|
|||
m_site = site;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(PageState state,
|
||||
Element parent) {
|
||||
Element content = parent.newChildElement(
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
<!-- IMPORT DEFINITIONS ccm-ldn-shortcuts installed into the main CCM webapp
|
||||
-->
|
||||
<xsl:import href="../../../../packages/bebop/xsl/bebop.xsl"/>
|
||||
<xsl:import href="../../../../packages/ui/xsl/ui.xsl"/>
|
||||
<xsl:import href="../../../packages/bebop/xsl/bebop.xsl"/>
|
||||
<xsl:import href="../../../packages/ui/xsl/ui.xsl"/>
|
||||
|
||||
<xsl:param name="dispatcher-prefix"/>
|
||||
|
||||
Loading…
Reference in New Issue