SciProject: AuthoringStep und Anzeige im ProjectSummaryTab für an einem Projekt beteiligte Organisationen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1192 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5289ebee50
commit
79c52a2665
|
|
@ -16,6 +16,7 @@ public class SciProjectConfig extends AbstractConfig {
|
|||
|
||||
private final Parameter enableSubProjectsStep;
|
||||
private final Parameter enableSuperProjectsStep;
|
||||
private final Parameter enableInvolvedOrgasStep;
|
||||
private final Parameter shortDescMaxLength;
|
||||
private final Parameter enableDescriptionDhtml;
|
||||
private final Parameter enableMembersAllInOne;
|
||||
|
|
@ -41,6 +42,12 @@ public class SciProjectConfig extends AbstractConfig {
|
|||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
|
||||
enableInvolvedOrgasStep =
|
||||
new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
|
||||
shortDescMaxLength = new IntegerParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length",
|
||||
Parameter.REQUIRED,
|
||||
|
|
@ -73,28 +80,33 @@ public class SciProjectConfig extends AbstractConfig {
|
|||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
|
||||
enableFundingVolume = new BooleanParameter(
|
||||
enableFundingVolume =
|
||||
new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
|
||||
fundingVolumeLength = new IntegerParameter(
|
||||
fundingVolumeLength =
|
||||
new IntegerParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.enable_funding_length",
|
||||
Parameter.REQUIRED,
|
||||
128);
|
||||
|
||||
permittedPersonType = new StringParameter(
|
||||
permittedPersonType =
|
||||
new StringParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.permitted_person_type",
|
||||
Parameter.REQUIRED,
|
||||
"com.arsdigita.cms.contenttypes.GenericPerson");
|
||||
|
||||
tabs = new StringParameter(
|
||||
tabs =
|
||||
new StringParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.tabs",
|
||||
Parameter.REQUIRED,
|
||||
"summary:com.arsdigita.cms.contenttypes.ui.SciProjectSummaryTab;desc:com.arsdigita.cms.contenttypes.ui.SciProjectDescTab");
|
||||
|
||||
register(enableSubProjectsStep);
|
||||
register(enableSuperProjectsStep);
|
||||
register(enableInvolvedOrgasStep);
|
||||
register(shortDescMaxLength);
|
||||
register(enableDescriptionDhtml);
|
||||
register(enableMembersAllInOne);
|
||||
|
|
@ -117,6 +129,10 @@ public class SciProjectConfig extends AbstractConfig {
|
|||
return (Boolean) get(enableSuperProjectsStep);
|
||||
}
|
||||
|
||||
public final boolean getEnableInvolvedOrgasStep() {
|
||||
return (Boolean) get(enableInvolvedOrgasStep);
|
||||
}
|
||||
|
||||
public final int getShortDescMaxLength() {
|
||||
return (Integer) get(shortDescMaxLength);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.purpose = E
|
|||
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.enable_involved_orgas_step.title = Show involved organizations step?
|
||||
com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step.purpose = Enables authoring step form managing organizations involved with the project
|
||||
com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step.example = true
|
||||
com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.ui.SciProjectGlobalizationUtil;
|
||||
import com.arsdigita.cms.contenttypes.ui.SciProjectInvolvedOrganizationsStep;
|
||||
import com.arsdigita.cms.contenttypes.ui.SciProjectSubProjectsStep;
|
||||
import com.arsdigita.cms.contenttypes.ui.SciProjectSuperProjectsStep;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
|
|
@ -25,25 +26,42 @@ public class SciProjectInitializer extends ContentTypeInitializer {
|
|||
final SciProjectConfig config = SciProject.getConfig();
|
||||
|
||||
if (config.getEnableSubProjectsStep()) {
|
||||
AuthoringKitWizard.registerAssetStep(SciProject.BASE_DATA_OBJECT_TYPE,
|
||||
AuthoringKitWizard.registerAssetStep(
|
||||
SciProject.BASE_DATA_OBJECT_TYPE,
|
||||
SciProjectSubProjectsStep.class,
|
||||
SciProjectGlobalizationUtil.globalize("sciproject.ui.subprojects.title"),
|
||||
SciProjectGlobalizationUtil.globalize("sciproject.ui.subprojects.description"),
|
||||
SciProjectGlobalizationUtil.
|
||||
globalize("sciproject.ui.subprojects.title"),
|
||||
SciProjectGlobalizationUtil.
|
||||
globalize("sciproject.ui.subprojects.description"),
|
||||
10);
|
||||
}
|
||||
|
||||
if (config.getEnableSuperProjectsStep()) {
|
||||
AuthoringKitWizard.registerAssetStep(SciProject.BASE_DATA_OBJECT_TYPE,
|
||||
AuthoringKitWizard.registerAssetStep(
|
||||
SciProject.BASE_DATA_OBJECT_TYPE,
|
||||
SciProjectSuperProjectsStep.class,
|
||||
SciProjectGlobalizationUtil.globalize("sciproject.ui.superprojects.title"),
|
||||
SciProjectGlobalizationUtil.globalize("sciproject.ui.superprojects.description"),
|
||||
10);
|
||||
SciProjectGlobalizationUtil.
|
||||
globalize("sciproject.ui.superprojects.title"),
|
||||
SciProjectGlobalizationUtil.
|
||||
globalize("sciproject.ui.superprojects.description"),
|
||||
20);
|
||||
}
|
||||
|
||||
if (config.getEnableInvolvedOrgasStep()) {
|
||||
AuthoringKitWizard.registerAssetStep(
|
||||
SciProject.BASE_DATA_OBJECT_TYPE,
|
||||
SciProjectInvolvedOrganizationsStep.class,
|
||||
SciProjectGlobalizationUtil.
|
||||
globalize("sciproject.ui.involved_orgas.title"),
|
||||
SciProjectGlobalizationUtil.
|
||||
globalize("sciproject.ui.involved_orgas.description"),
|
||||
30);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[] {
|
||||
return new String[]{
|
||||
"/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl"
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
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 SciProjectInvolvedOrganizationsStep extends SimpleEditStep {
|
||||
|
||||
private final static String ADD_INVOLVED_ORGANIZATION_STEP =
|
||||
"SciProjectAddInvolvedOrganization";
|
||||
public final static String ASSOC_TYPE = "InvolvedOrganization";
|
||||
|
||||
public SciProjectInvolvedOrganizationsStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciProjectInvolvedOrganizationsStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
final BasicItemForm addInvolvedOrgaSheet =
|
||||
new GenericOrganizationalUnitSuperiorOrgaUnitAddForm(
|
||||
itemModel,
|
||||
new GenericOrgaUnitSuperiorOrgaUnitAddFormCustomizer() {
|
||||
|
||||
public String getSelectSuperiorOrgaUnitLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.select").localize();
|
||||
}
|
||||
|
||||
public String getSuperiorOrgaUnitType() {
|
||||
return GenericOrganizationalUnit.class.getName();
|
||||
}
|
||||
|
||||
public String getAssocType() {
|
||||
return ASSOC_TYPE;
|
||||
}
|
||||
|
||||
public String getNothingSelectedMessage() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.select.nothing").localize();
|
||||
}
|
||||
|
||||
public String getNoSuitableLanguageVariantMessage() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.no_suitable_language_variant").localize();
|
||||
}
|
||||
|
||||
public String getAddingToItselfMessage() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.adding_to_itself").localize();
|
||||
}
|
||||
|
||||
public String getAlreadyAddedMessage() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.already_added").localize();
|
||||
}
|
||||
});
|
||||
add(ADD_INVOLVED_ORGANIZATION_STEP,
|
||||
(String) SciProjectGlobalizationUtil.globalize("sciproject.ui.involved_orgas.add").localize(),
|
||||
new WorkflowLockedComponentAccess(addInvolvedOrgaSheet, itemModel),
|
||||
addInvolvedOrgaSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
final GenericOrganizationalUnitSuperiorOrgaUnitsTable involvedTable = new GenericOrganizationalUnitSuperiorOrgaUnitsTable(
|
||||
itemModel, new GenericOrgaUnitSuperiorOrgaUnitsTableCustomizer() {
|
||||
|
||||
public String getEmptyViewLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.empty_view").localize();
|
||||
}
|
||||
|
||||
public String getNameColumnLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas..columns.name").localize();
|
||||
}
|
||||
|
||||
public String getDeleteColumnLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.columns.delete").localize();
|
||||
}
|
||||
|
||||
public String getUpColumnLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.columns.up").localize();
|
||||
}
|
||||
|
||||
public String getDownColumnLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.columns.down").localize();
|
||||
}
|
||||
|
||||
public String getDeleteLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.delete").localize();
|
||||
}
|
||||
|
||||
public String getUpLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.up").localize();
|
||||
}
|
||||
|
||||
public String getDownLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.down").localize();
|
||||
}
|
||||
|
||||
public String getConfirmRemoveLabel() {
|
||||
return (String) SciProjectGlobalizationUtil.globalize(
|
||||
"sciproject.ui.involved_orgas.delete.confirm").localize();
|
||||
}
|
||||
|
||||
public String getAssocType() {
|
||||
return ASSOC_TYPE;
|
||||
}
|
||||
});
|
||||
|
||||
setDisplayComponent(involvedTable);
|
||||
}
|
||||
}
|
||||
|
|
@ -66,3 +66,20 @@ sciorganization.ui.project.members=Members
|
|||
sciorganization.ui.project_description.title=Description
|
||||
sciproject.ui.edit_basic_sheet=Edit basic properties
|
||||
sciproject.ui.members.add=Add member
|
||||
sciproject.ui.involved_orgas.select=Select involved organization
|
||||
sciproject.ui.involved_orgas.select.nothing=No organization selected
|
||||
sciproject.ui.involved_orgas.no_suitable_language_variant=The selected organization item has no suitable language variant
|
||||
sciproject.ui.involved_orgas.adding_to_itself=It is not possible to add a project to itself as involved organization.
|
||||
sciproject.ui.involved_orgas.already_added=The selected organization has already been added to this project as an involved organization.
|
||||
sciproject.ui.involved_orgas.add=Add involved organization
|
||||
sciproject.ui.involved_orgas.empty_view=No involved organizations found
|
||||
sciproject.ui.involved_orgas..columns.name=Name of the organisation
|
||||
sciproject.ui.involved_orgas.columns.delete=Remove
|
||||
sciproject.ui.involved_orgas.columns.up=Up
|
||||
sciproject.ui.involved_orgas.columns.down=Down
|
||||
sciproject.ui.involved_orgas.delete=Remove
|
||||
sciproject.ui.involved_orgas.up=Up
|
||||
sciproject.ui.involved_orgas.down=Down
|
||||
sciproject.ui.involved_orgas.delete.confirm=Are you sure to remove the selected organization from the organisations involved with this project?
|
||||
sciproject.ui.involved_orgas.title=Involved Organizations
|
||||
sciproject.ui.involved_orgas.description=Managed involved organizations
|
||||
|
|
|
|||
|
|
@ -67,3 +67,20 @@ sciorganization.ui.project.members=Mitglieder
|
|||
sciorganization.ui.project_description.title=Beschreibung
|
||||
sciproject.ui.edit_basic_sheet=Basiseigenschaften bearbeiten
|
||||
sciproject.ui.members.add=Mitglied hinzuf\u00fcgen
|
||||
sciproject.ui.involved_orgas.select=Beteiligte Organisation ausw\u00e4hlen
|
||||
sciproject.ui.involved_orgas.select.nothing=Es wurde keine Organisation ausgew\u00e4hlt
|
||||
sciproject.ui.involved_orgas.no_suitable_language_variant=F\u00fcr die ausgew\u00e4hlte Organisation existiert keine passende Sprachvariante
|
||||
sciproject.ui.involved_orgas.adding_to_itself=Es ist nicht m\u00f6glich einem Projekt das Projekt selbst als beteiligte Organisation zuzuweisen.
|
||||
sciproject.ui.involved_orgas.already_added=Die ausgew\u00e4hlte Organisation wurde dem Projekt bereits als beteiligte Organisation hinzugef\u00fcgt.
|
||||
sciproject.ui.involved_orgas.add=Beteiligte Organisation hinzuf\u00fcgen
|
||||
sciproject.ui.involved_orgas.empty_view=Keine beteiligten Organisationen gefunden
|
||||
sciproject.ui.involved_orgas..columns.name=Name der Organisation
|
||||
sciproject.ui.involved_orgas.columns.delete=Entfernen
|
||||
sciproject.ui.involved_orgas.columns.up=Hoch
|
||||
sciproject.ui.involved_orgas.columns.down=Runter
|
||||
sciproject.ui.involved_orgas.delete=Entfernen
|
||||
sciproject.ui.involved_orgas.up=Hoch
|
||||
sciproject.ui.involved_orgas.down=Runter
|
||||
sciproject.ui.involved_orgas.delete.confirm=Sind Sie sicher, dass die die ausgew\u00e4hlte Organisation aus den an diesem Projekt beteiligten Organisationen l\u00f6schen wollen?
|
||||
sciproject.ui.involved_orgas.title=Beteiligte Organisationen
|
||||
sciproject.ui.involved_orgas.description=Verwalten von am Projekt beteiligten Organisationen
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSubordinateCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
|
|
@ -64,6 +65,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
|||
generateContactsXml(project, projectSummaryElem, state);
|
||||
}
|
||||
|
||||
if (config.isShowingInvolvedOrgas()) {
|
||||
generateInvolvedOrgasXml(project, projectSummaryElem, state);
|
||||
}
|
||||
|
||||
if (config.isShowingSubProjects()) {
|
||||
generateSubProjectsXml(project, projectSummaryElem, state);
|
||||
}
|
||||
|
|
@ -207,6 +212,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
|||
final GenericOrganizationalUnitContactCollection contacts = project.
|
||||
getContacts();
|
||||
|
||||
if ((contacts == null) || contacts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Element contactsElem = parent.newChildElement("contacts");
|
||||
|
||||
while (contacts.next()) {
|
||||
|
|
@ -230,17 +239,70 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
|||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
protected void generateInvolvedOrgasXml(final SciProject project,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final GenericOrganizationalUnitSuperiorCollection orgas = project.getSuperiorOrgaUnits();
|
||||
|
||||
if (orgas == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
orgas.addFilter(String.format("link.assocType = '%s'",
|
||||
SciProjectInvolvedOrganizationsStep.ASSOC_TYPE));
|
||||
|
||||
if (orgas.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Element involvedElem = parent.newChildElement("involvedOrganizations");
|
||||
while(orgas.next()) {
|
||||
generateInvolvedOrgaXml(orgas.getGenericOrganizationalUnit(),
|
||||
involvedElem,
|
||||
state);
|
||||
}
|
||||
logger.debug(String.format("Generated XML for involved organizations "
|
||||
+ "of project '%s' in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
protected void generateInvolvedOrgaXml(
|
||||
final GenericOrganizationalUnit involved,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final XmlGenerator generator = new XmlGenerator(involved);
|
||||
generator.setUseExtraXml(false);
|
||||
generator.generateXML(state, parent, "");
|
||||
logger.debug(String.format("Generated XML for involved organization "
|
||||
+ "'%s' in %d ms.",
|
||||
involved.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
protected void generateSubProjectsXml(final SciProject project,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final Element subProjectsElem = parent.newChildElement("subProjects");
|
||||
final GenericOrganizationalUnitSubordinateCollection subProjects =
|
||||
project.
|
||||
getSubordinateOrgaUnits();
|
||||
|
||||
if (subProjects == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
subProjects.addFilter(
|
||||
String.format("link.assocType = '%s'",
|
||||
SciProjectSubProjectsStep.ASSOC_TYPE));
|
||||
|
||||
if (subProjects.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Element subProjectsElem = parent.newChildElement("subProjects");
|
||||
while (subProjects.next()) {
|
||||
generateSubProjectXml(
|
||||
(SciProject) subProjects.getGenericOrganizationalUnit(),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|||
*/
|
||||
public class SciProjectSuperProjectsStep extends SimpleEditStep {
|
||||
|
||||
private String ADD_SUPERPROJECT_SHEET_NAME = "SciProjectAddSuperProject";
|
||||
private final static String ADD_SUPERPROJECT_SHEET_NAME = "SciProjectAddSuperProject";
|
||||
public final static String ASSOC_TYPE = "SubProject";
|
||||
|
||||
public SciProjectSuperProjectsStep(final ItemSelectionModel itemModel,
|
||||
|
|
|
|||
Loading…
Reference in New Issue