dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13595
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4394: Initialize updated.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4394 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-08-20 12:25:52 +0200
message:
Initialize updated.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm
--
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-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2011-06-23 16:42:13 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2011-08-20 10:16:56 +0000
@@ -40,6 +40,8 @@
import org.hisp.dhis.mapping.MapView;
import org.hisp.dhis.mapping.MappingService;
import org.hisp.dhis.mapping.comparator.MapLayerNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.user.UserSettingService;
@@ -76,6 +78,13 @@
{
this.configurationService = configurationService;
}
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
// -------------------------------------------------------------------------
// Input
@@ -133,6 +142,13 @@
{
return infrastructuralPeriodType;
}
+
+ private OrganisationUnit rootNode;
+
+ public OrganisationUnit getRootNode()
+ {
+ return rootNode;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -164,6 +180,8 @@
infrastructuralDataElements = configurationService.getConfiguration().getInfrastructuralDataElements();
infrastructuralPeriodType = configurationService.getConfiguration().getInfrastructuralPeriodTypeDefaultIfNull();
+
+ rootNode = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) ).iterator().next();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2011-08-04 13:36:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2011-08-20 10:16:56 +0000
@@ -70,5 +70,11 @@
],
"security": {
"isAdmin": $auth.hasAccess( "dhis-web-mapping", "deleteMapLegendSet" )
- }
+ },
+ "rootNode": {
+ "id": "$!{rootNode.id}",
+ "name": "$!encoder.jsonEncode( ${rootNode.name} )",
+ "level": 1,
+ "hasChildrenWithCoordinates": $!{rootNode.hasChildrenWithCoordinates()}
+ }
}
\ No newline at end of file