← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9711: Translation for person-attribute-group object.

 

------------------------------------------------------------
revno: 9711
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-04 23:14:38 +0700
message:
  Translation for person-attribute-group object.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.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/patient/DefaultPatientAttributeGroupService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java	2012-09-11 13:35:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeGroupService.java	2013-02-04 16:14:38 +0000
@@ -26,8 +26,11 @@
  */
 package org.hisp.dhis.patient;
 
+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.patientAttributeGroupStore = patientAttributeGroupStore;
     }
 
+    private I18nService i18nService;
+
+    public void setI18nService( I18nService service )
+    {
+        i18nService = service;
+    }
+
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -70,17 +80,17 @@
 
     public PatientAttributeGroup getPatientAttributeGroup( int id )
     {
-        return patientAttributeGroupStore.get( id );
+        return i18n( i18nService, patientAttributeGroupStore.get( id ) );
     }
 
     public PatientAttributeGroup getPatientAttributeGroupByName( String name )
     {
-        return patientAttributeGroupStore.getByName( name );
+        return i18n( i18nService, patientAttributeGroupStore.getByName( name ) );
     }
 
     public Collection<PatientAttributeGroup> getAllPatientAttributeGroups()
     {
-        return patientAttributeGroupStore.getAll();
+        return i18n( i18nService, patientAttributeGroupStore.getAll() );
     }
-    
+
 }

=== 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-04 03:09:04 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml	2013-02-04 16:14:38 +0000
@@ -302,6 +302,7 @@
 		class="org.hisp.dhis.patient.DefaultPatientAttributeGroupService">
 		<property name="patientAttributeGroupStore"
 			ref="org.hisp.dhis.patient.PatientAttributeGroupStore" />
+		<property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.program.ProgramStageDataElementService"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2013-02-02 10:34:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ShowAddPatientFormAction.java	2013-02-04 16:14:38 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientAttributeGroupService;
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientIdentifierTypeService;
@@ -94,7 +95,7 @@
     {
         this.patientRegistrationFormService = patientRegistrationFormService;
     }
-
+    
     private I18n i18n;
 
     public void setI18n( I18n i18n )
@@ -178,8 +179,8 @@
 
             if ( patientRegistrationForm != null )
             {
-                customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd( patientRegistrationForm
-                    .getDataEntryForm().getHtmlCode(), healthWorkers, null, null, i18n, format );
+                customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd(
+                    patientRegistrationForm.getDataEntryForm().getHtmlCode(), healthWorkers, null, null, i18n, format );
             }
         }
         else
@@ -205,30 +206,32 @@
             attributeGroupsMap = new HashMap<PatientAttributeGroup, Collection<PatientAttribute>>();
             for ( PatientAttribute patientAttribute : patientAttributes )
             {
-                PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
-                if ( attributeGroup != null )
+                if ( !patientAttribute.getValueType().equals( PatientAttribute.TYPE_CALCULATED ) )
                 {
-                    if ( attributeGroupsMap.containsKey( attributeGroup ) )
+                    PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
+                    if ( attributeGroup != null )
                     {
-                        Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
-                        attributes.add( patientAttribute );
+                        if ( attributeGroupsMap.containsKey( attributeGroup ) )
+                        {
+                            Collection<PatientAttribute> attributes = attributeGroupsMap.get( attributeGroup );
+                            attributes.add( patientAttribute );
+                        }
+                        else
+                        {
+                            Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+                            attributes.add( patientAttribute );
+                            attributeGroupsMap.put( attributeGroup, attributes );
+                        }
                     }
                     else
                     {
-                        Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
-                        attributes.add( patientAttribute );
-                        attributeGroupsMap.put( attributeGroup, attributes );
+                        noGroupAttributes.add( patientAttribute );
                     }
                 }
-                else
-                {
-                    noGroupAttributes.add( patientAttribute );
-                }
             }
 
         }
 
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-02-01 08:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm	2013-02-04 16:14:38 +0000
@@ -138,10 +138,10 @@
 	#end
 
 	<!-- ATTRIBUTES IN GROUPS -->
-
+	
 	#foreach ($attributeGroup in $attributeGroupsMap.keySet() )
 		<tr><td>&nbsp;</td></tr>
-		<tr><th colspan="2" class="heading-column">$attributeGroup.name</th></tr>
+		<tr><th colspan="2" class="heading-column">$attributeGroup.displayName</th></tr>
 		#set($attributes = $attributeGroupsMap.get($attributeGroup))
 		#foreach($attribute in $attributes )
 			#set($value = "")
@@ -182,7 +182,7 @@
 	<!-- ATTRIBUTES NOT IN GROUPS -->
 
 	#if ( $noGroupAttributes && $noGroupAttributes.size() > 0) 	
-		<tr><th colspan="2" class="heading-column">$i18n.getString( "Other details" )</th></tr>
+		<tr><th colspan="2" class="heading-column">$i18n.getString( "other_details" )</th></tr>
 		#foreach($attribute in $noGroupAttributes )
 		#if( $!attribute && $attribute.program )
 		#elseif( $!attribute )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm	2012-10-30 04:15:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm	2013-02-04 16:14:38 +0000
@@ -7,36 +7,29 @@
     
       <table class="listTable">
           <col>          
-          <col width="20">
-          <col width="20">
-          <col width="20">          		  
+          <col width="120">       		  
 		  <tr>
 		  	<td></td>
-			<td colspan="3" style="text-align:right">
+			<td style="text-align:right">
 				<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddPatientAttributeGroupForm.action'" style="width:75px">
 				<input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortPatientAttributeGroup.action'" style="width:75px"><br>
 			</td>
 		  </tr>
           <tr>
             <th>$i18n.getString( "name" )</th>
-            <th colspan="3">$i18n.getString( "operations" )</th>
+            <th>$i18n.getString( "operations" )</th>
           </tr>
 
           <tbody id="list">
             #foreach( $patientAttributeGroup in $patientAttributeGroups )
               <tr id="tr${patientAttributeGroup.id}">
               
-                <td onclick="showPatientAttributeGroupDetails( $patientAttributeGroup.id )">$encoder.htmlEncode( $patientAttributeGroup.name )</td>                
+                <td onclick="showPatientAttributeGroupDetails( $patientAttributeGroup.id )">$encoder.htmlEncode( $patientAttributeGroup.displayName )</td>                
                 
-                <td style="text-align:center"#alternate( $mark )>
+                <td>
                   <a href="showUpdatePatientAttributeGroupForm.action?id=$patientAttributeGroup.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:removePatientAttributeGroup( '$patientAttributeGroup.id', '$encoder.jsEncode( $patientAttributeGroup.name )' )" 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( 'PatientAttributeGroup', '$patientAttributeGroup.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+			      <a href="javascript:removePatientAttributeGroup( '$patientAttributeGroup.id', '$encoder.jsEncode( $patientAttributeGroup.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
                   <a href="javascript:showPatientAttributeGroupDetails( $patientAttributeGroup.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
                 </td>