dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18175
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7559: Impl user org unit children property for png charts
------------------------------------------------------------
revno: 7559
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-07-10 12:12:30 +0200
message:
Impl user org unit children property for png charts
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2012-07-09 11:54:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2012-07-10 10:12:30 +0000
@@ -56,7 +56,6 @@
import org.hisp.dhis.user.User;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -152,7 +151,7 @@
private transient List<Period> relativePeriods = new ArrayList<Period>();
- private transient OrganisationUnit organisationUnit;
+ private transient List<OrganisationUnit> relativeOrganisationUnits = new ArrayList<OrganisationUnit>();
// -------------------------------------------------------------------------
// Constructors
@@ -200,9 +199,9 @@
public List<OrganisationUnit> getAllOrganisationUnits()
{
- if ( organisationUnit != null )
+ if ( relativeOrganisationUnits != null && !relativeOrganisationUnits.isEmpty() )
{
- return Arrays.asList( organisationUnit );
+ return relativeOrganisationUnits;
}
else
{
@@ -695,15 +694,15 @@
}
@JsonIgnore
- public OrganisationUnit getOrganisationUnit()
+ public List<OrganisationUnit> getRelativeOrganisationUnits()
{
- return organisationUnit;
+ return relativeOrganisationUnits;
}
@JsonIgnore
- public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ public void setRelativeOrganisationUnits( List<OrganisationUnit> relativeOrganisationUnits )
{
- this.organisationUnit = organisationUnit;
+ this.relativeOrganisationUnits = relativeOrganisationUnits;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2012-07-09 10:10:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2012-07-10 10:12:30 +0000
@@ -196,11 +196,20 @@
User user = currentUserService.getCurrentUser();
- if ( chart.isUserOrganisationUnit() && user != null && user.getOrganisationUnit() != null )
+ if ( user != null && user.getOrganisationUnit() != null )
{
- chart.setOrganisationUnit( user.getOrganisationUnit() );
+ OrganisationUnit unit = user.getOrganisationUnit();
+
+ if ( chart.isUserOrganisationUnit() )
+ {
+ chart.getRelativeOrganisationUnits().add( unit );
+ }
+ else if ( chart.isUserOrganisationUnitChildren() )
+ {
+ chart.getRelativeOrganisationUnits().addAll( unit.hasChild() ? unit.getSortedChildren() : Arrays.asList( unit ) );
+ }
}
-
+
chart.setFormat( format );
return getJFreeChart( chart, !chart.isHideSubtitle() );
@@ -223,7 +232,7 @@
chart.setHideLegend( true );
chart.getIndicators().add( indicator );
chart.setRelativePeriods( periods );
- chart.setOrganisationUnit( unit );
+ chart.getOrganisationUnits().add( unit );
chart.setFormat( format );
return getJFreeChart( chart, title );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl 2012-04-08 20:23:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/chart.xsl 2012-07-10 10:12:30 +0000
@@ -107,6 +107,10 @@
<td>User organisation unit</td>
<td> <xsl:value-of select="d:userOrganisationUnit"/> </td>
</tr>
+ <tr>
+ <td>User organisation unit children</td>
+ <td> <xsl:value-of select="d:userOrganisationUnitChildren"/> </td>
+ </tr>
</table>
<xsl:apply-templates select="d:organisationUnits|d:dataElements|d:indicators" mode="short"/>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2012-06-23 08:37:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2012-07-10 10:12:30 +0000
@@ -219,11 +219,6 @@
"alphanumericwithbasicpuncspaces" : true,
"notOnlyDigits" : false
},
- "description" : {
- "rangelength" : [ 3, 250 ],
- "alphanumericwithbasicpuncspaces" : true,
- "notOnlyDigits" : true
- },
"formName" : {
"rangelength" : [ 2, 150 ],
"alphanumericwithbasicpuncspaces" : false,
@@ -312,10 +307,6 @@
"alphanumericwithbasicpuncspaces" : true,
"notOnlyDigits" : false
},
- "description" : {
- "rangelength" : [ 3, 250 ],
- "alphanumericwithbasicpuncspaces" : true
- },
"url" : {
"url" : true,
"rangelength" : [ 0, 255 ]