diff --git a/ccm-cms-types-organization/application.xml b/ccm-cms-types-organization/application.xml new file mode 100644 index 000000000..2a79205c2 --- /dev/null +++ b/ccm-cms-types-organization/application.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + The Organization Content Type for OpenCCM. + + diff --git a/ccm-cms-types-organization/pdl/com/arsdigita/content-types/Organization.pdl b/ccm-cms-types-organization/pdl/com/arsdigita/content-types/Organization.pdl new file mode 100644 index 000000000..989f9082c --- /dev/null +++ b/ccm-cms-types-organization/pdl/com/arsdigita/content-types/Organization.pdl @@ -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 ); +} diff --git a/ccm-cms-types-organization/sql/ccm-cms-types-organization/postgres-create.sql b/ccm-cms-types-organization/sql/ccm-cms-types-organization/postgres-create.sql new file mode 100644 index 000000000..a733590e2 --- /dev/null +++ b/ccm-cms-types-organization/sql/ccm-cms-types-organization/postgres-create.sql @@ -0,0 +1,3 @@ +begin; +\i ddl/postgres/create.sql +end; \ No newline at end of file diff --git a/ccm-cms-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Organization.xml b/ccm-cms-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Organization.xml new file mode 100644 index 000000000..09a9ac500 --- /dev/null +++ b/ccm-cms-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Organization.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Organization.xml b/ccm-cms-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Organization.xml new file mode 100644 index 000000000..39582a3fa --- /dev/null +++ b/ccm-cms-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Organization.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ccm-cms-types-organization/src/ccm-cms-types-organization.config b/ccm-cms-types-organization/src/ccm-cms-types-organization.config new file mode 100644 index 000000000..2a4020fc1 --- /dev/null +++ b/ccm-cms-types-organization/src/ccm-cms-types-organization.config @@ -0,0 +1,4 @@ + + + + diff --git a/ccm-cms-types-organization/src/ccm-cms-types-organization.load b/ccm-cms-types-organization/src/ccm-cms-types-organization.load new file mode 100644 index 000000000..5f089ecbc --- /dev/null +++ b/ccm-cms-types-organization/src/ccm-cms-types-organization.load @@ -0,0 +1,16 @@ + + + +
+
+ + + +
+ + + + + + + diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/Organization.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/Organization.java new file mode 100644 index 000000000..fcf87207f --- /dev/null +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/Organization.java @@ -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); + }*/ + +} diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/OrganizationInitializer.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/OrganizationInitializer.java new file mode 100644 index 000000000..a7874f11c --- /dev/null +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/OrganizationInitializer.java @@ -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"; + } +} diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/OrganizationLoader.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/OrganizationLoader.java new file mode 100644 index 000000000..421d70cec --- /dev/null +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/OrganizationLoader.java @@ -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; + } + +} diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationAddChildForm.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationAddChildForm.java new file mode 100644 index 000000000..0d7f9fdc8 --- /dev/null +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationAddChildForm.java @@ -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); + } +} \ No newline at end of file diff --git a/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationChildrenPropertiesStep.java b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationChildrenPropertiesStep.java new file mode 100644 index 000000000..e1f73e301 --- /dev/null +++ b/ccm-cms-types-organization/src/com/arsdigita/cms/contenttypes/ui/OrganizationChildrenPropertiesStep.java @@ -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); + } +} \ No newline at end of file diff --git a/ccm-cms-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/Organization.xsl b/ccm-cms-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/Organization.xsl new file mode 100644 index 000000000..282b76080 --- /dev/null +++ b/ccm-cms-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/Organization.xsl @@ -0,0 +1,19 @@ + +]> + + + + +

+
+ + +

+
+ +
\ No newline at end of file