dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20746
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9630: Translation for OptionSet object.
------------------------------------------------------------
revno: 9630
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-01-28 13:59:48 +0700
message:
Translation for OptionSet object.
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.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-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.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/option/DefaultOptionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-11-01 15:15:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2013-01-28 06:59:48 +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 java.util.List;
+import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -40,6 +43,10 @@
public class DefaultOptionService
implements OptionService
{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
private OptionStore optionStore;
public void setOptionStore( OptionStore optionStore )
@@ -47,6 +54,17 @@
this.optionStore = optionStore;
}
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation methods
+ // -------------------------------------------------------------------------
+
public int saveOptionSet( OptionSet optionSet )
{
return optionStore.save( optionSet );
@@ -56,20 +74,20 @@
{
optionStore.update( optionSet );
}
-
+
public OptionSet getOptionSet( int id )
{
- return optionStore.get( id );
+ return i18n( i18nService, optionStore.get( id ));
}
public OptionSet getOptionSet( String uid )
{
- return optionStore.getByUid( uid );
+ return i18n( i18nService, optionStore.getByUid( uid ));
}
-
+
public OptionSet getOptionSetByName( String name )
{
- return optionStore.getByName( name );
+ return i18n( i18nService, optionStore.getByName( name ));
}
public void deleteOptionSet( OptionSet optionSet )
@@ -79,17 +97,17 @@
public Collection<OptionSet> getAllOptionSets()
{
- return optionStore.getAll();
+ return i18n( i18nService, optionStore.getAll());
}
-
- public List<String> getOptions( int optionSetId, String key, Integer max )
+
+ public List<String> getOptions( int optionSetId, String key, Integer max )
{
List<String> options = null;
-
+
if ( key != null || max != null )
{
// Use query as option set size might be very high
-
+
options = optionStore.getOptions( optionSetId, key, max );
}
else
@@ -97,10 +115,10 @@
// Return all from object association to preserve custom order
OptionSet optionSet = getOptionSet( optionSetId );
-
+
options = new ArrayList<String>( optionSet.getOptions() );
}
-
+
return options;
}
}
=== 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 2013-01-28 06:47:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-01-28 06:59:48 +0000
@@ -556,6 +556,7 @@
<bean id="org.hisp.dhis.option.OptionService" class="org.hisp.dhis.option.DefaultOptionService">
<property name="optionStore" ref="org.hisp.dhis.option.OptionStore" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
</bean>
<bean id="org.hisp.dhis.mapping.MappingService" class="org.hisp.dhis.mapping.DefaultMappingService">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm 2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm 2013-01-28 06:59:48 +0000
@@ -1,7 +1,7 @@
{ "optionSet":
{
"id": "${optionSet.id}",
- "name": "$!encoder.jsonEncode( ${optionSet.name} )",
+ "name": "$!encoder.jsonEncode( ${optionSet.displayName} )",
"optionCount": "$!{optionSet.options.size()}"
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm 2012-04-16 12:26:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm 2013-01-28 06:59:48 +0000
@@ -13,7 +13,7 @@
<td style="vertical-align:top">
<table class="listTable">
<col>
- <col width="90">
+ <col width="120">
<tr>
<td>
$i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:250px"/>
@@ -29,10 +29,11 @@
<tbody id="list">
#foreach( $optionSet in $optionSets )
<tr id="tr${optionSet.id}">
- <td>$encoder.htmlEncode( $optionSet.name )</td>
+ <td>$encoder.htmlEncode( $optionSet.displayName )</td>
<td style="text-align:right">
<a href="showUpdateOptionSetForm.action?id=$optionSet.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
- <a href="javascript:removeOptionSet( $optionSet.id, '$encoder.jsEncode( $optionSet.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:translate( 'OptionSet', '$optionSet.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeOptionSet( $optionSet.id, '$encoder.jsEncode( $optionSet.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
<a href="javascript:showOptionSetDetails( $optionSet.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2013-01-28 06:47:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2013-01-28 06:59:48 +0000
@@ -140,7 +140,7 @@
<select id="selectedOptionSetId" name="selectedOptionSetId">
<option value="0">[$i18n.getString('please_select')]</option>
#foreach ( $optionSet in $optionSets )
- <option value="$optionSet.id">$encoder.htmlEncode( $optionSet.name )</option>
+ <option value="$optionSet.id">$encoder.htmlEncode( $optionSet.displayName )</option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2013-01-28 06:47:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2013-01-28 06:59:48 +0000
@@ -159,7 +159,7 @@
<select id="selectedOptionSetId" name="selectedOptionSetId">
<option value="0">[$i18n.getString('please_select')]</option>
#foreach ( $optionSet in $optionSets )
- <option value="$optionSet.id" #if( $dataElement.optionSet && $dataElement.optionSet.id == "$optionSet.id" ) selected #end>$encoder.htmlEncode( $optionSet.name )</option>
+ <option value="$optionSet.id" #if( $dataElement.optionSet && $dataElement.optionSet.id == "$optionSet.id" ) selected #end>$encoder.htmlEncode( $optionSet.displayName )</option>
#end
</select>
</td>