Ergänzungen an den Tabs

git-svn-id: https://svn.libreccm.org/ccm/trunk@1306 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-11-30 09:21:25 +00:00
parent 9ff0b3543a
commit 4eff66ae5f
3 changed files with 38 additions and 0 deletions

View File

@ -78,6 +78,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
generateSubProjectsXml(project, projectSummaryElem, state); generateSubProjectsXml(project, projectSummaryElem, state);
} }
if (config.isShowingFunding()) {
generateFundingXml(project, projectSummaryElem, state);
}
logger.debug(String.format("Generated XML for summary tab of project " logger.debug(String.format("Generated XML for summary tab of project "
+ "'%s' in %d ms.", + "'%s' in %d ms.",
orgaunit.getName(), orgaunit.getName(),
@ -402,6 +406,23 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
System.currentTimeMillis() - start)); 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 class XmlGenerator extends SimpleXMLGenerator {
private final ContentItem item; private final ContentItem item;

View File

@ -17,6 +17,7 @@ public class SciProjectSummaryTabConfig extends AbstractConfig {
private final Parameter showContacts; private final Parameter showContacts;
private final Parameter showInvolvedOrgas; private final Parameter showInvolvedOrgas;
private final Parameter showSubProjects; private final Parameter showSubProjects;
private final Parameter showFunding;
public SciProjectSummaryTabConfig() { public SciProjectSummaryTabConfig() {
showMembers = showMembers =
@ -49,11 +50,18 @@ public class SciProjectSummaryTabConfig extends AbstractConfig {
Parameter.REQUIRED, Parameter.REQUIRED,
true); true);
showFunding =
new BooleanParameter("com.arsdigita.cms.contenttypes.sciproject.summarytab.funding.show",
Parameter.REQUIRED,
true);
register(showMembers); register(showMembers);
register(mergeMembers); register(mergeMembers);
register(showContacts); register(showContacts);
register(showInvolvedOrgas); register(showInvolvedOrgas);
register(showSubProjects); register(showSubProjects);
register(showFunding);
loadInfo(); loadInfo();
} }
@ -77,4 +85,8 @@ public class SciProjectSummaryTabConfig extends AbstractConfig {
public final boolean isShowingSubProjects() { public final boolean isShowingSubProjects() {
return (Boolean) get(showSubProjects); return (Boolean) get(showSubProjects);
} }
public final boolean isShowingFunding() {
return (Boolean) get(showFunding);
}
} }

View File

@ -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.purpose = Show subprojects?
com.arsdigita.cms.contenttypes.sciproject.summarytab.subprojects.show.example = true 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.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]