← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9817: Translation for relationship type.

 

------------------------------------------------------------
revno: 9817
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-18 09:49:25 +0700
message:
  Translation for relationship type.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/relationshipType.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-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java	2011-03-31 01:55:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipTypeService.java	2013-02-18 02:49:25 +0000
@@ -26,8 +26,11 @@
  */
 package org.hisp.dhis.relationship;
 
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
 import java.util.Collection;
 
+import org.hisp.dhis.i18n.I18nService;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -49,6 +52,13 @@
         this.relationshipTypeStore = relationshipTypeStore;
     }
 
+    private I18nService i18nService;
+
+    public void setI18nService( I18nService service )
+    {
+        i18nService = service;
+    }
+
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -60,12 +70,12 @@
 
     public Collection<RelationshipType> getAllRelationshipTypes()
     {
-        return relationshipTypeStore.getAll();
+        return i18n( i18nService, relationshipTypeStore.getAll() );
     }
 
     public RelationshipType getRelationshipType( int id )
     {
-        return relationshipTypeStore.get( id );
+        return i18n( i18nService, relationshipTypeStore.get( id ) );
     }
 
     public int saveRelationshipType( RelationshipType relationshipType )
@@ -80,6 +90,6 @@
 
     public RelationshipType getRelationshipType( String aIsToB, String bIsToA )
     {
-        return relationshipTypeStore.getRelationshipType( aIsToB, bIsToA );
+        return i18n( i18nService, relationshipTypeStore.getRelationshipType( aIsToB, bIsToA ) );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2013-02-13 15:58:32 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2013-02-18 02:49:25 +0000
@@ -190,6 +190,7 @@
 		class="org.hisp.dhis.relationship.DefaultRelationshipTypeService">
 		<property name="relationshipTypeStore"
 			ref="org.hisp.dhis.relationship.RelationshipTypeStore" />
+		<property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.program.ProgramStageInstanceService"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/relationshipType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/relationshipType.vm	2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/relationshipType.vm	2013-02-18 02:49:25 +0000
@@ -7,10 +7,8 @@
     
       <table class="listTable">          
           <col>
-          <col>                    
-          <col width="20">
-          <col width="20">
-          <col width="20">                    		  
+		  <col>
+          <col width="120">
 		  <tr>
 		  	<td></td>
 		  	<td></td>
@@ -19,7 +17,7 @@
           <tr>
             <th>$i18n.getString( "relationship_type" )</th>            
             <th>$i18n.getString( "name" )</th>
-            <th colspan="3">$i18n.getString( "operations" )</th>
+            <th>$i18n.getString( "operations" )</th>
           </tr>
 
           <tbody id="list">
@@ -28,17 +26,11 @@
               
                 <td onclick="showRelationshipTypeDetails( $relationshipType.id )">$encoder.htmlEncode( $relationshipType.aIsToB )/$encoder.htmlEncode( $relationshipType.bIsToA )</td>
                 
-                <td onclick="showRelationshipTypeDetails( $relationshipType.id )">$encoder.htmlEncode( $relationshipType.name )</td>               
+                <td onclick="showRelationshipTypeDetails( $relationshipType.id )">$encoder.htmlEncode( $relationshipType.displayName )</td>               
                 
                 <td style="text-align:center"#alternate( $mark )>
                   <a href="showUpdateRelationshipTypeForm.action?id=$relationshipType.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
-                </td>                
- 
-                <td style="text-align:center"#alternate( $mark )>
-                  <a href="javascript:removeRelationshipType( '$relationshipType.id', '$encoder.jsEncode( $relationshipType.aIsToB )', '$encoder.jsEncode( $relationshipType.bIsToA )'  )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
-                </td>    
-                
-                <td style="text-align:center"#alternate( $mark )>                                      
+				  <a href="javascript:translate( 'RelationshipType', '$relationshipType.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>  <a href="javascript:removeRelationshipType( '$relationshipType.id', '$encoder.jsEncode( $relationshipType.aIsToB )', '$encoder.jsEncode( $relationshipType.bIsToA )'  )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
                   <a href="javascript:showRelationshipTypeDetails( $relationshipType.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
                 </td>