← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21297: DV support for db translations.

 

------------------------------------------------------------
revno: 21297
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-03 16:52:41 +0100
message:
  DV support for db translations.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js


--
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-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js	2015-12-03 12:29:20 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js	2015-12-03 15:52:41 +0000
@@ -3189,19 +3189,26 @@
 
                 // init
                 var defaultKeyUiLocale = 'en',
-                    defaultKeyAnalysisDisplayProperty = 'name',
+                    defaultKeyAnalysisDisplayProperty = 'displayName',
+                    displayPropertyMap = {
+                        'name': 'displayName',
+                        'displayName': 'displayName',
+                        'shortName': 'displayShortName',
+                        'displayShortName': 'displayShortName'
+                    },
                     namePropertyUrl,
                     contextPath,
                     keyUiLocale;
 
                 init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
-                init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+                init.userAccount.settings.keyAnalysisDisplayProperty = displayPropertyMap[init.userAccount.settings.keyAnalysisDisplayProperty] || defaultKeyAnalysisDisplayProperty;
 
                 // local vars
                 contextPath = init.contextPath;
                 keyUiLocale = init.userAccount.settings.keyUiLocale;
                 keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
-                namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+                namePropertyUrl = keyAnalysisDisplayProperty + '|rename(name)';
+                dateFormat = init.systemInfo.dateFormat;
 
                 init.namePropertyUrl = namePropertyUrl;
 
@@ -3243,7 +3250,7 @@
 
         // dimensions
 		requests.push({
-			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,displayName|rename(name)&paging=false',
             disableCaching: false,
 			success: function(r) {
 				init.dimensions = r.responseText ? Ext.decode(r.responseText).dimensions : r.dimensions;
@@ -3253,7 +3260,7 @@
 
         // legend sets
         requests.push({
-            url: init.contextPath + '/api/legendSets.json?fields=id,name,legends[id,name,startValue,endValue,color]&paging=false',
+            url: init.contextPath + '/api/legendSets.json?fields=id,displayName|rename(name),legends[id,displayName|rename(name),startValue,endValue,color]&paging=false',
             success: function(r) {
                 init.legendSets = Ext.decode(r.responseText).legendSets || [];
                 fn();

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html	2015-11-10 22:06:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html	2015-12-03 15:52:41 +0000
@@ -17,7 +17,7 @@
 
 	<script>
 		Ext.onReady(function() {
-			var url = 'http://localhost:8888';
+			var url = 'http://localhost:8080';
 
 			DHIS.getChart({
 				url: url,

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2015-11-27 17:23:06 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js	2015-12-03 15:52:41 +0000
@@ -5688,7 +5688,7 @@
 					format: 'json',
 					noCache: false,
 					extraParams: {
-						fields: 'children[id,' + ns.core.init.namePropertyUrl + ',children::isNotEmpty|rename(hasChildren)&paging=false'
+						fields: 'children[id,' + namePropertyUrl + ',children::isNotEmpty|rename(hasChildren)&paging=false'
 					},
 					url: ns.core.init.contextPath + '/api/organisationUnits',
 					reader: {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js	2015-11-10 22:06:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js	2015-12-03 15:52:41 +0000
@@ -858,8 +858,8 @@
             conf.url = {
                 analysisFields: [
                     '*',
-                    'program[id,name]',
-                    'programStage[id,name]',
+                    'program[id,displayName|rename(name)]',
+                    'programStage[id,displayName|rename(name)]',
                     'columns[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
                     'rows[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
                     'filters[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
@@ -2452,7 +2452,14 @@
 					dx = dimConf.indicator.dimensionName,
 					co = dimConf.category.dimensionName,
                     aggTypes = ['COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'],
-                    displayProperty = xLayout.displayProperty || init.userAccount.settings.keyAnalysisDisplayProperty || 'name';
+                    propertyMap = {
+                        'name': 'name',
+                        'displayName': 'name',
+                        'shortName': 'shortName',
+                        'displayShortName': 'shortName'
+                    },
+                    keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty,
+                    displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name';
 
                 for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
                     dimName = axisDimensionNames[i];
@@ -4140,19 +4147,25 @@
 
                 // init
                 var defaultKeyUiLocale = 'en',
-                    defaultKeyAnalysisDisplayProperty = 'name',
+                    defaultKeyAnalysisDisplayProperty = 'displayName',
+                    displayPropertyMap = {
+                        'name': 'displayName',
+                        'displayName': 'displayName',
+                        'shortName': 'displayShortName',
+                        'displayShortName': 'displayShortName'
+                    },
                     namePropertyUrl,
                     contextPath,
                     keyUiLocale;
 
                 init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
-                init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+                init.userAccount.settings.keyAnalysisDisplayProperty = displayPropertyMap[init.userAccount.settings.keyAnalysisDisplayProperty] || defaultKeyAnalysisDisplayProperty;
 
                 // local vars
                 contextPath = init.contextPath;
                 keyUiLocale = init.userAccount.settings.keyUiLocale;
                 keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
-                namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+                namePropertyUrl = keyAnalysisDisplayProperty + '|rename(name)';
 
                 init.namePropertyUrl = namePropertyUrl;
 
@@ -4162,7 +4175,7 @@
 
         // user orgunit
 		requests.push({
-			url: init.contextPath + '/api/organisationUnits.' + type + '?userOnly=true&fields=id,name,children[id,name]&paging=false',
+			url: init.contextPath + '/api/organisationUnits.' + type + '?userOnly=true&fields=id,displayName|rename(name),children[id,displayName|rename(name)]&paging=false',
             disableCaching: false,
 			success: function(r) {
 				var organisationUnits = (r.responseText ? Ext.decode(r.responseText).organisationUnits : r) || [],
@@ -4194,7 +4207,7 @@
 		});
 
 		requests.push({
-			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,displayName|rename(name)&paging=false',
             disableCaching: false,
 			success: function(r) {
 				init.dimensions = r.responseText ? Ext.decode(r.responseText).dimensions : r.dimensions;

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js	2015-11-10 22:06:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js	2015-12-03 15:52:41 +0000
@@ -858,8 +858,8 @@
             conf.url = {
                 analysisFields: [
                     '*',
-                    'program[id,name]',
-                    'programStage[id,name]',
+                    'program[id,displayName|rename(name)]',
+                    'programStage[id,displayName|rename(name)]',
                     'columns[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
                     'rows[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
                     'filters[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
@@ -2452,7 +2452,14 @@
 					dx = dimConf.indicator.dimensionName,
 					co = dimConf.category.dimensionName,
                     aggTypes = ['COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'],
-                    displayProperty = xLayout.displayProperty || init.userAccount.settings.keyAnalysisDisplayProperty || 'name';
+                    propertyMap = {
+                        'name': 'name',
+                        'displayName': 'name',
+                        'shortName': 'shortName',
+                        'displayShortName': 'shortName'
+                    },
+                    keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty,
+                    displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name';
 
                 for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
                     dimName = axisDimensionNames[i];
@@ -4140,19 +4147,25 @@
 
                 // init
                 var defaultKeyUiLocale = 'en',
-                    defaultKeyAnalysisDisplayProperty = 'name',
+                    defaultKeyAnalysisDisplayProperty = 'displayName',
+                    displayPropertyMap = {
+                        'name': 'displayName',
+                        'displayName': 'displayName',
+                        'shortName': 'displayShortName',
+                        'displayShortName': 'displayShortName'
+                    },
                     namePropertyUrl,
                     contextPath,
                     keyUiLocale;
 
                 init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
-                init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+                init.userAccount.settings.keyAnalysisDisplayProperty = displayPropertyMap[init.userAccount.settings.keyAnalysisDisplayProperty] || defaultKeyAnalysisDisplayProperty;
 
                 // local vars
                 contextPath = init.contextPath;
                 keyUiLocale = init.userAccount.settings.keyUiLocale;
                 keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
-                namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+                namePropertyUrl = keyAnalysisDisplayProperty + '|rename(name)';
 
                 init.namePropertyUrl = namePropertyUrl;
 
@@ -4162,7 +4175,7 @@
 
         // user orgunit
 		requests.push({
-			url: init.contextPath + '/api/organisationUnits.' + type + '?userOnly=true&fields=id,name,children[id,name]&paging=false',
+			url: init.contextPath + '/api/organisationUnits.' + type + '?userOnly=true&fields=id,displayName|rename(name),children[id,displayName|rename(name)]&paging=false',
             disableCaching: false,
 			success: function(r) {
 				var organisationUnits = (r.responseText ? Ext.decode(r.responseText).organisationUnits : r) || [],
@@ -4194,7 +4207,7 @@
 		});
 
 		requests.push({
-			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,displayName|rename(name)&paging=false',
             disableCaching: false,
 			success: function(r) {
 				init.dimensions = r.responseText ? Ext.decode(r.responseText).dimensions : r.dimensions;

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-11-10 22:06:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-12-03 15:52:41 +0000
@@ -858,8 +858,8 @@
             conf.url = {
                 analysisFields: [
                     '*',
-                    'program[id,name]',
-                    'programStage[id,name]',
+                    'program[id,displayName|rename(name)]',
+                    'programStage[id,displayName|rename(name)]',
                     'columns[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
                     'rows[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
                     'filters[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
@@ -2452,7 +2452,14 @@
 					dx = dimConf.indicator.dimensionName,
 					co = dimConf.category.dimensionName,
                     aggTypes = ['COUNT', 'SUM', 'STDDEV', 'VARIANCE', 'MIN', 'MAX'],
-                    displayProperty = xLayout.displayProperty || init.userAccount.settings.keyAnalysisDisplayProperty || 'name';
+                    propertyMap = {
+                        'name': 'name',
+                        'displayName': 'name',
+                        'shortName': 'shortName',
+                        'displayShortName': 'shortName'
+                    },
+                    keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty,
+                    displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name';
 
                 for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
                     dimName = axisDimensionNames[i];
@@ -4140,19 +4147,25 @@
 
                 // init
                 var defaultKeyUiLocale = 'en',
-                    defaultKeyAnalysisDisplayProperty = 'name',
+                    defaultKeyAnalysisDisplayProperty = 'displayName',
+                    displayPropertyMap = {
+                        'name': 'displayName',
+                        'displayName': 'displayName',
+                        'shortName': 'displayShortName',
+                        'displayShortName': 'displayShortName'
+                    },
                     namePropertyUrl,
                     contextPath,
                     keyUiLocale;
 
                 init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
-                init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+                init.userAccount.settings.keyAnalysisDisplayProperty = displayPropertyMap[init.userAccount.settings.keyAnalysisDisplayProperty] || defaultKeyAnalysisDisplayProperty;
 
                 // local vars
                 contextPath = init.contextPath;
                 keyUiLocale = init.userAccount.settings.keyUiLocale;
                 keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
-                namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+                namePropertyUrl = keyAnalysisDisplayProperty + '|rename(name)';
 
                 init.namePropertyUrl = namePropertyUrl;
 
@@ -4162,7 +4175,7 @@
 
         // user orgunit
 		requests.push({
-			url: init.contextPath + '/api/organisationUnits.' + type + '?userOnly=true&fields=id,name,children[id,name]&paging=false',
+			url: init.contextPath + '/api/organisationUnits.' + type + '?userOnly=true&fields=id,displayName|rename(name),children[id,displayName|rename(name)]&paging=false',
             disableCaching: false,
 			success: function(r) {
 				var organisationUnits = (r.responseText ? Ext.decode(r.responseText).organisationUnits : r) || [],
@@ -4194,7 +4207,7 @@
 		});
 
 		requests.push({
-			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+			url: init.contextPath + '/api/dimensions.' + type + '?fields=id,displayName|rename(name)&paging=false',
             disableCaching: false,
 			success: function(r) {
 				init.dimensions = r.responseText ? Ext.decode(r.responseText).dimensions : r.dimensions;