← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5779: I18n db, organisation unit module

 

------------------------------------------------------------
revno: 5779
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-01-22 09:21:22 +0100
message:
  I18n db, organisation unit module
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.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-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java	2012-01-22 08:21:22 +0000
@@ -27,10 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
 import java.util.ArrayList;
 import java.util.Collection;
 
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.i18n.I18nService;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;
 import org.springframework.transaction.annotation.Transactional;
@@ -61,6 +64,13 @@
         this.organisationUnitGroupSetStore = organisationUnitGroupSetStore;
     }
 
+    private I18nService i18nService;
+
+    public void setI18nService( I18nService service )
+    {
+        i18nService = service;
+    }
+
     // -------------------------------------------------------------------------
     // OrganisationUnitGroup
     // -------------------------------------------------------------------------
@@ -82,7 +92,7 @@
 
     public OrganisationUnitGroup getOrganisationUnitGroup( int id )
     {
-        return organisationUnitGroupStore.get( id );
+        return i18n( i18nService, organisationUnitGroupStore.get( id ) );
     }
     
     public Collection<OrganisationUnitGroup> getOrganisationUnitGroups( final Collection<Integer> identifiers )
@@ -100,24 +110,44 @@
 
     public OrganisationUnitGroup getOrganisationUnitGroup( String uid )
     {
-        return organisationUnitGroupStore.getByUid( uid );
+        return i18n( i18nService, organisationUnitGroupStore.getByUid( uid ) );
     }
 
     public OrganisationUnitGroup getOrganisationUnitGroupByName( String name )
     {
-        return organisationUnitGroupStore.getByName( name );
+        return i18n( i18nService, organisationUnitGroupStore.getByName( name ) );
     }
 
     public Collection<OrganisationUnitGroup> getAllOrganisationUnitGroups()
     {
-        return organisationUnitGroupStore.getAll();
+        return i18n( i18nService, organisationUnitGroupStore.getAll() );
     }
     
     public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsWithGroupSets()
     {
-        return organisationUnitGroupStore.getOrganisationUnitGroupsWithGroupSets();
-    }
-
+        return i18n( i18nService, organisationUnitGroupStore.getOrganisationUnitGroupsWithGroupSets() );
+    }
+
+    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetween( int first, int max )
+    {
+        return i18n( i18nService, organisationUnitGroupStore.getBetween( first, max ) );
+    }
+
+    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetweenByName( String name, int first, int max )
+    {
+        return i18n( i18nService, organisationUnitGroupStore.getBetweenByName( name, first, max ) );
+    }
+
+    public int getOrganisationUnitGroupCount()
+    {
+        return organisationUnitGroupStore.getCount();
+    }
+
+    public int getOrganisationUnitGroupCountByName( String name )
+    {
+        return organisationUnitGroupStore.getCountByName( name );
+    }
+    
     // -------------------------------------------------------------------------
     // OrganisationUnitGroupSet
     // -------------------------------------------------------------------------
@@ -139,12 +169,12 @@
 
     public OrganisationUnitGroupSet getOrganisationUnitGroupSet( int id )
     {
-        return organisationUnitGroupSetStore.get( id );
+        return i18n( i18nService, organisationUnitGroupSetStore.get( id ) );
     }
 
     public OrganisationUnitGroupSet getOrganisationUnitGroupSet( String uid )
     {
-        return organisationUnitGroupSetStore.getByUid( uid );
+        return i18n( i18nService, organisationUnitGroupSetStore.getByUid( uid ) );
     }
     
     public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSets( final Collection<Integer> identifiers )
@@ -162,12 +192,12 @@
 
     public OrganisationUnitGroupSet getOrganisationUnitGroupSetByName( String name )
     {
-        return organisationUnitGroupSetStore.getByName( name );
+        return i18n( i18nService, organisationUnitGroupSetStore.getByName( name ) );
     }
 
     public Collection<OrganisationUnitGroupSet> getAllOrganisationUnitGroupSets()
     {
-        return organisationUnitGroupSetStore.getAll();
+        return i18n( i18nService, organisationUnitGroupSetStore.getAll() );
     }
 
     public Collection<OrganisationUnitGroupSet> getCompulsoryOrganisationUnitGroupSets()
@@ -223,35 +253,15 @@
         
         return groupSets;
     }
-
-    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetween( int first, int max )
-    {
-        return organisationUnitGroupStore.getBetween( first, max );
-    }
-
-    public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetweenByName( String name, int first, int max )
-    {
-        return organisationUnitGroupStore.getBetweenByName( name, first, max );
-    }
-
-    public int getOrganisationUnitGroupCount()
-    {
-        return organisationUnitGroupStore.getCount();
-    }
-
-    public int getOrganisationUnitGroupCountByName( String name )
-    {
-        return organisationUnitGroupStore.getCountByName( name );
-    }
     
     public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetween( int first, int max )
     {
-        return organisationUnitGroupSetStore.getBetween( first, max );
+        return i18n( i18nService, organisationUnitGroupSetStore.getBetween( first, max ) );
     }
     
     public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetweenByName( String name, int first, int max )
     {
-        return organisationUnitGroupSetStore.getBetweenByName( name, first, max );
+        return i18n( i18nService, organisationUnitGroupSetStore.getBetweenByName( name, first, max ) );
     }
     
     public int getOrganisationUnitGroupSetCount()
@@ -263,5 +273,4 @@
     {
         return organisationUnitGroupSetStore.getCountByName( name );
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 08:05:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 08:21:22 +0000
@@ -363,6 +363,7 @@
   <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" class="org.hisp.dhis.organisationunit.DefaultOrganisationUnitGroupService">
     <property name="organisationUnitGroupStore" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupStore" />
     <property name="organisationUnitGroupSetStore" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetStore" />
+    <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
   </bean>
 
   <bean id="org.hisp.dhis.dataanalysis.StdDevOutlierAnalysisService" class="org.hisp.dhis.dataanalysis.StdDevOutlierAnalysisService">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.vm	2011-03-19 19:30:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.vm	2012-01-22 08:21:22 +0000
@@ -19,7 +19,7 @@
 			</table>
 			<table class="listTable" id="listTable">
 				<col/>
-				<col width="96px"/>				
+				<col width="120px"/>				
                 <thead>				
 				<tr>
 					<th>$i18n.getString( "name" )</th>
@@ -29,11 +29,12 @@
 				<tbody id="list">
 				#foreach( $organisationUnitGroup in $organisationUnitGroups )
 				<tr id="tr${organisationUnitGroup.id}">
-					<td onclick="showOrganisationUnitGroupDetails( $organisationUnitGroup.id )">$encoder.htmlEncode( $organisationUnitGroup.name )</td>
+					<td onclick="showOrganisationUnitGroupDetails( $organisationUnitGroup.id )">$encoder.htmlEncode( $organisationUnitGroup.displayName )</td>
 					<td style="text-align:right">
 						<a href="openUpdateOrganisationUnitGroup.action?id=$organisationUnitGroup.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+						<a href="javascript:translate( 'OrganisationUnitGroup', '$organisationUnitGroup.id' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
 						#if( $auth.hasAccess( "dhis-web-maintenance-organisationunit", "removeOrganisationUnitGroup" ) )
-						<a href="javascript:removeOrganisationUnitGroup( $organisationUnitGroup.id, '$encoder.jsEncode( $organisationUnitGroup.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+						<a href="javascript:removeOrganisationUnitGroup( $organisationUnitGroup.id, '$encoder.jsEncode( $organisationUnitGroup.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
 						#else <img src="../images/delete-denied.png" alt="$i18n.getString( 'remove' )"/> #end
 						<a href="javascript:showOrganisationUnitGroupDetails( $organisationUnitGroup.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
 					</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.vm	2011-03-19 19:30:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.vm	2012-01-22 08:21:22 +0000
@@ -21,7 +21,7 @@
 			</table>
 			<table class="listTable" id="listTable">
 				<col/>
-				<col width="96px"/>				
+				<col width="120px"/>				
                 <thead>
 				
 				<tr>
@@ -32,11 +32,12 @@
 				<tbody id="list">
 				#foreach( $organisationUnitGroupSet in $organisationUnitGroupSets )
 				<tr id="tr${organisationUnitGroupSet.id}">
-					<td onclick="showOrganisationUnitGroupSetDetails( $organisationUnitGroupSet.id )">$encoder.htmlEncode( $organisationUnitGroupSet.name )</td>
+					<td onclick="showOrganisationUnitGroupSetDetails( $organisationUnitGroupSet.id )">$encoder.htmlEncode( $organisationUnitGroupSet.displayName )</td>
 					<td style="text-align:right">
 						<a href="showUpdateOrganisationUnitGroupSetForm.action?id=$organisationUnitGroupSet.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+						<a href="javascript:translate( 'OrganisationUnitGroupSet', '$organisationUnitGroupSet.id' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
 						#if( $auth.hasAccess( "dhis-web-maintenance-organisationunit", "removeOrganisationUnitGroupSet" ) )
-						<a href="javascript:removeOrganisationUnitGroupSet( $organisationUnitGroupSet.id, '$encoder.jsEncode( $organisationUnitGroupSet.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+						<a href="javascript:removeOrganisationUnitGroupSet( $organisationUnitGroupSet.id, '$encoder.jsEncode( $organisationUnitGroupSet.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
 						#else <img src="../images/delete-denied.png" alt="$i18n.getString( 'remove' )"/> #end
 						<a href="javascript:showOrganisationUnitGroupSetDetails( $organisationUnitGroupSet.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
 					</td>