From 4eff66ae5f68b050b69dd461e179226ea01b08df Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 30 Nov 2011 09:21:25 +0000 Subject: [PATCH] =?UTF-8?q?Erg=C3=A4nzungen=20an=20den=20Tabs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@1306 8810af33-2d31-482b-a856-94f89814c4df --- .../contenttypes/ui/SciProjectSummaryTab.java | 21 +++++++++++++++++++ .../ui/SciProjectSummaryTabConfig.java | 12 +++++++++++ ...ojectSummaryTabConfig_parameter.properties | 5 +++++ 3 files changed, 38 insertions(+) diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java index 745aff54f..392386b41 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java @@ -78,6 +78,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { generateSubProjectsXml(project, projectSummaryElem, state); } + if (config.isShowingFunding()) { + generateFundingXml(project, projectSummaryElem, state); + } + logger.debug(String.format("Generated XML for summary tab of project " + "'%s' in %d ms.", orgaunit.getName(), @@ -402,6 +406,23 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { System.currentTimeMillis() - start)); } + protected void generateFundingXml(final SciProject project, + final Element parent, + final PageState state) { + if ((project.getFunding() != null) + && !project.getFunding().trim().isEmpty()) { + final Element fundingElem = parent.newChildElement("funding"); + fundingElem.setText(project.getFunding()); + } + + if ((project.getFundingVolume() != null) + && !project.getFundingVolume().trim().isEmpty()) { + final Element fundingVolumeElem = parent.newChildElement( + "fundingVolume"); + fundingVolumeElem.setText(project.getFundingVolume()); + } + } + private class XmlGenerator extends SimpleXMLGenerator { private final ContentItem item; diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig.java index a49b85b6b..7dc0cfc24 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig.java @@ -17,6 +17,7 @@ public class SciProjectSummaryTabConfig extends AbstractConfig { private final Parameter showContacts; private final Parameter showInvolvedOrgas; private final Parameter showSubProjects; + private final Parameter showFunding; public SciProjectSummaryTabConfig() { showMembers = @@ -49,11 +50,18 @@ public class SciProjectSummaryTabConfig extends AbstractConfig { Parameter.REQUIRED, true); + showFunding = + new BooleanParameter("com.arsdigita.cms.contenttypes.sciproject.summarytab.funding.show", + Parameter.REQUIRED, + true); + + register(showMembers); register(mergeMembers); register(showContacts); register(showInvolvedOrgas); register(showSubProjects); + register(showFunding); loadInfo(); } @@ -77,4 +85,8 @@ public class SciProjectSummaryTabConfig extends AbstractConfig { public final boolean isShowingSubProjects() { return (Boolean) get(showSubProjects); } + + public final boolean isShowingFunding() { + return (Boolean) get(showFunding); + } } diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig_parameter.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig_parameter.properties index 67ec42c48..7a830d576 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig_parameter.properties +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTabConfig_parameter.properties @@ -22,3 +22,8 @@ com.arsdigita.cms.contenttypes.sciproject.summarytab.subprojects.show.title = Sh com.arsdigita.cms.contenttypes.sciproject.summarytab.subprojects.show.purpose = Show subprojects? com.arsdigita.cms.contenttypes.sciproject.summarytab.subprojects.show.example = true com.arsdigita.cms.contenttypes.sciproject.summarytab.subprojects.show.format = [Boolean] + +com.arsdigita.cms.contenttypes.sciproject.summarytab.funding.show.title = Show funding info? +com.arsdigita.cms.contenttypes.sciproject.summarytab.funding.show.purpose = Show funding info? +com.arsdigita.cms.contenttypes.sciproject.summarytab.funding.show.example = true +com.arsdigita.cms.contenttypes.sciproject.summarytab.funding.show.format = [Boolean]