ContentType
Änderung an dem Statusfeld der ContentTypen. Es ist jetzt möglich, interne und versteckte ContentTypen anzulegen und zu unterscheiden. Die versteckten CTs werden in der Liste zum Anlegen neuer CIs nicht angezeigt, sind aber im Reiter Dokumenttypen sichtbar, so daß sie aus einer ContentSection gelöscht oder ihr hinzugefügt werden können. Außerdem läßt sich ein versteckter CT als Vaterobject für einen UDCT verwenden. CMS Loader Beim Erstellen der ersten ContentSection werden nun auch die generischen CTs hinzugefügt. Diese Anpassung ist nötig, da die GCTs über den Loader von CMS geladen werden, der 1. nicht von AbstractContentTypeLoader abgeleitet ist 2. zum Zeitpunkt des Ladens der GCTs noch keine ContentSection angelegt ist. git-svn-id: https://svn.libreccm.org/ccm/trunk@620 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
20e8d916f1
commit
4ca5cc9293
|
|
@ -32,7 +32,7 @@ object type ContentType extends ACSObject {
|
||||||
String[0..1] ancestors = content_types.ancestors VARCHAR(2000);
|
String[0..1] ancestors = content_types.ancestors VARCHAR(2000);
|
||||||
String[0..1] siblings = content_types.siblings VARCHAR(2000);
|
String[0..1] siblings = content_types.siblings VARCHAR(2000);
|
||||||
|
|
||||||
Boolean[1..1] isInternal = content_types.is_internal CHAR(1);
|
String[1..1] mode = content_types.mode CHAR(1);
|
||||||
BigDecimal[0..1] itemFormID = content_types.item_form_id INTEGER;
|
BigDecimal[0..1] itemFormID = content_types.item_form_id INTEGER;
|
||||||
AuthoringKit[0..1] authoringKit = join content_types.type_id
|
AuthoringKit[0..1] authoringKit = join content_types.type_id
|
||||||
to authoring_kits.type_id;
|
to authoring_kits.type_id;
|
||||||
|
|
@ -64,7 +64,7 @@ association {
|
||||||
do {
|
do {
|
||||||
select
|
select
|
||||||
t.type_id, t.object_type, t.label, t.description, t.classname,
|
t.type_id, t.object_type, t.label, t.description, t.classname,
|
||||||
t.ancestors, t.siblings, t.is_internal, t.item_form_id
|
t.ancestors, t.siblings, t.mode, t.item_form_id
|
||||||
from
|
from
|
||||||
content_types t, content_section_type_map m, authoring_kits a
|
content_types t, content_section_type_map m, authoring_kits a
|
||||||
where
|
where
|
||||||
|
|
@ -80,7 +80,7 @@ association {
|
||||||
creatableContentTypes.className = t.classname;
|
creatableContentTypes.className = t.classname;
|
||||||
creatableContentTypes.ancestors = t.ancestors;
|
creatableContentTypes.ancestors = t.ancestors;
|
||||||
creatableContentTypes.siblings = t.siblings;
|
creatableContentTypes.siblings = t.siblings;
|
||||||
creatableContentTypes.isInternal = t.is_internal;
|
creatableContentTypes.mode = t.mode;
|
||||||
creatableContentTypes.itemFormID = t.item_form_id;
|
creatableContentTypes.itemFormID = t.item_form_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ association {
|
||||||
do {
|
do {
|
||||||
select
|
select
|
||||||
t.type_id, t.object_type, t.label, t.description, t.classname,
|
t.type_id, t.object_type, t.label, t.description, t.classname,
|
||||||
t.ancestors, t.siblings, t.is_internal, t.item_form_id
|
t.ancestors, t.siblings, t.mode, t.item_form_id
|
||||||
from
|
from
|
||||||
content_types t
|
content_types t
|
||||||
where
|
where
|
||||||
|
|
@ -128,7 +128,7 @@ association {
|
||||||
notAssociatedContentTypes.className = t.classname;
|
notAssociatedContentTypes.className = t.classname;
|
||||||
notAssociatedContentTypes.ancestors = t.ancestors;
|
notAssociatedContentTypes.ancestors = t.ancestors;
|
||||||
notAssociatedContentTypes.siblings = t.siblings;
|
notAssociatedContentTypes.siblings = t.siblings;
|
||||||
notAssociatedContentTypes.isInternal = t.is_internal;
|
notAssociatedContentTypes.mode = t.mode;
|
||||||
notAssociatedContentTypes.itemFormID = t.item_form_id;
|
notAssociatedContentTypes.itemFormID = t.item_form_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -157,9 +157,9 @@ query registeredContentTypes {
|
||||||
select
|
select
|
||||||
t.type_id, t.object_type, t.label,
|
t.type_id, t.object_type, t.label,
|
||||||
t.description, t.classname, t.ancestors, t.siblings,
|
t.description, t.classname, t.ancestors, t.siblings,
|
||||||
t.is_internal, t.item_form_id
|
t.mode, t.item_form_id
|
||||||
from content_types t
|
from content_types t
|
||||||
where t.is_internal = '0'
|
where t.mode != 'I'
|
||||||
and exists (select 1 from content_section_type_map
|
and exists (select 1 from content_section_type_map
|
||||||
where type_id = t.type_id)
|
where type_id = t.type_id)
|
||||||
} map {
|
} map {
|
||||||
|
|
@ -170,7 +170,7 @@ query registeredContentTypes {
|
||||||
type.className = t.classname;
|
type.className = t.classname;
|
||||||
type.ancestors = t.ancestors;
|
type.ancestors = t.ancestors;
|
||||||
type.siblings = t.siblings;
|
type.siblings = t.siblings;
|
||||||
type.isInternal = t.is_internal;
|
type.mode = t.mode;
|
||||||
type.itemFormID = t.item_form_id;
|
type.itemFormID = t.item_form_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,19 @@ comment on column content_types.classname is '
|
||||||
comment on column content_types.label is '
|
comment on column content_types.label is '
|
||||||
The pretty name for this content type
|
The pretty name for this content type
|
||||||
';
|
';
|
||||||
comment on column content_types.is_internal is '
|
--comment on column content_types.is_internal is '
|
||||||
|
-- An internal content type is one that is not user-defined and maintained
|
||||||
|
-- internally. A content type should be made internal under the following
|
||||||
|
-- two conditions:
|
||||||
|
-- 1) The object type needs to take advantage of content type services
|
||||||
|
-- (i.e., versioning, categorization, lifecycle, workflow) that are already
|
||||||
|
-- implemented in CMS.
|
||||||
|
-- 2) The content type cannot be explicitly registered to a content section.
|
||||||
|
-- The Template content type is one such internal content type.
|
||||||
|
--';
|
||||||
|
comment on column content_types.mode is '
|
||||||
|
Saves the mode of the content type: I = internal, H = hidden
|
||||||
|
|
||||||
An internal content type is one that is not user-defined and maintained
|
An internal content type is one that is not user-defined and maintained
|
||||||
internally. A content type should be made internal under the following
|
internally. A content type should be made internal under the following
|
||||||
two conditions:
|
two conditions:
|
||||||
|
|
@ -39,4 +51,7 @@ comment on column content_types.is_internal is '
|
||||||
implemented in CMS.
|
implemented in CMS.
|
||||||
2) The content type cannot be explicitly registered to a content section.
|
2) The content type cannot be explicitly registered to a content section.
|
||||||
The Template content type is one such internal content type.
|
The Template content type is one such internal content type.
|
||||||
|
|
||||||
|
A hidden content type is one that cannot used directly but other content
|
||||||
|
types can extend from it. Also, it is a legit parent for UDCTs.
|
||||||
';
|
';
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,12 @@ create table content_types (
|
||||||
classname varchar(200),
|
classname varchar(200),
|
||||||
ancestors varchar(2000),
|
ancestors varchar(2000),
|
||||||
siblings varchar(2000),
|
siblings varchar(2000),
|
||||||
is_internal char(1) default '0' not null
|
-- is_internal char(1) default '0' not null
|
||||||
constraint content_types_is_internal_ck
|
-- constraint content_types_is_internal_ck
|
||||||
check ( is_internal in ('0', '1') ),
|
-- check ( is_internal in ('0', '1') ),
|
||||||
|
mode char(1) default '' not null
|
||||||
|
constraint content_types_mode_ck
|
||||||
|
check ( mode in ('D', 'H', 'I') ),
|
||||||
item_form_id integer
|
item_form_id integer
|
||||||
constraint content_types_form_id_fk references
|
constraint content_types_form_id_fk references
|
||||||
bebop_components (component_id)
|
bebop_components (component_id)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
description="A generic address type"
|
description="A generic address type"
|
||||||
objectType="com.arsdigita.cms.contenttypes.GenericAddress"
|
objectType="com.arsdigita.cms.contenttypes.GenericAddress"
|
||||||
classname="com.arsdigita.cms.contenttypes.GenericAddress"
|
classname="com.arsdigita.cms.contenttypes.GenericAddress"
|
||||||
isInternal="yes">
|
mode="hidden">
|
||||||
|
|
||||||
<ctd:authoring-kit
|
<ctd:authoring-kit
|
||||||
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
description="A generic article type"
|
description="A generic article type"
|
||||||
objectType="com.arsdigita.cms.contenttypes.GenericArticle"
|
objectType="com.arsdigita.cms.contenttypes.GenericArticle"
|
||||||
classname="com.arsdigita.cms.contenttypes.GenericArticle"
|
classname="com.arsdigita.cms.contenttypes.GenericArticle"
|
||||||
isInternal="yes">
|
mode="hidden">
|
||||||
|
|
||||||
</ctd:content-type>
|
</ctd:content-type>
|
||||||
</ctd:content-types>
|
</ctd:content-types>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
description="A generic Contact type"
|
description="A generic Contact type"
|
||||||
objectType="com.arsdigita.cms.contenttypes.GenericContact"
|
objectType="com.arsdigita.cms.contenttypes.GenericContact"
|
||||||
classname="com.arsdigita.cms.contenttypes.GenericContact"
|
classname="com.arsdigita.cms.contenttypes.GenericContact"
|
||||||
isInternal="yes">
|
mode="hidden">
|
||||||
|
|
||||||
<ctd:authoring-kit
|
<ctd:authoring-kit
|
||||||
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
description="A generic content type for organizations and projects."
|
description="A generic content type for organizations and projects."
|
||||||
objectType="com.arsdigita.cms.contenttypes.GenericOrganizationalUnit"
|
objectType="com.arsdigita.cms.contenttypes.GenericOrganizationalUnit"
|
||||||
classname= "com.arsdigita.cms.contenttypes.GenericOrganizationalUnit"
|
classname= "com.arsdigita.cms.contenttypes.GenericOrganizationalUnit"
|
||||||
isInternal="yes">
|
mode="hidden">
|
||||||
|
|
||||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
description="A generic Person type"
|
description="A generic Person type"
|
||||||
objectType="com.arsdigita.cms.contenttypes.GenericPerson"
|
objectType="com.arsdigita.cms.contenttypes.GenericPerson"
|
||||||
classname="com.arsdigita.cms.contenttypes.GenericPerson"
|
classname="com.arsdigita.cms.contenttypes.GenericPerson"
|
||||||
isInternal="yes">
|
mode="hidden">
|
||||||
|
|
||||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericPersonCreate">
|
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericPersonCreate">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
description="Templates for rendering content items"
|
description="Templates for rendering content items"
|
||||||
objectType="com.arsdigita.cms.Template"
|
objectType="com.arsdigita.cms.Template"
|
||||||
classname="com.arsdigita.cms.Template"
|
classname="com.arsdigita.cms.Template"
|
||||||
isInternal="yes">
|
mode="internal">
|
||||||
<ctd:authoring-kit>
|
<ctd:authoring-kit>
|
||||||
|
|
||||||
<ctd:authoring-step
|
<ctd:authoring-step
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms;
|
package com.arsdigita.cms;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.categorization.Category;
|
import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
import com.arsdigita.cms.dispatcher.PageResolver;
|
import com.arsdigita.cms.dispatcher.PageResolver;
|
||||||
|
|
@ -55,7 +54,6 @@ import org.apache.log4j.Logger;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>A content section represents a collection of content that is
|
* <p>A content section represents a collection of content that is
|
||||||
* managed as a unit. Content sections typically correspond to major
|
* managed as a unit. Content sections typically correspond to major
|
||||||
|
|
@ -94,12 +92,10 @@ import java.math.BigDecimal;
|
||||||
public class ContentSection extends Application {
|
public class ContentSection extends Application {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.ContentSection";
|
"com.arsdigita.cms.ContentSection";
|
||||||
public static final String PACKAGE_TYPE = "content-section";
|
public static final String PACKAGE_TYPE = "content-section";
|
||||||
public final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
|
public final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
|
||||||
|
|
||||||
protected static final String ID = "id";
|
protected static final String ID = "id";
|
||||||
protected static final String PACKAGE = "package";
|
protected static final String PACKAGE = "package";
|
||||||
protected static final String NAME = "label";
|
protected static final String NAME = "label";
|
||||||
|
|
@ -113,7 +109,6 @@ public class ContentSection extends Application {
|
||||||
protected static final String ITEM_RESOLVER_CLASS = "itemResolverClass";
|
protected static final String ITEM_RESOLVER_CLASS = "itemResolverClass";
|
||||||
protected static final String TEMPLATE_RESOLVER_CLASS = "templateResolverClass";
|
protected static final String TEMPLATE_RESOLVER_CLASS = "templateResolverClass";
|
||||||
protected static final String XML_GENERATOR_CLASS = "xmlGeneratorClass";
|
protected static final String XML_GENERATOR_CLASS = "xmlGeneratorClass";
|
||||||
|
|
||||||
protected static final String CONTENT_TYPES = "associatedContentTypes";
|
protected static final String CONTENT_TYPES = "associatedContentTypes";
|
||||||
protected static final String CREATABLE_CONTENT_TYPES =
|
protected static final String CREATABLE_CONTENT_TYPES =
|
||||||
"creatableContentTypes";
|
"creatableContentTypes";
|
||||||
|
|
@ -122,18 +117,13 @@ public class ContentSection extends Application {
|
||||||
protected static final String LIFECYCLE_DEFINITIONS =
|
protected static final String LIFECYCLE_DEFINITIONS =
|
||||||
"associatedLifecycleDefinitions";
|
"associatedLifecycleDefinitions";
|
||||||
protected static final String WF_TEMPLATES = "associatedWorkflowTemplates";
|
protected static final String WF_TEMPLATES = "associatedWorkflowTemplates";
|
||||||
|
|
||||||
private final static String ITEM_QUERY = "com.arsdigita.cms.ItemsInSection";
|
private final static String ITEM_QUERY = "com.arsdigita.cms.ItemsInSection";
|
||||||
private final static String SECTION_ID = "sectionId";
|
private final static String SECTION_ID = "sectionId";
|
||||||
|
|
||||||
private static final CMSConfig s_config = new CMSConfig();
|
private static final CMSConfig s_config = new CMSConfig();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
s_config.load();
|
s_config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Cached properties
|
// Cached properties
|
||||||
PageResolver m_pageResolver = null;
|
PageResolver m_pageResolver = null;
|
||||||
ItemResolver m_itemResolver = null;
|
ItemResolver m_itemResolver = null;
|
||||||
|
|
@ -144,7 +134,6 @@ public class ContentSection extends Application {
|
||||||
// super(BASE_DATA_OBJECT_TYPE);
|
// super(BASE_DATA_OBJECT_TYPE);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor re-creating a content section object by retrieving its data
|
* Constructor re-creating a content section object by retrieving its data
|
||||||
* object by OID
|
* object by OID
|
||||||
|
|
@ -177,7 +166,6 @@ public class ContentSection extends Application {
|
||||||
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static CMSConfig getConfig() {
|
public static CMSConfig getConfig() {
|
||||||
return s_config;
|
return s_config;
|
||||||
}
|
}
|
||||||
|
|
@ -186,6 +174,7 @@ public class ContentSection extends Application {
|
||||||
* @return the base PDL object type for this section. Child classes should
|
* @return the base PDL object type for this section. Child classes should
|
||||||
* override this method to return the correct value
|
* override this method to return the correct value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getBaseDataObjectType() {
|
public String getBaseDataObjectType() {
|
||||||
return BASE_DATA_OBJECT_TYPE;
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
@ -197,6 +186,7 @@ public class ContentSection extends Application {
|
||||||
* @param key The name of the attribute
|
* @param key The name of the attribute
|
||||||
* @return The value of the attribute
|
* @return The value of the attribute
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object get(String key) {
|
public Object get(String key) {
|
||||||
return super.get(key);
|
return super.get(key);
|
||||||
}
|
}
|
||||||
|
|
@ -208,6 +198,7 @@ public class ContentSection extends Application {
|
||||||
* @param key The name of the attribute
|
* @param key The name of the attribute
|
||||||
* @param value The value of the attribute
|
* @param value The value of the attribute
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void set(String key, Object value) {
|
public void set(String key, Object value) {
|
||||||
super.set(key, value);
|
super.set(key, value);
|
||||||
}
|
}
|
||||||
|
|
@ -215,6 +206,7 @@ public class ContentSection extends Application {
|
||||||
/**
|
/**
|
||||||
* Sets the content section of the root folder to this section.
|
* Sets the content section of the root folder to this section.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void afterSave() {
|
protected void afterSave() {
|
||||||
super.afterSave();
|
super.afterSave();
|
||||||
// Set the root folder's content section.
|
// Set the root folder's content section.
|
||||||
|
|
@ -238,6 +230,7 @@ public class ContentSection extends Application {
|
||||||
*
|
*
|
||||||
* @return A title
|
* @return A title
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
@ -290,7 +283,6 @@ public class ContentSection extends Application {
|
||||||
// public SiteNode getSiteNode() {
|
// public SiteNode getSiteNode() {
|
||||||
// return getPackageInstance().getDefaultMountPoint();
|
// return getPackageInstance().getDefaultMountPoint();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the location of the content section.
|
* Finds the location of the content section.
|
||||||
*
|
*
|
||||||
|
|
@ -337,7 +329,6 @@ public class ContentSection extends Application {
|
||||||
//
|
//
|
||||||
// return path.substring(0, path.length() - 1);
|
// return path.substring(0, path.length() - 1);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the folder in which all draft items are contained, directly or
|
* Get the folder in which all draft items are contained, directly or
|
||||||
* indirectly. This folder will in general contain different kinds of
|
* indirectly. This folder will in general contain different kinds of
|
||||||
|
|
@ -506,8 +497,8 @@ public class ContentSection extends Application {
|
||||||
|
|
||||||
if (m_pageResolver == null) {
|
if (m_pageResolver == null) {
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
s_log.debug("The page resolver hasn't been loaded yet; " +
|
s_log.debug("The page resolver hasn't been loaded yet; "
|
||||||
"loading it now");
|
+ "loading it now");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -677,13 +668,10 @@ public class ContentSection extends Application {
|
||||||
m_xmlGenerator = null;
|
m_xmlGenerator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//
|
//
|
||||||
// Globalization.
|
// Globalization.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the default Locale. This is used for translating or creating
|
* Gets the default Locale. This is used for translating or creating
|
||||||
* content if no locale is specified.
|
* content if no locale is specified.
|
||||||
|
|
@ -764,22 +752,27 @@ public class ContentSection extends Application {
|
||||||
locale.removeFromAssociation(da);
|
locale.removeFromAssociation(da);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//
|
//
|
||||||
// Content types.
|
// Content types.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all user-defined content types registered to the content section.
|
* Get all user-defined content types registered to the content section.
|
||||||
*
|
*
|
||||||
* @return A ContentTypeCollection of registered content types
|
* @return A ContentTypeCollection of registered content types
|
||||||
*/
|
*/
|
||||||
public ContentTypeCollection getContentTypes() {
|
public ContentTypeCollection getContentTypes() {
|
||||||
|
return getContentTypes(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentTypeCollection getContentTypes(boolean hidden) {
|
||||||
DataAssociation da = (DataAssociation) get(CONTENT_TYPES);
|
DataAssociation da = (DataAssociation) get(CONTENT_TYPES);
|
||||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||||
// Filter out internal contentt types.
|
// Filter out internal content types.
|
||||||
types.addFilter("isInternal = '0'");
|
types.addFilter("mode != 'I'");
|
||||||
|
if (!hidden) {
|
||||||
|
types.addFilter("mode != 'H'");
|
||||||
|
}
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -793,10 +786,17 @@ public class ContentSection extends Application {
|
||||||
* 3) possess a non-empty creation component in its AuthoringKit.
|
* 3) possess a non-empty creation component in its AuthoringKit.
|
||||||
*/
|
*/
|
||||||
public ContentTypeCollection getCreatableContentTypes() {
|
public ContentTypeCollection getCreatableContentTypes() {
|
||||||
|
return getCreatableContentTypes(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentTypeCollection getCreatableContentTypes(boolean hidden) {
|
||||||
DataAssociation da = (DataAssociation) get(CREATABLE_CONTENT_TYPES);
|
DataAssociation da = (DataAssociation) get(CREATABLE_CONTENT_TYPES);
|
||||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||||
// Filter out internal content types.
|
// Filter out internal content types.
|
||||||
types.addFilter("isInternal = '0'");
|
types.addFilter("mode != 'I'");
|
||||||
|
if (!hidden) {
|
||||||
|
types.addFilter("mode != 'H'");
|
||||||
|
}
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -849,16 +849,14 @@ public class ContentSection extends Application {
|
||||||
DataAssociation da = (DataAssociation) get(CONTENT_TYPES_NOT_ASSOC);
|
DataAssociation da = (DataAssociation) get(CONTENT_TYPES_NOT_ASSOC);
|
||||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||||
// Filter out internal content types.
|
// Filter out internal content types.
|
||||||
types.addFilter("isInternal = '0'");
|
types.addFilter("mode != 'I'");
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//
|
//
|
||||||
// Lifecycle definitions.
|
// Lifecycle definitions.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all lifecycle definitions registered to the content section.
|
* Get all lifecycle definitions registered to the content section.
|
||||||
*
|
*
|
||||||
|
|
@ -866,8 +864,7 @@ public class ContentSection extends Application {
|
||||||
* lifecycle definition.
|
* lifecycle definition.
|
||||||
*/
|
*/
|
||||||
public LifecycleDefinitionCollection getLifecycleDefinitions() {
|
public LifecycleDefinitionCollection getLifecycleDefinitions() {
|
||||||
return
|
return new LifecycleDefinitionCollection(getLifecycleDefinitionsAssociation());
|
||||||
new LifecycleDefinitionCollection(getLifecycleDefinitionsAssociation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -892,12 +889,10 @@ public class ContentSection extends Application {
|
||||||
return (DataAssociation) get(LIFECYCLE_DEFINITIONS);
|
return (DataAssociation) get(LIFECYCLE_DEFINITIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//
|
//
|
||||||
// Workflow templates.
|
// Workflow templates.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all workflow templates registered to the content section.
|
* Get all workflow templates registered to the content section.
|
||||||
*
|
*
|
||||||
|
|
@ -931,13 +926,10 @@ public class ContentSection extends Application {
|
||||||
return (DataAssociation) get(WF_TEMPLATES);
|
return (DataAssociation) get(WF_TEMPLATES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//
|
//
|
||||||
// Finding a content section.
|
// Finding a content section.
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the section given the SiteNode.
|
* Looks up the section given the SiteNode.
|
||||||
*
|
*
|
||||||
|
|
@ -991,7 +983,6 @@ public class ContentSection extends Application {
|
||||||
// }
|
// }
|
||||||
// return section;
|
// return section;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the content section for an item.
|
* Get the content section for an item.
|
||||||
*
|
*
|
||||||
|
|
@ -1029,13 +1020,10 @@ public class ContentSection extends Application {
|
||||||
* @return A collection of content sections
|
* @return A collection of content sections
|
||||||
*/
|
*/
|
||||||
public static ContentSectionCollection getAllSections() {
|
public static ContentSectionCollection getAllSections() {
|
||||||
DataCollection da = SessionManager.getSession().retrieve
|
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
(BASE_DATA_OBJECT_TYPE);
|
|
||||||
return new ContentSectionCollection(da);
|
return new ContentSectionCollection(da);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a content section of the given name using default values and
|
* Creates a content section of the given name using default values and
|
||||||
* returns it.
|
* returns it.
|
||||||
|
|
@ -1069,13 +1057,6 @@ public class ContentSection extends Application {
|
||||||
PermissionService.setContext(folder.getOID(), section.getOID());
|
PermissionService.setContext(folder.getOID(), section.getOID());
|
||||||
createDefaultResources(section);
|
createDefaultResources(section);
|
||||||
|
|
||||||
// Left over, see above
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// rootExcursion.run();
|
|
||||||
//
|
|
||||||
// //now retrieve the created content section and return it
|
|
||||||
// return (ContentSection) Application.retrieveApplicationForPath("/" + name + "/");
|
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1107,8 +1088,7 @@ public class ContentSection extends Application {
|
||||||
prc,
|
prc,
|
||||||
irc,
|
irc,
|
||||||
xgc,
|
xgc,
|
||||||
"com.arsdigita.cms.dispatcher.DefaultTemplateResolver"
|
"com.arsdigita.cms.dispatcher.DefaultTemplateResolver");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1148,8 +1128,7 @@ public class ContentSection extends Application {
|
||||||
templates.save();
|
templates.save();
|
||||||
|
|
||||||
//create and initialize the content section application
|
//create and initialize the content section application
|
||||||
ContentSection section = (ContentSection) Application.createApplication
|
ContentSection section = (ContentSection) Application.createApplication(BASE_DATA_OBJECT_TYPE, name, name, null);
|
||||||
(BASE_DATA_OBJECT_TYPE, name, name, null );
|
|
||||||
section.initialize(name,
|
section.initialize(name,
|
||||||
folder,
|
folder,
|
||||||
category,
|
category,
|
||||||
|
|
@ -1164,7 +1143,6 @@ public class ContentSection extends Application {
|
||||||
return section;
|
return section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and maps default resources to the content section.
|
* Creates and maps default resources to the content section.
|
||||||
*
|
*
|
||||||
|
|
@ -1239,7 +1217,6 @@ public class ContentSection extends Application {
|
||||||
return staff;
|
return staff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a newly created content section.
|
* Initialize a newly created content section.
|
||||||
*
|
*
|
||||||
|
|
@ -1281,7 +1258,6 @@ public class ContentSection extends Application {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the child items of this section. An item is defined to be "in"
|
* Fetches the child items of this section. An item is defined to be "in"
|
||||||
* a content section if it can be found directly in the folder hierarchy
|
* a content section if it can be found directly in the folder hierarchy
|
||||||
|
|
@ -1304,5 +1280,4 @@ public class ContentSection extends Application {
|
||||||
public String getStylesheetPath() {
|
public String getStylesheetPath() {
|
||||||
return STYLESHEET;
|
return STYLESHEET;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class ContentType extends ACSObject {
|
||||||
public static final String LABEL = "label";
|
public static final String LABEL = "label";
|
||||||
public static final String DESCRIPTION = "description";
|
public static final String DESCRIPTION = "description";
|
||||||
public static final String CLASSNAME = "className";
|
public static final String CLASSNAME = "className";
|
||||||
public static final String IS_INTERNAL = "isInternal";
|
public static final String MODE = "mode";
|
||||||
public static final String AUTHORING_KIT = "authoringKit";
|
public static final String AUTHORING_KIT = "authoringKit";
|
||||||
public static final String ITEM_FORM_ID = "itemFormID";
|
public static final String ITEM_FORM_ID = "itemFormID";
|
||||||
public static final String ITEM_FORM = "itemForm";
|
public static final String ITEM_FORM = "itemForm";
|
||||||
|
|
@ -123,8 +123,8 @@ public class ContentType extends ACSObject {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeSave() {
|
protected void beforeSave() {
|
||||||
if (isInternal() == null) {
|
if (getMode() == null) {
|
||||||
setInternal(false);
|
setMode("default");
|
||||||
}
|
}
|
||||||
super.beforeSave();
|
super.beforeSave();
|
||||||
}
|
}
|
||||||
|
|
@ -224,17 +224,37 @@ public class ContentType extends ACSObject {
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
public Boolean isInternal() {
|
public Boolean isInternal() {
|
||||||
return (Boolean) get(IS_INTERNAL);
|
return "I".equalsIgnoreCase((String) get(MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make this content type internal or not.
|
* <p>A hidden content type is one that is not user-defined but not meant
|
||||||
|
* to be used directly (p. ex. GenericArticle). in contrast they provide
|
||||||
|
* some basic features for different kind of content type to be extended
|
||||||
|
* from. Also, they are legit perents for UDCTs.
|
||||||
*
|
*
|
||||||
* @param isInternal true if this content type should be internal,
|
* @return Boolean.TRUE if this content type is internal, Boolean.FALSE
|
||||||
* false otherwise
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
public void setInternal(boolean isInternal) {
|
public Boolean isHidden() {
|
||||||
set(IS_INTERNAL, (isInternal ? Boolean.TRUE : Boolean.FALSE));
|
return "H".equalsIgnoreCase((String) get(MODE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the display / user mode of this content type
|
||||||
|
*
|
||||||
|
* @param mode string. ATM: "interal" or "hidden" or ""
|
||||||
|
*/
|
||||||
|
public void setMode(String mode) {
|
||||||
|
if (mode != null && !mode.isEmpty()) {
|
||||||
|
set(MODE, mode.toUpperCase().substring(0, 1));
|
||||||
|
} else {
|
||||||
|
set(MODE, "default".toUpperCase().substring(0, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMode() {
|
||||||
|
return (String) get(MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -481,7 +501,19 @@ public class ContentType extends ACSObject {
|
||||||
* @return A collection of all content types
|
* @return A collection of all content types
|
||||||
*/
|
*/
|
||||||
public static ContentTypeCollection getAllContentTypes() {
|
public static ContentTypeCollection getAllContentTypes() {
|
||||||
return getAllContentTypes(true);
|
return getAllContentTypes(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches a collection of all content types, including internal content
|
||||||
|
* types.
|
||||||
|
*
|
||||||
|
* @param hidden If false, fetch all content types, ecluding hidden
|
||||||
|
* content types
|
||||||
|
* @return A collection of all content types
|
||||||
|
*/
|
||||||
|
public static ContentTypeCollection getAllContentTypes(boolean hidden) {
|
||||||
|
return getAllContentTypes(true, hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -490,19 +522,25 @@ public class ContentType extends ACSObject {
|
||||||
* @return A collection of user-defined content types
|
* @return A collection of user-defined content types
|
||||||
*/
|
*/
|
||||||
public static ContentTypeCollection getUserDefinedContentTypes() {
|
public static ContentTypeCollection getUserDefinedContentTypes() {
|
||||||
return getAllContentTypes(false);
|
return getAllContentTypes(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param internal If true, fetch all content types, including internal
|
* @param internal If false, fetch all content types, excluding internal
|
||||||
|
* content types.
|
||||||
|
* @param hidden If false, fetch all content types, excluding hidden
|
||||||
* content types.
|
* content types.
|
||||||
*/
|
*/
|
||||||
private static ContentTypeCollection getAllContentTypes(boolean internal) {
|
private static ContentTypeCollection getAllContentTypes(boolean internal, boolean hidden) {
|
||||||
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||||
|
|
||||||
if (!internal) {
|
if (!internal) {
|
||||||
types.addFilter("isInternal = '0'");
|
types.addFilter("mode != 'I'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hidden) {
|
||||||
|
types.addFilter("mode != 'H'");
|
||||||
}
|
}
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +583,6 @@ public class ContentType extends ACSObject {
|
||||||
ctc.addFilter(or);
|
ctc.addFilter(or);
|
||||||
return ctc;
|
return ctc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List s_xsl = new ArrayList();
|
private static List s_xsl = new ArrayList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ import com.arsdigita.xml.XML;
|
||||||
// import java.io.IOException;
|
// import java.io.IOException;
|
||||||
// import java.io.InputStream;
|
// import java.io.InputStream;
|
||||||
// import java.util.HashMap;
|
// import java.util.HashMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
// import javax.xml.parsers.ParserConfigurationException;
|
// import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
@ -72,7 +73,6 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
// Migration status
|
// Migration status
|
||||||
//
|
//
|
||||||
// The module in its complete version (i.e. all method invocations in run()
|
// The module in its complete version (i.e. all method invocations in run()
|
||||||
|
|
@ -83,8 +83,6 @@ import org.apache.log4j.Logger;
|
||||||
//
|
//
|
||||||
// Next Try
|
// Next Try
|
||||||
// Refactor using legacy compatible web/Application and ApplicationSetup
|
// Refactor using legacy compatible web/Application and ApplicationSetup
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Executes nonrecurring at install time and loads (installs and initializes)
|
* <p>Executes nonrecurring at install time and loads (installs and initializes)
|
||||||
* the Content Management System module,including the Content Center, CMS Service
|
* the Content Management System module,including the Content Center, CMS Service
|
||||||
|
|
@ -115,14 +113,11 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
/** Creates a s_logging category with name = full name of class */
|
/** Creates a s_logging category with name = full name of class */
|
||||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
private static final Logger s_log = Logger.getLogger(Loader.class);
|
||||||
|
|
||||||
// Load main CMS configuration file
|
// Load main CMS configuration file
|
||||||
private static final LoaderConfig s_conf = new LoaderConfig();
|
private static final LoaderConfig s_conf = new LoaderConfig();
|
||||||
|
|
||||||
// static { // requirred to actually read the config file
|
// static { // requirred to actually read the config file
|
||||||
// s_config.load();
|
// s_config.load();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant string used as key for creating CMS (content-section) as a
|
* Constant string used as key for creating CMS (content-section) as a
|
||||||
* legacy application.
|
* legacy application.
|
||||||
|
|
@ -139,7 +134,6 @@ public class Loader extends PackageLoader {
|
||||||
*/
|
*/
|
||||||
private final static String CMS_STYLESHEET =
|
private final static String CMS_STYLESHEET =
|
||||||
"/packages/content-section/xsl/cms.xsl";
|
"/packages/content-section/xsl/cms.xsl";
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Constant string used as key for creating Workspace (content-center) as a
|
// * Constant string used as key for creating Workspace (content-center) as a
|
||||||
// * legacy application.
|
// * legacy application.
|
||||||
|
|
@ -160,7 +154,6 @@ public class Loader extends PackageLoader {
|
||||||
*/
|
*/
|
||||||
private final static String WORKSPACE_STYLESHEET =
|
private final static String WORKSPACE_STYLESHEET =
|
||||||
"/packages/content-section/xsl/content-center.xsl";
|
"/packages/content-section/xsl/content-center.xsl";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the CMS service package instance, i.e. its URL.
|
* Name of the CMS service package instance, i.e. its URL.
|
||||||
*/
|
*/
|
||||||
|
|
@ -170,9 +163,7 @@ public class Loader extends PackageLoader {
|
||||||
// * legacy application.
|
// * legacy application.
|
||||||
// */
|
// */
|
||||||
// public final static String SERVICE_PACKAGE_KEY = "cms-service";
|
// public final static String SERVICE_PACKAGE_KEY = "cms-service";
|
||||||
|
private ArrayList m_content_type_list = new ArrayList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard constructor.
|
* Standard constructor.
|
||||||
|
|
@ -183,11 +174,11 @@ public class Loader extends PackageLoader {
|
||||||
s_log.debug("CMS.loader (Constructor) completed");
|
s_log.debug("CMS.loader (Constructor) completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void run(final ScriptContext ctx) {
|
public void run(final ScriptContext ctx) {
|
||||||
s_log.debug("CMS.loader.run() invoked");
|
s_log.debug("CMS.loader.run() invoked");
|
||||||
|
|
||||||
new KernelExcursion() {
|
new KernelExcursion() {
|
||||||
|
|
||||||
public void excurse() {
|
public void excurse() {
|
||||||
setEffectiveParty(Kernel.getSystemParty());
|
setEffectiveParty(Kernel.getSystemParty());
|
||||||
|
|
||||||
|
|
@ -291,8 +282,6 @@ public class Loader extends PackageLoader {
|
||||||
//
|
//
|
||||||
// s_log.debug("Done creating the CMS package type.");
|
// s_log.debug("Done creating the CMS package type.");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and instantiates the Workspace package (content-center) in the
|
* Loads and instantiates the Workspace package (content-center) in the
|
||||||
* database using old style application.
|
* database using old style application.
|
||||||
|
|
@ -345,7 +334,6 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and instantiates the Workspace package (content-center) in the
|
* Loads and instantiates the Workspace package (content-center) in the
|
||||||
* database.
|
* database.
|
||||||
|
|
@ -372,6 +360,8 @@ public class Loader extends PackageLoader {
|
||||||
appsetup.setSingleton(true);
|
appsetup.setSingleton(true);
|
||||||
appsetup.setPortalApplication(false);
|
appsetup.setPortalApplication(false);
|
||||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new Workspace(dataObject);
|
return new Workspace(dataObject);
|
||||||
}
|
}
|
||||||
|
|
@ -392,7 +382,6 @@ public class Loader extends PackageLoader {
|
||||||
s_log.debug("Done loading CMS Workspace.");
|
s_log.debug("Done loading CMS Workspace.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CMS Service application is used by the Content Management System as a
|
* CMS Service application is used by the Content Management System as a
|
||||||
* store for global resources and assets.
|
* store for global resources and assets.
|
||||||
|
|
@ -404,8 +393,7 @@ public class Loader extends PackageLoader {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// from ServiceInstaller.createPackageType();
|
// from ServiceInstaller.createPackageType();
|
||||||
PackageType type = PackageType.create
|
PackageType type = PackageType.create(CMS.SERVICE_PACKAGE_KEY,
|
||||||
(CMS.SERVICE_PACKAGE_KEY,
|
|
||||||
"Content Management System Services",
|
"Content Management System Services",
|
||||||
"Content Management System Services",
|
"Content Management System Services",
|
||||||
"http://cms-service.arsdigita.com/");
|
"http://cms-service.arsdigita.com/");
|
||||||
|
|
@ -425,12 +413,10 @@ public class Loader extends PackageLoader {
|
||||||
node.save();
|
node.save();
|
||||||
|
|
||||||
} catch (DataObjectNotFoundException e) {
|
} catch (DataObjectNotFoundException e) {
|
||||||
throw new ConfigError
|
throw new ConfigError("Failed to initialize CMS global services package.");
|
||||||
("Failed to initialize CMS global services package.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CMS Service application is used by the Content Management System as a
|
* CMS Service application is used by the Content Management System as a
|
||||||
* store for global resources and assets.
|
* store for global resources and assets.
|
||||||
|
|
@ -459,6 +445,8 @@ public class Loader extends PackageLoader {
|
||||||
appsetup.setSingleton(true);
|
appsetup.setSingleton(true);
|
||||||
appsetup.setPortalApplication(false);
|
appsetup.setPortalApplication(false);
|
||||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||||
|
|
||||||
|
@Override
|
||||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new Service(dataObject);
|
return new Service(dataObject);
|
||||||
}
|
}
|
||||||
|
|
@ -479,7 +467,6 @@ public class Loader extends PackageLoader {
|
||||||
s_log.debug("Done creating CMS Service Package.");
|
s_log.debug("Done creating CMS Service Package.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an content section application type and an initial default
|
* Load an content section application type and an initial default
|
||||||
* content-section instance as specified in LoaderConfig.
|
* content-section instance as specified in LoaderConfig.
|
||||||
|
|
@ -507,6 +494,7 @@ public class Loader extends PackageLoader {
|
||||||
appType.setStylesheet(CMS_STYLESHEET); // by default: /pack./c-s/xml/cms.xml
|
appType.setStylesheet(CMS_STYLESHEET); // by default: /pack./c-s/xml/cms.xml
|
||||||
// contains the xsl to generate the page
|
// contains the xsl to generate the page
|
||||||
appType.setInstantiator(new ACSObjectInstantiator() {
|
appType.setInstantiator(new ACSObjectInstantiator() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainObject doNewInstance(DataObject dataObject) {
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
return new ContentSection(dataObject);
|
return new ContentSection(dataObject);
|
||||||
|
|
@ -550,6 +538,7 @@ public class Loader extends PackageLoader {
|
||||||
s_conf.getTemplateResolverClass());
|
s_conf.getTemplateResolverClass());
|
||||||
// XML generator class, set autonomously by ContentSection.create()
|
// XML generator class, set autonomously by ContentSection.create()
|
||||||
|
|
||||||
|
setup.registerContentTypes(m_content_type_list);
|
||||||
setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
|
setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
|
||||||
// Section specific categories, usually not used.
|
// Section specific categories, usually not used.
|
||||||
// During initial load at install time nor used at all!
|
// During initial load at install time nor used at all!
|
||||||
|
|
@ -606,18 +595,28 @@ public class Loader extends PackageLoader {
|
||||||
s_log.debug("Loading content type definitions ...");
|
s_log.debug("Loading content type definitions ...");
|
||||||
|
|
||||||
if (ctDefFiles != null) {
|
if (ctDefFiles != null) {
|
||||||
|
XMLContentTypeHandler handler = new XMLContentTypeHandler();
|
||||||
Iterator i = ctDefFiles.iterator();
|
Iterator i = ctDefFiles.iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
String xmlFile = (String) i.next();
|
String xmlFile = (String) i.next();
|
||||||
s_log.debug("Processing contentTypes in: " + xmlFile);
|
s_log.debug("Processing contentTypes in: " + xmlFile);
|
||||||
XML.parseResource(xmlFile, new XMLContentTypeHandler());
|
XML.parseResource(xmlFile, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Iterator iter = handler.getContentTypes().iterator();
|
||||||
|
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
ContentType ct = (ContentType) iter.next();
|
||||||
|
if (!ct.isInternal()) {
|
||||||
|
m_content_type_list.add(ct.getClassName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s_log.debug("Done loading content type definitions.");
|
s_log.debug("Done loading content type definitions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integrates the CMS privileges into the Core permision system.
|
* Integrates the CMS privileges into the Core permision system.
|
||||||
*
|
*
|
||||||
|
|
@ -646,6 +645,4 @@ public class Loader extends PackageLoader {
|
||||||
}
|
}
|
||||||
s_log.debug("Done creating Privileges.");
|
s_log.debug("Done creating Privileges.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,20 +33,14 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.cms.workflow.CMSTask;
|
import com.arsdigita.cms.workflow.CMSTask;
|
||||||
import com.arsdigita.cms.workflow.CMSTaskType;
|
import com.arsdigita.cms.workflow.CMSTaskType;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
// import com.arsdigita.domain.DomainObject;
|
|
||||||
import com.arsdigita.initializer.InitializationException;
|
import com.arsdigita.initializer.InitializationException;
|
||||||
// import com.arsdigita.kernel.ACSObjectInstantiator;
|
|
||||||
import com.arsdigita.kernel.Party;
|
import com.arsdigita.kernel.Party;
|
||||||
import com.arsdigita.kernel.PartyCollection;
|
import com.arsdigita.kernel.PartyCollection;
|
||||||
import com.arsdigita.kernel.Role;
|
import com.arsdigita.kernel.Role;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
// import com.arsdigita.persistence.DataObject;
|
|
||||||
// import com.arsdigita.runtime.AbstractConfig;
|
|
||||||
import com.arsdigita.cms.LoaderConfig;
|
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
// import com.arsdigita.web.ApplicationSetup;
|
|
||||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
|
|
@ -59,7 +53,6 @@ import java.util.EmptyStackException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
// import java.util.NoSuchElementException;
|
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -78,14 +71,12 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
public final class ContentSectionSetup {
|
public final class ContentSectionSetup {
|
||||||
|
|
||||||
private static Logger s_log = Logger.getLogger(ContentSectionSetup.class);
|
private static Logger s_log = Logger.getLogger(ContentSectionSetup.class);
|
||||||
|
|
||||||
private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
|
private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
|
||||||
private HashMap m_tasks = new HashMap();
|
private HashMap m_tasks = new HashMap();
|
||||||
private LifecycleDefinition m_lcd;
|
private LifecycleDefinition m_lcd;
|
||||||
private WorkflowTemplate m_wf;
|
private WorkflowTemplate m_wf;
|
||||||
final ContentSection m_section;
|
final ContentSection m_section;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Using this constructor the content section has to be
|
* Constructor. Using this constructor the content section has to be
|
||||||
* already created using ContentSection.create(name)
|
* already created using ContentSection.create(name)
|
||||||
|
|
@ -98,7 +89,6 @@ public final class ContentSectionSetup {
|
||||||
m_section = section;
|
m_section = section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper class to create and configure a content section instance
|
* Wrapper class to create and configure a content section instance
|
||||||
* in one step.
|
* in one step.
|
||||||
|
|
@ -111,8 +101,7 @@ public final class ContentSectionSetup {
|
||||||
String templateResolverClassName,
|
String templateResolverClassName,
|
||||||
List sectionContentTypes,
|
List sectionContentTypes,
|
||||||
Boolean useSectionCategories,
|
Boolean useSectionCategories,
|
||||||
List categoryFileList
|
List categoryFileList) {
|
||||||
) {
|
|
||||||
s_log.info("Creating content section on /" + name);
|
s_log.info("Creating content section on /" + name);
|
||||||
|
|
||||||
ContentSection section = ContentSection.create(name);
|
ContentSection section = ContentSection.create(name);
|
||||||
|
|
@ -143,8 +132,6 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps through a list of roles which are part of a staff group and
|
* Steps through a list of roles which are part of a staff group and
|
||||||
* delegates processing of each role.
|
* delegates processing of each role.
|
||||||
|
|
@ -170,9 +157,10 @@ public final class ContentSectionSetup {
|
||||||
desc,
|
desc,
|
||||||
privileges);
|
privileges);
|
||||||
|
|
||||||
if (task != null)
|
if (task != null) {
|
||||||
m_tasks.put(task, group);
|
m_tasks.put(task, group);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,8 +186,8 @@ public final class ContentSectionSetup {
|
||||||
role.grantPermission(m_section,
|
role.grantPermission(m_section,
|
||||||
PrivilegeDescriptor.get("cms_" + priv));
|
PrivilegeDescriptor.get("cms_" + priv));
|
||||||
|
|
||||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN) ||
|
if (priv.equals(SecurityManager.CATEGORY_ADMIN)
|
||||||
priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
|
|| priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
|
||||||
RootCategoryCollection coll = Category.getRootCategories(m_section);
|
RootCategoryCollection coll = Category.getRootCategories(m_section);
|
||||||
while (coll.next()) {
|
while (coll.next()) {
|
||||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN)) {
|
if (priv.equals(SecurityManager.CATEGORY_ADMIN)) {
|
||||||
|
|
@ -238,10 +226,10 @@ public final class ContentSectionSetup {
|
||||||
: "registered@nullhost";
|
: "registered@nullhost";
|
||||||
|
|
||||||
Party viewer = retrieveParty(email);
|
Party viewer = retrieveParty(email);
|
||||||
if (viewer == null)
|
if (viewer == null) {
|
||||||
throw new InitializationException(
|
throw new InitializationException((String) GlobalizationUtil.globalize(
|
||||||
(String) GlobalizationUtil.globalize(
|
|
||||||
"cms.installer.cannot_find_group_for_email").localize() + email);
|
"cms.installer.cannot_find_group_for_email").localize() + email);
|
||||||
|
}
|
||||||
|
|
||||||
s_log.info("Adding " + email + " to viewers role");
|
s_log.info("Adding " + email + " to viewers role");
|
||||||
viewers.getGroup().addMemberOrSubgroup(viewer);
|
viewers.getGroup().addMemberOrSubgroup(viewer);
|
||||||
|
|
@ -282,22 +270,18 @@ public final class ContentSectionSetup {
|
||||||
s_log.info("Registering " + itemResolverClassName
|
s_log.info("Registering " + itemResolverClassName
|
||||||
+ " as the item resolver class");
|
+ " as the item resolver class");
|
||||||
} else {
|
} else {
|
||||||
m_section.setItemResolverClass(ContentSection.getConfig()
|
m_section.setItemResolverClass(ContentSection.getConfig().getDefaultItemResolverClass().getName());
|
||||||
.getDefaultItemResolverClass()
|
|
||||||
.getName());
|
|
||||||
s_log.info("Registering " + itemResolverClassName
|
s_log.info("Registering " + itemResolverClassName
|
||||||
+ " as the item resolver class");
|
+ " as the item resolver class");
|
||||||
}
|
}
|
||||||
if (templateResolverClassName != null && templateResolverClassName.length() > 0) {
|
if (templateResolverClassName != null && templateResolverClassName.length() > 0) {
|
||||||
m_section.setTemplateResolverClass(templateResolverClassName);
|
m_section.setTemplateResolverClass(templateResolverClassName);
|
||||||
s_log.info("Registering " + templateResolverClassName +
|
s_log.info("Registering " + templateResolverClassName
|
||||||
" as the template resolver class");
|
+ " as the template resolver class");
|
||||||
} else {
|
} else {
|
||||||
m_section.setTemplateResolverClass(ContentSection.getConfig()
|
m_section.setTemplateResolverClass(ContentSection.getConfig().getDefaultTemplateResolverClass().getName());
|
||||||
.getDefaultTemplateResolverClass()
|
s_log.info("Registering " + templateResolverClassName
|
||||||
.getName());
|
+ " as the template resolver class");
|
||||||
s_log.info("Registering " + templateResolverClassName +
|
|
||||||
" as the template resolver class");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_section.save();
|
m_section.save();
|
||||||
|
|
@ -356,8 +340,9 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
|
|
||||||
Role author = (Role) m_tasks.get("Authoring");
|
Role author = (Role) m_tasks.get("Authoring");
|
||||||
if (author != null)
|
if (author != null) {
|
||||||
authoring.assignGroup(author.getGroup());
|
authoring.assignGroup(author.getGroup());
|
||||||
|
}
|
||||||
|
|
||||||
authoring.setTaskType(CMSTaskType.retrieve(CMSTaskType.AUTHOR));
|
authoring.setTaskType(CMSTaskType.retrieve(CMSTaskType.AUTHOR));
|
||||||
authoring.save();
|
authoring.save();
|
||||||
|
|
@ -371,8 +356,9 @@ public final class ContentSectionSetup {
|
||||||
approval.save();
|
approval.save();
|
||||||
|
|
||||||
Role approver = (Role) m_tasks.get("Approval");
|
Role approver = (Role) m_tasks.get("Approval");
|
||||||
if (approver != null)
|
if (approver != null) {
|
||||||
approval.assignGroup(approver.getGroup());
|
approval.assignGroup(approver.getGroup());
|
||||||
|
}
|
||||||
|
|
||||||
approval.setTaskType(CMSTaskType.retrieve(CMSTaskType.EDIT));
|
approval.setTaskType(CMSTaskType.retrieve(CMSTaskType.EDIT));
|
||||||
approval.save();
|
approval.save();
|
||||||
|
|
@ -387,8 +373,9 @@ public final class ContentSectionSetup {
|
||||||
deploy.save();
|
deploy.save();
|
||||||
|
|
||||||
Role publisher = (Role) m_tasks.get("Publishing");
|
Role publisher = (Role) m_tasks.get("Publishing");
|
||||||
if (publisher != null)
|
if (publisher != null) {
|
||||||
deploy.assignGroup(publisher.getGroup());
|
deploy.assignGroup(publisher.getGroup());
|
||||||
|
}
|
||||||
|
|
||||||
deploy.setTaskType(CMSTaskType.retrieve(CMSTaskType.DEPLOY));
|
deploy.setTaskType(CMSTaskType.retrieve(CMSTaskType.DEPLOY));
|
||||||
deploy.save();
|
deploy.save();
|
||||||
|
|
@ -448,14 +435,13 @@ public final class ContentSectionSetup {
|
||||||
s_log.info("Adding type " + name + " to " + m_section.getDisplayName());
|
s_log.info("Adding type " + name + " to " + m_section.getDisplayName());
|
||||||
m_section.addContentType(type);
|
m_section.addContentType(type);
|
||||||
|
|
||||||
s_log.info("Setting the default lifecycle for " +
|
s_log.info("Setting the default lifecycle for "
|
||||||
name + " to " + m_lcd.getLabel());
|
+ name + " to " + m_lcd.getLabel());
|
||||||
ContentTypeLifecycleDefinition.
|
ContentTypeLifecycleDefinition.updateLifecycleDefinition(m_section, type, m_lcd);
|
||||||
updateLifecycleDefinition(m_section, type, m_lcd);
|
|
||||||
m_lcd.save();
|
m_lcd.save();
|
||||||
|
|
||||||
s_log.info("Setting the default workflow template for " + name +
|
s_log.info("Setting the default workflow template for " + name
|
||||||
" to " + m_wf.getLabel());
|
+ " to " + m_wf.getLabel());
|
||||||
ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf);
|
ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf);
|
||||||
m_wf.save();
|
m_wf.save();
|
||||||
|
|
||||||
|
|
@ -468,8 +454,9 @@ public final class ContentSectionSetup {
|
||||||
int pos1 = filename.lastIndexOf("/");
|
int pos1 = filename.lastIndexOf("/");
|
||||||
int pos2 = filename.lastIndexOf(".");
|
int pos2 = filename.lastIndexOf(".");
|
||||||
|
|
||||||
if (pos2 == -1)
|
if (pos2 == -1) {
|
||||||
pos2 = filename.length();
|
pos2 = filename.length();
|
||||||
|
}
|
||||||
|
|
||||||
String label = filename.substring(pos1 + 1, pos2);
|
String label = filename.substring(pos1 + 1, pos2);
|
||||||
|
|
||||||
|
|
@ -483,21 +470,16 @@ public final class ContentSectionSetup {
|
||||||
temp.setLabel(label);
|
temp.setLabel(label);
|
||||||
temp.setParent(m_section.getTemplatesFolder());
|
temp.setParent(m_section.getTemplatesFolder());
|
||||||
|
|
||||||
final ClassLoader loader = Thread.currentThread
|
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||||
().getContextClassLoader();
|
final InputStream stream = loader.getResourceAsStream(filename.substring(1));
|
||||||
final InputStream stream = loader.getResourceAsStream
|
|
||||||
(filename.substring(1));
|
|
||||||
|
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
throw new IllegalStateException
|
throw new IllegalStateException((String) GlobalizationUtil.globalize("cms.installer.cannot_find_file").localize() + filename);
|
||||||
((String) GlobalizationUtil.globalize
|
|
||||||
("cms.installer.cannot_find_file").localize() + filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final BufferedReader input = new BufferedReader
|
final BufferedReader input = new BufferedReader(new InputStreamReader(stream));
|
||||||
(new InputStreamReader(stream));
|
|
||||||
|
|
||||||
StringBuffer body = new StringBuffer();
|
StringBuilder body = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -507,8 +489,9 @@ public final class ContentSectionSetup {
|
||||||
(String) GlobalizationUtil.globalize(
|
(String) GlobalizationUtil.globalize(
|
||||||
"cms.installer.cannot_read_line_of_data").localize(), ex);
|
"cms.installer.cannot_read_line_of_data").localize(), ex);
|
||||||
}
|
}
|
||||||
if (line == null)
|
if (line == null) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
body.append(line);
|
body.append(line);
|
||||||
body.append("\n");
|
body.append("\n");
|
||||||
|
|
@ -518,12 +501,9 @@ public final class ContentSectionSetup {
|
||||||
|
|
||||||
temp.save();
|
temp.save();
|
||||||
|
|
||||||
TemplateManagerFactory.getInstance()
|
TemplateManagerFactory.getInstance().addTemplate(m_section, type, temp, "public");
|
||||||
.addTemplate(m_section, type, temp, "public");
|
|
||||||
|
|
||||||
temp.publish(m_lcd, new Date());
|
temp.publish(m_lcd, new Date());
|
||||||
// Dan said to comment this out
|
|
||||||
// temp.getLifecycle().start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -553,7 +533,6 @@ public final class ContentSectionSetup {
|
||||||
alert.save();
|
alert.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// // Currently there is no way to persists alert preferemces, therefore
|
// // Currently there is no way to persists alert preferemces, therefore
|
||||||
// // currently not a loader or setup task.
|
// // currently not a loader or setup task.
|
||||||
// /**
|
// /**
|
||||||
|
|
@ -607,14 +586,13 @@ public final class ContentSectionSetup {
|
||||||
//
|
//
|
||||||
// return unfinished;
|
// return unfinished;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// ///////////////////// Private Class Section ////////////////////////////
|
// ///////////////////// Private Class Section ////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAX Handler for category lists. Creates the categories as they are
|
* SAX Handler for category lists. Creates the categories as they are
|
||||||
* defined, with structure, in the xml document.
|
* defined, with structure, in the xml document.
|
||||||
*/
|
*/
|
||||||
private class CategoryHandler extends DefaultHandler {
|
private class CategoryHandler extends DefaultHandler {
|
||||||
|
|
||||||
private Stack m_cats = new Stack();
|
private Stack m_cats = new Stack();
|
||||||
private ContentSection m_section;
|
private ContentSection m_section;
|
||||||
|
|
||||||
|
|
@ -687,5 +665,4 @@ public final class ContentSectionSetup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,7 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
|
||||||
ContentSection.BASE_DATA_OBJECT_TYPE);
|
ContentSection.BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
while (sections.next()) {
|
while (sections.next()) {
|
||||||
ContentSection section = (ContentSection) DomainObjectFactory.
|
ContentSection section = (ContentSection) DomainObjectFactory.newInstance(sections.getDataObject());
|
||||||
newInstance(sections.getDataObject());
|
|
||||||
if (!isLoadableInto(section)) {
|
if (!isLoadableInto(section)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ public interface ContentTypeHelper {
|
||||||
public void setLabelKey(String labelKey);
|
public void setLabelKey(String labelKey);
|
||||||
public String getLabelKey();
|
public String getLabelKey();
|
||||||
public boolean isInternal();
|
public boolean isInternal();
|
||||||
public void setInternal(boolean internal);
|
public boolean isHidden();
|
||||||
|
public void setMode(String mode);
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
public void setDescription(String description) ;
|
public void setDescription(String description) ;
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
||||||
private String m_className;
|
private String m_className;
|
||||||
private String m_createComponent;
|
private String m_createComponent;
|
||||||
private AuthoringKit m_kit;
|
private AuthoringKit m_kit;
|
||||||
private boolean m_internal;
|
private String m_mode;
|
||||||
|
|
||||||
public ContentTypeHelperImpl() {
|
public ContentTypeHelperImpl() {
|
||||||
}
|
}
|
||||||
|
|
@ -95,12 +95,16 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
||||||
return m_labelKey;
|
return m_labelKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInternal(boolean internal) {
|
public void setMode(String mode) {
|
||||||
m_internal = internal;
|
m_mode = mode.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInternal() {
|
public boolean isInternal() {
|
||||||
return m_internal;
|
return m_mode.equalsIgnoreCase("internal");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHidden() {
|
||||||
|
return m_mode.equalsIgnoreCase("hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -210,7 +214,7 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
||||||
m_type.setDescription(m_description);
|
m_type.setDescription(m_description);
|
||||||
m_type.setClassName(m_className);
|
m_type.setClassName(m_className);
|
||||||
m_type.setAssociatedObjectType(m_objectType);
|
m_type.setAssociatedObjectType(m_objectType);
|
||||||
m_type.setInternal(m_internal);
|
m_type.setMode(m_mode);
|
||||||
|
|
||||||
// create pedigree for this content type
|
// create pedigree for this content type
|
||||||
createPedigree(m_type);
|
createPedigree(m_type);
|
||||||
|
|
@ -221,7 +225,7 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
||||||
// Turn on search indexing for this type
|
// Turn on search indexing for this type
|
||||||
ObjectType type = SessionManager.getMetadataRoot().getObjectType(m_objectType);
|
ObjectType type = SessionManager.getMetadataRoot().getObjectType(m_objectType);
|
||||||
if (type.isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE)
|
if (type.isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE)
|
||||||
&& !m_internal) {
|
&& !isInternal()) {
|
||||||
s_log.debug("Registering search adapter for "
|
s_log.debug("Registering search adapter for "
|
||||||
+ m_objectType);
|
+ m_objectType);
|
||||||
MetadataProviderRegistry.registerAdapter(
|
MetadataProviderRegistry.registerAdapter(
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.installer.xml;
|
package com.arsdigita.cms.installer.xml;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.cms.AuthoringKit;
|
import com.arsdigita.cms.AuthoringKit;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -38,26 +38,22 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @see ContentTypeInitializer
|
* @see ContentTypeInitializer
|
||||||
* @author Nobuko Asakai <nasakai@redhat.com> */
|
* @author Nobuko Asakai <nasakai@redhat.com> */
|
||||||
|
|
||||||
public class XMLContentTypeHandler extends DefaultHandler {
|
public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
|
|
||||||
private static Logger s_log =
|
private static Logger s_log =
|
||||||
Logger.getLogger(XMLContentTypeHandler.class.getName());
|
Logger.getLogger(XMLContentTypeHandler.class.getName());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ArrayList m_types = new ArrayList();
|
private ArrayList m_types = new ArrayList();
|
||||||
|
|
||||||
private ContentTypeHelper m_type;
|
private ContentTypeHelper m_type;
|
||||||
private ContentType m_contentType;
|
private ContentType m_contentType;
|
||||||
private AuthoringKit m_authoringKit;
|
private AuthoringKit m_authoringKit;
|
||||||
private int m_nextOrder;
|
private int m_nextOrder;
|
||||||
|
|
||||||
private boolean m_including;
|
private boolean m_including;
|
||||||
|
|
||||||
public List getContentTypes() {
|
public List getContentTypes() {
|
||||||
return m_types;
|
return m_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startElement(String uri, String name,
|
public void startElement(String uri, String name,
|
||||||
String qName, Attributes atts) {
|
String qName, Attributes atts) {
|
||||||
if (name.equals("content-types")) {
|
if (name.equals("content-types")) {
|
||||||
|
|
@ -85,14 +81,17 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
m_type.setObjectType(atts.getValue("objectType"));
|
m_type.setObjectType(atts.getValue("objectType"));
|
||||||
m_type.setClassName(atts.getValue("classname"));
|
m_type.setClassName(atts.getValue("classname"));
|
||||||
|
|
||||||
String internal = atts.getValue("isInternal");
|
String mode = atts.getValue("mode");
|
||||||
if (internal != null &&
|
if (mode != null && !mode.isEmpty()) {
|
||||||
"yes".equals(internal)) {
|
m_type.setMode(mode.trim());
|
||||||
m_type.setInternal(true);
|
} else {
|
||||||
|
m_type.setMode("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
// UDCT stuff
|
// UDCT stuff
|
||||||
m_type.setParentType(parentType);
|
m_type.setParentType(parentType);
|
||||||
m_type.setName(atts.getValue("name"));
|
m_type.setName(atts.getValue("name"));
|
||||||
|
|
||||||
m_contentType = m_type.createType();
|
m_contentType = m_type.createType();
|
||||||
m_types.add(m_contentType);
|
m_types.add(m_contentType);
|
||||||
} else if (name.equals("authoring-kit")) {
|
} else if (name.equals("authoring-kit")) {
|
||||||
|
|
@ -120,8 +119,7 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
||||||
m_type.addAuthoringStep(labelKey, labelBundle,
|
m_type.addAuthoringStep(labelKey, labelBundle,
|
||||||
descriptionKey, descriptionBundle,
|
descriptionKey, descriptionBundle,
|
||||||
atts.getValue("component"),
|
atts.getValue("component"),
|
||||||
new BigDecimal(m_nextOrder++)
|
new BigDecimal(m_nextOrder++));
|
||||||
);
|
|
||||||
} else if (name.equals("include")) {
|
} else if (name.equals("include")) {
|
||||||
String file = atts.getValue("href");
|
String file = atts.getValue("href");
|
||||||
m_including = true;
|
m_including = true;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.type;
|
package com.arsdigita.cms.ui.type;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
|
|
@ -58,18 +57,16 @@ public class AddContentItemElement extends ElementAddForm {
|
||||||
|
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(AddContentItemElement.class);
|
Logger.getLogger(AddContentItemElement.class);
|
||||||
|
|
||||||
private SingleSelect m_itemTypeSelect;
|
private SingleSelect m_itemTypeSelect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public AddContentItemElement(ACSObjectSelectionModel types) {
|
public AddContentItemElement(ACSObjectSelectionModel types) {
|
||||||
super("ContentTypeAddContentItemElement", "Add a ContentItem Element", types);
|
super("ContentTypeAddContentItemElement", "Add a ContentItem Element", types);
|
||||||
|
|
||||||
add(new Label(GlobalizationUtil.globalize
|
add(new Label(GlobalizationUtil.globalize("cms.ui.type.association_content_type")));
|
||||||
("cms.ui.type.association_content_type")));
|
m_itemTypeSelect = new SingleSelect(new BigDecimalParameter("AddContentItemTypeSelect"));
|
||||||
m_itemTypeSelect = new SingleSelect
|
|
||||||
(new BigDecimalParameter("AddContentItemTypeSelect"));
|
|
||||||
try {
|
try {
|
||||||
m_itemTypeSelect.addPrintListener(new ItemTypeSelectPrintListener());
|
m_itemTypeSelect.addPrintListener(new ItemTypeSelectPrintListener());
|
||||||
} catch (TooManyListenersException ex) {
|
} catch (TooManyListenersException ex) {
|
||||||
|
|
@ -92,9 +89,7 @@ public class AddContentItemElement extends ElementAddForm {
|
||||||
try {
|
try {
|
||||||
itemType = new ContentType(itemTypeID);
|
itemType = new ContentType(itemTypeID);
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
throw new FormProcessException
|
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.type.invalid").localize());
|
||||||
((String) GlobalizationUtil.globalize
|
|
||||||
("cms.ui.type.invalid").localize());
|
|
||||||
}
|
}
|
||||||
return itemType;
|
return itemType;
|
||||||
}
|
}
|
||||||
|
|
@ -105,8 +100,7 @@ public class AddContentItemElement extends ElementAddForm {
|
||||||
|
|
||||||
ContentType itemType = getItemType(state);
|
ContentType itemType = getItemType(state);
|
||||||
dot.addOptionalAssociation(label,
|
dot.addOptionalAssociation(label,
|
||||||
MetadataRoot.getMetadataRoot().getObjectType
|
MetadataRoot.getMetadataRoot().getObjectType(itemType.getAssociatedObjectType()));
|
||||||
(itemType.getAssociatedObjectType()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void addFormComponent(PersistentForm pForm, String label,
|
protected final void addFormComponent(PersistentForm pForm, String label,
|
||||||
|
|
@ -119,8 +113,7 @@ public class AddContentItemElement extends ElementAddForm {
|
||||||
pContentTypeName.save();
|
pContentTypeName.save();
|
||||||
pForm.addComponent(pContentTypeName);
|
pForm.addComponent(pContentTypeName);
|
||||||
PersistentSingleSelect pSelect = PersistentSingleSelect.create(label);
|
PersistentSingleSelect pSelect = PersistentSingleSelect.create(label);
|
||||||
pSelect.setParameterModel
|
pSelect.setParameterModel("com.arsdigita.bebop.parameters.BigDecimalParameter");
|
||||||
("com.arsdigita.bebop.parameters.BigDecimalParameter");
|
|
||||||
pSelect.save();
|
pSelect.save();
|
||||||
pForm.addComponent(pSelect);
|
pForm.addComponent(pSelect);
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +130,7 @@ public class AddContentItemElement extends ElementAddForm {
|
||||||
// Get the current content section
|
// Get the current content section
|
||||||
ContentSection section = CMS.getContext().getContentSection();
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
|
||||||
ContentTypeCollection contentTypes = section.getCreatableContentTypes();
|
ContentTypeCollection contentTypes = section.getCreatableContentTypes(true);
|
||||||
contentTypes.addOrder(ContentType.LABEL);
|
contentTypes.addOrder(ContentType.LABEL);
|
||||||
while (contentTypes.next()) {
|
while (contentTypes.next()) {
|
||||||
ContentType type = contentTypes.getContentType();
|
ContentType type = contentTypes.getContentType();
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import com.arsdigita.toolbox.ui.Cancellable;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains the split pane for the ContentType
|
* This class contains the split pane for the ContentType
|
||||||
* administration interface.
|
* administration interface.
|
||||||
|
|
@ -60,9 +61,7 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public final class ContentTypeAdminPane extends BaseAdminPane {
|
public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger(ContentTypeAdminPane.class);
|
||||||
(ContentTypeAdminPane.class);
|
|
||||||
|
|
||||||
private final ACSObjectSelectionModel m_model;
|
private final ACSObjectSelectionModel m_model;
|
||||||
private final ContentTypeRequestLocal m_type;
|
private final ContentTypeRequestLocal m_type;
|
||||||
|
|
||||||
|
|
@ -98,13 +97,13 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
super.register(p);
|
super.register(p);
|
||||||
|
|
||||||
p.addActionListener(new ActionListener() {
|
p.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
ContentType contentType = (ContentType) m_model.getSelectedObject(state);
|
ContentType contentType = (ContentType) m_model.getSelectedObject(state);
|
||||||
ContentSection section = CMS.getContext().getContentSection();
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
if (contentType == null) {
|
if (contentType == null) {
|
||||||
final String template = state.getRequest().getParameter
|
final String template = state.getRequest().getParameter(ContentSectionPage.SET_TEMPLATE);
|
||||||
(ContentSectionPage.SET_TEMPLATE);
|
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
DataCollection da = SessionManager.getSession().retrieve(SectionTemplateMapping.BASE_DATA_OBJECT_TYPE);
|
DataCollection da = SessionManager.getSession().retrieve(SectionTemplateMapping.BASE_DATA_OBJECT_TYPE);
|
||||||
DomainCollection c = new DomainCollection(da);
|
DomainCollection c = new DomainCollection(da);
|
||||||
|
|
@ -143,6 +142,7 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AddTypeContainer extends GridPanel implements ActionListener, FormProcessListener {
|
private class AddTypeContainer extends GridPanel implements ActionListener, FormProcessListener {
|
||||||
|
|
||||||
private Label m_noTypesAvailable =
|
private Label m_noTypesAvailable =
|
||||||
new Label(gz("cms.ui.type.select.none"));
|
new Label(gz("cms.ui.type.select.none"));
|
||||||
private SelectType m_selectType;
|
private SelectType m_selectType;
|
||||||
|
|
@ -157,28 +157,26 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
GridPanel container = new GridPanel(1);
|
GridPanel container = new GridPanel(1);
|
||||||
container.add(m_noTypesAvailable);
|
container.add(m_noTypesAvailable);
|
||||||
m_selectType = new SelectType();
|
m_selectType = new SelectType();
|
||||||
m_selectType.addSubmissionListener
|
m_selectType.addSubmissionListener(new CancelListener(m_selectType));
|
||||||
(new CancelListener(m_selectType));
|
|
||||||
m_selectType.addProcessListener(this);
|
m_selectType.addProcessListener(this);
|
||||||
container.add(m_selectType);
|
container.add(m_selectType);
|
||||||
selectSection.setBody(container);
|
selectSection.setBody(container);
|
||||||
|
|
||||||
Section addSection = new Section() {
|
Section addSection = new Section() {
|
||||||
|
|
||||||
public final boolean isVisible(final PageState state) {
|
public final boolean isVisible(final PageState state) {
|
||||||
return super.isVisible(state) &&
|
return super.isVisible(state)
|
||||||
!ContentSection.getConfig().getHideUDCTUI();
|
&& !ContentSection.getConfig().getHideUDCTUI();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
addSection.setHeading(new Label(gz("cms.ui.type.define")));
|
addSection.setHeading(new Label(gz("cms.ui.type.define")));
|
||||||
m_createType = new CreateType(m_model);
|
m_createType = new CreateType(m_model);
|
||||||
m_createType.addSubmissionListener
|
m_createType.addSubmissionListener(new CancelListener(m_createType));
|
||||||
(new CancelListener(m_createType));
|
|
||||||
m_createType.addProcessListener(this);
|
m_createType.addProcessListener(this);
|
||||||
addSection.setBody(m_createType);
|
addSection.setBody(m_createType);
|
||||||
add(addSection);
|
add(addSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
ContentSection section = CMS.getContext().getContentSection();
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
|
@ -194,7 +192,6 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
resetPane(state);
|
resetPane(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -203,7 +200,9 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
* becaue it was protected
|
* becaue it was protected
|
||||||
*/
|
*/
|
||||||
private final class CancelListener implements FormSubmissionListener {
|
private final class CancelListener implements FormSubmissionListener {
|
||||||
|
|
||||||
Cancellable m_form;
|
Cancellable m_form;
|
||||||
|
|
||||||
CancelListener(Cancellable form) {
|
CancelListener(Cancellable form) {
|
||||||
m_form = form;
|
m_form = form;
|
||||||
}
|
}
|
||||||
|
|
@ -221,13 +220,14 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
private void resetPane(PageState state) {
|
private void resetPane(PageState state) {
|
||||||
getBody().reset(state);
|
getBody().reset(state);
|
||||||
if (getSelectionModel().isSelected(state)) {
|
if (getSelectionModel().isSelected(state)) {
|
||||||
s_log.debug("The selection model is selected; displaying " +
|
s_log.debug("The selection model is selected; displaying "
|
||||||
"the item pane");
|
+ "the item pane");
|
||||||
getBody().push(state, getItemPane());
|
getBody().push(state, getItemPane());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SelectionRequestLocal extends ContentTypeRequestLocal {
|
private class SelectionRequestLocal extends ContentTypeRequestLocal {
|
||||||
|
|
||||||
protected final Object initialValue(final PageState state) {
|
protected final Object initialValue(final PageState state) {
|
||||||
ContentType contentType = (ContentType) m_model.getSelectedObject(state);
|
ContentType contentType = (ContentType) m_model.getSelectedObject(state);
|
||||||
return contentType;
|
return contentType;
|
||||||
|
|
@ -235,6 +235,7 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeleteForm extends BaseDeleteForm {
|
private class DeleteForm extends BaseDeleteForm {
|
||||||
|
|
||||||
DeleteForm() {
|
DeleteForm() {
|
||||||
super(new Label(gz("cms.ui.type.delete_prompt")));
|
super(new Label(gz("cms.ui.type.delete_prompt")));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class ContentTypeListModelBuilder extends LockableImpl
|
||||||
final ContentSection section =
|
final ContentSection section =
|
||||||
CMS.getContext().getContentSection();
|
CMS.getContext().getContentSection();
|
||||||
|
|
||||||
m_types = section.getContentTypes();
|
m_types = section.getContentTypes(true);
|
||||||
m_types.addOrder(ContentType.LABEL);
|
m_types.addOrder(ContentType.LABEL);
|
||||||
m_types.rewind();
|
m_types.rewind();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.type;
|
package com.arsdigita.cms.ui.type;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -85,21 +84,16 @@ import java.util.TooManyListenersException;
|
||||||
* @author Xixi D'Moon (xdmoon@arsdigita.com)
|
* @author Xixi D'Moon (xdmoon@arsdigita.com)
|
||||||
* @version $Revision: #21 $ $Date: 2004/08/17 $
|
* @version $Revision: #21 $ $Date: 2004/08/17 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CreateType extends CMSForm
|
public class CreateType extends CMSForm
|
||||||
implements FormProcessListener, FormInitListener, FormSubmissionListener, FormValidationListener {
|
implements FormProcessListener, FormInitListener, FormSubmissionListener, FormValidationListener {
|
||||||
|
|
||||||
private static final String DEFAULT_UDITEM_TYPE = ContentPage.BASE_DATA_OBJECT_TYPE;
|
private static final String DEFAULT_UDITEM_TYPE = ContentPage.BASE_DATA_OBJECT_TYPE;
|
||||||
private static final String CATEGORIZATION_COMPONENT =
|
private static final String CATEGORIZATION_COMPONENT =
|
||||||
"com.arsdigita.cms.ui.authoring.ItemCategoryStep";
|
"com.arsdigita.cms.ui.authoring.ItemCategoryStep";
|
||||||
|
|
||||||
private final static Logger s_log =
|
private final static Logger s_log =
|
||||||
Logger.getLogger(CreateType.class.getName());
|
Logger.getLogger(CreateType.class.getName());
|
||||||
|
|
||||||
//private static final ObjectType TEST_TYPE = SessionManager.getMetadataRoot().getObjectType("com.arsdigita.kernel.Party");
|
//private static final ObjectType TEST_TYPE = SessionManager.getMetadataRoot().getObjectType("com.arsdigita.kernel.Party");
|
||||||
|
|
||||||
private static final String CREATION_COMPONENT = "com.arsdigita.cms.ui.authoring.PageCreateDynamic";
|
private static final String CREATION_COMPONENT = "com.arsdigita.cms.ui.authoring.PageCreateDynamic";
|
||||||
|
|
||||||
private Hidden m_id;
|
private Hidden m_id;
|
||||||
private TextField m_name;
|
private TextField m_name;
|
||||||
private TextField m_label;
|
private TextField m_label;
|
||||||
|
|
@ -110,12 +104,12 @@ public class CreateType extends CMSForm
|
||||||
private Submit m_submit;
|
private Submit m_submit;
|
||||||
private Submit m_cancel;
|
private Submit m_cancel;
|
||||||
private SingleSelectionModel m_types = null;
|
private SingleSelectionModel m_types = null;
|
||||||
|
|
||||||
DynamicObjectType dot;
|
DynamicObjectType dot;
|
||||||
|
|
||||||
public CreateType() {
|
public CreateType() {
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateType(SingleSelectionModel m) {
|
public CreateType(SingleSelectionModel m) {
|
||||||
super("NewContentItemDefinition");
|
super("NewContentItemDefinition");
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
|
|
@ -201,6 +195,7 @@ public class CreateType extends CMSForm
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this form is cancelled
|
// if this form is cancelled
|
||||||
|
@Override
|
||||||
public boolean isCancelled(PageState s) {
|
public boolean isCancelled(PageState s) {
|
||||||
return m_cancel.isSelected(s);
|
return m_cancel.isSelected(s);
|
||||||
}
|
}
|
||||||
|
|
@ -227,8 +222,7 @@ public class CreateType extends CMSForm
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dupe == true) {
|
if (dupe == true) {
|
||||||
throw new FormProcessException
|
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.type.name_not_unique", new Object[]{typeLabel}).localize());
|
||||||
((String) GlobalizationUtil.globalize("cms.ui.type.name_not_unique", new Object[] { typeLabel }).localize());
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (int i = 0; i < typeName.length(); i++) {
|
for (int i = 0; i < typeName.length(); i++) {
|
||||||
|
|
@ -278,12 +272,10 @@ public class CreateType extends CMSForm
|
||||||
if (parentContentType != null) {
|
if (parentContentType != null) {
|
||||||
parentContentClassname = parentContentType.getClassName();
|
parentContentClassname = parentContentType.getClassName();
|
||||||
parentObjectType =
|
parentObjectType =
|
||||||
SessionManager.getMetadataRoot().getObjectType
|
SessionManager.getMetadataRoot().getObjectType(parentContentType.getAssociatedObjectType());
|
||||||
(parentContentType.getAssociatedObjectType());
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
parentContentType = ContentType.findByAssociatedObjectType
|
parentContentType = ContentType.findByAssociatedObjectType(DEFAULT_UDITEM_TYPE);
|
||||||
(DEFAULT_UDITEM_TYPE);
|
|
||||||
parentContentClassname = parentContentType.getClassName();
|
parentContentClassname = parentContentType.getClassName();
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
// If parent content type isn't found, don't add
|
// If parent content type isn't found, don't add
|
||||||
|
|
@ -291,17 +283,14 @@ public class CreateType extends CMSForm
|
||||||
//classname
|
//classname
|
||||||
parentContentClassname = "com.arsdigita.cms.ContentPage";
|
parentContentClassname = "com.arsdigita.cms.ContentPage";
|
||||||
}
|
}
|
||||||
parentObjectType = SessionManager.getMetadataRoot().getObjectType
|
parentObjectType = SessionManager.getMetadataRoot().getObjectType(DEFAULT_UDITEM_TYPE);
|
||||||
(DEFAULT_UDITEM_TYPE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String qname = parentObjectType.getModel().getName() + "." + name;
|
String qname = parentObjectType.getModel().getName() + "." + name;
|
||||||
MetadataRoot root = MetadataRoot.getMetadataRoot();
|
MetadataRoot root = MetadataRoot.getMetadataRoot();
|
||||||
if (root.getObjectType(qname) != null || root.hasTable(name)) {
|
if (root.getObjectType(qname) != null || root.hasTable(name)) {
|
||||||
throw new FormValidationException
|
throw new FormValidationException(m_name, (String) GlobalizationUtil.globalize("cms.ui.type.duplicate_type",
|
||||||
(m_name, (String) GlobalizationUtil.globalize
|
|
||||||
("cms.ui.type.duplicate_type",
|
|
||||||
new Object[]{name}).localize());
|
new Object[]{name}).localize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,8 +306,7 @@ public class CreateType extends CMSForm
|
||||||
try {
|
try {
|
||||||
contentType = new ContentType(key);
|
contentType = new ContentType(key);
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
contentType = new ContentType(SessionManager.getSession().create
|
contentType = new ContentType(SessionManager.getSession().create(new OID(ContentType.BASE_DATA_OBJECT_TYPE, key)));
|
||||||
(new OID(ContentType.BASE_DATA_OBJECT_TYPE, key)));
|
|
||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -392,6 +380,7 @@ public class CreateType extends CMSForm
|
||||||
ContentType type) {
|
ContentType type) {
|
||||||
updateContentTypeAssociation(section, type, null);
|
updateContentTypeAssociation(section, type, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* registers the new type to this content section
|
* registers the new type to this content section
|
||||||
* and creates authoring kit for the content type
|
* and creates authoring kit for the content type
|
||||||
|
|
@ -464,11 +453,15 @@ public class CreateType extends CMSForm
|
||||||
|
|
||||||
t.addOption(new Option("-1", "-- select --"));
|
t.addOption(new Option("-1", "-- select --"));
|
||||||
|
|
||||||
ContentTypeCollection contentTypes = section.getCreatableContentTypes();
|
ContentTypeCollection contentTypes = section.getCreatableContentTypes(true);
|
||||||
contentTypes.addOrder(ContentType.LABEL);
|
contentTypes.addOrder(ContentType.LABEL);
|
||||||
while (contentTypes.next()) {
|
while (contentTypes.next()) {
|
||||||
ContentType type = contentTypes.getContentType();
|
ContentType type = contentTypes.getContentType();
|
||||||
t.addOption(new Option(type.getID().toString(), type.getLabel()));
|
Label label = new Label(type.getLabel());
|
||||||
|
if (type.isHidden()) {
|
||||||
|
label.setFontWeight(Label.ITALIC);
|
||||||
|
}
|
||||||
|
t.addOption(new Option(type.getID().toString(), label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -533,8 +526,7 @@ public class CreateType extends CMSForm
|
||||||
contentType, lifecycle);
|
contentType, lifecycle);
|
||||||
} else {
|
} else {
|
||||||
//remove the association
|
//remove the association
|
||||||
ContentTypeLifecycleDefinition.removeLifecycleDefinition
|
ContentTypeLifecycleDefinition.removeLifecycleDefinition(section, contentType);
|
||||||
(section, contentType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
|
|
@ -553,8 +545,7 @@ public class CreateType extends CMSForm
|
||||||
if (workflowID.intValue() != -1) {
|
if (workflowID.intValue() != -1) {
|
||||||
// Set default workflow definition association.
|
// Set default workflow definition association.
|
||||||
WorkflowTemplate template = new WorkflowTemplate(new OID(WorkflowTemplate.BASE_DATA_OBJECT_TYPE, workflowID));
|
WorkflowTemplate template = new WorkflowTemplate(new OID(WorkflowTemplate.BASE_DATA_OBJECT_TYPE, workflowID));
|
||||||
ContentTypeWorkflowTemplate.
|
ContentTypeWorkflowTemplate.updateWorkflowTemplate(section, contentType, template);
|
||||||
updateWorkflowTemplate(section, contentType, template);
|
|
||||||
} else {
|
} else {
|
||||||
// Remove the association.
|
// Remove the association.
|
||||||
ContentTypeWorkflowTemplate.removeWorkflowTemplate(section, contentType);
|
ContentTypeWorkflowTemplate.removeWorkflowTemplate(section, contentType);
|
||||||
|
|
@ -565,5 +556,4 @@ public class CreateType extends CMSForm
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.type;
|
package com.arsdigita.cms.ui.type;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -45,7 +44,6 @@ import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.TooManyListenersException;
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains a form component to that allows adding
|
* This class contains a form component to that allows adding
|
||||||
* already-existing content type to a content section.
|
* already-existing content type to a content section.
|
||||||
|
|
@ -58,7 +56,6 @@ public class SelectType extends CMSForm
|
||||||
implements PrintListener, FormSubmissionListener, FormProcessListener {
|
implements PrintListener, FormSubmissionListener, FormProcessListener {
|
||||||
|
|
||||||
private final static String TYPES = "types";
|
private final static String TYPES = "types";
|
||||||
|
|
||||||
private CheckboxGroup m_typesCheckbox;
|
private CheckboxGroup m_typesCheckbox;
|
||||||
private Submit m_submit;
|
private Submit m_submit;
|
||||||
private Submit m_cancel;
|
private Submit m_cancel;
|
||||||
|
|
@ -90,7 +87,6 @@ public class SelectType extends CMSForm
|
||||||
addSubmissionListener(this);
|
addSubmissionListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a checkbox list of all content type not associated
|
* Generate a checkbox list of all content type not associated
|
||||||
* with the current content section
|
* with the current content section
|
||||||
|
|
@ -108,8 +104,11 @@ public class SelectType extends CMSForm
|
||||||
while (contentTypes.next()) {
|
while (contentTypes.next()) {
|
||||||
ContentType contentType = contentTypes.getContentType();
|
ContentType contentType = contentTypes.getContentType();
|
||||||
|
|
||||||
t.addOption(new Option(contentType.getID().toString(),
|
Label label = new Label(contentType.getLabel());
|
||||||
contentType.getLabel()));
|
if (contentType.isHidden()) {
|
||||||
|
label.setFontWeight(Label.ITALIC);
|
||||||
|
}
|
||||||
|
t.addOption(new Option(contentType.getID().toString(), label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,7 +134,6 @@ public class SelectType extends CMSForm
|
||||||
return m_cancel.isSelected(state);
|
return m_cancel.isSelected(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes form listener which updates a life cycle
|
* Processes form listener which updates a life cycle
|
||||||
*/
|
*/
|
||||||
|
|
@ -152,8 +150,8 @@ public class SelectType extends CMSForm
|
||||||
type = new ContentType(new BigDecimal(types[i]));
|
type = new ContentType(new BigDecimal(types[i]));
|
||||||
section.addContentType(type);
|
section.addContentType(type);
|
||||||
} catch (DataObjectNotFoundException ex) {
|
} catch (DataObjectNotFoundException ex) {
|
||||||
throw new UncheckedWrapperException("Content Type ID#" + types[i] +
|
throw new UncheckedWrapperException("Content Type ID#" + types[i]
|
||||||
" not found", ex);
|
+ " not found", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,5 +160,4 @@ public class SelectType extends CMSForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue