ccm-cms-types-organization
git-svn-id: https://svn.libreccm.org/ccm/trunk@479 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e21df54bca
commit
4542a9186c
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-cms-types-organization"
|
||||||
|
prettyName="OpenCCM Content Types"
|
||||||
|
version="6.6.0"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
|
||||||
|
</ccm:dependencies>
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="pdl"/>
|
||||||
|
<ccm:directory name="sql"/>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
<ccm:description>
|
||||||
|
The Organization Content Type for OpenCCM.
|
||||||
|
</ccm:description>
|
||||||
|
</ccm:application>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
model com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.cms.*;
|
||||||
|
|
||||||
|
object type Organization extends GenericOrganizationalUnit {
|
||||||
|
reference key ( ct_organizations.organization_id );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
begin;
|
||||||
|
\i ddl/postgres/create.sql
|
||||||
|
end;
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
|
||||||
|
|
||||||
|
<!-- Is internal will be set the yes when testing is finished. -->
|
||||||
|
<ctd:content-type
|
||||||
|
label="Organization"
|
||||||
|
description="A content type of organization."
|
||||||
|
objectType="com.arsdigita.cms.contenttypes.Organization"
|
||||||
|
classname="com.arsdigita.cms.contenttypes.Organization">
|
||||||
|
|
||||||
|
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||||
|
|
||||||
|
<ctd:authoring-step
|
||||||
|
labelKey="cms.contenttypes.shared.basic_properties.title"
|
||||||
|
labelBundle="cms.contenttypes.cms.ui.CMSResources"
|
||||||
|
descriptionKey="cms.contenttypes.shared.basic_properties.description"
|
||||||
|
descriptionBundle="com.arsdigita.cms.ui.CMSResources"
|
||||||
|
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
|
||||||
|
ordering="1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ctd:authoring-step
|
||||||
|
labelKey="genericorgaunit.authoring.contact_properties.title"
|
||||||
|
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
|
||||||
|
descriptionKey="genericorgaunit.authoring.contact_properties.description"
|
||||||
|
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
|
||||||
|
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitContactPropertiesStep"
|
||||||
|
ordering="2"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ctd:authoring-step
|
||||||
|
labelKey="genericorgaunit.authoring.child_properties.title"
|
||||||
|
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
|
||||||
|
descriptionKey="genericorgaunit.authoring.child_properties.description"
|
||||||
|
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
|
||||||
|
component="com.arsdigita.cms.contenttypes.ui.OrganizationChildrenPropertiesStep"
|
||||||
|
ordering="3"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||||
|
</ctd:authoring-kit>
|
||||||
|
|
||||||
|
</ctd:content-type>
|
||||||
|
|
||||||
|
</ctd:content-types>
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
<!--
|
||||||
|
Extend adapter for ContentItemPanel to also output the associated objects.
|
||||||
|
The default properties for BaseContact are left as is and are inherited from ContentPage
|
||||||
|
-->
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Organization" extends="com.arsdigita.cms.ContentPage">
|
||||||
|
<xrd:associations rule="include">
|
||||||
|
<xrd:property name="/object/contacts"/>
|
||||||
|
</xrd:associations>
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<registry>
|
||||||
|
<!-- <config class="com.arsdigita.cms.contenttypes.OrganizationConfig" storage="ccm-cms-types-organization/organization.properties"/> -->
|
||||||
|
</registry>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<load>
|
||||||
|
<requires>
|
||||||
|
<table name="inits"/>
|
||||||
|
<table name="acs_objects"/>
|
||||||
|
<table name="cms_items"/>
|
||||||
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
|
</requires>
|
||||||
|
<provides>
|
||||||
|
<table name="ct_organizations"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contenttypes.OrganizationInitializer"/>
|
||||||
|
</provides>
|
||||||
|
<scripts>
|
||||||
|
<schema directory="ccm-cms-types-organization"/>
|
||||||
|
<data class="com.arsdigita.cms.contenttypes.OrganizationLoader"/>
|
||||||
|
</scripts>
|
||||||
|
</load>
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class Organization extends GenericOrganizationalUnit {
|
||||||
|
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Organization";
|
||||||
|
|
||||||
|
public Organization() {
|
||||||
|
super(BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Organization(BigDecimal id)
|
||||||
|
throws DataObjectNotFoundException {
|
||||||
|
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Organization(OID oid) {
|
||||||
|
super(oid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Organization(DataObject obj) {
|
||||||
|
super(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Organization(String type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public void beforeSave() {
|
||||||
|
super.beforeSave();
|
||||||
|
|
||||||
|
Assert.exists(getContentType(), ContentType.class);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class OrganizationInitializer extends ContentTypeInitializer {
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(OrganizationInitializer.class);
|
||||||
|
|
||||||
|
public OrganizationInitializer() {
|
||||||
|
super("ccm-cms-types-organization.pdl.mf",
|
||||||
|
Organization.BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getStylesheets() {
|
||||||
|
return new String[]{
|
||||||
|
"/static/content-types/com/arsdigita/cms/contenttypes/Organization.xsl"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTraversalXML() {
|
||||||
|
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Organization.xml";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loader.
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class OrganizationLoader extends AbstractContentTypeLoader {
|
||||||
|
|
||||||
|
private static final String[] TYPES = {
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Organization.xml"
|
||||||
|
};
|
||||||
|
|
||||||
|
public String[] getTypes() {
|
||||||
|
return TYPES;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.Organization;
|
||||||
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class OrganizationAddChildForm extends BasicItemForm {
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(
|
||||||
|
OrganizationAddChildForm.class);
|
||||||
|
private OrganizationChildrenPropertiesStep m_step;
|
||||||
|
private ItemSearchWidget m_itemSearch;
|
||||||
|
private SaveCancelSection m_saveCancelSection;
|
||||||
|
private final String ITEM_SEARCH = "orgaunitChild";
|
||||||
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
|
public OrganizationAddChildForm(ItemSelectionModel itemModel) {
|
||||||
|
super("ChildAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addWidgets() {
|
||||||
|
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.select_child").localize()));
|
||||||
|
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
|
findByAssociatedObjectType(
|
||||||
|
Organization.BASE_DATA_OBJECT_TYPE));
|
||||||
|
add(this.m_itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
GenericOrganizationalUnit parent = (GenericOrganizationalUnit) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
|
||||||
|
parent.addOrgaUnitChildren((GenericOrganizationalUnit) data.get(
|
||||||
|
ITEM_SEARCH));
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.Organization;
|
||||||
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jensp
|
||||||
|
*/
|
||||||
|
public class OrganizationChildrenPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(OrganizationChildrenPropertiesStep.class);
|
||||||
|
private static String ADD_CHILD_SHEET_NAME = "addChild";
|
||||||
|
|
||||||
|
public OrganizationChildrenPropertiesStep(
|
||||||
|
ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrganizationChildrenPropertiesStep(
|
||||||
|
ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent,
|
||||||
|
String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addChildSheet = new OrganizationAddChildForm(
|
||||||
|
itemModel);
|
||||||
|
add(ADD_CHILD_SHEET_NAME,
|
||||||
|
(String) ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.contenttypes.ui.genericorgaunit.add_child").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
|
||||||
|
addChildSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
GenericOrganizationalUnitChildTable childrenTable = new GenericOrganizationalUnitChildTable(
|
||||||
|
(itemModel));
|
||||||
|
setDisplayComponent(childrenTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE stylesheet [
|
||||||
|
<!ENTITY nbsp " " ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
|
||||||
|
]>
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Organization']" mode="cms:CT_graphics"
|
||||||
|
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_Organization">
|
||||||
|
<p><xsl:value-of select="./orgaunit_name"/></p>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Organization']" mode="cms:CT_text"
|
||||||
|
name="cms:CT_text_com_arsdigita_cms_contenttypes_Organization">
|
||||||
|
<p><xsl:value-of select="./orgaunit_name"/></p>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
Loading…
Reference in New Issue