dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31802
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16242: Fixed bug, mismatch between sharing and translations of category option, category, category combo
------------------------------------------------------------
revno: 16242
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-07-25 15:31:03 +0200
message:
Fixed bug, mismatch between sharing and translations of category option, category, category combo
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.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-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2014-07-25 13:31:03 +0000
@@ -39,6 +39,10 @@
import java.util.ListIterator;
import java.util.Map;
+import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+
/**
* @author Lars Helge Overland
*/
@@ -48,6 +52,12 @@
private static final String SEPARATOR = "-";
private static final SimpleDateFormat LONG_DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss" );
+ public static final Map<String, String> CLASS_ALIAS = new HashMap<String, String>() {{
+ put( "CategoryOption", DataElementCategoryOption.class.getSimpleName() );
+ put( "Category", DataElementCategory.class.getSimpleName() );
+ put( "CategoryCombo", DataElementCategoryCombo.class.getSimpleName() );
+ } };
+
/**
* Joins the names of the IdentifiableObjects in the given list and separates
* them with a comma and space. Returns null if the given list is null or has
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java 2014-06-24 21:22:44 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java 2014-07-25 13:31:03 +0000
@@ -48,6 +48,7 @@
// -------------------------------------------------------------------------
// Dependency
// -------------------------------------------------------------------------
+
@Autowired
private I18nManager manager;
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java 2014-07-08 07:36:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java 2014-07-25 13:31:03 +0000
@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.common.IdentifiableObjectUtils.CLASS_ALIAS;
+
import java.util.Locale;
import java.util.Map;
@@ -41,7 +43,6 @@
*/
public class GetTranslationsAction
extends ActionSupport
-
{
private String className;
@@ -93,6 +94,8 @@
public String execute()
throws Exception
{
+ className = className != null && CLASS_ALIAS.containsKey( className ) ? CLASS_ALIAS.get( className ) : className;
+
Locale locale = LocaleUtils.getLocale( loc );
translations = i18nService.getTranslationsNoFallback( className, objectUid, locale );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java 2014-05-05 12:22:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java 2014-07-25 13:31:03 +0000
@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.common.IdentifiableObjectUtils.CLASS_ALIAS;
+
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
@@ -165,6 +167,8 @@
public String execute()
throws Exception
{
+ className = className != null && CLASS_ALIAS.containsKey( className ) ? CLASS_ALIAS.get( className ) : className;
+
currentLocale = i18nService.getCurrentLocale();
availableLocales = i18nService.getAvailableLocales();
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java 2014-05-05 12:22:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java 2014-07-25 13:31:03 +0000
@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.common.IdentifiableObjectUtils.CLASS_ALIAS;
+
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
@@ -142,6 +144,8 @@
public String execute()
throws Exception
{
+ className = className != null && CLASS_ALIAS.containsKey( className ) ? CLASS_ALIAS.get( className ) : className;
+
log.info( "Classname: " + className + ", uid: " + uid + ", loc: " + loc );
IdentifiableObject object = identifiableObjectManager.getObject( uid , className );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm 2014-07-18 10:53:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm 2014-07-25 13:31:03 +0000
@@ -64,7 +64,7 @@
<tbody id="list">
#foreach( $dataElementCategory in $dataElementCategories )
#if( $dataElementCategory.id != $defaultCategory.id )
- <tr id="tr${dataElementCategory.id}" data-id="$!dataElementCategory.id" data-uid="$!dataElementCategory.uid" data-type="DataElementCategory" data-name="$encoder.htmlEncode( $!dataElementCategory.displayName )"
+ <tr id="tr${dataElementCategory.id}" data-id="$!dataElementCategory.id" data-uid="$!dataElementCategory.uid" data-type="Category" data-name="$encoder.htmlEncode( $!dataElementCategory.displayName )"
data-can-manage="$security.canManage( $dataElementCategory )"
data-can-update="$security.canUpdate( $dataElementCategory )"
data-can-delete="$security.canDelete( $dataElementCategory )">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm 2014-07-18 10:53:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryOption.vm 2014-07-25 13:31:03 +0000
@@ -67,7 +67,7 @@
<tbody id="list">
#foreach( $dataElementCategoryOption in $dataElementCategoryOptions )
#if( $dataElementCategoryOption.id != $defaultCategoryOption.id )
- <tr id="tr${dataElementCategoryOption.id}" data-id="$!dataElementCategoryOption.id" data-uid="$!dataElementCategoryOption.uid" data-type="DataElementCategoryOption" data-name="$encoder.htmlEncode( $!dataElementCategoryOption.displayName )"
+ <tr id="tr${dataElementCategoryOption.id}" data-id="$!dataElementCategoryOption.id" data-uid="$!dataElementCategoryOption.uid" data-type="CategoryOption" data-name="$encoder.htmlEncode( $!dataElementCategoryOption.displayName )"
data-can-manage="$security.canManage( $dataElementCategoryOption )"
data-can-update="$security.canUpdate( $dataElementCategoryOption )"
data-can-delete="$security.canDelete( $dataElementCategoryOption )">