dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13700
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4468: Minor fix to ouwt json
------------------------------------------------------------
revno: 4468
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-08-27 15:23:03 +0200
message:
Minor fix to ouwt json
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java
--
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-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm 2011-08-18 07:30:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm 2011-08-27 13:23:03 +0000
@@ -1,7 +1,7 @@
{
"version":"$!encoder.jsonEncode( $version )"
+,"roots": [ #foreach( $root in $rootOrganisationUnits )$root.id#if( $velocityCount < $rootOrganisationUnits.size() ),#end#end ]
#if( ! $versionOnly )
-,"roots": [ #foreach( $root in $rootOrganisationUnits )$root.id#if( $velocityCount < $rootOrganisationUnits.size() ),#end#end ]
,"organisationUnits": {
#foreach( $unit in $organisationUnits )
"${unit.id}":{"id":${unit.id},"n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":${unit.parent.id},#end"c":[#foreach( $child in $unit.sortedChildren )${child.id}#if( $velocityCount < $unit.children.size() ),#end#end]}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2011-08-17 15:46:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2011-08-27 13:23:03 +0000
@@ -116,40 +116,40 @@
public String execute()
throws Exception
- {
+ {
+ Collection<OrganisationUnit> userOrganisationUnits = new HashSet<OrganisationUnit>();
+
+ User user = currentUserService.getCurrentUser();
+
+ if ( user.getOrganisationUnits() != null && user.getOrganisationUnits().size() > 0 )
+ {
+ userOrganisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
+ rootOrganisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
+ }
+ else
+ {
+ if ( user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
+ {
+ userOrganisationUnits = new ArrayList<OrganisationUnit>(
+ organisationUnitService.getRootOrganisationUnits() );
+ rootOrganisationUnits = new ArrayList<OrganisationUnit>(
+ organisationUnitService.getRootOrganisationUnits() );
+ }
+ else
+ {
+ userOrganisationUnits = new ArrayList<OrganisationUnit>();
+ rootOrganisationUnits = new ArrayList<OrganisationUnit>();
+ }
+ }
+
if ( !versionOnly )
{
- Collection<OrganisationUnit> userOrganisationUnits = new HashSet<OrganisationUnit>();
-
- User user = currentUserService.getCurrentUser();
-
- if ( user.getOrganisationUnits() != null && user.getOrganisationUnits().size() > 0 )
- {
- userOrganisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
- rootOrganisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
- }
- else
- {
- if ( user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
- {
- userOrganisationUnits = new ArrayList<OrganisationUnit>(
- organisationUnitService.getRootOrganisationUnits() );
- rootOrganisationUnits = new ArrayList<OrganisationUnit>(
- organisationUnitService.getRootOrganisationUnits() );
- }
- else
- {
- userOrganisationUnits = new ArrayList<OrganisationUnit>();
- rootOrganisationUnits = new ArrayList<OrganisationUnit>();
- }
- }
-
for ( OrganisationUnit unit : userOrganisationUnits )
{
organisationUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( unit.getId() ) );
}
}
-
+
version = getVersionString();
return SUCCESS;