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
master
jensp 2011-10-17 19:23:23 +00:00
parent 22242c02a2
commit ec7e0ed894
31 changed files with 1836 additions and 3 deletions

View File

@ -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 =

View File

@ -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()) {

View File

@ -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));
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-sci-types-project"
prettyName="Scientific CMS Project content type"
version = "6.6.4"
release="1"
webapp="ROOT">
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.3" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.4" relation="ge"/>
</ccm:dependencies>
<ccm:directories>
<ccm:directory name="pdl"/>
<ccm:directory name="sql"/>
<ccm:directory name="src"/>
</ccm:directories>s
<ccm:contacts>
<ccm:contact uri="http://www.scientificcms.org" type="website"/>
<ccm:contact uri="mailto:info@scientificcms.org" type="support"/>
</ccm:contacts>
<ccm:description>
Content type for a (scientific) project.
</ccm:description>
</ccm:application>

View File

@ -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;
}
}

View File

@ -0,0 +1,4 @@
begin;
\i ddl/postgres/create.sql
\i ddl/postgres/deferred.sql
end;

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type
label="SciProject"
description="Projects of scientific organizations."
objectType="com.arsdigita.cms.contenttypes.SciProject"
classname="com.arsdigita.cms.contenttypes.SciProject">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="sciorganization.ui.project_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project_properties.title"
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciProjectResources"
component="com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep"
ordering="1"/>
<ctd:authoring-step
labelKey="sciorganization.ui.project.members"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project.members.description"
component="com.arsdigita.cms.contenttypes.ui.SciProjectMemberStep"
ordering="2"/>
<ctd:authoring-step
labelKey="sciorganization.ui.project_description.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project_description.title"
component="com.arsdigita.cms.contenttypes.ui.SciProjectDescriptionStep"
ordering="3"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xrd:adapters
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciProject" extends="com.arsdigita.cms.ContentPage">
<xrd:attributes rule="exclude">
<xrd:property name="/object/projectDescription"/>
</xrd:attributes>
<xrd:associations rule="include">
<xrd:property name="/object/contacts"/>
<xrd:property name="/object/persons"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<config class="com.arsdigita.cms.contenttypes.SciProjectConfig"
storage="ccm-sci-types-project/sciproject.properties"/>
</registry>

View File

@ -0,0 +1,16 @@
<load>
<requires>
<table name="inits"/>
<table name="acs_objects"/>
<table name="cms_items"/>
<initializer class="com.arsdigita.cms.Initializer"/>
</requires>
<provides>
<table name="ct_sci_projects"/>
<initializer class="com.arsdigita.cms.contenttypes.SciProjectInitializer"/>
</provides>
<scripts>
<schema directory="ccm-sci-types-project"/>
<data class="com.arsdigita.cms.contenttypes.SciProjectLoader"/>
</scripts>
</load>

View File

@ -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;
/**
* <p>
* The class represents a (scientific) project. It extends
* {@link GenericOrganizationalUnit} and adds
* some fields for additional information:
* </p>
* <dl>
* <dt><code>projectBegin</code></dt>
* <dd>The begin of the project</dd>
* <dt><code>projectEnd</code></dt>
* <dd>The end of the project</dd>
* <dt><code>shortDescription</code></dt>
* <dd>A short description (500 characters) of the project</dd>
* <dt><code>description</code></dt>
* <dd>A description of the project/<dd>
* <dt><code>funding</code><dt>
* <dd>A text about the funding of the project</dd>
* <dt><code>fundingVolume</code></dt>
* <dd><code>Volume of the funding</code></dt>
* </dl>
*
* 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;
}
}
}
}

View File

@ -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);
}
}

View File

@ -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]

View File

@ -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";
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,14 @@
package com.arsdigita.cms.contenttypes;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public enum SciProjectMemberStatus {
ALL,
ACTIVE,
ASSOCIATED,
FORMER
}

View File

@ -0,0 +1,12 @@
package com.arsdigita.cms.contenttypes;
/**
*
* @author Jens Pelzetter
* @version $Id$
*/
public enum SciProjectStatus {
ALL,
CURRENT,
FINISHED
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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"));
}
}

View File

@ -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();
}
}

View File

@ -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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,19 @@
<!DOCTYPE stylesheet [
<!ENTITY nbsp "&#160;" ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
version="1.0">
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.SciProject']" mode="cms:CT_graphics"
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_SciProject">
<p><xsl:value-of select="./name"/></p>
</xsl:template>
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.SciProject']" mode="cms:CT_text"
name="cms:CT_text_com_arsdigita_cms_contenttypes_SciProject">
<p><xsl:value-of select="./name"/></p>
</xsl:template>
</xsl:stylesheet>