diff --git a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl
index cc549d0d2..0ed097ae1 100644
--- a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl
+++ b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/GenericOrganization.pdl
@@ -29,9 +29,4 @@ object type GenericOrganization extends ContentPage {
String[0..1] description = ct_genericorganizations.description VARCHAR(2000);
reference key (ct_genericorganizations.organization_id);
-}
-
-association {
- composite GenericOrganization[1..1] orga = join ct_genericorganization_roles.organization_id to ct_genericorganizations.organization_id;
- composite OrganizationRole[0..n] roles = join ct_genericorganizations.organization_id to ct_genericorganization_roles.organization_id;
}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/OrganizationRole.pdl b/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/OrganizationRole.pdl
deleted file mode 100644
index e6a094a82..000000000
--- a/ccm-cms-types-genericorganization/pdl/com/arsdigita/content-types/OrganizationRole.pdl
+++ /dev/null
@@ -1,9 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentPage;
-
-object type OrganizationRole extends ContentPage {
- String[1..1] rolename = ct_genericorganization_roles.rolename VARCHAR(512);
-
- reference key (ct_genericorganization_roles.role_id);
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml b/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml
index f10815ca7..b7ac6b1d0 100644
--- a/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml
+++ b/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganization.xml
@@ -18,16 +18,16 @@
labelBundle="com.arsdigita.cms.contenttypes.GenericOrganizationResources"
descriptionKey="genericorganization.authoring.basic_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.GenericOrganizationResources"
- component="com.arsdigita.cms.contenttypes.ui.genericorganization.GenericOrganizationEdit"
+ component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationPropertiesStep"
ordering="1"/>
-
+ ordering="2"/> -->
diff --git a/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp b/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp
deleted file mode 100644
index 5d1d82aa3..000000000
--- a/ccm-cms-types-genericorganization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
diff --git a/ccm-cms-types-genericorganization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml b/ccm-cms-types-genericorganization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml
deleted file mode 100644
index 911e3b201..000000000
--- a/ccm-cms-types-genericorganization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load b/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load
index c526d0d91..25a595380 100644
--- a/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load
+++ b/ccm-cms-types-genericorganization/src/ccm-cms-types-genericorganization.load
@@ -4,11 +4,11 @@
+
-
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java
index ac1863fa5..b5c22e1fe 100644
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java
+++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganization.java
@@ -25,6 +25,7 @@ import com.arsdigita.persistence.OID;
import com.arsdigita.util.Assert;
import java.math.BigDecimal;
import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.domain.DomainObjectFactory;
import org.apache.log4j.Logger;
@@ -154,7 +155,6 @@ public class GenericOrganization extends ContentPage {
set(ORGANIZATIONNAME, name);
}
-
/**
*
* @return Addendum for the name of the organization.
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java
index 461973d46..be0f0f122 100644
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java
+++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationInitializer.java
@@ -47,10 +47,10 @@ public class GenericOrganizationInitializer extends ContentTypeInitializer {
*
* @return path of the traversal-adapter XML file.
*/
- @Override
+ /*@Override
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GenericOrganization.xml";
- }
+ }*/
/**
*
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java
index a57fb5cc1..719d2a0d6 100644
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java
+++ b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/GenericOrganizationLoader.java
@@ -56,10 +56,10 @@ public class GenericOrganizationLoader extends AbstractContentTypeLoader {
*/
public GenericOrganizationLoader() {
super();
- m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template",
+ /*m_template = new ResourceParameter("com.arsdigita.cms.contenttypes.genericorganization.template",
Parameter.REQUIRED,
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/genericorganization-item.jsp");
- register(m_template);
+ register(m_template);*/
}
/**
@@ -69,7 +69,7 @@ public class GenericOrganizationLoader extends AbstractContentTypeLoader {
* @param ld
* @param wf
*/
- @Override
+ /*@Override
protected void prepareSection(final ContentSection section,
final ContentType type,
final LifecycleDefinition ld,
@@ -83,5 +83,5 @@ public class GenericOrganizationLoader extends AbstractContentTypeLoader {
type,
ld,
wf);
- }
+ }*/
}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java
deleted file mode 100644
index 7221f8824..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRole.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.OID;
-
-import org.apache.log4j.Logger;
-
-import java.math.BigDecimal;
-
-
-/**
- * ContentItem reprenting a role in a organization, e.g. CEO.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRole extends ContentPage {
-
- private static final Logger logger = Logger.getLogger(OrganizationRole.class);
- /**
- * Name of the role.
- */
- public static final String ROLENAME = "rolename";
- /**
- * Type identifier.
- */
- public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole";
-
- /**
- * Default Constructor
- */
- public OrganizationRole() {
- super(BASE_DATA_OBJECT_TYPE);
- }
-
- /**
- * Trys to find the role with the given id in the database.
- *
- * @param id of the role to find.
- * @throws com.arsdigita.domain.DataObjectNotFoundException
- */
- public OrganizationRole(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- /**
- * Trys to find the role with the given id in the database.
- *
- * @param id
- * @throws com.arsdigita.domain.DataObjectNotFoundException
- */
- public OrganizationRole(OID id) throws DataObjectNotFoundException {
- super(id);
- }
-
- /**
- * Creates an OrganizationRole object based on a DataObject
- *
- * @param obj A object of DataObject class.
- */
- public OrganizationRole(DataObject obj) {
- super(obj);
- }
-
- /**
- *
- * @param type
- */
- public OrganizationRole(String type) {
- super(type);
- }
-
- public String getBaseDataObjectType() {
- return BASE_DATA_OBJECT_TYPE;
- }
-
- //Accessors
-
- /**
- *
- * @return The name of the role.
- */
- public String getRolename() {
- return (String) get(ROLENAME);
- }
-
- /**
- * Sets the name of the role.
- *
- * @param rolename New name of the role.
- */
- public void setRolename(String rolename) {
- set(ROLENAME, rolename);
- }
-
- @Override
- public ContentSection getContentSection() {
- ContentSection ct = super.getContentSection();
-
- if (ct != null) {
- return ct;
- } else {
- ACSObject parent = getParent();
- if ((parent != null) && parent instanceof GenericOrganization) {
- ct = ((ContentItem) parent).getContentSection();
- return ct;
- }
- }
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java
deleted file mode 100644
index 7e7e0ef26..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/OrganizationRoleCollection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- * Collection containing all roles associated to an organization.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRoleCollection extends DomainCollection {
-
- //public static final String versionId = "$Id: OrganizationRoleCollection.java 001 2009-05-28 12:40:00Z jensp $";
-
- /**
- * Creates an object of this class from an DataCollection object.
- *
- * @param dataCollection
- */
- public OrganizationRoleCollection(DataCollection dataCollection) {
- super(dataCollection);
- }
-
- @Override
- public DomainObject getDomainObject() {
- return new OrganizationRole(m_dataCollection.getDataObject());
- }
-
- /**
- * @return the item at the current position
- */
- public OrganizationRole getOrganizationRole() {
- return (OrganizationRole) getDomainObject();
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java
deleted file mode 100644
index 1fb8ece28..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationCreate.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.cms.ContentBundle;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
-import com.arsdigita.cms.ui.authoring.CreationComponent;
-import com.arsdigita.cms.ui.authoring.CreationSelector;
-import com.arsdigita.ui.util.GlobalizationUtil;
-
-/**
- * Form for creating a new organization.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationCreate extends GenericOrganizationForm implements FormInitListener, FormProcessListener, FormSubmissionListener, FormValidationListener, CreationComponent {
- private CreationSelector m_parent;
- private ApplyWorkflowFormSection m_workflowSection;
-
- /**
- * Constructor.
- *
- * @param itemModel
- * @param parent
- */
- public GenericOrganizationCreate(ItemSelectionModel itemModel, CreationSelector parent) {
- super("GenericOrganizationCreate", itemModel);
- m_parent = parent;
- m_workflowSection.setCreationSelector(m_parent);
- m_workflowSection.setContentType(m_itemModel.getContentType());
- addSubmissionListener(this);
- getSaveCancelSection().getSaveButton().setButtonLabel("Create");
- }
-
- /**
- * Adds all widgets to the form.
- */
- @Override
- protected void addWidgets() {
- m_workflowSection = new ApplyWorkflowFormSection();
- add(m_workflowSection, ColumnPanel.INSERT);
- super.addWidgets();
- }
-
- public ApplyWorkflowFormSection getWorkflowSection() {
- return m_workflowSection;
- }
-
- public void init(FormSectionEvent event) throws FormProcessException {
- //Nothing yet
- }
-
- public void submitted(FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
-
- if(getSaveCancelSection().getCancelButton().isSelected(state)) {
- m_parent.redirectBack(state);
- throw new FormProcessException((String)GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.submission_canceled").localize());
- }
- }
-
- public void validate(FormSectionEvent event) throws FormProcessException {
- //Nothing yet
- }
-
- public void process(final FormSectionEvent event) throws FormProcessException {
- final FormData data = event.getFormData();
- final PageState state = event.getPageState();
- final ContentSection section = m_parent.getContentSection(state);
-
- final GenericOrganization orga = createGenericOrganization(state);
-
- orga.setOrganizationName((String)data.get(ORGANIZATIONAME));
- orga.setOrganizationNameAddendum((String)data.get(ORGANIZATIONNAMEADDENDUM));
- orga.setDescription((String)data.get(DESCRIPTION));
-
- final ContentBundle bundle = new ContentBundle(orga);
- bundle.setParent(m_parent.getFolder(state));
- bundle.setContentSection(section);
-
- m_workflowSection.applyWorkflow(state, orga);
-
- m_parent.editItem(state, orga);
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java
deleted file mode 100644
index a29546175..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEdit.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-import com.arsdigita.ui.util.GlobalizationUtil;
-
-/**
- * EditStep for editing an organization.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationEdit extends SimpleEditStep {
-
- /**
- * Constructor.
- *
- * @param itemModel
- * @param parent
- */
- public GenericOrganizationEdit(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
- super(itemModel, parent);
-
- setDefaultEditKey("edit");
- GenericOrganizationForm form = getForm(itemModel);
- add("edit", "Edit", new WorkflowLockedComponentAccess(form, itemModel), form.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(getGenericOrganizationPropertiesSheet(itemModel));
- }
-
- /**
- *
- * @param model
- * @return A new instance of this class.
- */
- protected GenericOrganizationForm getForm(ItemSelectionModel model) {
- return new GenericOrganizationEditForm(model, this);
- }
-
- /**
- *
- * @param model
- * @return A sheet with widgets for the properites of GenericOrgnization.
- */
- public Component getGenericOrganizationPropertiesSheet(ItemSelectionModel model) {
-
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(model);
-
- sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationname"), GenericOrganization.ORGANIZATIONNAME);
- sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.organizationnameaddendum"), GenericOrganization.ORGANIZATIONNAMEADDENDUM);
- sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.description"), GenericOrganization.DESCRIPTION);
-
- return sheet;
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java
deleted file mode 100644
index 83e9955eb..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationEditForm.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.Folder;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.util.Assert;
-
-/**
- * Form for editing a GenericOrganization.
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationEditForm extends GenericOrganizationForm implements FormSubmissionListener {
-
- private SimpleEditStep m_step;
-
- /**
- * Constructor.
- *
- * @param itemModel
- * @param step
- */
- public GenericOrganizationEditForm(ItemSelectionModel itemModel, SimpleEditStep step) {
- super("GenericOrganizationEditForm", itemModel);
- addSubmissionListener(this);
- m_step = step;
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- super.initBasicWidgets(e);
- }
-
- public void submitted(FormSectionEvent fse) {
- if (getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
- m_step.cancelStreamlinedCreation(fse.getPageState());
- }
- }
-
- public void process(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
- GenericOrganization orga = processBasicWidgets(fse);
- m_step.maybeForwardToNextStep(fse.getPageState());
- }
-
- /**
- * This function does nothing real usefull yet. It will maybe removed later.
- *
- * @param fse
- * @throws FormProcessException
- */
- public void validate(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
- FormData data = fse.getFormData();
-
- GenericOrganization orga = (GenericOrganization) m_itemModel.getSelectedObject(state);
- Assert.exists(orga, GenericOrganization.class);
-
- String newOrganizationName = (String)data.get(GenericOrganizationForm.ORGANIZATIONAME);
- String oldOrganizationName = orga.getOrganizationName();
-
- boolean valid = true;
-
- if(!valid) {
- throw new FormProcessException("error");
- }
- }
-
- private Folder getParentFolder(GenericOrganization orga) {
- ContentItem parent = (ContentItem)orga.getParent();
- while((parent != null)
- && (!(parent instanceof Folder))) {
- parent = (ContentItem)parent.getParent();
- }
-
- return (Folder)parent;
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java
deleted file mode 100644
index b703597a4..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationForm.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.FormSection;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormValidationListener;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.ui.util.GlobalizationUtil;
-import com.arsdigita.util.Assert;
-import javax.servlet.ServletException;
-import org.apache.log4j.Logger;
-
-/**
- * A form section for editing an orgnization.
- *
- * @author Jens Pelzetter
- */
-public abstract class GenericOrganizationForm extends FormSection implements FormInitListener, FormProcessListener, FormValidationListener {
-
- /**
- * ItemSelectionModel for the form section
- */
- protected ItemSelectionModel m_itemModel;
- /**
- * SaveCancelSection (Save and Cancel buttons) for this sections.
- */
- protected SaveCancelSection m_saveCancelSection;
-
- private Label m_script = new Label("");
-
- /**
- * Organizationname.
- */
- public static final String ORGANIZATIONAME = GenericOrganization.ORGANIZATIONNAME;
- /**
- * Addedum
- */
- public static final String ORGANIZATIONNAMEADDENDUM = GenericOrganization.ORGANIZATIONNAMEADDENDUM;
- /**
- * Description
- */
- public static final String DESCRIPTION = GenericOrganization.DESCRIPTION;
- private static final Logger logger = Logger.getLogger(GenericOrganizationForm.class);
-
- /**
- * Creates the columnpanel, adds the widgets, the SaveCancelSection and the listeners.
- *
- * @param formName
- * @param itemModel
- */
- public GenericOrganizationForm(String formName, ItemSelectionModel itemModel) {
- super(new ColumnPanel(2));
-
- m_itemModel = itemModel;
-
- ColumnPanel panel = (ColumnPanel) getPanel();
- panel.setBorder(false);
- panel.setPadColor("#ffffff");
- panel.setColumnWidth(1, "20%");
- panel.setColumnWidth(2, "80%");
- panel.setWidth("100%");
-
- addWidgets();
-
- addSaveCancelSection();
-
- addInitListener(this);
- addProcessListener(this);
- addValidationListener(this);
- }
-
- /**
- * Adds the SavaCancelSection.
- */
- public void addSaveCancelSection() {
- m_saveCancelSection = new SaveCancelSection();
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- }
-
- /**
- *
- * @return The SaveCancelSection of the form section.
- */
- public SaveCancelSection getSaveCancelSection() {
- return m_saveCancelSection;
- }
-
- /**
- * Adds the widgets to the form.
- */
- protected void addWidgets() {
- add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationname")));
- TextField organizationName = new TextField(ORGANIZATIONAME);
- organizationName.addValidationListener(new NotNullValidationListener());
- add(organizationName);
-
- add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationnameaddendum")));
- TextField organizationNameAddendum = new TextField(ORGANIZATIONNAMEADDENDUM);
- add(organizationNameAddendum);
-
- add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganzation.ui.description")));
- TextArea description = new TextArea(DESCRIPTION);
- description.setRows(5);
- description.setCols(30);
- add(description);
- }
-
- public abstract void init (FormSectionEvent e) throws FormProcessException;
- public abstract void process (FormSectionEvent e) throws FormProcessException;
- public abstract void validate (FormSectionEvent e) throws FormProcessException;
-
- /**
- * Inits the widgets.
- *
- * @param e
- * @return
- */
- public GenericOrganization initBasicWidgets(FormSectionEvent e) {
- Assert.exists(m_itemModel, ItemSelectionModel.class);
-
- FormData data = e.getFormData();
- PageState state = e.getPageState();
- GenericOrganization orga = (GenericOrganization)m_itemModel.getSelectedObject(state);
-
- if (orga != null) {
- data.put(ORGANIZATIONAME, orga.getOrganizationName());
- data.put(ORGANIZATIONNAMEADDENDUM, orga.getOrganizationNameAddendum());
- data.put(DESCRIPTION, orga.getDescription());
- }
-
- return orga;
- }
-
- /**
- * Processes the widgets.
- *
- * @param e
- * @return
- */
- public GenericOrganization processBasicWidgets(FormSectionEvent e) {
- Assert.exists(m_itemModel, ItemSelectionModel.class);
-
- FormData data = e.getFormData();
- PageState state = e.getPageState();
- GenericOrganization orga = (GenericOrganization)m_itemModel.getSelectedObject(state);
-
- if(orga != null) {
- orga.setOrganizationName((String)data.get(ORGANIZATIONAME));
- orga.setOrganizationNameAddendum((String)data.get(ORGANIZATIONNAMEADDENDUM));
- orga.setDescription((String)data.get(DESCRIPTION));
- }
-
- return orga;
- }
-
- /**
- * Creates a new organization.
- *
- * @param state
- * @return
- * @throws com.arsdigita.bebop.FormProcessException
- */
- public GenericOrganization createGenericOrganization(PageState state) throws FormProcessException {
- Assert.exists(m_itemModel, ItemSelectionModel.class);
-
- GenericOrganization orga = null;
-
- try {
- orga = (GenericOrganization)m_itemModel.createItem();
- } catch(ServletException e) {
- logger.error("ServletException: " + e.getMessage(), e);
- throw new FormProcessException(e.getMessage(), e);
- }
-
- if(m_itemModel.getSelectedKey(state) == null) {
- m_itemModel.setSelectedObject(state, orga);
- }
-
- return orga;
- }
-}
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java
deleted file mode 100644
index 16ccaa9d1..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/GenericOrganizationViewRoles.java
+++ /dev/null
@@ -1,327 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.ActionLink;
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.Container;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.ChangeEvent;
-import com.arsdigita.bebop.event.ChangeListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.contenttypes.ui.ResettableContainer;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.ui.util.GlobalizationUtil;
-import com.arsdigita.util.Assert;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class GenericOrganizationViewRoles extends ResettableContainer {
-
- /* Ids for the editing panels */
- /**
- * Identifier for the table of roles
- */
- public static final String ROLES_TABLE = "rolesTable";
- /**
- * Identifier for the role edit form
- */
- public static final String ROLES_EDIT = "rolesEdit";
- /**
- * Identifier for the role delete form
- */
- public static final String ROLES_DELETE = "rolesDelete";
-
- /* class attributes */
- /**
- * Identifier for the data table
- */
- public static final String DATA_TABLE = "dataTable";
- /**
- * Identifier for the action link
- */
- public static final String ACTION_LINK = "actionLink";
- /**
- * The authoring wizard
- */
- protected AuthoringKitWizard m_wizard;
- /**
- * ItemSelectionModel for the organization
- */
- protected ItemSelectionModel m_selectionOrganization;
- /**
- * ItemSelection for the role
- */
- protected ItemSelectionModel m_selectionRole;
- /**
- * ItemSelectionModel for moving the role position (currently not used)
- */
- protected ItemSelectionModel m_moveRole;
- /**
- * Move parameter (not used yet)
- */
- protected BigDecimalParameter m_moveParameter;
-
- /* Visual components doing the word */
- /**
- * Table with all roles associated with the organization.
- */
- protected RoleTable m_roleTable;
- /**
- * Form for editing a role
- */
- protected RoleEditForm m_roleEdit;
- /**
- * Form for deleting a role
- */
- protected RoleDeleteForm m_roleDelete;
- /**
- * Begin link
- */
- protected ActionLink m_beginLink;
- private Label m_moveRoleLabel;
- private String m_typeIdStr;
-
- /**
- * Constructor.
- *
- * @param selOrga
- * @param wizard
- */
- public GenericOrganizationViewRoles(ItemSelectionModel selOrga, AuthoringKitWizard wizard) {
- super();
- m_selectionOrganization = selOrga;
- m_wizard = wizard;
- m_typeIdStr = wizard.getContentType().getID().toString();
- Assert.exists(m_selectionOrganization, ItemSelectionModel.class);
-
- add(buildRoleTable(), true);
- add(buildRoleEdit(), false);
- add(buildRoleDelete(), false);
- }
-
- /**
- * Builds the table of roles.
- *
- * @return The table of roles.
- */
- protected Container buildRoleTable() {
- ColumnPanel c = new ColumnPanel(1);
- c.setKey(ROLES_TABLE + m_typeIdStr);
- c.setBorderColor("#ffffff");
- c.setPadColor("#ffffff");
-
- m_moveParameter = new BigDecimalParameter("moveRole");
- m_moveRole = new ItemSelectionModel(OrganizationRole.class.getName(), OrganizationRole.BASE_DATA_OBJECT_TYPE, m_moveParameter);
- m_roleTable = new RoleTable(m_selectionOrganization, m_moveRole);
- m_roleTable.setClassAttr(DATA_TABLE);
-
- m_selectionRole = new ItemSelectionModel(OrganizationRole.class.getName(), OrganizationRole.BASE_DATA_OBJECT_TYPE, m_roleTable.getRowSelectionModel());
-
- m_roleTable.setRoleModel(m_selectionRole);
-
- Label emptyView = new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.no_roles_yet"));
- m_roleTable.setEmptyView(emptyView);
-
- m_moveRoleLabel = new Label("Role Name");
- c.add(m_moveRoleLabel, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
-
- m_beginLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.move_to_beginning").localize());
- c.add(m_beginLink);
-
- m_beginLink.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent event) {
- PageState state = event.getPageState();
- GenericOrganization orga = (GenericOrganization) m_selectionOrganization.getSelectedObject(state);
-
- m_moveRole.setSelectedKey(state, null);
- }
- });
-
- m_moveRole.addChangeListener(new ChangeListener() {
-
- public void stateChanged(ChangeEvent e) {
- PageState state = e.getPageState();
- if (m_moveRole.getSelectedKey(state) == null) {
- m_beginLink.setVisible(state, false);
- m_moveRoleLabel.setVisible(state, false);
- } else {
- m_beginLink.setVisible(state, true);
- m_moveRoleLabel.setVisible(state, true);
- m_moveRoleLabel.setLabel((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.move_role_name").localize() + ((OrganizationRole) m_moveRole.getSelectedObject(state)).getRolename(), state);
- }
- }
- });
-
- m_roleTable.addTableActionListener(new TableActionListener() {
-
- public void cellSelected(TableActionEvent e) {
- PageState state = e.getPageState();
-
- TableColumn col = m_roleTable.getColumnModel().get(e.getColumn().intValue());
- String colName = (String) col.getHeaderValue();
-
- if (RoleTable.COL_DEL.equals(colName)) {
- onlyShowComponent(state, ROLES_DELETE + m_typeIdStr);
- } else if (RoleTable.COL_EDIT.equals(colName)) {
- onlyShowComponent(state, ROLES_EDIT + m_typeIdStr);
- }
- }
-
- public void headSelected(TableActionEvent e) {
- //Nothing
- }
- });
-
- c.add(m_roleTable);
-
- c.add(buildAddLink());
-
- return c;
- }
-
- /**
- * Builds the edit form.
- *
- * @return The edit form.
- */
- protected Container buildRoleEdit() {
- ColumnPanel c = new ColumnPanel(1);
- c.setKey(ROLES_EDIT + m_typeIdStr);
- c.setBorderColor("#ffffff");
- c.setPadColor("#ffffff");
-
- c.add(new Label(new PrintListener() {
-
- public void prepare(PrintEvent event) {
- PageState state = event.getPageState();
- Label label = (Label) event.getTarget();
-
- if (m_selectionRole.getSelectedKey(state) == null) {
- label.setLabel((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.add_role").localize());
- } else {
- label.setLabel((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.edit_role").localize());
- }
- }
- }));
-
- m_roleEdit = new RoleEditForm(m_selectionOrganization, m_selectionRole, this);
- c.add(m_roleEdit);
-
- c.add(buildViewAllLink());
- c.add(buildAddLink());
-
- return c;
- }
-
- /**
- * Builds the delete form
- *
- * @return The delete form.
- */
- protected Container buildRoleDelete() {
- ColumnPanel c = new ColumnPanel(1);
- c.setKey(ROLES_DELETE + m_typeIdStr);
- c.setBorderColor("#ffffff");
- c.setPadColor("#ffffff");
-
- c.add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.delete_role")));
- m_roleDelete = new RoleDeleteForm(m_selectionOrganization, m_selectionRole);
- m_roleDelete.addSubmissionListener(new FormSubmissionListener() {
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
- onlyShowComponent(state, ROLES_TABLE + m_typeIdStr);
- }
- });
- c.add(m_roleDelete);
-
- c.add(buildViewAllLink());
-
- return c;
- }
-
- /**
- * Builds the view all roles link.
- *
- * @return The ViewAllLink.
- */
- protected ActionLink buildViewAllLink() {
- ActionLink viewAllLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.view_all_roles").localize());
- viewAllLink.setClassAttr(ACTION_LINK);
- viewAllLink.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- onlyShowComponent(e.getPageState(), ROLES_TABLE + m_typeIdStr);
- }
- });
-
- return viewAllLink;
- }
-
- /**
- * Builds the add link.
- *
- * @return The add link.
- */
- protected ActionLink buildAddLink() {
- ActionLink addLink = new ActionLink((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorgnization.add_new_role").localize()) {
-
- @Override
- public boolean isVisible(PageState state) {
- SecurityManager sm = Utilities.getSecurityManager(state);
- ContentItem item = (ContentItem) m_selectionOrganization.getSelectedObject(state);
-
- return (super.isVisible(state) && sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, item));
- }
- };
-
- addLink.setClassAttr(ACTION_LINK);
- addLink.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- PageState state = e.getPageState();
- m_selectionRole.clearSelection(state);
- onlyShowComponent(state, ROLES_EDIT + m_typeIdStr);
- }
- });
-
- return addLink;
- }
-
- @Override
- public void register(Page p) {
- super.register(p);
- p.addGlobalStateParam(m_moveParameter);
- p.setVisibleDefault(m_beginLink, false);
- p.setVisibleDefault(m_moveRoleLabel, false);
-
- }
-
- /**
- *
- * @return The typeIdStr.
- */
- public String getTypeIdStr() {
- return m_typeIdStr;
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java
deleted file mode 100644
index 6452fe8ee..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/OrganizationRolePanel.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SimpleComponent;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.CMSContext;
-import com.arsdigita.cms.CMSExcursion;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.contenttypes.OrganizationRoleCollection;
-import com.arsdigita.cms.dispatcher.XMLGenerator;
-import com.arsdigita.util.UncheckedWrapperException;
-import com.arsdigita.xml.Element;
-import java.io.IOException;
-import javax.servlet.ServletException;
-import org.apache.log4j.Logger;
-
-/**
- * Panel for editing roles.
- *
- * @author Jens Pelzetter
- */
-public class OrganizationRolePanel extends SimpleComponent {
-
- private static final Logger logger = Logger.getLogger(OrganizationRolePanel.class);
-
- //private PageParameter m_page;
- private boolean m_showAllRoles = false;
- //private static final String versionId = "$Id: OrganizationRolePanel.java 2009-06-01T10:42+02:00";
-
- /**
- * Constructor.
- */
- public OrganizationRolePanel() {
- super();
- }
-
- @Override
- public void register(Page p) {
- super.register(p);
-
- addGlobalStateParams(p);
- }
-
- /**
- * Adds a global state param. Not in use yet.
- *
- * @param p
- */
- public void addGlobalStateParams(Page p) {
- }
-
- /**
- *
- * @param state
- * @param item
- * @return The XMLGenerator for the panel.
- */
- protected XMLGenerator getXMLGenerator(PageState state, ContentItem item) {
- ContentSection section = null;
-
- try {
- section = CMS.getContext().getContentSection();
- } catch (Exception e) {
- }
-
- if (section == null) {
- logger.debug(String.format("Item id %s-%s-%s", item.getOID().toString(), item.getContentSection().toString(), item.toString()));
- section = item.getContentSection();
- CMS.getContext().setContentSection(section);
- }
-
- return section.getXMLGenerator();
- }
-
- /**
- * Sets the value of the showAllRoles property.
- *
- * @param showAll
- */
- public void setShowAllRoles(boolean showAll) {
- this.m_showAllRoles = showAll;
- }
-
- /**
- * Returns the current ContentItem.
- *
- * @param state
- * @return
- */
- protected ContentItem getContentItem(PageState state) {
- CMSContext context = CMS.getContext();
-
- if (!context.hasContentItem()) {
- return null;
- }
-
- return context.getContentItem();
- }
-
- /**
- *
- * @param item
- * @param state
- * @return An array with all roles associated with the organization.
- */
- protected OrganizationRole[] getOrganizationRoles(ContentItem item, final PageState state) {
- GenericOrganization orga = (GenericOrganization) item;
- OrganizationRoleCollection roles = orga.getOrganizationRoles();
-
- OrganizationRole[] page = new OrganizationRole[(int) roles.size()];
- int i = 0;
- while (roles.next()) {
- page[i] = roles.getOrganizationRole();
- i++;
- }
- return page;
- }
-
- @Override
- public void generateXML(final PageState state, final Element parent) {
- ContentItem item = getContentItem(state);
-
- if (!isVisible(state) ||
- (item == null) ||
- !(item instanceof GenericOrganization)) {
- logger.debug("Skipping");
- return;
- }
-
- generateXML(item, parent, state);
- }
-
- /**
- * Creates the XML for the panel.
- *
- * @param item
- * @param element
- * @param state
- */
- public void generateXML(ContentItem item, Element element, PageState state) {
- Element content = element.newChildElement("cms:organizationRolePanel", CMS.CMS_XML_NS);
- exportAttributes(content);
-
- XMLGenerator xmlGenerator = getXMLGenerator(state, item);
-
- OrganizationRole roles[] = getOrganizationRoles(item, state);
- for(int i = 0; i < roles.length; i++) {
- generateRoleXML(state, content, roles[i], xmlGenerator);
- }
- }
-
- /**
- * Creates the XML for a role.
- *
- * @param state
- * @param parent
- * @param role
- * @param xmlGenerator
- */
- protected void generateRoleXML(final PageState state, final Element parent, final ContentItem role, final XMLGenerator xmlGenerator) {
- CMSExcursion excursion = new CMSExcursion() {
-
- @Override
- protected void excurse() throws ServletException, IOException {
- setContentItem(role);
- xmlGenerator.generateXML(state, parent, null);
- }
- };
-
- try {
- excursion.run();
- } catch(ServletException e) {
- throw new UncheckedWrapperException("excursion failed", e);
- } catch(IOException e) {
- throw new UncheckedWrapperException("excursion failed", e);
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java
deleted file mode 100644
index 93a1ac79f..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleDeleteForm.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.Form;
-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.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.util.Assert;
-import org.apache.log4j.Logger;
-
-/**
- * Form for deleting a role.
- *
- * @author Jens Pelzetter
- */
-public class RoleDeleteForm extends Form implements FormInitListener, FormSubmissionListener, FormProcessListener {
-
- private static final Logger logger = Logger.getLogger(RoleDeleteForm.class);
- /**
- * ItemSelectionModel for the organization.
- */
- protected ItemSelectionModel m_selectionOrganization;
- /**
- * ItemSelectionModle for the role
- */
- protected ItemSelectionModel m_selectionRole;
- /**
- * SaveCancelSection of this form
- */
- protected SaveCancelSection m_saveCancelSection;
- private Label m_roleNameLabel;
-
- /**
- * Constructor.
- *
- * @param selectionOrganization
- * @param selectionRole
- */
- public RoleDeleteForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) {
- super("RoleDeleteForm", new ColumnPanel(2));
-
- m_selectionOrganization = selectionOrganization;
- m_selectionRole = selectionRole;
-
- ColumnPanel panel = (ColumnPanel) getPanel();
- panel.setBorder(false);
- panel.setPadColor("#ffffff");
- panel.setColumnWidth(1, "20%");
- panel.setColumnWidth(2, "80%");
- panel.setWidth("100%");
-
- m_roleNameLabel = new Label("Role Name");
- add(m_roleNameLabel, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- addSaveCancelSection();
-
- addInitListener(this);
- addSubmissionListener(this);
- addProcessListener(this);
- }
-
- /**
- * Adds the SaveCancelSection of this form.
- *
- * @return
- */
- protected SaveCancelSection addSaveCancelSection() {
- m_saveCancelSection = new SaveCancelSection();
- m_saveCancelSection.getSaveButton().setButtonLabel("Delete");
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- return m_saveCancelSection;
- }
-
- public void init(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
-
- OrganizationRole role = (OrganizationRole) m_selectionRole.getSelectedObject(state);
-
- if(role == null) {
- logger.error("No role selected");
- }
- else {
- m_roleNameLabel.setLabel(role.getRolename(), state);
- }
- }
-
- public void submitted(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
-
- if (m_saveCancelSection.getCancelButton().isSelected(state)) {
- throw new FormProcessException((String) GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.submission_canceled").localize());
- }
- }
-
- public void process(FormSectionEvent e) throws FormProcessException {
- PageState state = e.getPageState();
-
- GenericOrganization orga = (GenericOrganization) m_selectionOrganization.getSelectedObject(state);
- OrganizationRole role = (OrganizationRole) m_selectionRole.getSelectedObject(state);
-
- Assert.exists(orga, GenericOrganization.class);
- Assert.exists(role, OrganizationRole.class);
-
- orga.removeOrganizationRole(role);
-
- logger.info(String.format("role %s delete", m_selectionRole.getSelectedKey(state)));
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java
deleted file mode 100644
index c7c9d1b6a..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleEditForm.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.ColumnPanel;
-import com.arsdigita.bebop.Form;
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Page;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.SaveCancelSection;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.TrimmedStringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.UncheckedWrapperException;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Form for editing a role.
- *
- * @author Jens Pelzetter
- */
-public class RoleEditForm extends Form {
-
- private static final Logger logger = Logger.getLogger(RoleEditForm.class);
-
- private ItemSelectionModel m_selectionOrganization;
- private ItemSelectionModel m_selectionRole;
-
- //private BigDecimalParameter m_textParam;
- private GenericOrganizationViewRoles m_container;
-
- private SaveCancelSection m_saveCancelSection;
-
- /**
- * Rolename identifier string.
- */
- public static final String ROLENAME = OrganizationRole.ROLENAME;
-
- /**
- * Constructor.
- *
- * @param selectionOrganization
- * @param selectionRole
- */
- public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole) {
- this(selectionOrganization, selectionRole, null);
- }
-
- /**
- * Constructor.
- *
- * @param selectionOrganization
- * @param selectionRole
- * @param container
- */
- public RoleEditForm(ItemSelectionModel selectionOrganization, ItemSelectionModel selectionRole, GenericOrganizationViewRoles container) {
- super("RoleEditForm", new ColumnPanel(2));
-
- m_selectionOrganization = selectionOrganization;
- m_selectionRole = selectionRole;
- m_container = container;
-
- setMethod(Form.POST);
- setEncType("multipart/form-data");
-
- ColumnPanel panel = (ColumnPanel)getPanel();
- panel.setBorder(false);
- panel.setPadColor("#ffffff");
- panel.setColumnWidth(1, "20%");
- panel.setColumnWidth(2, "80%");
- panel.setWidth("100%");
-
- addWidgets();
- addSaveCancelSection();
-
- addInitListener(new RoleInitListener());
- addSubmissionListener(new RoleSubmissionListener());
- addProcessListener(new RoleProcessListener());
- }
-
- /**
- * Adds the SaveCancelSection to the form.
- *
- * @return
- */
- protected SaveCancelSection addSaveCancelSection() {
- m_saveCancelSection = new SaveCancelSection();
- add(m_saveCancelSection, ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
- return m_saveCancelSection;
- }
-
- /**
- *
- * @return The SaveCancelSection of this form.
- */
- public SaveCancelSection getSaveCancelSection() {
- return m_saveCancelSection;
- }
-
- /**
- * Adds the widgets to the form.
- */
- protected void addWidgets() {
- logger.info("Adding widgets for role form...");
- add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.rolename")));
- TextField nameWidget = new TextField(new TrimmedStringParameter(ROLENAME));
- nameWidget.addValidationListener(new NotNullValidationListener());
- add(nameWidget);
- }
-
- private class RoleInitListener implements FormInitListener {
- public void init(FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
- FormData data = event.getFormData();
-
- if(m_selectionRole.getSelectedKey(state) != null) {
- BigDecimal id = new BigDecimal(m_selectionRole.getSelectedKey(state).toString());
-
- try {
- OrganizationRole role = new OrganizationRole(id);
-
- data.put(ROLENAME, role.getRolename());
- } catch(DataObjectNotFoundException e) {
- logger.error(String.format("Role(%d) could not be found", id));
- }
- }
- }
- }
-
- private class RoleSubmissionListener implements FormSubmissionListener {
- public void submitted(FormSectionEvent event) throws FormProcessException {
- PageState state = event.getPageState();
-
- if((m_saveCancelSection.getCancelButton().isSelected(state)) &&
- (m_container != null)) {
- m_container.onlyShowComponent(state, GenericOrganizationViewRoles.ROLES_TABLE + m_container.getTypeIdStr());
- throw new FormProcessException((String)GlobalizationUtil.globalize("cms.contenttypes.ui.genericorganization.submission_canceled").localize());
- }
- }
- }
-
- private class RoleProcessListener implements FormProcessListener {
- public void process(FormSectionEvent event) throws FormProcessException {
- logger.info("Processing edit event...");
- PageState state = event.getPageState();
- FormData data = event.getFormData();
-
- BigDecimal id = new BigDecimal(m_selectionOrganization.getSelectedKey(state).toString());
- GenericOrganization orga = null;
- try {
- orga = new GenericOrganization(id);
- } catch(DataObjectNotFoundException e) {
- throw new UncheckedWrapperException(e);
- }
-
- //Get role or create new one if role is not existing yet
- OrganizationRole role = (OrganizationRole)m_selectionRole.getSelectedObject(state);
- if(role == null) {
- role = createRole(event, orga);
- orga.addOrganizationRole(role);
- }
-
- role.setRolename((String)data.get(OrganizationRole.ROLENAME));
-
- if(m_container != null) {
- m_container.onlyShowComponent(state, GenericOrganizationViewRoles.ROLES_TABLE + m_container.getTypeIdStr());
- }
- }
- }
-
- /**
- * Creates a new role.
- *
- * @param event
- * @param orga
- * @return The role.
- */
- protected OrganizationRole createRole(FormSectionEvent event, GenericOrganization orga) {
- logger.info("creating new role...");
-
- PageState state = event.getPageState();
- FormData data = event.getFormData();
-
- OrganizationRole role = new OrganizationRole();
-
- role.setRolename((String)data.get(ROLENAME));
- role.setName(orga.getName() + ": " + (String)data.get(OrganizationRole.ROLENAME));
-
- logger.info("new role created");
- return role;
- }
-
- @Override
- public void register(Page page) {
- super.register(page);
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java b/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java
deleted file mode 100644
index 7da7ada2c..000000000
--- a/ccm-cms-types-genericorganization/src/com/arsdigita/cms/contenttypes/ui/genericorganization/RoleTable.java
+++ /dev/null
@@ -1,276 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui.genericorganization;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.GenericOrganization;
-import com.arsdigita.cms.contenttypes.OrganizationRole;
-import com.arsdigita.cms.contenttypes.OrganizationRoleCollection;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Table listing all Roles associated with a organization.
- *
- * @author Jens Pelzetter
- */
-public class RoleTable extends Table {
-
- private final static Logger logger = Logger.getLogger(RoleTable.class);
-
- // columns headings
- /**
- * Heading for first column
- */
- public static final String COL_TITLE = "Role";
- /**
- * Heading for second column
- */
- public static final String COL_EDIT = "Edit";
- /**
- * Heading for third column
- */
- public static final String COL_MOVE = "Move";
- /**
- * Heading for last column
- */
- public static final String COL_DEL = "Delete";
- private ItemSelectionModel m_selectionOrganization;
- private ItemSelectionModel m_selectionRole;
- private ItemSelectionModel m_moveRole;
-
- /**
- * Constructor.
- *
- * @param selOrga
- * @param moveRole
- */
- public RoleTable(ItemSelectionModel selOrga, ItemSelectionModel moveRole) {
- super();
- m_selectionOrganization = selOrga;
- m_moveRole = moveRole;
-
- TableColumnModel model = getColumnModel();
- model.add(new TableColumn(0, COL_TITLE));
- model.add(new TableColumn(1, COL_EDIT));
- model.add(new TableColumn(2, COL_MOVE));
- model.add(new TableColumn(3, COL_DEL));
-
- model.get(1).setCellRenderer(new RoleTableCellRenderer(true));
- model.get(2).setCellRenderer(new RoleTableCellRenderer(true));
- model.get(3).setCellRenderer(new RoleTableCellRenderer(true));
-
- setModelBuilder(new RoleTableModelBuilder(m_selectionOrganization, m_moveRole));
-
- addTableActionListener(new TableActionListener() {
-
- public void cellSelected(TableActionEvent e) {
- PageState state = e.getPageState();
-
- TableColumn col = getColumnModel().get(e.getColumn().intValue());
- String colName = (String) col.getHeaderValue();
-
- if (COL_MOVE.equals(colName)) {
- if (m_moveRole.getSelectedKey(state) == null) {
- m_moveRole.setSelectedKey(state, m_selectionRole.getSelectedKey(state));
- } else {
- GenericOrganization orga = (GenericOrganization) m_selectionOrganization.getSelectedObject(state);
-
- BigDecimal id = (BigDecimal) m_moveRole.getSelectedKey(state);
- OrganizationRole role = (OrganizationRole) DomainObjectFactory.newInstance(new OID(OrganizationRole.BASE_DATA_OBJECT_TYPE, id));
-
- BigDecimal dest = new BigDecimal((String) e.getRowKey());
- OrganizationRole destRole = (OrganizationRole) DomainObjectFactory.newInstance(new OID(OrganizationRole.BASE_DATA_OBJECT_TYPE, "dest"));
-
- m_moveRole.setSelectedKey(state, null);
- }
- }
- }
-
- public void headSelected(TableActionEvent e) {
- //Nothing
- }
- });
-
- }
-
- /**
- * Sets the ItemSelectionModel.
- *
- * @param itemModel
- */
- public void setRoleModel(ItemSelectionModel itemModel) {
- if (itemModel == null) {
- logger.warn("null item model");
- }
- m_selectionRole = itemModel;
- }
-
- /**
- * Builder class for the table model.
- */
- protected class RoleTableModelBuilder extends LockableImpl implements TableModelBuilder {
-
- /**
- * ItemSelectionModel for the organization.
- */
- protected ItemSelectionModel m_selectionOrganization;
- /**
- * ItemSelectionModel for moving the role (feature not implemented yet)
- */
- protected ItemSelectionModel m_moveRole;
-
- /**
- * Constructor.
- *
- * @param selectionOrganization
- * @param moveRole
- */
- public RoleTableModelBuilder(ItemSelectionModel selectionOrganization, ItemSelectionModel moveRole) {
- m_selectionOrganization = selectionOrganization;
- m_moveRole = moveRole;
- }
-
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
-
- GenericOrganization orga = (GenericOrganization) m_selectionOrganization.getSelectedObject(state);
-
- return new RoleTableModel(table, state, orga, m_moveRole);
- }
- }
-
- /**
- * TableModel for the RoleTable.
- */
- protected class RoleTableModel implements TableModel {
-
- private TableColumnModel m_colModel;
- private RoleTable m_table;
- private PageState m_state;
- private OrganizationRoleCollection m_roles;
- private ItemSelectionModel m_moveRole;
- private OrganizationRole m_role;
-
- /**
- * Constructor.
- *
- * @param table
- * @param state
- * @param orga
- * @param moveRole
- */
- public RoleTableModel(Table table, PageState state, GenericOrganization orga, ItemSelectionModel moveRole) {
- m_colModel = table.getColumnModel();
- m_table = (RoleTable) table;
- m_state = state;
- m_roles = orga.getOrganizationRoles();
- m_moveRole = moveRole;
- }
-
- public int getColumnCount() {
- return m_colModel.size();
- }
-
- public boolean nextRow() {
- if (m_roles.next()) {
- m_role = m_roles.getOrganizationRole();
- return true;
- }
- return false;
- }
-
- public Object getElementAt(int columnIndex) {
- if (m_colModel == null) {
- return null;
- }
-
- TableColumn col = m_colModel.get(columnIndex);
- String colName = (String) col.getHeaderValue();
-
- if (COL_TITLE.equals(colName)) {
- return m_role.getRolename();
- } else if(COL_EDIT.equals(colName)) {
- return "edit";
- } else if(COL_DEL.equals(colName)) {
- return "delete";
- } else if(COL_MOVE.equals(colName)) {
- if(m_moveRole.getSelectedKey(m_state) == null) {
- return "move";
- } else {
- return "move below here";
- }
- }
-
- return null;
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_role.getID();
- }
- }
-
- /**
- * Renderer for the cells of the RoleTable.
- */
- public class RoleTableCellRenderer extends LockableImpl implements TableCellRenderer {
-
- private boolean m_active;
-
- /**
- * Constructor.
- */
- public RoleTableCellRenderer() {
- this(false);
- }
-
- /**
- * Constructor.
- *
- * @param active
- */
- public RoleTableCellRenderer(boolean active) {
- m_active = active;
- }
-
- public Component getComponent(Table table, PageState state, Object value, boolean isSelected, Object key, int row, int column) {
- Component ret = null;
- SecurityManager sm = Utilities.getSecurityManager(state);
- ContentItem item = (ContentItem) m_selectionOrganization.getSelectedObject(state);
-
- boolean active = m_active && sm.canAccess(state.getRequest(), SecurityManager.EDIT_ITEM, item);
-
- if (value instanceof Component) {
- ret = (Component) value;
- } else {
- if (value == null) {
- ret = new Label("", false);
- } else {
- if (active) {
- ret = new ControlLink(value.toString());
- } else {
- ret = new Label(value.toString());
- }
- }
- }
-
- return ret;
- }
- }
-}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationrole/application.xml b/ccm-cms-types-organizationrole/application.xml
new file mode 100644
index 000000000..63e3e08ea
--- /dev/null
+++ b/ccm-cms-types-organizationrole/application.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Content type representing a role in a organization (eg CEO). For use with the GenericOrganization type.
+
+
\ No newline at end of file
diff --git a/ccm-cms-types-organizationrole/pdl/com/arsdigita/content-types/OrganizationRole.pdl b/ccm-cms-types-organizationrole/pdl/com/arsdigita/content-types/OrganizationRole.pdl
new file mode 100644
index 000000000..e20b02755
--- /dev/null
+++ b/ccm-cms-types-organizationrole/pdl/com/arsdigita/content-types/OrganizationRole.pdl
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2009 Jens Pelzetter/Center for Social Poltics, University of Bremen. All Rights Reserved.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+model com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.cms.ContentPage;
+
+object type OrganizationRole extends ContentPage {
+ String[0..1] rolename = ct_organizationroles.rolename VARCHAR(512);
+
+ reference key (ct_organizationroles.role_id);
+}
\ No newline at end of file
diff --git a/ccm-cms-types-organizationrole/sql/ccm-cms-types-organizationrole/postgres-create.sql b/ccm-cms-types-organizationrole/sql/ccm-cms-types-organizationrole/postgres-create.sql
new file mode 100644
index 000000000..a733590e2
--- /dev/null
+++ b/ccm-cms-types-organizationrole/sql/ccm-cms-types-organizationrole/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-organizationrole/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xml b/ccm-cms-types-organizationrole/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xml
new file mode 100644
index 000000000..eebb8b209
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-cms-types-organizationrole/src/ccm-cms-types-organizationrole.config b/ccm-cms-types-organizationrole/src/ccm-cms-types-organizationrole.config
new file mode 100644
index 000000000..bcf00468e
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/ccm-cms-types-organizationrole.config
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/ccm-cms-types-organizationrole/src/ccm-cms-types-organizationrole.load b/ccm-cms-types-organizationrole/src/ccm-cms-types-organizationrole.load
new file mode 100644
index 000000000..00f521900
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/ccm-cms-types-organizationrole.load
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRole.java b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRole.java
new file mode 100644
index 000000000..8a7fc2102
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRole.java
@@ -0,0 +1,52 @@
+package com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.cms.ContentPage;
+
+import java.math.BigDecimal;
+import org.apache.log4j.Logger;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.persistence.DataObject;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class OrganizationRole extends ContentPage {
+
+ public static final String ROLENAME = "rolename";
+
+ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.OrganizationRole";
+
+ public static final Logger logger = Logger.getLogger(OrganizationRole.class);
+
+ public OrganizationRole() {
+ super(BASE_DATA_OBJECT_TYPE);
+ }
+
+ public OrganizationRole(BigDecimal id) throws DataObjectNotFoundException {
+ super(id);
+ }
+
+ public OrganizationRole(OID oid) {
+ super(oid);
+ }
+
+ public OrganizationRole(DataObject obj) {
+ super(obj);
+ }
+
+ public OrganizationRole(String type) {
+ super(type);
+ }
+
+ public String getRoleName() {
+ return (String) get(ROLENAME);
+ }
+
+ public void setRoleName(String rolename) {
+ logger.error(String.format("Setting rolename to %s", rolename));
+ set(ROLENAME, rolename);
+ }
+
+}
diff --git a/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRoleInitializer.java b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRoleInitializer.java
new file mode 100644
index 000000000..b718af491
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRoleInitializer.java
@@ -0,0 +1,27 @@
+package com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.runtime.DomainInitEvent;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class OrganizationRoleInitializer extends ContentTypeInitializer {
+
+ private final static Logger logger = Logger.getLogger(OrganizationRoleInitializer.class);
+
+ public OrganizationRoleInitializer() {
+ super("ccm-cms-types-organizationrole.pdl.mf", OrganizationRole.BASE_DATA_OBJECT_TYPE);
+ }
+
+ @Override
+ public void init(DomainInitEvent evt) {
+ super.init(evt);
+ }
+
+ @Override
+ public String[] getStylesheets() {
+ return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xsl"};
+ }
+}
diff --git a/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRoleLoader.java b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRoleLoader.java
new file mode 100644
index 000000000..3fc531d73
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/OrganizationRoleLoader.java
@@ -0,0 +1,20 @@
+package com.arsdigita.cms.contenttypes;
+
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class OrganizationRoleLoader extends AbstractContentTypeLoader {
+ private static final Logger logger = Logger.getLogger(OrganizationRoleLoader.class);
+
+ private static final String TYPES[] = { "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xml" };
+
+ @Override
+ protected String[] getTypes() {
+ return TYPES;
+ }
+
+
+}
diff --git a/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java
new file mode 100644
index 000000000..1421b6199
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertiesStep.java
@@ -0,0 +1,61 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.OrganizationRole;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.ui.authoring.SimpleEditStep;
+import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
+import com.arsdigita.ui.util.GlobalizationUtil;
+
+import java.text.DateFormat;
+
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class OrganizationRolePropertiesStep extends SimpleEditStep {
+
+ public static final String EDIT_SHEET_NAME = "edit";
+
+ public OrganizationRolePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
+ super(itemModel, parent);
+
+ setDefaultEditKey(EDIT_SHEET_NAME);
+ BasicPageForm editSheet;
+
+ editSheet = new OrganizationRolePropertyForm(itemModel, this);
+ add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
+
+ setDisplayComponent(getOrganizationRolePropertySheet(itemModel));
+ }
+
+ public static Component getOrganizationRolePropertySheet(ItemSelectionModel itemModel) {
+ DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
+
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.organizationrole.rolename"), OrganizationRole.ROLENAME);
+
+ if(!ContentSection.getConfig().getHideLaunchDate()) {
+ sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
+ public String format(DomainObject item, String attribute, PageState state) {
+ ContentPage page = (ContentPage)item;
+ if(page.getLaunchDate() != null) {
+ return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
+ }
+ else {
+ return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
+ }
+ }
+ });
+ }
+
+ return sheet;
+ }
+}
diff --git a/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java
new file mode 100644
index 000000000..074c7eb3d
--- /dev/null
+++ b/ccm-cms-types-organizationrole/src/com/arsdigita/cms/contenttypes/ui/OrganizationRolePropertyForm.java
@@ -0,0 +1,83 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.OrganizationRole;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.parameters.ParameterModel;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.FormData;
+
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class OrganizationRolePropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
+
+ private static final Logger logger = Logger.getLogger(OrganizationRolePropertyForm.class);
+ private OrganizationRolePropertiesStep m_step;
+ public static final String ROLENAME = OrganizationRole.ROLENAME;
+ public static final String ID = "OrganizationRole_edit";
+
+ public OrganizationRolePropertyForm(ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ public OrganizationRolePropertyForm(ItemSelectionModel itemModel, OrganizationRolePropertiesStep step) {
+ super(ID, itemModel);
+ m_step = step;
+ addSubmissionListener(this);
+ }
+
+ @Override
+ protected void addWidgets() {
+ super.addWidgets();
+
+ add(new Label((String)GlobalizationUtil.globalize("cms.contenttypes.ui.organizationrole.rolename").localize()));
+ //ParameterModel rolenameParameter = new StringParameter(ROLENAME);
+ //TextField rolename = new TextField(rolenameParameter);
+ TextField rolename = new TextField(ROLENAME);
+ add(rolename);
+ }
+
+ public void init(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+ OrganizationRole role = (OrganizationRole)super.initBasicWidgets(fse);
+
+ data.put(ROLENAME, role.getRoleName());
+ }
+
+ public void submitted(FormSectionEvent fse) {
+ logger.error("submitted");
+ if((m_step != null) &&
+ (getSaveCancelSection().getCancelButton().isSelected(fse.getPageState()))) {
+ m_step.cancelStreamlinedCreation(fse.getPageState());
+ }
+ }
+
+ public void process(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+
+ OrganizationRole role = (OrganizationRole)super.processBasicWidgets(fse);
+
+ if((role != null) &&
+ (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState()))) {
+ logger.error(String.format("Setting rolename to %s", data.get(ROLENAME)));
+ role.setRoleName((String)data.get(ROLENAME));
+
+ role.save();
+ }
+
+ if(m_step != null) {
+ m_step.maybeForwardToNextStep(fse.getPageState());
+ }
+ }
+}
diff --git a/ccm-cms-types-organizationrole/web/static/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xsl b/ccm-cms-types-organizationrole/web/static/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xsl
new file mode 100644
index 000000000..e250af404
--- /dev/null
+++ b/ccm-cms-types-organizationrole/web/static/content-types/com/arsdigita/cms/contenttypes/OrganizationRole.xsl
@@ -0,0 +1,29 @@
+
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file