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] 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;
|
||||
AuthoringKit[0..1] authoringKit = join content_types.type_id
|
||||
to authoring_kits.type_id;
|
||||
|
|
@ -64,7 +64,7 @@ association {
|
|||
do {
|
||||
select
|
||||
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
|
||||
content_types t, content_section_type_map m, authoring_kits a
|
||||
where
|
||||
|
|
@ -80,7 +80,7 @@ association {
|
|||
creatableContentTypes.className = t.classname;
|
||||
creatableContentTypes.ancestors = t.ancestors;
|
||||
creatableContentTypes.siblings = t.siblings;
|
||||
creatableContentTypes.isInternal = t.is_internal;
|
||||
creatableContentTypes.mode = t.mode;
|
||||
creatableContentTypes.itemFormID = t.item_form_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ association {
|
|||
do {
|
||||
select
|
||||
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
|
||||
content_types t
|
||||
where
|
||||
|
|
@ -128,7 +128,7 @@ association {
|
|||
notAssociatedContentTypes.className = t.classname;
|
||||
notAssociatedContentTypes.ancestors = t.ancestors;
|
||||
notAssociatedContentTypes.siblings = t.siblings;
|
||||
notAssociatedContentTypes.isInternal = t.is_internal;
|
||||
notAssociatedContentTypes.mode = t.mode;
|
||||
notAssociatedContentTypes.itemFormID = t.item_form_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -157,9 +157,9 @@ query registeredContentTypes {
|
|||
select
|
||||
t.type_id, t.object_type, t.label,
|
||||
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
|
||||
where t.is_internal = '0'
|
||||
where t.mode != 'I'
|
||||
and exists (select 1 from content_section_type_map
|
||||
where type_id = t.type_id)
|
||||
} map {
|
||||
|
|
@ -170,7 +170,7 @@ query registeredContentTypes {
|
|||
type.className = t.classname;
|
||||
type.ancestors = t.ancestors;
|
||||
type.siblings = t.siblings;
|
||||
type.isInternal = t.is_internal;
|
||||
type.mode = t.mode;
|
||||
type.itemFormID = t.item_form_id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,19 @@ comment on column content_types.classname is '
|
|||
comment on column content_types.label is '
|
||||
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
|
||||
internally. A content type should be made internal under the following
|
||||
two conditions:
|
||||
|
|
@ -39,4 +51,7 @@ comment on column content_types.is_internal is '
|
|||
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.
|
||||
|
||||
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),
|
||||
ancestors varchar(2000),
|
||||
siblings varchar(2000),
|
||||
is_internal char(1) default '0' not null
|
||||
constraint content_types_is_internal_ck
|
||||
check ( is_internal in ('0', '1') ),
|
||||
-- is_internal char(1) default '0' not null
|
||||
-- constraint content_types_is_internal_ck
|
||||
-- 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
|
||||
constraint content_types_form_id_fk references
|
||||
bebop_components (component_id)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
description="A generic address type"
|
||||
objectType="com.arsdigita.cms.contenttypes.GenericAddress"
|
||||
classname="com.arsdigita.cms.contenttypes.GenericAddress"
|
||||
isInternal="yes">
|
||||
mode="hidden">
|
||||
|
||||
<ctd:authoring-kit
|
||||
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
description="A generic article type"
|
||||
objectType="com.arsdigita.cms.contenttypes.GenericArticle"
|
||||
classname="com.arsdigita.cms.contenttypes.GenericArticle"
|
||||
isInternal="yes">
|
||||
mode="hidden">
|
||||
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
description="A generic Contact type"
|
||||
objectType="com.arsdigita.cms.contenttypes.GenericContact"
|
||||
classname="com.arsdigita.cms.contenttypes.GenericContact"
|
||||
isInternal="yes">
|
||||
mode="hidden">
|
||||
|
||||
<ctd:authoring-kit
|
||||
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
description="A generic content type for organizations and projects."
|
||||
objectType="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">
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
description="A generic Person type"
|
||||
objectType="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">
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
description="Templates for rendering content items"
|
||||
objectType="com.arsdigita.cms.Template"
|
||||
classname="com.arsdigita.cms.Template"
|
||||
isInternal="yes">
|
||||
mode="internal">
|
||||
<ctd:authoring-kit>
|
||||
|
||||
<ctd:authoring-step
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms;
|
||||
|
||||
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.PageResolver;
|
||||
|
|
@ -55,7 +54,6 @@ import org.apache.log4j.Logger;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* <p>A content section represents a collection of content that is
|
||||
* managed as a unit. Content sections typically correspond to major
|
||||
|
|
@ -94,12 +92,10 @@ import java.math.BigDecimal;
|
|||
public class ContentSection extends Application {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.ContentSection";
|
||||
public static final String PACKAGE_TYPE = "content-section";
|
||||
public final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
|
||||
|
||||
protected static final String ID = "id";
|
||||
protected static final String PACKAGE = "package";
|
||||
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 TEMPLATE_RESOLVER_CLASS = "templateResolverClass";
|
||||
protected static final String XML_GENERATOR_CLASS = "xmlGeneratorClass";
|
||||
|
||||
protected static final String CONTENT_TYPES = "associatedContentTypes";
|
||||
protected static final String CREATABLE_CONTENT_TYPES =
|
||||
"creatableContentTypes";
|
||||
|
|
@ -122,18 +117,13 @@ public class ContentSection extends Application {
|
|||
protected static final String LIFECYCLE_DEFINITIONS =
|
||||
"associatedLifecycleDefinitions";
|
||||
protected static final String WF_TEMPLATES = "associatedWorkflowTemplates";
|
||||
|
||||
private final static String ITEM_QUERY = "com.arsdigita.cms.ItemsInSection";
|
||||
private final static String SECTION_ID = "sectionId";
|
||||
|
||||
private static final CMSConfig s_config = new CMSConfig();
|
||||
|
||||
static {
|
||||
s_config.load();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cached properties
|
||||
PageResolver m_pageResolver = null;
|
||||
ItemResolver m_itemResolver = null;
|
||||
|
|
@ -144,7 +134,6 @@ public class ContentSection extends Application {
|
|||
// super(BASE_DATA_OBJECT_TYPE);
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* Constructor re-creating a content section object by retrieving its data
|
||||
* object by OID
|
||||
|
|
@ -177,7 +166,6 @@ public class ContentSection extends Application {
|
|||
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
|
||||
public static CMSConfig getConfig() {
|
||||
return s_config;
|
||||
}
|
||||
|
|
@ -186,6 +174,7 @@ public class ContentSection extends Application {
|
|||
* @return the base PDL object type for this section. Child classes should
|
||||
* override this method to return the correct value
|
||||
*/
|
||||
@Override
|
||||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
|
@ -197,6 +186,7 @@ public class ContentSection extends Application {
|
|||
* @param key The name of the attribute
|
||||
* @return The value of the attribute
|
||||
*/
|
||||
@Override
|
||||
public Object get(String key) {
|
||||
return super.get(key);
|
||||
}
|
||||
|
|
@ -208,6 +198,7 @@ public class ContentSection extends Application {
|
|||
* @param key The name of the attribute
|
||||
* @param value The value of the attribute
|
||||
*/
|
||||
@Override
|
||||
public void set(String key, Object 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.
|
||||
*/
|
||||
@Override
|
||||
protected void afterSave() {
|
||||
super.afterSave();
|
||||
// Set the root folder's content section.
|
||||
|
|
@ -238,6 +230,7 @@ public class ContentSection extends Application {
|
|||
*
|
||||
* @return A title
|
||||
*/
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return getName();
|
||||
}
|
||||
|
|
@ -290,7 +283,6 @@ public class ContentSection extends Application {
|
|||
// public SiteNode getSiteNode() {
|
||||
// return getPackageInstance().getDefaultMountPoint();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Finds the location of the content section.
|
||||
*
|
||||
|
|
@ -337,7 +329,6 @@ public class ContentSection extends Application {
|
|||
//
|
||||
// return path.substring(0, path.length() - 1);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the folder in which all draft items are contained, directly or
|
||||
* indirectly. This folder will in general contain different kinds of
|
||||
|
|
@ -371,7 +362,7 @@ public class ContentSection extends Application {
|
|||
// sub-items/folders. The next step is to recursively update items
|
||||
// under the root folder when fetching "all items in a section" is
|
||||
// implemented.
|
||||
if ( !isNew() ) {
|
||||
if (!isNew()) {
|
||||
Folder oldRoot = getRootFolder();
|
||||
oldRoot.setContentSection(null);
|
||||
oldRoot.save();
|
||||
|
|
@ -506,8 +497,8 @@ public class ContentSection extends Application {
|
|||
|
||||
if (m_pageResolver == null) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("The page resolver hasn't been loaded yet; " +
|
||||
"loading it now");
|
||||
s_log.debug("The page resolver hasn't been loaded yet; "
|
||||
+ "loading it now");
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -677,13 +668,10 @@ public class ContentSection extends Application {
|
|||
m_xmlGenerator = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//
|
||||
// Globalization.
|
||||
//
|
||||
|
||||
/**
|
||||
* Gets the default Locale. This is used for translating or creating
|
||||
* content if no locale is specified.
|
||||
|
|
@ -692,7 +680,7 @@ public class ContentSection extends Application {
|
|||
*/
|
||||
public Locale getDefaultLocale() {
|
||||
DataObject obj = (DataObject) get(DEFAULT_LOCALE);
|
||||
if ( obj == null ) {
|
||||
if (obj == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new Locale(obj);
|
||||
|
|
@ -748,7 +736,7 @@ public class ContentSection extends Application {
|
|||
DataAssociation da = (DataAssociation) get(LOCALES);
|
||||
locale.addToAssociation(da);
|
||||
|
||||
if ( isDefault ) {
|
||||
if (isDefault) {
|
||||
setDefaultLocale(locale);
|
||||
}
|
||||
}
|
||||
|
|
@ -764,22 +752,27 @@ public class ContentSection extends Application {
|
|||
locale.removeFromAssociation(da);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//
|
||||
// Content types.
|
||||
//
|
||||
|
||||
/**
|
||||
* Get all user-defined content types registered to the content section.
|
||||
*
|
||||
* @return A ContentTypeCollection of registered content types
|
||||
*/
|
||||
public ContentTypeCollection getContentTypes() {
|
||||
return getContentTypes(false);
|
||||
}
|
||||
|
||||
public ContentTypeCollection getContentTypes(boolean hidden) {
|
||||
DataAssociation da = (DataAssociation) get(CONTENT_TYPES);
|
||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||
// Filter out internal contentt types.
|
||||
types.addFilter("isInternal = '0'");
|
||||
// Filter out internal content types.
|
||||
types.addFilter("mode != 'I'");
|
||||
if (!hidden) {
|
||||
types.addFilter("mode != 'H'");
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
|
|
@ -793,10 +786,17 @@ public class ContentSection extends Application {
|
|||
* 3) possess a non-empty creation component in its AuthoringKit.
|
||||
*/
|
||||
public ContentTypeCollection getCreatableContentTypes() {
|
||||
return getCreatableContentTypes(false);
|
||||
}
|
||||
|
||||
public ContentTypeCollection getCreatableContentTypes(boolean hidden) {
|
||||
DataAssociation da = (DataAssociation) get(CREATABLE_CONTENT_TYPES);
|
||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||
// Filter out internal content types.
|
||||
types.addFilter("isInternal = '0'");
|
||||
types.addFilter("mode != 'I'");
|
||||
if (!hidden) {
|
||||
types.addFilter("mode != 'H'");
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
|
|
@ -807,7 +807,7 @@ public class ContentSection extends Application {
|
|||
* @param type The content type
|
||||
*/
|
||||
public void addContentType(ContentType type) {
|
||||
if ( ! hasContentType(type) ) {
|
||||
if (!hasContentType(type)) {
|
||||
DataAssociation da = (DataAssociation) get(CONTENT_TYPES);
|
||||
type.addToAssociation(da);
|
||||
}
|
||||
|
|
@ -835,7 +835,7 @@ public class ContentSection extends Application {
|
|||
DataAssociation da = (DataAssociation) get(CONTENT_TYPES);
|
||||
DataAssociationCursor cursor = da.cursor();
|
||||
cursor.addEqualsFilter(ID, type.getID());
|
||||
return ( cursor.size() > 0 );
|
||||
return (cursor.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -849,16 +849,14 @@ public class ContentSection extends Application {
|
|||
DataAssociation da = (DataAssociation) get(CONTENT_TYPES_NOT_ASSOC);
|
||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||
// Filter out internal content types.
|
||||
types.addFilter("isInternal = '0'");
|
||||
types.addFilter("mode != 'I'");
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//
|
||||
// Lifecycle definitions.
|
||||
//
|
||||
|
||||
/**
|
||||
* Get all lifecycle definitions registered to the content section.
|
||||
*
|
||||
|
|
@ -866,8 +864,7 @@ public class ContentSection extends Application {
|
|||
* lifecycle definition.
|
||||
*/
|
||||
public LifecycleDefinitionCollection getLifecycleDefinitions() {
|
||||
return
|
||||
new LifecycleDefinitionCollection(getLifecycleDefinitionsAssociation());
|
||||
return new LifecycleDefinitionCollection(getLifecycleDefinitionsAssociation());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -892,12 +889,10 @@ public class ContentSection extends Application {
|
|||
return (DataAssociation) get(LIFECYCLE_DEFINITIONS);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//
|
||||
// Workflow templates.
|
||||
//
|
||||
|
||||
/**
|
||||
* Get all workflow templates registered to the content section.
|
||||
*
|
||||
|
|
@ -931,13 +926,10 @@ public class ContentSection extends Application {
|
|||
return (DataAssociation) get(WF_TEMPLATES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//
|
||||
// Finding a content section.
|
||||
//
|
||||
|
||||
/**
|
||||
* Looks up the section given the SiteNode.
|
||||
*
|
||||
|
|
@ -949,7 +941,7 @@ public class ContentSection extends Application {
|
|||
public static ContentSection getSectionFromNode(SiteNode node)
|
||||
throws DataObjectNotFoundException {
|
||||
|
||||
return (ContentSection)retrieveApplicationForSiteNode(node);
|
||||
return (ContentSection) retrieveApplicationForSiteNode(node);
|
||||
|
||||
// BigDecimal sectionId = null;
|
||||
//
|
||||
|
|
@ -991,7 +983,6 @@ public class ContentSection extends Application {
|
|||
// }
|
||||
// return section;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the content section for an item.
|
||||
*
|
||||
|
|
@ -1029,13 +1020,10 @@ public class ContentSection extends Application {
|
|||
* @return A collection of content sections
|
||||
*/
|
||||
public static ContentSectionCollection getAllSections() {
|
||||
DataCollection da = SessionManager.getSession().retrieve
|
||||
(BASE_DATA_OBJECT_TYPE);
|
||||
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||
return new ContentSectionCollection(da);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a content section of the given name using default values and
|
||||
* returns it.
|
||||
|
|
@ -1055,7 +1043,7 @@ public class ContentSection extends Application {
|
|||
String xgc = "com.arsdigita.cms.dispatcher.SimpleXMLGenerator";
|
||||
String trc = "com.arsdigita.cms.dispatcher.DefaultTemplateResolver";
|
||||
|
||||
ContentSection section = ContentSection.create( name,
|
||||
ContentSection section = ContentSection.create(name,
|
||||
folder,
|
||||
category,
|
||||
staff,
|
||||
|
|
@ -1069,13 +1057,6 @@ public class ContentSection extends Application {
|
|||
PermissionService.setContext(folder.getOID(), section.getOID());
|
||||
createDefaultResources(section);
|
||||
|
||||
// Left over, see above
|
||||
// }
|
||||
// };
|
||||
// rootExcursion.run();
|
||||
//
|
||||
// //now retrieve the created content section and return it
|
||||
// return (ContentSection) Application.retrieveApplicationForPath("/" + name + "/");
|
||||
return section;
|
||||
}
|
||||
|
||||
|
|
@ -1107,8 +1088,7 @@ public class ContentSection extends Application {
|
|||
prc,
|
||||
irc,
|
||||
xgc,
|
||||
"com.arsdigita.cms.dispatcher.DefaultTemplateResolver"
|
||||
);
|
||||
"com.arsdigita.cms.dispatcher.DefaultTemplateResolver");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1143,14 +1123,13 @@ public class ContentSection extends Application {
|
|||
// Create template root folder.
|
||||
Folder templates = new Folder();
|
||||
templates.setName("templates");
|
||||
templates.setLabel( (String) GlobalizationUtil.globalize(
|
||||
templates.setLabel((String) GlobalizationUtil.globalize(
|
||||
"cms.templates").localize());
|
||||
templates.save();
|
||||
|
||||
//create and initialize the content section application
|
||||
ContentSection section = (ContentSection) Application.createApplication
|
||||
(BASE_DATA_OBJECT_TYPE, name, name, null );
|
||||
section.initialize( name,
|
||||
ContentSection section = (ContentSection) Application.createApplication(BASE_DATA_OBJECT_TYPE, name, name, null);
|
||||
section.initialize(name,
|
||||
folder,
|
||||
category,
|
||||
staff,
|
||||
|
|
@ -1164,7 +1143,6 @@ public class ContentSection extends Application {
|
|||
return section;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and maps default resources to the content section.
|
||||
*
|
||||
|
|
@ -1207,7 +1185,7 @@ public class ContentSection extends Application {
|
|||
protected static Folder createRootFolder(String name) {
|
||||
Folder root = new Folder();
|
||||
root.setName("/");
|
||||
root.setLabel( (String) GlobalizationUtil.globalize(
|
||||
root.setLabel((String) GlobalizationUtil.globalize(
|
||||
"cms.installer.root_folder").localize());
|
||||
root.save();
|
||||
return root;
|
||||
|
|
@ -1239,7 +1217,6 @@ public class ContentSection extends Application {
|
|||
return staff;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a newly created content section.
|
||||
*
|
||||
|
|
@ -1281,7 +1258,6 @@ public class ContentSection extends Application {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -1304,5 +1280,4 @@ public class ContentSection extends Application {
|
|||
public String getStylesheetPath() {
|
||||
return STYLESHEET;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class ContentType extends ACSObject {
|
|||
public static final String LABEL = "label";
|
||||
public static final String DESCRIPTION = "description";
|
||||
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 ITEM_FORM_ID = "itemFormID";
|
||||
public static final String ITEM_FORM = "itemForm";
|
||||
|
|
@ -123,8 +123,8 @@ public class ContentType extends ACSObject {
|
|||
|
||||
@Override
|
||||
protected void beforeSave() {
|
||||
if (isInternal() == null) {
|
||||
setInternal(false);
|
||||
if (getMode() == null) {
|
||||
setMode("default");
|
||||
}
|
||||
super.beforeSave();
|
||||
}
|
||||
|
|
@ -224,17 +224,37 @@ public class ContentType extends ACSObject {
|
|||
* otherwise.
|
||||
*/
|
||||
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,
|
||||
* false otherwise
|
||||
* @return Boolean.TRUE if this content type is internal, Boolean.FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
public void setInternal(boolean isInternal) {
|
||||
set(IS_INTERNAL, (isInternal ? Boolean.TRUE : Boolean.FALSE));
|
||||
public Boolean isHidden() {
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
private static ContentTypeCollection getAllContentTypes(boolean internal) {
|
||||
private static ContentTypeCollection getAllContentTypes(boolean internal, boolean hidden) {
|
||||
DataCollection da = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||
ContentTypeCollection types = new ContentTypeCollection(da);
|
||||
|
||||
if (!internal) {
|
||||
types.addFilter("isInternal = '0'");
|
||||
types.addFilter("mode != 'I'");
|
||||
}
|
||||
|
||||
if (!hidden) {
|
||||
types.addFilter("mode != 'H'");
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
|
@ -545,7 +583,6 @@ public class ContentType extends ACSObject {
|
|||
ctc.addFilter(or);
|
||||
return ctc;
|
||||
}
|
||||
|
||||
private static List s_xsl = new ArrayList();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ import com.arsdigita.xml.XML;
|
|||
// import java.io.IOException;
|
||||
// import java.io.InputStream;
|
||||
// import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
// import javax.xml.parsers.ParserConfigurationException;
|
||||
|
|
@ -72,7 +73,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
// Migration status
|
||||
//
|
||||
// The module in its complete version (i.e. all method invocations in run()
|
||||
|
|
@ -83,8 +83,6 @@ import org.apache.log4j.Logger;
|
|||
//
|
||||
// Next Try
|
||||
// Refactor using legacy compatible web/Application and ApplicationSetup
|
||||
|
||||
|
||||
/**
|
||||
* <p>Executes nonrecurring at install time and loads (installs and initializes)
|
||||
* 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 */
|
||||
private static final Logger s_log = Logger.getLogger(Loader.class);
|
||||
|
||||
// Load main CMS configuration file
|
||||
private static final LoaderConfig s_conf = new LoaderConfig();
|
||||
|
||||
// static { // requirred to actually read the config file
|
||||
// s_config.load();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Constant string used as key for creating CMS (content-section) as a
|
||||
* legacy application.
|
||||
|
|
@ -139,7 +134,6 @@ public class Loader extends PackageLoader {
|
|||
*/
|
||||
private final static String CMS_STYLESHEET =
|
||||
"/packages/content-section/xsl/cms.xsl";
|
||||
|
||||
// /**
|
||||
// * Constant string used as key for creating Workspace (content-center) as a
|
||||
// * legacy application.
|
||||
|
|
@ -160,7 +154,6 @@ public class Loader extends PackageLoader {
|
|||
*/
|
||||
private final static String WORKSPACE_STYLESHEET =
|
||||
"/packages/content-section/xsl/content-center.xsl";
|
||||
|
||||
/**
|
||||
* Name of the CMS service package instance, i.e. its URL.
|
||||
*/
|
||||
|
|
@ -170,9 +163,7 @@ public class Loader extends PackageLoader {
|
|||
// * legacy application.
|
||||
// */
|
||||
// public final static String SERVICE_PACKAGE_KEY = "cms-service";
|
||||
|
||||
|
||||
|
||||
private ArrayList m_content_type_list = new ArrayList();
|
||||
|
||||
/**
|
||||
* Standard constructor.
|
||||
|
|
@ -183,11 +174,11 @@ public class Loader extends PackageLoader {
|
|||
s_log.debug("CMS.loader (Constructor) completed");
|
||||
}
|
||||
|
||||
|
||||
public void run(final ScriptContext ctx) {
|
||||
s_log.debug("CMS.loader.run() invoked");
|
||||
|
||||
new KernelExcursion() {
|
||||
|
||||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
|
||||
|
|
@ -214,7 +205,7 @@ public class Loader extends PackageLoader {
|
|||
|
||||
// 5) load content type definition(s)
|
||||
// Used to be step 2 in former enterprise.init file
|
||||
loadContentTypeDefinitions(s_conf.getCTDefFiles() );
|
||||
loadContentTypeDefinitions(s_conf.getCTDefFiles());
|
||||
|
||||
// 6) Load CMS (content section) package application instance
|
||||
// Used to be step 4 in former enterprise.init file
|
||||
|
|
@ -291,8 +282,6 @@ public class Loader extends PackageLoader {
|
|||
//
|
||||
// s_log.debug("Done creating the CMS package type.");
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Loads and instantiates the Workspace package (content-center) in the
|
||||
* database using old style application.
|
||||
|
|
@ -345,7 +334,6 @@ public class Loader extends PackageLoader {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads and instantiates the Workspace package (content-center) in the
|
||||
* database.
|
||||
|
|
@ -360,18 +348,20 @@ public class Loader extends PackageLoader {
|
|||
// create application type
|
||||
ApplicationSetup appsetup = new ApplicationSetup(s_log);
|
||||
// new style properties
|
||||
appsetup.setApplicationObjectType( Workspace.BASE_DATA_OBJECT_TYPE );
|
||||
appsetup.setTitle( Workspace.INSTANCE_NAME ); // same as for instance
|
||||
appsetup.setApplicationObjectType(Workspace.BASE_DATA_OBJECT_TYPE);
|
||||
appsetup.setTitle(Workspace.INSTANCE_NAME); // same as for instance
|
||||
// there is only one
|
||||
appsetup.setDescription("The content center workspace for content creators.");
|
||||
// old style / legacy compatible properties
|
||||
appsetup.setKey( Workspace.PACKAGE_KEY );
|
||||
appsetup.setDispatcherClass( Workspace.DISPATCHER_CLASS );
|
||||
appsetup.setKey(Workspace.PACKAGE_KEY);
|
||||
appsetup.setDispatcherClass(Workspace.DISPATCHER_CLASS);
|
||||
// should not be needed anymore, stypesheets handled by StylesheetResolver
|
||||
appsetup.setStylesheet( Workspace.STYLESHEET );
|
||||
appsetup.setStylesheet(Workspace.STYLESHEET);
|
||||
appsetup.setSingleton(true);
|
||||
appsetup.setPortalApplication(false);
|
||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||
|
||||
@Override
|
||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new Workspace(dataObject);
|
||||
}
|
||||
|
|
@ -392,7 +382,6 @@ public class Loader extends PackageLoader {
|
|||
s_log.debug("Done loading CMS Workspace.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CMS Service application is used by the Content Management System as a
|
||||
* store for global resources and assets.
|
||||
|
|
@ -404,8 +393,7 @@ public class Loader extends PackageLoader {
|
|||
|
||||
try {
|
||||
// from ServiceInstaller.createPackageType();
|
||||
PackageType type = PackageType.create
|
||||
(CMS.SERVICE_PACKAGE_KEY,
|
||||
PackageType type = PackageType.create(CMS.SERVICE_PACKAGE_KEY,
|
||||
"Content Management System Services",
|
||||
"Content Management System Services",
|
||||
"http://cms-service.arsdigita.com/");
|
||||
|
|
@ -425,12 +413,10 @@ public class Loader extends PackageLoader {
|
|||
node.save();
|
||||
|
||||
} catch (DataObjectNotFoundException e) {
|
||||
throw new ConfigError
|
||||
("Failed to initialize CMS global services package.");
|
||||
throw new ConfigError("Failed to initialize CMS global services package.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CMS Service application is used by the Content Management System as a
|
||||
* store for global resources and assets.
|
||||
|
|
@ -447,18 +433,20 @@ public class Loader extends PackageLoader {
|
|||
// create application type
|
||||
ApplicationSetup appsetup = new ApplicationSetup(s_log);
|
||||
// new style properties
|
||||
appsetup.setApplicationObjectType( Service.BASE_DATA_OBJECT_TYPE );
|
||||
appsetup.setTitle( Service.INSTANCE_NAME ); // same as for instance
|
||||
appsetup.setApplicationObjectType(Service.BASE_DATA_OBJECT_TYPE);
|
||||
appsetup.setTitle(Service.INSTANCE_NAME); // same as for instance
|
||||
// there is only one
|
||||
appsetup.setDescription("Services to store global resources and assets.");
|
||||
// old style / legacy compatible properties
|
||||
appsetup.setKey( Service.PACKAGE_KEY );
|
||||
appsetup.setDispatcherClass( Service.DISPATCHER_CLASS );
|
||||
appsetup.setKey(Service.PACKAGE_KEY);
|
||||
appsetup.setDispatcherClass(Service.DISPATCHER_CLASS);
|
||||
// Service has no UI, therefore no stylesheet available
|
||||
// appsetup.setStylesheet( Workspace.STYLESHEET );
|
||||
appsetup.setSingleton(true);
|
||||
appsetup.setPortalApplication(false);
|
||||
appsetup.setInstantiator(new ACSObjectInstantiator() {
|
||||
|
||||
@Override
|
||||
protected DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new Service(dataObject);
|
||||
}
|
||||
|
|
@ -479,7 +467,6 @@ public class Loader extends PackageLoader {
|
|||
s_log.debug("Done creating CMS Service Package.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load an content section application type and an initial default
|
||||
* 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
|
||||
// contains the xsl to generate the page
|
||||
appType.setInstantiator(new ACSObjectInstantiator() {
|
||||
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new ContentSection(dataObject);
|
||||
|
|
@ -547,16 +535,17 @@ public class Loader extends PackageLoader {
|
|||
// registers predefined "Authoring", "Approval", "Publishing' steps
|
||||
setup.registerWorkflowTemplates();
|
||||
setup.registerResolvers(s_conf.getItemResolverClass(),
|
||||
s_conf.getTemplateResolverClass() );
|
||||
s_conf.getTemplateResolverClass());
|
||||
// XML generator class, set autonomously by ContentSection.create()
|
||||
|
||||
setup.registerContentTypes(m_content_type_list);
|
||||
setup.registerContentTypes(s_conf.getContentSectionsContentTypes());
|
||||
// Section specific categories, usually not used.
|
||||
// During initial load at install time nor used at all!
|
||||
// default value is false so no categories get loaded.
|
||||
if (s_conf.getUseSectionCategories()) {
|
||||
Iterator files = ((List) s_conf.getCategoryFileList()).iterator();
|
||||
while ( files.hasNext() ) {
|
||||
while (files.hasNext()) {
|
||||
setup.registerCategories((String) files.next());
|
||||
}
|
||||
}
|
||||
|
|
@ -605,19 +594,29 @@ public class Loader extends PackageLoader {
|
|||
private void loadContentTypeDefinitions(List ctDefFiles) {
|
||||
s_log.debug("Loading content type definitions ...");
|
||||
|
||||
if ( ctDefFiles != null) {
|
||||
if (ctDefFiles != null) {
|
||||
XMLContentTypeHandler handler = new XMLContentTypeHandler();
|
||||
Iterator i = ctDefFiles.iterator();
|
||||
while (i.hasNext()) {
|
||||
String xmlFile = (String)i.next();
|
||||
String xmlFile = (String) i.next();
|
||||
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.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Integrates the CMS privileges into the Core permision system.
|
||||
*
|
||||
|
|
@ -633,10 +632,10 @@ public class Loader extends PackageLoader {
|
|||
|
||||
DataQuery dq = SessionManager.getSession().retrieveQuery(CMS_PRIVILEGES);
|
||||
try {
|
||||
while ( dq.next() ) {
|
||||
while (dq.next()) {
|
||||
String privilege = (String) dq.get(PRIVILEGE);
|
||||
s_log.debug(String.format("privilege = %s", privilege));
|
||||
if ( PrivilegeDescriptor.get(privilege) == null ) {
|
||||
if (PrivilegeDescriptor.get(privilege) == null) {
|
||||
PrivilegeDescriptor.createPrivilege(privilege);
|
||||
}
|
||||
}
|
||||
|
|
@ -646,6 +645,4 @@ public class Loader extends PackageLoader {
|
|||
}
|
||||
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.CMSTaskType;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
// import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.initializer.InitializationException;
|
||||
// import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.PartyCollection;
|
||||
import com.arsdigita.kernel.Role;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
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.UncheckedWrapperException;
|
||||
// import com.arsdigita.web.ApplicationSetup;
|
||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
||||
|
|
@ -59,7 +53,6 @@ import java.util.EmptyStackException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
// import java.util.NoSuchElementException;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -78,14 +71,12 @@ import org.xml.sax.helpers.DefaultHandler;
|
|||
public final class ContentSectionSetup {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(ContentSectionSetup.class);
|
||||
|
||||
private final static String STYLESHEET = "/packages/content-section/xsl/cms.xsl";
|
||||
private HashMap m_tasks = new HashMap();
|
||||
private LifecycleDefinition m_lcd;
|
||||
private WorkflowTemplate m_wf;
|
||||
final ContentSection m_section;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. Using this constructor the content section has to be
|
||||
* already created using ContentSection.create(name)
|
||||
|
|
@ -98,7 +89,6 @@ public final class ContentSectionSetup {
|
|||
m_section = section;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper class to create and configure a content section instance
|
||||
* in one step.
|
||||
|
|
@ -111,8 +101,7 @@ public final class ContentSectionSetup {
|
|||
String templateResolverClassName,
|
||||
List sectionContentTypes,
|
||||
Boolean useSectionCategories,
|
||||
List categoryFileList
|
||||
) {
|
||||
List categoryFileList) {
|
||||
s_log.info("Creating content section on /" + name);
|
||||
|
||||
ContentSection section = ContentSection.create(name);
|
||||
|
|
@ -123,7 +112,7 @@ public final class ContentSectionSetup {
|
|||
setup.registerViewers(isPubliclyViewable);
|
||||
setup.registerPublicationCycles();
|
||||
setup.registerWorkflowTemplates();
|
||||
setup.registerResolvers( itemResolverClassName,templateResolverClassName );
|
||||
setup.registerResolvers(itemResolverClassName, templateResolverClassName);
|
||||
|
||||
// setup.registerContentTypes((List)m_conf.getParameter(TYPES));
|
||||
setup.registerContentTypes(sectionContentTypes);
|
||||
|
|
@ -131,7 +120,7 @@ public final class ContentSectionSetup {
|
|||
// section specific categories, usually not used.
|
||||
if (useSectionCategories) {
|
||||
Iterator files = categoryFileList.iterator();
|
||||
while ( files.hasNext() ) {
|
||||
while (files.hasNext()) {
|
||||
setup.registerCategories((String) files.next());
|
||||
}
|
||||
}
|
||||
|
|
@ -143,8 +132,6 @@ public final class ContentSectionSetup {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Steps through a list of roles which are part of a staff group and
|
||||
* delegates processing of each role.
|
||||
|
|
@ -155,12 +142,12 @@ public final class ContentSectionSetup {
|
|||
|
||||
Iterator i = roles.iterator();
|
||||
while (i.hasNext()) {
|
||||
List role = (List)i.next();
|
||||
List role = (List) i.next();
|
||||
|
||||
String name = (String)role.get(0);
|
||||
String desc = (String)role.get(1);
|
||||
List privileges = (List)role.get(2);
|
||||
String task = (role.size() > 3 ? (String)role.get(3) : null);
|
||||
String name = (String) role.get(0);
|
||||
String desc = (String) role.get(1);
|
||||
List privileges = (List) role.get(2);
|
||||
String task = (role.size() > 3 ? (String) role.get(3) : null);
|
||||
|
||||
s_log.info("Creating role " + name);
|
||||
|
||||
|
|
@ -170,9 +157,10 @@ public final class ContentSectionSetup {
|
|||
desc,
|
||||
privileges);
|
||||
|
||||
if (task != null)
|
||||
if (task != null) {
|
||||
m_tasks.put(task, group);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -192,14 +180,14 @@ public final class ContentSectionSetup {
|
|||
|
||||
Iterator i = privileges.iterator();
|
||||
while (i.hasNext()) {
|
||||
String priv = (String)i.next();
|
||||
String priv = (String) i.next();
|
||||
s_log.info("Granting privilege cms_" + priv);
|
||||
|
||||
role.grantPermission(m_section,
|
||||
PrivilegeDescriptor.get("cms_" + priv));
|
||||
|
||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN) ||
|
||||
priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
|
||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN)
|
||||
|| priv.equals(SecurityManager.CATEGORIZE_ITEMS)) {
|
||||
RootCategoryCollection coll = Category.getRootCategories(m_section);
|
||||
while (coll.next()) {
|
||||
if (priv.equals(SecurityManager.CATEGORY_ADMIN)) {
|
||||
|
|
@ -238,10 +226,10 @@ public final class ContentSectionSetup {
|
|||
: "registered@nullhost";
|
||||
|
||||
Party viewer = retrieveParty(email);
|
||||
if (viewer == null)
|
||||
throw new InitializationException(
|
||||
(String) GlobalizationUtil.globalize(
|
||||
if (viewer == null) {
|
||||
throw new InitializationException((String) GlobalizationUtil.globalize(
|
||||
"cms.installer.cannot_find_group_for_email").localize() + email);
|
||||
}
|
||||
|
||||
s_log.info("Adding " + email + " to viewers role");
|
||||
viewers.getGroup().addMemberOrSubgroup(viewer);
|
||||
|
|
@ -277,27 +265,23 @@ public final class ContentSectionSetup {
|
|||
public void registerResolvers(String itemResolverClassName,
|
||||
String templateResolverClassName) {
|
||||
|
||||
if (itemResolverClassName != null && itemResolverClassName.length()>0) {
|
||||
if (itemResolverClassName != null && itemResolverClassName.length() > 0) {
|
||||
m_section.setItemResolverClass(itemResolverClassName);
|
||||
s_log.info("Registering " + itemResolverClassName
|
||||
+ " as the item resolver class");
|
||||
} else {
|
||||
m_section.setItemResolverClass(ContentSection.getConfig()
|
||||
.getDefaultItemResolverClass()
|
||||
.getName());
|
||||
m_section.setItemResolverClass(ContentSection.getConfig().getDefaultItemResolverClass().getName());
|
||||
s_log.info("Registering " + itemResolverClassName
|
||||
+ " as the item resolver class");
|
||||
}
|
||||
if (templateResolverClassName != null && templateResolverClassName.length()>0) {
|
||||
if (templateResolverClassName != null && templateResolverClassName.length() > 0) {
|
||||
m_section.setTemplateResolverClass(templateResolverClassName);
|
||||
s_log.info("Registering " + templateResolverClassName +
|
||||
" as the template resolver class");
|
||||
s_log.info("Registering " + templateResolverClassName
|
||||
+ " as the template resolver class");
|
||||
} else {
|
||||
m_section.setTemplateResolverClass(ContentSection.getConfig()
|
||||
.getDefaultTemplateResolverClass()
|
||||
.getName());
|
||||
s_log.info("Registering " + templateResolverClassName +
|
||||
" as the template resolver class");
|
||||
m_section.setTemplateResolverClass(ContentSection.getConfig().getDefaultTemplateResolverClass().getName());
|
||||
s_log.info("Registering " + templateResolverClassName
|
||||
+ " as the template resolver class");
|
||||
}
|
||||
|
||||
m_section.save();
|
||||
|
|
@ -314,7 +298,7 @@ public final class ContentSectionSetup {
|
|||
|
||||
// The feature lifecycle.
|
||||
LifecycleDefinition lcd = new LifecycleDefinition();
|
||||
lcd.setLabel( (String) GlobalizationUtil.globalize(
|
||||
lcd.setLabel((String) GlobalizationUtil.globalize(
|
||||
"cms.installer.simple_publication").localize());
|
||||
lcd.setDescription("A one-phase lifecycle for items.");
|
||||
lcd.save();
|
||||
|
|
@ -343,7 +327,7 @@ public final class ContentSectionSetup {
|
|||
|
||||
// The 3-step production workflow.
|
||||
WorkflowTemplate wf = new WorkflowTemplate();
|
||||
wf.setLabel( (String) GlobalizationUtil.globalize(
|
||||
wf.setLabel((String) GlobalizationUtil.globalize(
|
||||
"cms.installer.production_workflow").localize());
|
||||
wf.setDescription("A process that involves creating and approving content.");
|
||||
wf.save();
|
||||
|
|
@ -355,24 +339,26 @@ public final class ContentSectionSetup {
|
|||
authoring.save();
|
||||
|
||||
|
||||
Role author = (Role)m_tasks.get("Authoring");
|
||||
if (author != null)
|
||||
Role author = (Role) m_tasks.get("Authoring");
|
||||
if (author != null) {
|
||||
authoring.assignGroup(author.getGroup());
|
||||
}
|
||||
|
||||
authoring.setTaskType(CMSTaskType.retrieve(CMSTaskType.AUTHOR));
|
||||
authoring.save();
|
||||
|
||||
CMSTask approval = new CMSTask();
|
||||
approval.setLabel( (String) GlobalizationUtil.globalize(
|
||||
approval.setLabel((String) GlobalizationUtil.globalize(
|
||||
"cms.installer.approval").localize());
|
||||
approval.setDescription("Approve content.");
|
||||
approval.save();
|
||||
approval.addDependency(authoring);
|
||||
approval.save();
|
||||
|
||||
Role approver = (Role)m_tasks.get("Approval");
|
||||
if (approver != null)
|
||||
Role approver = (Role) m_tasks.get("Approval");
|
||||
if (approver != null) {
|
||||
approval.assignGroup(approver.getGroup());
|
||||
}
|
||||
|
||||
approval.setTaskType(CMSTaskType.retrieve(CMSTaskType.EDIT));
|
||||
approval.save();
|
||||
|
|
@ -386,9 +372,10 @@ public final class ContentSectionSetup {
|
|||
deploy.addDependency(approval);
|
||||
deploy.save();
|
||||
|
||||
Role publisher = (Role)m_tasks.get("Publishing");
|
||||
if (publisher != null)
|
||||
Role publisher = (Role) m_tasks.get("Publishing");
|
||||
if (publisher != null) {
|
||||
deploy.assignGroup(publisher.getGroup());
|
||||
}
|
||||
|
||||
deploy.setTaskType(CMSTaskType.retrieve(CMSTaskType.DEPLOY));
|
||||
deploy.save();
|
||||
|
|
@ -417,11 +404,11 @@ public final class ContentSectionSetup {
|
|||
while (i.hasNext()) {
|
||||
Object obj = i.next();
|
||||
if (obj instanceof String) {
|
||||
registerContentType((String)obj);
|
||||
registerContentType((String) obj);
|
||||
} else {
|
||||
List list = (List)obj;
|
||||
String name = (String)list.get(0);
|
||||
String file = (String)list.get(1);
|
||||
List list = (List) obj;
|
||||
String name = (String) list.get(0);
|
||||
String file = (String) list.get(1);
|
||||
|
||||
ContentType type = registerContentType(name);
|
||||
registerTemplate(type, file);
|
||||
|
|
@ -448,14 +435,13 @@ public final class ContentSectionSetup {
|
|||
s_log.info("Adding type " + name + " to " + m_section.getDisplayName());
|
||||
m_section.addContentType(type);
|
||||
|
||||
s_log.info("Setting the default lifecycle for " +
|
||||
name + " to " + m_lcd.getLabel());
|
||||
ContentTypeLifecycleDefinition.
|
||||
updateLifecycleDefinition(m_section, type, m_lcd);
|
||||
s_log.info("Setting the default lifecycle for "
|
||||
+ name + " to " + m_lcd.getLabel());
|
||||
ContentTypeLifecycleDefinition.updateLifecycleDefinition(m_section, type, m_lcd);
|
||||
m_lcd.save();
|
||||
|
||||
s_log.info("Setting the default workflow template for " + name +
|
||||
" to " + m_wf.getLabel());
|
||||
s_log.info("Setting the default workflow template for " + name
|
||||
+ " to " + m_wf.getLabel());
|
||||
ContentTypeWorkflowTemplate.updateWorkflowTemplate(m_section, type, m_wf);
|
||||
m_wf.save();
|
||||
|
||||
|
|
@ -468,14 +454,15 @@ public final class ContentSectionSetup {
|
|||
int pos1 = filename.lastIndexOf("/");
|
||||
int pos2 = filename.lastIndexOf(".");
|
||||
|
||||
if (pos2 == -1)
|
||||
if (pos2 == -1) {
|
||||
pos2 = filename.length();
|
||||
}
|
||||
|
||||
String label = filename.substring(pos1+1,pos2);
|
||||
String label = filename.substring(pos1 + 1, pos2);
|
||||
|
||||
String typename = type.getClassName();
|
||||
int pos3 = typename.lastIndexOf(".");
|
||||
String name = typename.substring(pos3+1, typename.length()) + "-" + label;
|
||||
String name = typename.substring(pos3 + 1, typename.length()) + "-" + label;
|
||||
|
||||
Template temp = new Template();
|
||||
temp.setContentSection(m_section);
|
||||
|
|
@ -483,21 +470,16 @@ public final class ContentSectionSetup {
|
|||
temp.setLabel(label);
|
||||
temp.setParent(m_section.getTemplatesFolder());
|
||||
|
||||
final ClassLoader loader = Thread.currentThread
|
||||
().getContextClassLoader();
|
||||
final InputStream stream = loader.getResourceAsStream
|
||||
(filename.substring(1));
|
||||
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
final InputStream stream = loader.getResourceAsStream(filename.substring(1));
|
||||
|
||||
if (stream == null) {
|
||||
throw new IllegalStateException
|
||||
((String) GlobalizationUtil.globalize
|
||||
("cms.installer.cannot_find_file").localize() + filename);
|
||||
throw new IllegalStateException((String) GlobalizationUtil.globalize("cms.installer.cannot_find_file").localize() + filename);
|
||||
}
|
||||
|
||||
final BufferedReader input = new BufferedReader
|
||||
(new InputStreamReader(stream));
|
||||
final BufferedReader input = new BufferedReader(new InputStreamReader(stream));
|
||||
|
||||
StringBuffer body = new StringBuffer();
|
||||
StringBuilder body = new StringBuilder();
|
||||
String line;
|
||||
for (;;) {
|
||||
try {
|
||||
|
|
@ -507,8 +489,9 @@ public final class ContentSectionSetup {
|
|||
(String) GlobalizationUtil.globalize(
|
||||
"cms.installer.cannot_read_line_of_data").localize(), ex);
|
||||
}
|
||||
if (line == null)
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
body.append(line);
|
||||
body.append("\n");
|
||||
|
|
@ -518,12 +501,9 @@ public final class ContentSectionSetup {
|
|||
|
||||
temp.save();
|
||||
|
||||
TemplateManagerFactory.getInstance()
|
||||
.addTemplate(m_section, type, temp, "public");
|
||||
TemplateManagerFactory.getInstance().addTemplate(m_section, type, temp, "public");
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
// // Currently there is no way to persists alert preferemces, therefore
|
||||
// // currently not a loader or setup task.
|
||||
// /**
|
||||
|
|
@ -607,14 +586,13 @@ public final class ContentSectionSetup {
|
|||
//
|
||||
// return unfinished;
|
||||
// }
|
||||
|
||||
// ///////////////////// Private Class Section ////////////////////////////
|
||||
|
||||
/**
|
||||
* SAX Handler for category lists. Creates the categories as they are
|
||||
* defined, with structure, in the xml document.
|
||||
*/
|
||||
private class CategoryHandler extends DefaultHandler {
|
||||
|
||||
private Stack m_cats = new Stack();
|
||||
private ContentSection m_section;
|
||||
|
||||
|
|
@ -623,8 +601,8 @@ public final class ContentSectionSetup {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void startElement ( String uri, String local,
|
||||
String qName, Attributes attrs ) {
|
||||
public void startElement(String uri, String local,
|
||||
String qName, Attributes attrs) {
|
||||
if ("categories".equals(qName)) {
|
||||
String name = attrs.getValue("name");
|
||||
if (name == null) {
|
||||
|
|
@ -648,13 +626,13 @@ public final class ContentSectionSetup {
|
|||
}
|
||||
m_cats.push(root);
|
||||
PermissionService.setContext(root, m_section);
|
||||
} else if ( "category".equals(qName) ) {
|
||||
} else if ("category".equals(qName)) {
|
||||
String name = attrs.getValue("name");
|
||||
String description = attrs.getValue("description");
|
||||
String url = attrs.getValue("url");
|
||||
|
||||
// set the default description to the name of the category
|
||||
if ( description == null ) {
|
||||
if (description == null) {
|
||||
description = name;
|
||||
}
|
||||
|
||||
|
|
@ -664,8 +642,8 @@ public final class ContentSectionSetup {
|
|||
|
||||
Category parent = null;
|
||||
try {
|
||||
parent = (Category)m_cats.peek();
|
||||
} catch ( EmptyStackException ex ) {
|
||||
parent = (Category) m_cats.peek();
|
||||
} catch (EmptyStackException ex) {
|
||||
throw new UncheckedWrapperException("no root category", ex);
|
||||
}
|
||||
|
||||
|
|
@ -679,13 +657,12 @@ public final class ContentSectionSetup {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endElement ( String uri, String local, String qName ) {
|
||||
if ( "category".equals(qName) ) {
|
||||
public void endElement(String uri, String local, String qName) {
|
||||
if ("category".equals(qName)) {
|
||||
m_cats.pop();
|
||||
} else if ( "categories".equals(qName)) {
|
||||
} else if ("categories".equals(qName)) {
|
||||
m_cats.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ public abstract class AbstractContentTypeLoader extends PackageLoader {
|
|||
ContentSection.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
while (sections.next()) {
|
||||
ContentSection section = (ContentSection) DomainObjectFactory.
|
||||
newInstance(sections.getDataObject());
|
||||
ContentSection section = (ContentSection) DomainObjectFactory.newInstance(sections.getDataObject());
|
||||
if (!isLoadableInto(section)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ public interface ContentTypeHelper {
|
|||
public void setLabelKey(String labelKey);
|
||||
public String getLabelKey();
|
||||
public boolean isInternal();
|
||||
public void setInternal(boolean internal);
|
||||
public boolean isHidden();
|
||||
public void setMode(String mode);
|
||||
/** @deprecated */
|
||||
public void setDescription(String description) ;
|
||||
/** @deprecated */
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
|||
private String m_className;
|
||||
private String m_createComponent;
|
||||
private AuthoringKit m_kit;
|
||||
private boolean m_internal;
|
||||
private String m_mode;
|
||||
|
||||
public ContentTypeHelperImpl() {
|
||||
}
|
||||
|
|
@ -95,12 +95,16 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
|||
return m_labelKey;
|
||||
}
|
||||
|
||||
public void setInternal(boolean internal) {
|
||||
m_internal = internal;
|
||||
public void setMode(String mode) {
|
||||
m_mode = mode.toLowerCase();
|
||||
}
|
||||
|
||||
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.setClassName(m_className);
|
||||
m_type.setAssociatedObjectType(m_objectType);
|
||||
m_type.setInternal(m_internal);
|
||||
m_type.setMode(m_mode);
|
||||
|
||||
// create pedigree for this content type
|
||||
createPedigree(m_type);
|
||||
|
|
@ -221,7 +225,7 @@ public class ContentTypeHelperImpl implements ContentTypeHelper {
|
|||
// Turn on search indexing for this type
|
||||
ObjectType type = SessionManager.getMetadataRoot().getObjectType(m_objectType);
|
||||
if (type.isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE)
|
||||
&& !m_internal) {
|
||||
&& !isInternal()) {
|
||||
s_log.debug("Registering search adapter for "
|
||||
+ m_objectType);
|
||||
MetadataProviderRegistry.registerAdapter(
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
package com.arsdigita.cms.installer.xml;
|
||||
|
||||
|
||||
import com.arsdigita.cms.AuthoringKit;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -38,34 +38,30 @@ import java.util.List;
|
|||
*
|
||||
* @see ContentTypeInitializer
|
||||
* @author Nobuko Asakai <nasakai@redhat.com> */
|
||||
|
||||
public class XMLContentTypeHandler extends DefaultHandler {
|
||||
|
||||
private static Logger s_log =
|
||||
Logger.getLogger(XMLContentTypeHandler.class.getName());
|
||||
|
||||
|
||||
|
||||
private ArrayList m_types = new ArrayList();
|
||||
|
||||
private ContentTypeHelper m_type;
|
||||
private ContentType m_contentType;
|
||||
private AuthoringKit m_authoringKit;
|
||||
private int m_nextOrder;
|
||||
|
||||
private boolean m_including;
|
||||
|
||||
public List getContentTypes() {
|
||||
return m_types;
|
||||
}
|
||||
|
||||
public void startElement( String uri, String name,
|
||||
@Override
|
||||
public void startElement(String uri, String name,
|
||||
String qName, Attributes atts) {
|
||||
if (name.equals("content-types") ) {
|
||||
if (name.equals("content-types")) {
|
||||
s_log.debug("matched content-types");
|
||||
} else if (name.equals("content-type")) {
|
||||
s_log.debug("matched content-type");
|
||||
String parentType = atts.getValue("parentType");
|
||||
if (parentType != null ) {
|
||||
if (parentType != null) {
|
||||
m_type = new UDCTHelper();
|
||||
s_log.debug("Creating UDCT");
|
||||
} else {
|
||||
|
|
@ -85,17 +81,20 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
|||
m_type.setObjectType(atts.getValue("objectType"));
|
||||
m_type.setClassName(atts.getValue("classname"));
|
||||
|
||||
String internal = atts.getValue("isInternal");
|
||||
if (internal != null &&
|
||||
"yes".equals(internal)) {
|
||||
m_type.setInternal(true);
|
||||
String mode = atts.getValue("mode");
|
||||
if (mode != null && !mode.isEmpty()) {
|
||||
m_type.setMode(mode.trim());
|
||||
} else {
|
||||
m_type.setMode("default");
|
||||
}
|
||||
|
||||
// UDCT stuff
|
||||
m_type.setParentType(parentType);
|
||||
m_type.setName(atts.getValue("name"));
|
||||
|
||||
m_contentType = m_type.createType();
|
||||
m_types.add(m_contentType);
|
||||
} else if ( name.equals("authoring-kit") ) {
|
||||
} else if (name.equals("authoring-kit")) {
|
||||
if (!m_including) {
|
||||
s_log.debug("matched authoring-kit");
|
||||
if (atts.getValue("createComponent") != null) {
|
||||
|
|
@ -104,7 +103,7 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
|||
m_authoringKit = m_type.createAuthoringKit();
|
||||
m_nextOrder = 1;
|
||||
}
|
||||
} else if ( name.equals("authoring-step" )) {
|
||||
} else if (name.equals("authoring-step")) {
|
||||
String label = atts.getValue("label");
|
||||
String labelKey = atts.getValue("labelKey");
|
||||
String labelBundle = atts.getValue("labelBundle");
|
||||
|
|
@ -120,8 +119,7 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
|||
m_type.addAuthoringStep(labelKey, labelBundle,
|
||||
descriptionKey, descriptionBundle,
|
||||
atts.getValue("component"),
|
||||
new BigDecimal(m_nextOrder++)
|
||||
);
|
||||
new BigDecimal(m_nextOrder++));
|
||||
} else if (name.equals("include")) {
|
||||
String file = atts.getValue("href");
|
||||
m_including = true;
|
||||
|
|
@ -133,7 +131,7 @@ public class XMLContentTypeHandler extends DefaultHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void endElement( String uri, String name,
|
||||
public void endElement(String uri, String name,
|
||||
String qName, Attributes atts) {
|
||||
if (name.equals("content-type")) {
|
||||
// reset the helper
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.type;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
|
|
@ -58,18 +57,16 @@ public class AddContentItemElement extends ElementAddForm {
|
|||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(AddContentItemElement.class);
|
||||
|
||||
private SingleSelect m_itemTypeSelect;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public AddContentItemElement(ACSObjectSelectionModel types) {
|
||||
super("ContentTypeAddContentItemElement", "Add a ContentItem Element", types);
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize
|
||||
("cms.ui.type.association_content_type")));
|
||||
m_itemTypeSelect = new SingleSelect
|
||||
(new BigDecimalParameter("AddContentItemTypeSelect"));
|
||||
add(new Label(GlobalizationUtil.globalize("cms.ui.type.association_content_type")));
|
||||
m_itemTypeSelect = new SingleSelect(new BigDecimalParameter("AddContentItemTypeSelect"));
|
||||
try {
|
||||
m_itemTypeSelect.addPrintListener(new ItemTypeSelectPrintListener());
|
||||
} catch (TooManyListenersException ex) {
|
||||
|
|
@ -78,7 +75,7 @@ public class AddContentItemElement extends ElementAddForm {
|
|||
}
|
||||
add(m_itemTypeSelect);
|
||||
|
||||
add(m_buttons, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER);
|
||||
add(m_buttons, ColumnPanel.FULL_WIDTH | ColumnPanel.CENTER);
|
||||
}
|
||||
|
||||
private ContentType getItemType(PageState state)
|
||||
|
|
@ -92,9 +89,7 @@ public class AddContentItemElement extends ElementAddForm {
|
|||
try {
|
||||
itemType = new ContentType(itemTypeID);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new FormProcessException
|
||||
((String) GlobalizationUtil.globalize
|
||||
("cms.ui.type.invalid").localize());
|
||||
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.type.invalid").localize());
|
||||
}
|
||||
return itemType;
|
||||
}
|
||||
|
|
@ -105,8 +100,7 @@ public class AddContentItemElement extends ElementAddForm {
|
|||
|
||||
ContentType itemType = getItemType(state);
|
||||
dot.addOptionalAssociation(label,
|
||||
MetadataRoot.getMetadataRoot().getObjectType
|
||||
(itemType.getAssociatedObjectType()));
|
||||
MetadataRoot.getMetadataRoot().getObjectType(itemType.getAssociatedObjectType()));
|
||||
}
|
||||
|
||||
protected final void addFormComponent(PersistentForm pForm, String label,
|
||||
|
|
@ -114,13 +108,12 @@ public class AddContentItemElement extends ElementAddForm {
|
|||
throws FormProcessException {
|
||||
|
||||
ContentType itemType = getItemType(state);
|
||||
PersistentHidden pContentTypeName = PersistentHidden.create(label+"Type");
|
||||
PersistentHidden pContentTypeName = PersistentHidden.create(label + "Type");
|
||||
pContentTypeName.setDefaultValue(itemType.getAssociatedObjectType());
|
||||
pContentTypeName.save();
|
||||
pForm.addComponent(pContentTypeName);
|
||||
PersistentSingleSelect pSelect = PersistentSingleSelect.create(label);
|
||||
pSelect.setParameterModel
|
||||
("com.arsdigita.bebop.parameters.BigDecimalParameter");
|
||||
pSelect.setParameterModel("com.arsdigita.bebop.parameters.BigDecimalParameter");
|
||||
pSelect.save();
|
||||
pForm.addComponent(pSelect);
|
||||
}
|
||||
|
|
@ -137,9 +130,9 @@ public class AddContentItemElement extends ElementAddForm {
|
|||
// Get the current content section
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
|
||||
ContentTypeCollection contentTypes = section.getCreatableContentTypes();
|
||||
ContentTypeCollection contentTypes = section.getCreatableContentTypes(true);
|
||||
contentTypes.addOrder(ContentType.LABEL);
|
||||
while ( contentTypes.next() ) {
|
||||
while (contentTypes.next()) {
|
||||
ContentType type = contentTypes.getContentType();
|
||||
t.addOption(new Option(type.getID().toString(), type.getLabel()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import com.arsdigita.toolbox.ui.Cancellable;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* This class contains the split pane for the ContentType
|
||||
* administration interface.
|
||||
|
|
@ -60,9 +61,7 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
public final class ContentTypeAdminPane extends BaseAdminPane {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(ContentTypeAdminPane.class);
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(ContentTypeAdminPane.class);
|
||||
private final ACSObjectSelectionModel m_model;
|
||||
private final ContentTypeRequestLocal m_type;
|
||||
|
||||
|
|
@ -98,13 +97,13 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
super.register(p);
|
||||
|
||||
p.addActionListener(new ActionListener() {
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final PageState state = e.getPageState();
|
||||
ContentType contentType = (ContentType) m_model.getSelectedObject(state);
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
if ( contentType == null ) {
|
||||
final String template = state.getRequest().getParameter
|
||||
(ContentSectionPage.SET_TEMPLATE);
|
||||
if (contentType == null) {
|
||||
final String template = state.getRequest().getParameter(ContentSectionPage.SET_TEMPLATE);
|
||||
if (template != null) {
|
||||
DataCollection da = SessionManager.getSession().retrieve(SectionTemplateMapping.BASE_DATA_OBJECT_TYPE);
|
||||
DomainCollection c = new DomainCollection(da);
|
||||
|
|
@ -120,11 +119,11 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
}
|
||||
c.close();
|
||||
}
|
||||
if ( contentType == null ) {
|
||||
if (contentType == null) {
|
||||
ContentTypeCollection contentTypes = section.getContentTypes();
|
||||
contentTypes.addOrder("label asc");
|
||||
try {
|
||||
if ( contentTypes.next() ) {
|
||||
if (contentTypes.next()) {
|
||||
contentType = contentTypes.getContentType();
|
||||
}
|
||||
} finally {
|
||||
|
|
@ -132,7 +131,7 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
}
|
||||
}
|
||||
if (contentType != null) {
|
||||
m_model.setSelectedObject(state,contentType);
|
||||
m_model.setSelectedObject(state, contentType);
|
||||
getBody().push(state, getItemPane());
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +142,7 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
}
|
||||
|
||||
private class AddTypeContainer extends GridPanel implements ActionListener, FormProcessListener {
|
||||
|
||||
private Label m_noTypesAvailable =
|
||||
new Label(gz("cms.ui.type.select.none"));
|
||||
private SelectType m_selectType;
|
||||
|
|
@ -157,28 +157,26 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
GridPanel container = new GridPanel(1);
|
||||
container.add(m_noTypesAvailable);
|
||||
m_selectType = new SelectType();
|
||||
m_selectType.addSubmissionListener
|
||||
(new CancelListener(m_selectType));
|
||||
m_selectType.addSubmissionListener(new CancelListener(m_selectType));
|
||||
m_selectType.addProcessListener(this);
|
||||
container.add(m_selectType);
|
||||
selectSection.setBody(container);
|
||||
|
||||
Section addSection = new Section() {
|
||||
|
||||
public final boolean isVisible(final PageState state) {
|
||||
return super.isVisible(state) &&
|
||||
!ContentSection.getConfig().getHideUDCTUI();
|
||||
return super.isVisible(state)
|
||||
&& !ContentSection.getConfig().getHideUDCTUI();
|
||||
}
|
||||
};
|
||||
addSection.setHeading(new Label(gz("cms.ui.type.define")));
|
||||
m_createType = new CreateType(m_model);
|
||||
m_createType.addSubmissionListener
|
||||
(new CancelListener(m_createType));
|
||||
m_createType.addSubmissionListener(new CancelListener(m_createType));
|
||||
m_createType.addProcessListener(this);
|
||||
addSection.setBody(m_createType);
|
||||
add(addSection);
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PageState s = e.getPageState();
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
|
|
@ -194,7 +192,6 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
final PageState state = e.getPageState();
|
||||
resetPane(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -203,7 +200,9 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
* becaue it was protected
|
||||
*/
|
||||
private final class CancelListener implements FormSubmissionListener {
|
||||
|
||||
Cancellable m_form;
|
||||
|
||||
CancelListener(Cancellable form) {
|
||||
m_form = form;
|
||||
}
|
||||
|
|
@ -221,13 +220,14 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
private void resetPane(PageState state) {
|
||||
getBody().reset(state);
|
||||
if (getSelectionModel().isSelected(state)) {
|
||||
s_log.debug("The selection model is selected; displaying " +
|
||||
"the item pane");
|
||||
s_log.debug("The selection model is selected; displaying "
|
||||
+ "the item pane");
|
||||
getBody().push(state, getItemPane());
|
||||
}
|
||||
}
|
||||
|
||||
private class SelectionRequestLocal extends ContentTypeRequestLocal {
|
||||
|
||||
protected final Object initialValue(final PageState state) {
|
||||
ContentType contentType = (ContentType) m_model.getSelectedObject(state);
|
||||
return contentType;
|
||||
|
|
@ -235,6 +235,7 @@ public final class ContentTypeAdminPane extends BaseAdminPane {
|
|||
}
|
||||
|
||||
private class DeleteForm extends BaseDeleteForm {
|
||||
|
||||
DeleteForm() {
|
||||
super(new Label(gz("cms.ui.type.delete_prompt")));
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ContentTypeListModelBuilder extends LockableImpl
|
|||
final ContentSection section =
|
||||
CMS.getContext().getContentSection();
|
||||
|
||||
m_types = section.getContentTypes();
|
||||
m_types = section.getContentTypes(true);
|
||||
m_types.addOrder(ContentType.LABEL);
|
||||
m_types.rewind();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.type;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
|
|
@ -85,21 +84,16 @@ import java.util.TooManyListenersException;
|
|||
* @author Xixi D'Moon (xdmoon@arsdigita.com)
|
||||
* @version $Revision: #21 $ $Date: 2004/08/17 $
|
||||
*/
|
||||
|
||||
public class CreateType extends CMSForm
|
||||
implements FormProcessListener, FormInitListener, FormSubmissionListener, FormValidationListener {
|
||||
|
||||
private static final String DEFAULT_UDITEM_TYPE = ContentPage.BASE_DATA_OBJECT_TYPE;
|
||||
private static final String CATEGORIZATION_COMPONENT =
|
||||
"com.arsdigita.cms.ui.authoring.ItemCategoryStep";
|
||||
|
||||
private final static Logger s_log =
|
||||
Logger.getLogger(CreateType.class.getName());
|
||||
|
||||
//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 Hidden m_id;
|
||||
private TextField m_name;
|
||||
private TextField m_label;
|
||||
|
|
@ -110,12 +104,12 @@ public class CreateType extends CMSForm
|
|||
private Submit m_submit;
|
||||
private Submit m_cancel;
|
||||
private SingleSelectionModel m_types = null;
|
||||
|
||||
DynamicObjectType dot;
|
||||
|
||||
public CreateType() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public CreateType(SingleSelectionModel m) {
|
||||
super("NewContentItemDefinition");
|
||||
if (m != null) {
|
||||
|
|
@ -190,7 +184,7 @@ public class CreateType extends CMSForm
|
|||
m_cancel = new Submit("cancel");
|
||||
m_cancel.setButtonLabel("Cancel");
|
||||
s.add(m_cancel);
|
||||
add(s, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER);
|
||||
add(s, ColumnPanel.FULL_WIDTH | ColumnPanel.CENTER);
|
||||
|
||||
//add the listeners
|
||||
addProcessListener(this);
|
||||
|
|
@ -201,6 +195,7 @@ public class CreateType extends CMSForm
|
|||
}
|
||||
|
||||
// if this form is cancelled
|
||||
@Override
|
||||
public boolean isCancelled(PageState s) {
|
||||
return m_cancel.isSelected(s);
|
||||
}
|
||||
|
|
@ -210,7 +205,7 @@ public class CreateType extends CMSForm
|
|||
* the particular content section, and if the new type name is
|
||||
* legal dynamic object type name
|
||||
*/
|
||||
public void validate (FormSectionEvent e) throws FormProcessException {
|
||||
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||
PageState s = e.getPageState();
|
||||
String typeLabel = (String) m_label.getValue(s);
|
||||
String typeName = (String) m_name.getValue(s);
|
||||
|
|
@ -220,23 +215,22 @@ public class CreateType extends CMSForm
|
|||
|
||||
boolean dupe = false;
|
||||
|
||||
while (contentTypes.next() && dupe==false) {
|
||||
if (contentTypes.getContentType().getLabel().compareTo(typeLabel)==0) {
|
||||
while (contentTypes.next() && dupe == false) {
|
||||
if (contentTypes.getContentType().getLabel().compareTo(typeLabel) == 0) {
|
||||
dupe = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dupe == true) {
|
||||
throw new FormProcessException
|
||||
((String) GlobalizationUtil.globalize("cms.ui.type.name_not_unique", new Object[] { typeLabel }).localize());
|
||||
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.type.name_not_unique", new Object[]{typeLabel}).localize());
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < typeName.length(); i++) {
|
||||
char c = typeName.charAt(i);
|
||||
if (Character.isWhitespace(c)) {
|
||||
throw new FormProcessException( (String) GlobalizationUtil.globalize("cms.ui.type.name_has_whitespace").localize());
|
||||
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.type.name_has_whitespace").localize());
|
||||
} else if (!Character.isLetterOrDigit(c)) {
|
||||
throw new FormProcessException( (String) GlobalizationUtil.globalize("cms.ui.type.name_not_alphanumeric").localize());
|
||||
throw new FormProcessException((String) GlobalizationUtil.globalize("cms.ui.type.name_not_alphanumeric").localize());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -278,12 +272,10 @@ public class CreateType extends CMSForm
|
|||
if (parentContentType != null) {
|
||||
parentContentClassname = parentContentType.getClassName();
|
||||
parentObjectType =
|
||||
SessionManager.getMetadataRoot().getObjectType
|
||||
(parentContentType.getAssociatedObjectType());
|
||||
SessionManager.getMetadataRoot().getObjectType(parentContentType.getAssociatedObjectType());
|
||||
} else {
|
||||
try {
|
||||
parentContentType = ContentType.findByAssociatedObjectType
|
||||
(DEFAULT_UDITEM_TYPE);
|
||||
parentContentType = ContentType.findByAssociatedObjectType(DEFAULT_UDITEM_TYPE);
|
||||
parentContentClassname = parentContentType.getClassName();
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
// If parent content type isn't found, don't add
|
||||
|
|
@ -291,18 +283,15 @@ public class CreateType extends CMSForm
|
|||
//classname
|
||||
parentContentClassname = "com.arsdigita.cms.ContentPage";
|
||||
}
|
||||
parentObjectType = SessionManager.getMetadataRoot().getObjectType
|
||||
(DEFAULT_UDITEM_TYPE);
|
||||
parentObjectType = SessionManager.getMetadataRoot().getObjectType(DEFAULT_UDITEM_TYPE);
|
||||
}
|
||||
|
||||
|
||||
String qname = parentObjectType.getModel().getName() + "." + name;
|
||||
MetadataRoot root = MetadataRoot.getMetadataRoot();
|
||||
if (root.getObjectType(qname) != null || root.hasTable(name)) {
|
||||
throw new FormValidationException
|
||||
(m_name, (String) GlobalizationUtil.globalize
|
||||
("cms.ui.type.duplicate_type",
|
||||
new Object[] { name }).localize());
|
||||
throw new FormValidationException(m_name, (String) GlobalizationUtil.globalize("cms.ui.type.duplicate_type",
|
||||
new Object[]{name}).localize());
|
||||
}
|
||||
|
||||
//create a new dynamic object type with
|
||||
|
|
@ -317,8 +306,7 @@ public class CreateType extends CMSForm
|
|||
try {
|
||||
contentType = new ContentType(key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
contentType = new ContentType(SessionManager.getSession().create
|
||||
(new OID(ContentType.BASE_DATA_OBJECT_TYPE, key)));
|
||||
contentType = new ContentType(SessionManager.getSession().create(new OID(ContentType.BASE_DATA_OBJECT_TYPE, key)));
|
||||
isNew = true;
|
||||
}
|
||||
|
||||
|
|
@ -339,10 +327,10 @@ public class CreateType extends CMSForm
|
|||
}
|
||||
|
||||
//associate a default lifecycle
|
||||
setDefaultLifecycle (lifecycleID, section, contentType);
|
||||
setDefaultLifecycle(lifecycleID, section, contentType);
|
||||
|
||||
//associate a default workflow
|
||||
setDefaultWorkflow (workflowID, section, contentType);
|
||||
setDefaultWorkflow(workflowID, section, contentType);
|
||||
|
||||
//drop the page to refresh content center, admin and item ui
|
||||
Utilities.refreshItemUI(state);
|
||||
|
|
@ -378,7 +366,7 @@ public class CreateType extends CMSForm
|
|||
* return true if this form is cancelled, false otherwise
|
||||
*/
|
||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
||||
if(m_cancel.isSelected(e.getPageState())) {
|
||||
if (m_cancel.isSelected(e.getPageState())) {
|
||||
throw new FormProcessException("cancelled");
|
||||
}
|
||||
}
|
||||
|
|
@ -392,6 +380,7 @@ public class CreateType extends CMSForm
|
|||
ContentType type) {
|
||||
updateContentTypeAssociation(section, type, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* registers the new type to this content section
|
||||
* and creates authoring kit for the content type
|
||||
|
|
@ -462,13 +451,17 @@ public class CreateType extends CMSForm
|
|||
// Get the current content section
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
|
||||
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);
|
||||
while ( contentTypes.next() ) {
|
||||
while (contentTypes.next()) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -485,10 +478,10 @@ public class CreateType extends CMSForm
|
|||
// Get the current content section
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
|
||||
t.addOption(new Option("-1","-- select --"));
|
||||
t.addOption(new Option("-1", "-- select --"));
|
||||
|
||||
LifecycleDefinitionCollection cycles = section.getLifecycleDefinitions();
|
||||
while ( cycles.next() ) {
|
||||
while (cycles.next()) {
|
||||
LifecycleDefinition cycle = cycles.getLifecycleDefinition();
|
||||
t.addOption(new Option(cycle.getID().toString(), cycle.getLabel()));
|
||||
}
|
||||
|
|
@ -507,10 +500,10 @@ public class CreateType extends CMSForm
|
|||
// Get the current content section
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
|
||||
t.addOption(new Option("-1","-- select --"));
|
||||
t.addOption(new Option("-1", "-- select --"));
|
||||
|
||||
TaskCollection templates = section.getWorkflowTemplates();
|
||||
while ( templates.next() ) {
|
||||
while (templates.next()) {
|
||||
WorkflowTemplate template =
|
||||
(WorkflowTemplate) templates.getDomainObject();
|
||||
t.addOption(new Option(template.getID().toString(),
|
||||
|
|
@ -533,8 +526,7 @@ public class CreateType extends CMSForm
|
|||
contentType, lifecycle);
|
||||
} else {
|
||||
//remove the association
|
||||
ContentTypeLifecycleDefinition.removeLifecycleDefinition
|
||||
(section, contentType);
|
||||
ContentTypeLifecycleDefinition.removeLifecycleDefinition(section, contentType);
|
||||
}
|
||||
}
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
|
|
@ -549,12 +541,11 @@ public class CreateType extends CMSForm
|
|||
|
||||
//associate a default workflow
|
||||
try {
|
||||
if ( workflowID != null) {
|
||||
if(workflowID.intValue() != -1) {
|
||||
if (workflowID != null) {
|
||||
if (workflowID.intValue() != -1) {
|
||||
// Set default workflow definition association.
|
||||
WorkflowTemplate template = new WorkflowTemplate(new OID(WorkflowTemplate.BASE_DATA_OBJECT_TYPE, workflowID));
|
||||
ContentTypeWorkflowTemplate.
|
||||
updateWorkflowTemplate(section, contentType, template);
|
||||
ContentTypeWorkflowTemplate.updateWorkflowTemplate(section, contentType, template);
|
||||
} else {
|
||||
// Remove the association.
|
||||
ContentTypeWorkflowTemplate.removeWorkflowTemplate(section, contentType);
|
||||
|
|
@ -565,5 +556,4 @@ public class CreateType extends CMSForm
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.type;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
|
|
@ -45,7 +44,6 @@ import com.arsdigita.util.UncheckedWrapperException;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
|
||||
/**
|
||||
* This class contains a form component to that allows adding
|
||||
* already-existing content type to a content section.
|
||||
|
|
@ -58,7 +56,6 @@ public class SelectType extends CMSForm
|
|||
implements PrintListener, FormSubmissionListener, FormProcessListener {
|
||||
|
||||
private final static String TYPES = "types";
|
||||
|
||||
private CheckboxGroup m_typesCheckbox;
|
||||
private Submit m_submit;
|
||||
private Submit m_cancel;
|
||||
|
|
@ -83,14 +80,13 @@ public class SelectType extends CMSForm
|
|||
m_cancel = new Submit("cancel");
|
||||
m_cancel.setButtonLabel("Cancel");
|
||||
s.add(m_cancel);
|
||||
add(s, ColumnPanel.FULL_WIDTH|ColumnPanel.CENTER);
|
||||
add(s, ColumnPanel.FULL_WIDTH | ColumnPanel.CENTER);
|
||||
|
||||
addProcessListener(this);
|
||||
addSubmissionListener(new TypeSecurityListener());
|
||||
addSubmissionListener(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a checkbox list of all content type not associated
|
||||
* with the current content section
|
||||
|
|
@ -108,8 +104,11 @@ public class SelectType extends CMSForm
|
|||
while (contentTypes.next()) {
|
||||
ContentType contentType = contentTypes.getContentType();
|
||||
|
||||
t.addOption(new Option(contentType.getID().toString(),
|
||||
contentType.getLabel()));
|
||||
Label label = new Label(contentType.getLabel());
|
||||
if (contentType.isHidden()) {
|
||||
label.setFontWeight(Label.ITALIC);
|
||||
}
|
||||
t.addOption(new Option(contentType.getID().toString(), label));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +120,7 @@ public class SelectType extends CMSForm
|
|||
*/
|
||||
public void submitted(FormSectionEvent event) throws FormProcessException {
|
||||
PageState state = event.getPageState();
|
||||
if ( isCancelled(state) ) {
|
||||
if (isCancelled(state)) {
|
||||
throw new FormProcessException("cancelled");
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +134,6 @@ public class SelectType extends CMSForm
|
|||
return m_cancel.isSelected(state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Processes form listener which updates a life cycle
|
||||
*/
|
||||
|
|
@ -146,14 +144,14 @@ public class SelectType extends CMSForm
|
|||
String[] types = (String[]) data.get(TYPES);
|
||||
ContentType type;
|
||||
|
||||
if ( types != null ) {
|
||||
for ( int i = 0; i < types.length; i++ ) {
|
||||
if (types != null) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
try {
|
||||
type = new ContentType(new BigDecimal(types[i]));
|
||||
section.addContentType(type);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new UncheckedWrapperException("Content Type ID#" + types[i] +
|
||||
" not found", ex);
|
||||
throw new UncheckedWrapperException("Content Type ID#" + types[i]
|
||||
+ " not found", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,5 +160,4 @@ public class SelectType extends CMSForm
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue