← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4331: minor changes to ouwt

 

------------------------------------------------------------
revno: 4331
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-08-17 14:51:38 +0200
message:
  minor changes to ouwt
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-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
  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-15 12:20:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm	2011-08-17 12:51:38 +0000
@@ -2,9 +2,9 @@
 #macro( expandOrganisationUnit $organisationUnit )
 {
 "id":$!{organisationUnit.id},
-#if( $organisationUnit.parent )"parentId":$!{organisationUnit.parent.id},#end
-"name":"$!encoder.jsonEncode( ${organisationUnit.name} )"#if( $organisationUnit.children.size() > 0 ),
-"children":[
+#if( $organisationUnit.parent )"pid":$!{organisationUnit.parent.id},#end
+"n":"$!encoder.jsonEncode( ${organisationUnit.name} )"#if( $organisationUnit.children.size() > 0 ),
+"c":[
 #foreach ( $child in $organisationUnit.sortedChildren )
 #expandOrganisationUnit( $child )#if( $velocityCount < $organisationUnit.children.size() ),#end
 #end]#end }

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2011-08-17 11:17:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2011-08-17 12:51:38 +0000
@@ -15,6 +15,7 @@
  */
 
 var organisationUnitTreePath = '../dhis-web-commons/ouwt/';
+var organisationUnits = {};
 
 var selection = new Selection();
 var subtree = new Subtree();
@@ -109,6 +110,7 @@
 
                                     localStorage[getTagId( "Roots" )] = JSON.stringify( roots );
                                     localStorage[getTagId( "Version" )] = data.version;
+                                    localStorage["organisationUnits"] = JSON.stringify( data.organisationUnits );
 
                                 } ).complete( function()
                         {
@@ -227,14 +229,14 @@
     {
         var output = {}
         output.id = ou.id;
-        output.parentId = ou.parentId;
-        output.name = ou.name;
+        output.parentId = ou.pid;
+        output.name = ou.n;
         output.children = [];
 
-        for ( var i in ou.children )
+        for ( var i in ou.c )
         {
-            output.children.push( ou.children[i].id );
-            store_ou( ou.children[i] );
+            output.children.push( ou.c[i].id );
+            store_ou( ou.c[i] );
         }
 
         localStorage[getTagId( ou.id )] = JSON.stringify( output );

=== 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 11:17:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2011-08-17 12:51:38 +0000
@@ -134,7 +134,7 @@
                 if ( user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
                 {
                     organisationUnits = new ArrayList<OrganisationUnit>(
-                        organisationUnitService.getAllOrganisationUnits() );
+                        organisationUnitService.getRootOrganisationUnits() );
                 }
                 else
                 {