← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18895: ouwt: support db translation, adds i18nService.internationalise to GetOrgUnitTreeAction

 

------------------------------------------------------------
revno: 18895
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-04-14 15:13:01 +0700
message:
  ouwt: support db translation, adds i18nService.internationalise to GetOrgUnitTreeAction
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/ajax/jsonOrganisationUnitTreePartial.vm
  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/resources/META-INF/dhis/beans.xml


--
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	2014-06-30 05:19:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm	2015-04-14 08:13:01 +0000
@@ -6,7 +6,8 @@
 #if( ! $versionOnly )
 ,"organisationUnits": {
 #foreach( $unit in $organisationUnits )
-"$!encoder.jsonEncode($unit.uid)":{"id":"$!encoder.jsonEncode($unit.uid)","n":"$!encoder.jsonEncode( ${unit.name} )","l":${unit.level},#if( $unit.parent )"pid":"$!encoder.jsonEncode($unit.parent.uid)",#end"c":[#foreach( $child in $unit.sortedChildren )"$!encoder.jsonEncode($child.uid)"#if( $velocityCount < $unit.children.size() ),#end#end]}
+"$!encoder.jsonEncode($unit.uid)":{"id":"$!encoder.jsonEncode($unit.uid)","n":"$!encoder.jsonEncode( ${unit.displayName} )","l":${unit.level},#if( $unit.parent )"pid":"$!encoder.jsonEncode($unit.parent.uid)",#end"c":[#foreach( $child in $unit.sortedChildren )
+"$!encoder.jsonEncode($child.uid)"#if( $velocityCount < $unit.children.size() ),#end#end]}
 #if( $velocityCount < $organisationUnits.size() ),#end#end
 }#end
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm	2015-01-08 10:24:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm	2015-04-14 08:13:01 +0000
@@ -4,6 +4,7 @@
 ,"roots": [ #foreach( $root in $rootOrganisationUnits )"$!encoder.jsonEncode($root.uid)"#if( $velocityCount < $rootOrganisationUnits.size() ),#end#end ]
 ,"organisationUnits": {
 #foreach( $unit in $organisationUnits )
-"$!encoder.jsonEncode($unit.uid)":{"id":"$!encoder.jsonEncode($unit.uid)","n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":"$!encoder.jsonEncode($unit.parent.uid)",#end"c":[#foreach( $child in $unit.sortedChildren )"$!encoder.jsonEncode($child.uid)"#if( $velocityCount < $unit.children.size() ),#end#end]}
+"$!encoder.jsonEncode($unit.uid)":{"id":"$!encoder.jsonEncode($unit.uid)","n":"$!encoder.jsonEncode( ${unit.displayName} )",#if( $unit.parent )"pid":"$!encoder.jsonEncode($unit.parent.uid)",#end"c":[#foreach( $child in $unit.sortedChildren )"$!encoder
+.jsonEncode($child.uid)"#if( $velocityCount < $unit.children.size() ),#end#end]}
 #if( $velocityCount < $organisationUnits.size() ),#end#end
 }}
\ No newline at end of file

=== 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	2015-04-10 06:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2015-04-14 08:13:01 +0000
@@ -30,6 +30,7 @@
 
 import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.i18n.I18nService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -37,6 +38,7 @@
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.version.Version;
 import org.hisp.dhis.version.VersionService;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -54,26 +56,17 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    @Autowired
     private CurrentUserService currentUserService;
 
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
+    @Autowired
     private OrganisationUnitService organisationUnitService;
 
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
+    @Autowired
     private VersionService versionService;
 
-    public void setVersionService( VersionService versionService )
-    {
-        this.versionService = versionService;
-    }
+    @Autowired
+    protected I18nService i18nService;
 
     // -------------------------------------------------------------------------
     // Input & Output
@@ -177,6 +170,8 @@
             rootOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );
         }
 
+        i18nService.internationalise( rootOrganisationUnits );
+
         if ( byName != null )
         {
             List<OrganisationUnit> organisationUnitByName = organisationUnitService.getOrganisationUnitByName( byName );
@@ -197,6 +192,8 @@
                     while ( (parent = parent.getParent()) != null );
                 }
 
+                i18nService.internationalise( organisationUnits );
+
                 return "partial";
             }
         }
@@ -217,6 +214,8 @@
                 }
             }
 
+            i18nService.internationalise( organisationUnits );
+
             return "partial";
         }
 
@@ -229,6 +228,8 @@
                 organisationUnits.addAll( parent.getChildren() );
             }
 
+            i18nService.internationalise( organisationUnits );
+
             return "partial";
         }
 
@@ -251,6 +252,7 @@
         }
 
         Collections.sort( rootOrganisationUnits, IdentifiableObjectNameComparator.INSTANCE );
+        i18nService.internationalise( organisationUnits );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2015-03-15 20:49:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2015-04-14 08:13:01 +0000
@@ -501,9 +501,6 @@
 
   <bean id="org.hisp.dhis.commons.action.GetOrganisationUnitTreeAction" class="org.hisp.dhis.commons.action.GetOrganisationUnitTreeAction"
     scope="prototype">
-    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-    <property name="versionService" ref="org.hisp.dhis.version.VersionService" />
   </bean>
 
   <bean id="org.hisp.dhis.commons.action.GetPeriodAction" class="org.hisp.dhis.commons.action.GetPeriodAction"