From ec7e0ed894b98a3de490fc2569a4d6267a3c7025 Mon Sep 17 00:00:00 2001 From: jensp Date: Mon, 17 Oct 2011 19:23:23 +0000 Subject: [PATCH] Content-Typ ccm-sci-types-project (extrahiert aus ccm-sci-types-organization), mit verschiedenen Optimierungen. Das Modul kompiliert, ist aber noch *nicht* getestet. Darstellung fehlt noch komplett (ExtraXMLGenerator). git-svn-id: https://svn.libreccm.org/ccm/trunk@1170 8810af33-2d31-482b-a856-94f89814c4df --- ...zationalUnitSubordinateOrgaUnitsTable.java | 2 +- .../installer/xml/ContentTypeHelperImpl.java | 17 +- .../persistence/metadata/MetadataRoot.java | 2 +- ccm-sci-types-project/application.xml | 25 ++ .../arsdigita/content-types/SciProject.pdl | 93 ++++++ .../ccm-sci-types-project/postgres-create.sql | 4 + .../arsdigita/cms/contenttypes/SciProject.xml | 43 +++ .../arsdigita/cms/contenttypes/SciProject.xml | 20 ++ .../src/ccm-sci-types-project.config | 5 + .../src/ccm-sci-types-project.load | 16 + .../cms/contenttypes/SciProject.java | 287 ++++++++++++++++++ .../cms/contenttypes/SciProjectConfig.java | 148 +++++++++ .../SciProjectConfig_parameter.properties | 54 ++++ .../contenttypes/SciProjectInitializer.java | 55 ++++ .../cms/contenttypes/SciProjectLoader.java | 23 ++ .../contenttypes/SciProjectMemberStatus.java | 14 + .../cms/contenttypes/SciProjectStatus.java | 12 + .../ui/SciProjectDescriptionEditForm.java | 128 ++++++++ .../ui/SciProjectDescriptionStep.java | 75 +++++ .../ui/SciProjectDescriptionUploadForm.java | 39 +++ .../ui/SciProjectGlobalizationUtil.java | 23 ++ .../ui/SciProjectMemberAddForm.java | 49 +++ .../ui/SciProjectMemberTable.java | 23 ++ .../ui/SciProjectMembersStep.java | 77 +++++ .../ui/SciProjectPropertiesStep.java | 115 +++++++ .../ui/SciProjectPropertyForm.java | 118 +++++++ .../ui/SciProjectResources.properties | 51 ++++ .../ui/SciProjectResources_de.properties | 36 +++ .../ui/SciProjectSubProjectsStep.java | 137 +++++++++ .../ui/SciProjectSuperProjectsStep.java | 129 ++++++++ .../arsdigita/cms/contenttypes/SciProject.xsl | 19 ++ 31 files changed, 1836 insertions(+), 3 deletions(-) create mode 100644 ccm-sci-types-project/application.xml create mode 100644 ccm-sci-types-project/pdl/com/arsdigita/content-types/SciProject.pdl create mode 100644 ccm-sci-types-project/sql/ccm-sci-types-project/postgres-create.sql create mode 100644 ccm-sci-types-project/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml create mode 100644 ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml create mode 100644 ccm-sci-types-project/src/ccm-sci-types-project.config create mode 100644 ccm-sci-types-project/src/ccm-sci-types-project.load create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProject.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectMemberStatus.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectStatus.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectGlobalizationUtil.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersStep.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsStep.java create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java create mode 100644 ccm-sci-types-project/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitsTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitsTable.java index b514b5ce3..77efa3fd8 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitsTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitsTable.java @@ -36,7 +36,7 @@ import org.apache.log4j.Logger; * @author Jens Pelzetter * @version $Id$ */ -public abstract class GenericOrganizationalUnitSubordinateOrgaUnitsTable +public class GenericOrganizationalUnitSubordinateOrgaUnitsTable extends Table { private final Logger logger = diff --git a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java index 6ffdf3f92..1915d1c70 100755 --- a/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java +++ b/ccm-cms/src/com/arsdigita/cms/installer/xml/ContentTypeHelperImpl.java @@ -32,6 +32,7 @@ import com.arsdigita.search.MetadataProviderRegistry; import com.arsdigita.util.Assert; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.StringTokenizer; import org.apache.log4j.Logger; @@ -229,7 +230,21 @@ public class ContentTypeHelperImpl implements ContentTypeHelper { ObjectType type = SessionManager.getMetadataRoot().getObjectType( m_objectType); if (type == null) { - throw new IllegalArgumentException(String.format("No object type for '%s'", m_objectType)); + final StringBuffer buffer = new StringBuffer(); + + final Collection objectTypes = SessionManager.getMetadataRoot().getObjectTypes(); + ObjectType objectType; + for(Object obj : objectTypes) { + objectType = (ObjectType) obj; + buffer.append('\t'); + buffer.append(objectType.getQualifiedName()); + buffer.append('\n'); + } + + throw new IllegalArgumentException(String.format( + "No object type for '%s'. Available object types:\n%s", + m_objectType, + buffer.toString())); } if (type.isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE) && !isInternal()) { diff --git a/ccm-core/src/com/arsdigita/persistence/metadata/MetadataRoot.java b/ccm-core/src/com/arsdigita/persistence/metadata/MetadataRoot.java index baa9800b3..3e4c540e1 100755 --- a/ccm-core/src/com/arsdigita/persistence/metadata/MetadataRoot.java +++ b/ccm-core/src/com/arsdigita/persistence/metadata/MetadataRoot.java @@ -183,7 +183,7 @@ public class MetadataRoot extends Element { * @return The ObjectType or null. **/ - public ObjectType getObjectType(String name) { + public ObjectType getObjectType(String name) { return ObjectType.wrap(m_root.getObjectType(name)); } diff --git a/ccm-sci-types-project/application.xml b/ccm-sci-types-project/application.xml new file mode 100644 index 000000000..c65f47627 --- /dev/null +++ b/ccm-sci-types-project/application.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + s + + + + + + Content type for a (scientific) project. + + \ No newline at end of file diff --git a/ccm-sci-types-project/pdl/com/arsdigita/content-types/SciProject.pdl b/ccm-sci-types-project/pdl/com/arsdigita/content-types/SciProject.pdl new file mode 100644 index 000000000..ea6d97d2a --- /dev/null +++ b/ccm-sci-types-project/pdl/com/arsdigita/content-types/SciProject.pdl @@ -0,0 +1,93 @@ +model com.arsdigita.cms.contenttypes; + +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.cms.*; + +object type SciProject extends GenericOrganizationalUnit { + + Date[0..1] projectbegin = ct_sci_projects.projectbegin DATE; + Date[0..1] projectend = ct_sci_projects.projectend DATE; + String[0..1] projectShortDesc = ct_sci_projects.shortdesc VARCHAR(5000); + String[0..1] projectDescription = ct_sci_projects.description CLOB; + String[0..1] funding = ct_sci_projects.funding CLOB; + String[0..1] fundingVolume = ct_sci_projects.funding_volume VARCHAR(2000); + + reference key ( ct_sci_projects.project_id ); + +} + +query getIdsOfContactsOfSciProject { + BigDecimal contactId; + + do { + select cms_organizationalunits_contact_map.contact_id + from cms_organizationalunits_contact_map + where cms_organizationalunits_contact_map.organizationalunit_id = :project + } map { + contactId = cms_organizationalunits_contact_map.contact_id; + } +} + +query getIdsOfSubProjectsOfSciProject { + BigDecimal projectId; + + do { + select cms_organizationalunit_hierarchy_map.subordinate_orgaunit_id + from cms_organizationalunit_hierarchy_map + where cms_organizationalunit_hierarchy_map.superior_orgaunit_id = :project + and cms_organizationalunit_hierarchy_map.assoc_type = 'subproject' + } map { + projectId = ct_sciorga_projects_subprojects_map.project_id; + } +} + +query getIdsOfMembersOfSciProject { + BigDecimal memberId; + + do { + select cms_organizationalunits_person_map.person_id + from cms_organizationalunits_person_map + where cms_organizationalunits_person_map.organizationalunit_id = :project + } map { + memberId = cms_organizationalunits_person_map.person_id; + } +} + +query getIdsOfActiveMembersOfSciProject { + BigDecimal memberId; + + do { + select cms_organizationalunits_person_map.person_id + from cms_organizationalunits_person_map + where cms_organizationalunits_person_map.organizationalunit_id = :project + and cms_organizationalunits_person_map.status = 'active' + } map { + memberId = cms_organizationalunits_person_map.person_id; + } +} + +query getIdsOfAssociatedMembersOfSciProject { + BigDecimal memberId; + + do { + select cms_organizationalunits_person_map.person_id + from cms_organizationalunits_person_map + where cms_organizationalunits_person_map.organizationalunit_id = :project + and cms_organizationalunits_person_map.status = 'associated' + } map { + memberId = cms_organizationalunits_person_map.personId; + } +} + +query getIdsOfFormerMembersOfSciProject { + BigDecimal memberId; + + do { + select cms_organizationalunits_person_map.cms_persons.person_id + from cms_organizationalunits_person_map + where cms_organizationalunits_person_map.organizationalunit_id = :project + and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer') + } map { + memberId = cms_organizationalunits_person_map.personId; + } +} \ No newline at end of file diff --git a/ccm-sci-types-project/sql/ccm-sci-types-project/postgres-create.sql b/ccm-sci-types-project/sql/ccm-sci-types-project/postgres-create.sql new file mode 100644 index 000000000..38716a0ca --- /dev/null +++ b/ccm-sci-types-project/sql/ccm-sci-types-project/postgres-create.sql @@ -0,0 +1,4 @@ +begin; +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql +end; \ No newline at end of file diff --git a/ccm-sci-types-project/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml b/ccm-sci-types-project/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml new file mode 100644 index 000000000..85be1a32b --- /dev/null +++ b/ccm-sci-types-project/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml b/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml new file mode 100644 index 000000000..bb5ab9147 --- /dev/null +++ b/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ccm-sci-types-project/src/ccm-sci-types-project.config b/ccm-sci-types-project/src/ccm-sci-types-project.config new file mode 100644 index 000000000..294adcbf2 --- /dev/null +++ b/ccm-sci-types-project/src/ccm-sci-types-project.config @@ -0,0 +1,5 @@ + + + + diff --git a/ccm-sci-types-project/src/ccm-sci-types-project.load b/ccm-sci-types-project/src/ccm-sci-types-project.load new file mode 100644 index 000000000..b69224802 --- /dev/null +++ b/ccm-sci-types-project/src/ccm-sci-types-project.load @@ -0,0 +1,16 @@ + + + +
+
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProject.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProject.java new file mode 100644 index 000000000..d64e6547c --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProject.java @@ -0,0 +1,287 @@ +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.DataQuery; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * The class represents a (scientific) project. It extends + * {@link GenericOrganizationalUnit} and adds + * some fields for additional information: + *

+ *
+ *
projectBegin
+ *
The begin of the project
+ *
projectEnd
+ *
The end of the project
+ *
shortDescription
+ *
A short description (500 characters) of the project
+ *
description
+ *
A description of the project/
+ *
funding
+ *
A text about the funding of the project
+ *
fundingVolume
+ *
Volume of the funding + *
+ * + * Also this module provides two authoring steps for defining hierarchies of + * projects. Two enable these authoring steps activate them in the + * configuration. + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProject extends GenericOrganizationalUnit { + + public static final String BEGIN = "projectbegin"; + public static final String END = "projectend"; + public static final String PROJECT_SHORT_DESCRIPTION = "projectShortDesc"; + public static final String PROJECT_DESCRIPTION = "projectDescription"; + public static final String FUNDING = "funding"; + public static final String FUNDING_VOLUME = "fundingVolume"; + public static final String ROLE_ENUM_NAME = "SciProjectRole"; + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contenttypes.SciProject"; + private static final SciProjectConfig config = new SciProjectConfig(); + + static { + config.load(); + } + + public SciProject() { + this(BASE_DATA_OBJECT_TYPE); + } + + public SciProject(final BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public SciProject(final OID oid) throws DataObjectNotFoundException { + super(oid); + } + + public SciProject(final DataObject dataObject) { + super(dataObject); + } + + public SciProject(final String type) { + super(type); + } + + public static SciProjectConfig getConfig() { + return config; + } + + public Date getBegin() { + return (Date) get(BEGIN); + } + + public void setBegin(Date begin) { + set(BEGIN, begin); + } + + public Date getEnd() { + return (Date) get(END); + } + + public void setEnd(Date end) { + set(END, end); + } + + public String getProjectShortDescription() { + return (String) get(PROJECT_SHORT_DESCRIPTION); + } + + public void setProjectShortDescription(String shortDesc) { + set(PROJECT_SHORT_DESCRIPTION, shortDesc); + } + + public String getProjectDescription() { + return (String) get(PROJECT_DESCRIPTION); + } + + public void setProjectDescription(String description) { + set(PROJECT_DESCRIPTION, description); + } + + public String getFunding() { + return (String) get(FUNDING); + } + + public void setFunding(String funding) { + set(FUNDING, funding); + } + + public String getFundingVolume() { + return (String) get(FUNDING_VOLUME); + } + + public void setFundingVolume(String fundingVolume) { + set(FUNDING_VOLUME, fundingVolume); + } + + @Override + public boolean hasContacts() { + boolean result = false; + + DataQuery query = + SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciProject"); + query.setParameter("project", getID()); + + if (query.size() > 0) { + result = true; + } else { + result = false; + } + + query.close(); + + return result; + } + + /** + * + * @param merge Should I also look into the projects and return true + * if the organization or at least one of the projects has members? + * @param status + * @return + */ + public boolean hasMembers(final boolean merge, + final SciProjectMemberStatus status) { + String queryName; + + switch (status) { + case ALL: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciProject"; + break; + case ACTIVE: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciProject"; + break; + case ASSOCIATED: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciProject"; + break; + case FORMER: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciProject"; + break; + default: + queryName = ""; + break; + } + + DataQuery query = SessionManager.getSession().retrieveQuery(queryName); + query.setParameter("project", getID()); + + if (query.size() > 0) { + query.close(); + return true; + } else { + if (merge) { + query.close(); + DataQuery projectsQuery = + SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject"); + projectsQuery.setParameter("project", getID()); + + if (query.size() > 0) { + BigDecimal projectId; + boolean result = false; + while (projectsQuery.next()) { + projectId = (BigDecimal) projectsQuery.get( + "projectId"); + result = hasMembers(projectId, merge, status); + + if (result) { + break; + } + } + + projectsQuery.close(); + return result; + } else { + projectsQuery.close(); + return false; + } + } else { + query.close(); + return false; + } + } + } + + private boolean hasMembers(final BigDecimal projectId, + final boolean merge, + final SciProjectMemberStatus status) { + String queryName; + + switch (status) { + case ALL: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciProject"; + break; + case ACTIVE: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciProject"; + break; + case ASSOCIATED: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfProject"; + break; + case FORMER: + queryName = + "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciProject"; + break; + default: + queryName = ""; + break; + } + + DataQuery query = SessionManager.getSession().retrieveQuery(queryName); + query.setParameter("project", projectId); + + if (query.size() > 0) { + query.close(); + return true; + } else { + if (merge) { + query.close(); + DataQuery subProjectsQuery = + SessionManager.getSession().retrieveQuery( + "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject"); + subProjectsQuery.setParameter("project", projectId); + + if (query.size() > 0) { + BigDecimal subprojectId; + boolean result = false; + while (subProjectsQuery.next()) { + subprojectId = (BigDecimal) subProjectsQuery.get( + "projectId"); + result = hasMembers(subprojectId, merge, status); + + if (result) { + break; + } + } + + subProjectsQuery.close(); + return result; + } else { + subProjectsQuery.close(); + return false; + } + } else { + query.close(); + return false; + } + } + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java new file mode 100644 index 000000000..63d746da1 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java @@ -0,0 +1,148 @@ +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; +import com.arsdigita.util.parameter.IntegerParameter; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringParameter; + +/** + * Configuration for {@link SciProject}. + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectConfig extends AbstractConfig { + + private final Parameter enableSubProjectsStep; + private final Parameter enableSuperProjectsStep; + private final Parameter shortDescMaxLength; + private final Parameter enableDescriptionDhtml; + private final Parameter enableMembersAllInOne; + private final Parameter enableMembersMerge; + private final Parameter enableFunding; + private final Parameter enableFundingDhtml; + private final Parameter enableFundingVolume; + private final Parameter fundingVolumeLength; + private final Parameter permittedPersonType; + + public SciProjectConfig() { + + enableSubProjectsStep = + new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_sub_projects_step", + Parameter.REQUIRED, + Boolean.FALSE); + + enableSuperProjectsStep = + new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step", + Parameter.REQUIRED, + Boolean.FALSE); + + shortDescMaxLength = new IntegerParameter( + "com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length", + Parameter.REQUIRED, + 500); + + enableDescriptionDhtml = + new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_description_dhtml", + Parameter.REQUIRED, + Boolean.TRUE); + + enableMembersAllInOne = + new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_members_all_in_one", + Parameter.REQUIRED, + Boolean.FALSE); + + enableMembersMerge = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_members_merge", + Parameter.REQUIRED, + Boolean.TRUE); + + enableFunding = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_funding", + Parameter.REQUIRED, + Boolean.TRUE); + + enableFundingDhtml = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_funding_dhtml", + Parameter.REQUIRED, + Boolean.TRUE); + + enableFundingVolume = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume", + Parameter.REQUIRED, + this); + + fundingVolumeLength = new IntegerParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_funding_length", + Parameter.REQUIRED, + 128); + + permittedPersonType = new StringParameter( + "com.arsdigita.cms.contenttypes.sciproject.permitted_person_type", + Parameter.REQUIRED, + "com.arsdigita.cms.contenttypes.GenericPerson"); + + register(enableSubProjectsStep); + register(enableSuperProjectsStep); + register(shortDescMaxLength); + register(enableDescriptionDhtml); + register(enableMembersAllInOne); + register(enableMembersMerge); + register(enableFunding); + register(enableFundingDhtml); + register(enableFundingVolume); + register(fundingVolumeLength); + register(permittedPersonType); + + loadInfo(); + } + + public final boolean getEnableSubProjectsStep() { + return (Boolean) get(enableSubProjectsStep); + } + + public final boolean getEnableSuperProjectsStep() { + return (Boolean) get(enableSuperProjectsStep); + } + + public final int getShortDescMaxLength() { + return (Integer) get(shortDescMaxLength); + } + + public final boolean getEnableDescriptionDhtml() { + return (Boolean) get(enableDescriptionDhtml); + } + + public final boolean getEnableMembersAllInOne() { + return (Boolean) get(enableMembersAllInOne); + } + + public final boolean getEnableMembersMerge() { + return (Boolean) get(enableMembersMerge); + } + + public boolean getEnableFunding() { + return (Boolean) get(enableFunding); + } + + public boolean getEnableFundingDhtml() { + return (Boolean) get(enableFundingDhtml); + } + + public boolean getEnableFundingVolume() { + return (Boolean) get(enableFundingVolume); + } + + public int getFundingVolumeLength() { + return (Integer) get(fundingVolumeLength); + } + + public String getPermittedPersonType() { + return (String) get(permittedPersonType); + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties new file mode 100644 index 000000000..73bc1b72c --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties @@ -0,0 +1,54 @@ +com.arsdigita.cms.contenttypes.sciproject.enable_sub_projects_step.title = Show sub projects step? +com.arsdigita.cms.contenttypes.sciproject.enable_sub_projects_step.purpose = Enables authoring step for adding sub projects to a project +com.arsdigita.cms.contenttypes.sciproject.enable_sub_projects_step.example = false +com.arsdigita.cms.contenttypes.sciproject.enable_sub_projects_step.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.title = Show super projects step? +com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.purpose = Enables authoring step to set the super project of project +com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.exampe = false +com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.title = Short description maximum length +com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.purpose = Maximum length for the short description of a SciProject item in characters. +com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.example = 500 +com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.format = [Integer] + +com.arsdigita.cms.contenttypes.sciproject.enable_description_dhtml.title = Enable DHTML editor +com.arsdigita.cms.contenttypes.sciproject.enable_description_dhtml.purpose = Enables the DHTML editor for the description of a SciProject +com.arsdigita.cms.contenttypes.sciproject.enable_description_dhtml.example = true +com.arsdigita.cms.contenttypes.sciproject.enable_description_dhtml.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_members_all_in_one.title = Show all members +com.arsdigita.cms.contenttypes.sciproject.enable_members_all_in_one.purpose = Decides if all members of project are shown together or separated by their status (active, associated, former) +com.arsdigita.cms.contenttypes.sciproject.enable_members_all_in_one.example = false +com.arsdigita.cms.contenttypes.sciproject.enable_members_all_in_one.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.title = Merge members +com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.purpose = Decides if the members of a sub project are also shown as the members of the super project +com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.example = true +com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_funding.title = Enable funding input field +com.arsdigita.cms.contenttypes.sciproject.enable_funding.purpose = Enables or disables an text area input field for a description how the project is funded. +com.arsdigita.cms.contenttypes.sciproject.enable_funding.example = true +com.arsdigita.cms.contenttypes.sciproject.enable_funding.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_funding_dhtml.title = Enable HTML editor for funding text area +com.arsdigita.cms.contenttypes.sciproject.enable_funding_dhtml.purpose = Enables the WYSIWYG HTML editor for the funding text area. +com.arsdigita.cms.contenttypes.sciproject.enable_funding_dhtml.example = true +com.arsdigita.cms.contenttypes.sciproject.enable_funding_dhtml.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume.title = Enable input field for funding volume +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume.purpose = If set to true an input field is available to input the volume of the funding of a project. +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume.example = true +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume_length.title = Maximum length for the funding input field in characters +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume_length.purpose = Maximum length for the funding input field in characters +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume_length.example = 128 +com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume_length.format = [Integer] + +com.arsdigita.cms.contenttypes.sciproject.permitted_person_type.title = Permitted person type for members of the project +com.arsdigita.cms.contenttypes.sciproject.permitted_person_type.purpose = Restrict the selectable persons for adding as member to a subtype of GenericPerson +com.arsdigita.cms.contenttypes.sciproject.permitted_person_type.example = com.arsdigita.cms.contenttypes.GenericPerson +com.arsdigita.cms.contenttypes.sciproject.permitted_person_type.format = [String] \ No newline at end of file diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java new file mode 100644 index 000000000..58f500786 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java @@ -0,0 +1,55 @@ +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.contenttypes.ui.SciProjectGlobalizationUtil; +import com.arsdigita.cms.contenttypes.ui.SciProjectSubProjectsStep; +import com.arsdigita.cms.contenttypes.ui.SciProjectSuperProjectsStep; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.runtime.DomainInitEvent; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectInitializer extends ContentTypeInitializer { + + public SciProjectInitializer() { + super("ccm-sci-types-project.pdl.mf", + SciProject.BASE_DATA_OBJECT_TYPE); + } + + @Override + public void init(final DomainInitEvent event) { + super.init(event); + + SciProjectConfig config = SciProject.getConfig(); + + if (config.getEnableSubProjectsStep()) { + AuthoringKitWizard.registerAssetStep(SciProject.BASE_DATA_OBJECT_TYPE, + SciProjectSubProjectsStep.class, + SciProjectGlobalizationUtil.globalize("sciproject.ui.subprojects.title"), + SciProjectGlobalizationUtil.globalize("sciproject.ui.subprojects.description"), + 10); + } + + if (config.getEnableSuperProjectsStep()) { + AuthoringKitWizard.registerAssetStep(SciProject.BASE_DATA_OBJECT_TYPE, + SciProjectSuperProjectsStep.class, + SciProjectGlobalizationUtil.globalize("sciproject.ui.superprojects.title"), + SciProjectGlobalizationUtil.globalize("sciproject.ui.superprojects.description"), + 10); + } + } + + @Override + public String[] getStylesheets() { + return new String[] { + "/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl" + }; + } + + @Override + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml"; + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java new file mode 100644 index 000000000..f11c6f67a --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java @@ -0,0 +1,23 @@ +package com.arsdigita.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectLoader extends AbstractContentTypeLoader { + + public SciProjectLoader() { + super(); + } + + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml" + }; + + @Override + public String[] getTypes() { + return TYPES; + } + +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectMemberStatus.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectMemberStatus.java new file mode 100644 index 000000000..05c62b38f --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectMemberStatus.java @@ -0,0 +1,14 @@ +package com.arsdigita.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public enum SciProjectMemberStatus { + + ALL, + ACTIVE, + ASSOCIATED, + FORMER +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectStatus.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectStatus.java new file mode 100644 index 000000000..f8ad963a7 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectStatus.java @@ -0,0 +1,12 @@ +package com.arsdigita.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public enum SciProjectStatus { + ALL, + CURRENT, + FINISHED +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java new file mode 100644 index 000000000..8d3993680 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java @@ -0,0 +1,128 @@ +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.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringInRangeValidationListener; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.cms.contenttypes.SciProjectConfig; +import com.arsdigita.cms.ui.CMSDHTMLEditor; +import com.arsdigita.cms.ui.authoring.BasicItemForm; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectDescriptionEditForm + extends BasicItemForm + implements FormProcessListener, + FormInitListener { + + private final static SciProjectConfig config = SciProject.getConfig(); + + public SciProjectDescriptionEditForm(final ItemSelectionModel itemModel) { + super("SciProjectDescriptionEditForm", itemModel); + } + + @Override + protected void addWidgets() { + add(new Label(SciProjectGlobalizationUtil.globalize( + "sciorganization.ui.project.description"))); + final ParameterModel descParam = new StringParameter( + SciProject.PROJECT_DESCRIPTION); + final TextArea desc; + if (config.getEnableDescriptionDhtml()) { + desc = new CMSDHTMLEditor(descParam); + } else { + desc = new TextArea(descParam); + } + desc.setCols(75); + desc.setRows(25); + add(desc); + + if (config.getEnableFunding()) { + add(new Label(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.funding"))); + final ParameterModel fundingParam = new StringParameter( + SciProject.FUNDING); + final TextArea funding; + if (config.getEnableFundingDhtml()) { + funding = new CMSDHTMLEditor(fundingParam); + } else { + funding = new TextArea(fundingParam); + } + funding.setCols(75); + funding.setRows(8); + add(funding); + } + + if (config.getEnableFundingVolume()) { + add(new Label(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.funding_volume"))); + final ParameterModel fundingVolumeParam = new StringParameter( + SciProject.FUNDING_VOLUME); + final TextField fundingVolume = new TextField(fundingVolumeParam); + fundingVolume.addValidationListener(new StringInRangeValidationListener( + 0, + config.getFundingVolumeLength())); + add(fundingVolume); + } + } + + @Override + public void init(final FormSectionEvent fse) throws FormProcessException { + final PageState state = fse.getPageState(); + final FormData data = fse.getFormData(); + final SciProject project = (SciProject) getItemSelectionModel(). + getSelectedObject(state); + + data.put(SciProject.PROJECT_DESCRIPTION, + project.getProjectDescription()); + if (config.getEnableFunding()) { + data.put(SciProject.FUNDING, project.getFunding()); + } + + if (config.getEnableFundingVolume()) { + data.put(SciProject.FUNDING_VOLUME, project.getFundingVolume()); + } + + setVisible(state, true); + } + + @Override + public void process(final FormSectionEvent fse) throws FormProcessException { + final PageState state = fse.getPageState(); + final FormData data = fse.getFormData(); + final SciProject project = (SciProject) getItemSelectionModel(). + getSelectedObject(state); + + if ((project != null) + && getSaveCancelSection().getSaveButton().isSelected(state)) { + project.setProjectDescription((String) data.get( + SciProject.PROJECT_DESCRIPTION)); + if (config.getEnableFunding()) { + project.setFunding((String) data.get( + SciProject.FUNDING)); + } + if (config.getEnableFundingVolume()) { + project.setFundingVolume((String) data.get( + SciProject.FUNDING_VOLUME)); + } + + project.save(); + + } + + init(fse); + } +} \ No newline at end of file diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java new file mode 100644 index 000000000..3271b3d5c --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java @@ -0,0 +1,75 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +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 com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectDescriptionStep extends SimpleEditStep { + + private String EDIT_PROJECT_DESC_SHEET_NAME = "editProjectDesc"; + private String UPLOAD_PROJECT_DESC_SHEET_NAME = "uploadProjectDesc"; + + public SciProjectDescriptionStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciProjectDescriptionStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + super(itemModel, parent, prefix); + + final BasicItemForm editDescForm = + new SciProjectDescriptionEditForm(itemModel); + add(EDIT_PROJECT_DESC_SHEET_NAME, + (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.edit_desc").localize(), + new WorkflowLockedComponentAccess(editDescForm, itemModel), + editDescForm.getSaveCancelSection().getCancelButton()); + + final SciProjectDescriptionUploadForm uploadDescForm = + new SciProjectDescriptionUploadForm( + itemModel); + add(UPLOAD_PROJECT_DESC_SHEET_NAME, + (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.upload_desc").localize(), + new WorkflowLockedComponentAccess(uploadDescForm, itemModel), + uploadDescForm.getSaveCancelSection().getCancelButton()); + + setDisplayComponent( + getSciProjectEditDescSheet(itemModel)); + + } + + public static Component getSciProjectEditDescSheet( + final ItemSelectionModel itemModel) { + final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( + itemModel); + + sheet.add(SciProjectGlobalizationUtil.globalize( + "sciorganization.ui.project.desc"), + SciProject.PROJECT_DESCRIPTION); + if (SciProject.getConfig().getEnableFunding()) { + sheet.add(SciProjectGlobalizationUtil.globalize( + "sciorganization.ui.project.funding"), + SciProject.FUNDING); + } + if (SciProject.getConfig().getEnableFundingVolume()) { + sheet.add(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.funding_volume"), + SciProject.FUNDING_VOLUME); + } + + return sheet; + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java new file mode 100644 index 000000000..969461747 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java @@ -0,0 +1,39 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectDescriptionUploadForm extends AbstractTextUploadForm { + + public SciProjectDescriptionUploadForm(final ItemSelectionModel itemModel) { + super(itemModel); + } + + @Override + public GlobalizedMessage getLabelText() { + return SciProjectGlobalizationUtil.globalize( + "sciproject.ui.description.upload"); + } + + @Override + public GlobalizedMessage getMimeTypeLabel() { + return SciProjectGlobalizationUtil.globalize( + "sciproject.ui.description.upload.mimetype"); + } + + @Override + public void setText(final ItemSelectionModel itemModel, + final PageState state, + final String text) { + final SciProject project = (SciProject) itemModel.getSelectedObject(state); + project.setProjectDescription(text); + project.save(); + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectGlobalizationUtil.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectGlobalizationUtil.java new file mode 100644 index 000000000..3f820d028 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectGlobalizationUtil.java @@ -0,0 +1,23 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectGlobalizationUtil { + + public static final String BUNDLE_NAME = "com.arsdigita.cms.contenttypes.ui.SciProjectResources"; + + public static GlobalizedMessage globalize(final String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + public static GlobalizedMessage globalize(final String key, + final Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java new file mode 100644 index 000000000..67d13ff33 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java @@ -0,0 +1,49 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.GenericPerson; +import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.domain.DataObjectNotFoundException; +import org.apache.log4j.Logger; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectMemberAddForm + extends GenericOrganizationalUnitPersonAddForm { + + private final Logger logger = + Logger.getLogger(SciProjectMemberAddForm.class); + + public SciProjectMemberAddForm( + final ItemSelectionModel itemModel, + final GenericOrganizationalUnitPersonSelector personSelector) { + super(itemModel, personSelector); + } + + @Override + protected String getPersonType() { + String personType = SciProject.getConfig().getPermittedPersonType(); + + try { + ContentType.findByAssociatedObjectType(personType); + } catch (DataObjectNotFoundException ex) { + logger.error(String.format("No content type for object type '%s'. " + + "Falling back to '%s'.", + personType, + GenericPerson.class.getName()), + ex); + personType = GenericPerson.class.getName(); + } + + return personType; + } + + @Override + protected String getRoleAttributeName() { + return SciProject.ROLE_ENUM_NAME; + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java new file mode 100644 index 000000000..1f31b9449 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java @@ -0,0 +1,23 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectMemberTable + extends GenericOrganizationalUnitPersonsTable { + + public SciProjectMemberTable(final ItemSelectionModel itemModel, + final GenericOrganizationalUnitPersonSelector personSelector) { + super(itemModel, personSelector); + } + + @Override + public String getRoleAttributeName() { + return SciProject.ROLE_ENUM_NAME; + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersStep.java new file mode 100644 index 000000000..c37186b76 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectMembersStep.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.GenericPerson; +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; + +/** + * + * @author Jens Pelzetter + */ +public class SciProjectMembersStep + extends SimpleEditStep +implements GenericOrganizationalUnitPersonSelector{ + + private static final String ADD_PROJECT_MEMBER_SHEET_NAME = "SciProjectAddMember"; + private GenericPerson selectedPerson; + private String selectedPersonRole; + private String selectedPersonStatus; + + public SciProjectMembersStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciProjectMembersStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + super(itemModel, parent, prefix); + + final BasicItemForm addMemberSheet = new SciProjectMemberAddForm( + itemModel, this); + add(ADD_PROJECT_MEMBER_SHEET_NAME, + (String) SciProjectGlobalizationUtil.globalize("sciproject.ui.add_member").localize(), + new WorkflowLockedComponentAccess(addMemberSheet, itemModel), + addMemberSheet.getSaveCancelSection().getCancelButton()); + + final SciProjectMemberTable memberTable = new SciProjectMemberTable( + itemModel, this); + setDisplayComponent(memberTable); + } + + public GenericPerson getSelectedPerson() { + return selectedPerson; + } + + public void setSelectedPerson(final GenericPerson selectedPerson) { + this.selectedPerson = selectedPerson; + } + + public String getSelectedPersonRole() { + return selectedPersonRole; + } + + public void setSelectedPersonRole(final String selectedPersonRole) { + this.selectedPersonRole = selectedPersonRole; + } + + public String getSelectedPersonStatus() { + return selectedPersonStatus; + } + + public void setSelectedPersonStatus(final String selectedPersonStatus) { + this.selectedPersonStatus = selectedPersonStatus; + } + + public void showEditComponent(final PageState state) { + showComponent(state, ADD_PROJECT_MEMBER_SHEET_NAME); + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java new file mode 100644 index 000000000..6cb05f5c3 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java @@ -0,0 +1,115 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; +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.domain.DomainObject; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import java.text.DateFormat; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectPropertiesStep + extends GenericOrganizationalUnitPropertiesStep { + + public SciProjectPropertiesStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + super(itemModel, parent); + } + + public static Component getSciProjectPropertySheet( + final ItemSelectionModel itemModel) { + final DomainObjectPropertySheet sheet = + (DomainObjectPropertySheet) GenericOrganizationalUnitPropertiesStep. + getGenericOrganizationalUnitPropertySheet(itemModel); + + sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.begin"), + SciProject.BEGIN, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(final DomainObject obj, + final String attribute, + final PageState state) { + final SciProject project = (SciProject) obj; + if (project.getBegin() == null) { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } else { + return DateFormat.getDateInstance(DateFormat.LONG).format( + project.getBegin()); + } + } + }); + sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.end"), + SciProject.END, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(final DomainObject obj, + final String attribute, + final PageState state) { + final SciProject project = (SciProject) obj; + if (project.getEnd() == null) { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } else { + return DateFormat.getDateInstance(DateFormat.LONG).format(project. + getEnd()); + } + } + }); + sheet.add(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.shortdesc"), + SciProject.PROJECT_SHORT_DESCRIPTION); + + return sheet; + } + + @Override + protected void addBasicProperties(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + final SimpleEditStep basicProperties = + new SimpleEditStep(itemModel, + parent, + EDIT_SHEET_NAME); + + BasicPageForm editBasicSheet = new SciProjectPropertyForm(itemModel, + this); + + basicProperties.add(EDIT_SHEET_NAME, + (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.edit_basic_sheet").localize(), + new WorkflowLockedComponentAccess(editBasicSheet, + itemModel), + editBasicSheet.getSaveCancelSection(). + getCancelButton()); + + basicProperties.setDisplayComponent( + getSciProjectPropertySheet(itemModel)); + + getSegmentedPanel().addSegment( + new Label((String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.edit_basic_properties"). + localize()), + basicProperties); + } + + @Override + protected void addSteps(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, + parent), + SciProjectGlobalizationUtil.globalize("sciproject.ui.contacts")); + + + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java new file mode 100644 index 000000000..42aa17d6e --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java @@ -0,0 +1,118 @@ +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.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.Date; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.parameters.DateParameter; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringInRangeValidationListener; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.cms.contenttypes.SciProjectConfig; +import java.util.Calendar; +import java.util.GregorianCalendar; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectPropertyForm + extends GenericOrganizationalUnitPropertyForm + implements FormProcessListener, + FormInitListener, + FormSubmissionListener { + + public final static String ID = "SciProjectEdit"; + private final static SciProjectConfig config = SciProject.getConfig(); + + public SciProjectPropertyForm(final ItemSelectionModel itemModel) { + this(itemModel, null); + } + + public SciProjectPropertyForm(final ItemSelectionModel itemModel, + final SciProjectPropertiesStep step) { + super(itemModel, step); + addSubmissionListener(this); + } + + @Override + public void addWidgets() { + super.addWidgets(); + + add(new Label(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.begin"))); + ParameterModel beginParam = new DateParameter(SciProject.BEGIN); + Calendar today = new GregorianCalendar(); + Date begin = new Date(beginParam); + begin.setYearRange(1970, (today.get(Calendar.YEAR) + 2)); + add(begin); + + add(new Label(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.end"))); + ParameterModel endParam = new DateParameter(SciProject.END); + Date end = new Date(endParam); + end.setYearRange(1970, (today.get(Calendar.YEAR) + 8)); + add(end); + + add(new Label(SciProjectGlobalizationUtil.globalize( + "sciproject.ui.shortdesc"))); + ParameterModel shortDescParam = new StringParameter( + SciProject.PROJECT_SHORT_DESCRIPTION); + TextArea shortDesc = new TextArea(shortDescParam); + shortDesc.addValidationListener( + new StringInRangeValidationListener(0, + config.getShortDescMaxLength())); + shortDesc.setCols(75); + shortDesc.setRows(5); + add(shortDesc); + } + + @Override + public void init(final FormSectionEvent fse) throws FormProcessException { + super.init(fse); + + final FormData data = fse.getFormData(); + final SciProject project = (SciProject) super.initBasicWidgets(fse); + + data.put(SciProject.BEGIN, project.getBegin()); + data.put(SciProject.END, project.getEnd()); + data.put(SciProject.PROJECT_SHORT_DESCRIPTION, + project.getProjectShortDescription()); + } + + @Override + public void process(final FormSectionEvent fse) throws FormProcessException { + super.process(fse); + + final FormData data = fse.getFormData(); + final PageState state = fse.getPageState(); + final SciProject project = (SciProject) super.processBasicWidgets(fse); + + if ((project != null) + && getSaveCancelSection().getCancelButton().isSelected(state)) { + project.setBegin((java.util.Date) data.get(SciProject.BEGIN)); + project.setEnd((java.util.Date) data.get(SciProject.END)); + project.setProjectShortDescription((String) data.get( + SciProject.PROJECT_SHORT_DESCRIPTION)); + + project.save(); + } + + init(fse); + } + + @Override + public String getTitleLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.title").localize(); + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties new file mode 100644 index 000000000..24b2ca9b1 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties @@ -0,0 +1,51 @@ +sciproject.ui.basic_properties=Basis properties +sciproject.ui.basic_properties.edit=Edit basic properties +sciproject.ui.basic_sheet.edit=Basic properties +sciproject.ui.begin=Start of project +sciproject.ui.contacts=Contacts +sciproject.ui.description=Project description +sciproject.ui.description.edit=Edit description +sciproject.ui.description.upload=Upload project description +sciproject.ui.description.upload=Upload description +sciproject.ui.description.upload.mimetype=Type of file +sciproject.ui.description.title=Description +sciproject.ui.end=End of project +sciproject.ui.funding=Funding +sciproject.ui.funding.volume=Volume of funding +sciproject.ui.member.add=Add member +sciproject.ui.members=Members of the project +sciproject.ui.properties.title=Properties +sciproject.ui.shortdesc=Short description +sciproject.ui.subproject=Subproject +sciproject.ui.subproject.add=Add subproject +sciproject.ui.subproject.confirm_remove=Are you sure to remove this subordinate project? +sciproject.ui.subproject.down=Down +sciproject.ui.subprojects.none=No subprojects found +sciproject.ui.subproject.remove=Remove subproject +sciproject.ui.subproject.select=Select project to add as subproject +sciproject.ui.subproject.up=Up +sciproject.ui.subprojects=Subprojects +sciproject.ui.superproject=Superior project +sciproject.ui.superproject.confirm_remove=Are you sure to remove this superior project? +sciproject.ui.superproject.none=No superior project found +sciproject.ui.superproject.remove=Remove superior project +sciproject.ui.superproject.set=Set superior project +sciproject.ui.superproject.select=Select superior project + +sciproject.ui.title=Name of the project + + + + + + + + + + + + + + + + diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties new file mode 100644 index 000000000..811ddfea2 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties @@ -0,0 +1,36 @@ +# To change this template, choose Tools | Templates +# and open the template in the editor. + +sciproject.ui.basic_properties=Basiseigenschaften +sciproject.ui.basic_properties.edit=Basiseigenschaften bearbeiten +sciproject.ui.basic_sheet.edit=Basiseigenschaften +sciproject.ui.begin=Beginn des Projekts +sciproject.ui.contacts=Kontakte +sciproject.ui.description=Projektbeschreibung +sciproject.ui.description.edit=Projektbeschreibung bearbeiten +sciproject.ui.description.upload=Projektbeschreibung hochladen +sciproject.ui.description.upload.mimetype=Dateityp +sciproject.ui.description.title=Projektbeschreibung +sciproject.ui.end=Ende des Projektes +sciproject.ui.funding=Finanzierung +sciproject.ui.funding.volume=Volumen der Finanzierung +sciproject.ui.member.add=Mitglied hinzuf\u00fcgen +sciproject.ui.members=Mitglieder des Projektes +sciproject.ui.properties.title=Basiseigenschaften +sciproject.ui.shortdesc=Kurzbeschreibung +sciproject.ui.subproject=Unterprojekt +sciproject.ui.subproject.add=Unterprojekt hinzuf\u00fcgen +sciproject.ui.subproject.confirm_remove=Wollen Sie das ausgew\u00e4hlte Unterprojekt wirklich entfernen? +sciproject.ui.subproject.down=Runter +sciproject.ui.subprojects.none=Keine Unterprojekte gefunden +sciproject.ui.subproject.remove=Unterprojekt entfernen +sciproject.ui.subproject.select=W\u00e4hlen das Projekt aus, dass als Unterprojekt hinzugef\u00fcgt werden soll +sciproject.ui.subproject.up=Hoch +sciproject.ui.subprojects=Unterprojekte +sciproject.ui.superproject=\u00dcbergeordnetes Projekt +sciproject.ui.superproject.confirm_remove=Wollen Sie das \u00fcbergeordnete Projekte wirklich entfernen? +sciproject.ui.superproject.none=Keine \u00fcbergeordneten Projekte gefunden. +sciproject.ui.superproject.remove=\u00dcbergeordnetes Projekt entfernen +sciproject.ui.superproject.select=\u00dcbergeordetes Projekt ausw\u00e4hlen +sciproject.ui.superproject.set=\u00dcbergeordnetes Projekt setzen +sciproject.ui.title=Name des Projektes diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsStep.java new file mode 100644 index 000000000..337739462 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsStep.java @@ -0,0 +1,137 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +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; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectSubProjectsStep extends SimpleEditStep { + + private String ADD_SUBPROJECT_SHEET_NAME = "SciProjectAddSubProject"; + public final static String ASSOC_TYPE = "SubProject"; + + public SciProjectSubProjectsStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciProjectSubProjectsStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + super(itemModel, parent, prefix); + + final BasicItemForm addSubProjectSheet = + new GenericOrganizationalUnitSubordinateOrgaUnitAddForm( + itemModel, + new GenericOrgaUnitSubordinateOrgaUnitAddFormCustomizer() { + + public String getSelectSubordinateOrgaUnitLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.select").localize(); + } + + public String getSubordinateOrgaUnitType() { + return SciProject.class.getName(); + } + + public String getAssocType() { + return ASSOC_TYPE; + } + + public String getNothingSelectedMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.nothing_selected"). + localize(); + } + + public String getNoSuitableLanguageVariantMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.no_suitable_language_variant"). + localize(); + } + + public String getAddingToItselfMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.adding_to_itself"). + localize(); + } + + public String getAlreadyAddedMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.already_added"). + localize(); + } + }); + add(ADD_SUBPROJECT_SHEET_NAME, + (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.add").localize(), + new WorkflowLockedComponentAccess(addSubProjectSheet, itemModel), + addSubProjectSheet.getSaveCancelSection().getCancelButton()); + + final GenericOrganizationalUnitSubordinateOrgaUnitsTable subProjectsTable = + new GenericOrganizationalUnitSubordinateOrgaUnitsTable( + itemModel, + new GenericOrgaUnitSubordinateOrgaUnitsTableCustomizer() { + + public String getEmptyViewLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subprojects.empty_view").localize(); + } + + public String getNameColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subprojects.columns.name").localize(); + } + + public String getDeleteColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subprojects.colums.delete").localize(); + } + + public String getUpColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subprojects.columns.up").localize(); + } + + public String getDownColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subprojects.columns.down").localize(); + } + + public String getDeleteLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.delete").localize(); + } + + public String getUpLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.up").localize(); + } + + public String getDownLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.down").localize(); + } + + public String getConfirmRemoveLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.subproject.remove.confirm").localize(); + } + + public String getAssocType() { + return ASSOC_TYPE; + } + }); + + setDisplayComponent(subProjectsTable); + + + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java new file mode 100644 index 000000000..ecefb9c64 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java @@ -0,0 +1,129 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciProject; +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; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectSuperProjectsStep extends SimpleEditStep { + + private String ADD_SUPERPROJECT_SHEET_NAME = "SciProjectAddSuperProject"; + public final static String ASSOC_TYPE = "SubProject"; + + public SciProjectSuperProjectsStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciProjectSuperProjectsStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + super(itemModel, parent, prefix); + + final BasicItemForm addSuperProjectSheet = + new GenericOrganizationalUnitSuperiorOrgaUnitAddForm( + itemModel, + new GenericOrgaUnitSuperiorOrgaUnitAddFormCustomizer() { + + public String getSelectSuperiorOrgaUnitLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.select").localize(); + } + + public String getSuperiorOrgaUnitType() { + return SciProject.class.getName(); + } + + public String getAssocType() { + return ASSOC_TYPE; + } + + public String getNothingSelectedMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.nothing_selected").localize(); + } + + public String getNoSuitableLanguageVariantMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.no_suitable_language_variant").localize(); + } + + public String getAddingToItselfMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.adding_to_itself").localize(); + } + + public String getAlreadyAddedMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.already_added").localize(); + } + }); + add(ADD_SUPERPROJECT_SHEET_NAME, + (String) SciProjectGlobalizationUtil.globalize("sciproject.ui.superproject.add").localize(), + new WorkflowLockedComponentAccess(addSuperProjectSheet, itemModel), + addSuperProjectSheet.getSaveCancelSection().getCancelButton()); + + final GenericOrganizationalUnitSuperiorOrgaUnitsTable superProjectsTable = new GenericOrganizationalUnitSuperiorOrgaUnitsTable( + itemModel, new GenericOrgaUnitSuperiorOrgaUnitsTableCustomizer() { + + public String getEmptyViewLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superprojects.empty_view").localize(); + } + + public String getNameColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superprojects.columns.name").localize(); + } + + public String getDeleteColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superprojects.columns.delete").localize(); + } + + public String getUpColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superprojects.columns.up").localize(); + } + + public String getDownColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superprojects.columns.down").localize(); + } + + public String getDeleteLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.delete").localize(); + } + + public String getUpLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.up").localize(); + } + + public String getDownLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.down").localize(); + } + + public String getConfirmRemoveLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.superproject.remove.confirm").localize(); + } + + public String getAssocType() { + return ASSOC_TYPE; + } + }); + + setDisplayComponent(superProjectsTable); + + } +} diff --git a/ccm-sci-types-project/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl b/ccm-sci-types-project/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl new file mode 100644 index 000000000..5dd9498a5 --- /dev/null +++ b/ccm-sci-types-project/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl @@ -0,0 +1,19 @@ + +]> + + + + +

+
+ + +

+
+ +
\ No newline at end of file