← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 21288
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-03 12:08:09 +0100
message:
  GIS support for db translations.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/plugin.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.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-mapping/plugin.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/plugin.html	2015-11-10 14:39:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/plugin.html	2015-12-03 11:08:09 +0000
@@ -7,9 +7,9 @@
     <link rel="stylesheet" type="text/css" href="//localhost:8080/dhis-web-commons/javascripts/ext/resources/css/ext-all-gray.css"/>
 -->
 
-    <script src="//localhost:8888/dhis-web-commons/javascripts/ext/ext-all.js"></script>
-    <script src="//maps.google.com/maps/api/js?sensor=false"></script>
-    <script src="//localhost:8888/dhis-web-commons/javascripts/openlayers/OpenLayers.js"></script>
+    <script src="../dhis-web-commons/javascripts/ext/ext-all.js"></script>
+    <script src="//maps.google.com/maps/api/js?v=3.22&sensor=false"></script>
+    <script src="//localhost:8080/dhis-web-commons/javascripts/openlayers/OpenLayers.js"></script>
     <script src="scripts/map.js"></script>
 
     <style>
@@ -27,7 +27,7 @@
 
     <script>
 		Ext.onReady(function() {
-			var url = "http://localhost:8888";;
+			var url = "http://localhost:8080";;
 
 			GIS.plugin.getMap({
 				url: url,

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-11-29 18:32:14 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-12-03 11:08:09 +0000
@@ -5018,7 +5018,7 @@
 					format: 'json',
 					noCache: false,
 					extraParams: {
-						fields: 'children[id,' + nameProperty + '|rename(text),children::isNotEmpty|rename(hasChildren)&paging=false'
+						fields: 'children[id,' + gis.init.namePropertyUrl + ',children::isNotEmpty|rename(hasChildren)&paging=false'
 					},
 					url: gis.init.contextPath + '/api/organisationUnits',
 					reader: {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-11-23 13:15:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-12-03 11:08:09 +0000
@@ -2960,6 +2960,14 @@
 
 		loadOrganisationUnits = function(view) {
             var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -2968,7 +2976,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3223,6 +3231,14 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3231,7 +3247,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3571,6 +3587,14 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3579,7 +3603,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3644,7 +3668,15 @@
 				dxItems = view.columns[0].items,
 				isOperand = view.columns[0].dimension === dimConf.operand.objectName,
 				peItems = view.filters[0].items,
-				ouItems = view.rows[0].items;
+				ouItems = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[view.displayProperty] || 'name';
 
 			// ou
 			paramString += 'dimension=ou:';
@@ -3678,7 +3710,7 @@
 			}
 
             // display property
-            paramString += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();            
+            paramString += '&displayProperty=' + displayProperty.toUpperCase();            
 
             if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                 paramString += '&userOrgUnit=';
@@ -6683,7 +6715,6 @@
         var isInit = false,
             requests = [],
             callbacks = 0,
-            type = 'json',
             ajax,
             fn;
 
@@ -6714,7 +6745,7 @@
         
         // dhis2
         requests.push({
-            url: init.contextPath + '/api/systemSettings.' + type + '?key=keyCalendar&key=keyDateFormat',
+            url: init.contextPath + '/api/systemSettings.json?key=keyCalendar&key=keyDateFormat',
             disableCaching: false,
             success: function(r) {
                 var systemSettings = r.responseText ? Ext.decode(r.responseText) : r,
@@ -6725,14 +6756,20 @@
 
                 // user-account
                 userAccountConfig = {
-                    url: init.contextPath + '/api/me/user-account.' + type,
+                    url: init.contextPath + '/api/me/user-account.json',
                     disableCaching: false,
                     success: function(r) {
                         init.userAccount = r.responseText ? Ext.decode(r.responseText) : r;
 
                         var onScriptReady = function() {
                             var defaultKeyUiLocale = 'en',
-                                defaultKeyAnalysisDisplayProperty = 'name',
+                                defaultKeyAnalysisDisplayProperty = 'displayName',
+                                displayPropertyMap = {
+                                    'name': 'displayName',
+                                    'displayName': 'displayName',
+                                    'shortName': 'displayShortName',
+                                    'displayShortName': 'displayShortName'
+                                },
                                 namePropertyUrl,
                                 contextPath,
                                 keyUiLocale,
@@ -6740,13 +6777,13 @@
                                 optionSetVersionConfig;
 
                             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;
@@ -6761,7 +6798,7 @@
                             });
 
                             optionSetVersionConfig = {
-                                url: contextPath + '/api/optionSets.' + type + '?fields=id,version&paging=false',
+                                url: contextPath + '/api/optionSets.json?fields=id,version&paging=false',
                                 disableCaching: false,
                                 success: function(r) {
                                     var optionSets = (r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets) || [],
@@ -6779,7 +6816,7 @@
                                     }
 
                                     optionSetConfig = {
-                                        url: contextPath + '/api/optionSets.' + type + '?fields=id,name,version,options[code,name]&paging=false' + url,
+                                        url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url,
                                         disableCaching: false,
                                         success: function(r) {
                                             var sets = r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets;
@@ -6853,7 +6890,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.json?userOnly=true&fields=id,' + init.namePropertyUrl + ',children[id,' + init.namePropertyUrl + ']&paging=false',
             disableCaching: false,
             success: function(r) {
                 var organisationUnits = (r.responseText ? Ext.decode(r.responseText).organisationUnits : r) || [],
@@ -6884,7 +6921,7 @@
 
         // dimensions
         requests.push({
-            url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+            url: init.contextPath + '/api/dimensions.json?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-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2015-11-27 16:01:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2015-12-03 11:08:09 +0000
@@ -5608,7 +5608,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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-11-23 13:16:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-12-03 11:08:09 +0000
@@ -2960,6 +2960,14 @@
 
 		loadOrganisationUnits = function(view) {
             var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -2968,7 +2976,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3223,6 +3231,14 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3231,7 +3247,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3571,6 +3587,14 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3579,7 +3603,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3644,7 +3668,15 @@
 				dxItems = view.columns[0].items,
 				isOperand = view.columns[0].dimension === dimConf.operand.objectName,
 				peItems = view.filters[0].items,
-				ouItems = view.rows[0].items;
+				ouItems = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[view.displayProperty] || 'name';
 
 			// ou
 			paramString += 'dimension=ou:';
@@ -3678,7 +3710,7 @@
 			}
 
             // display property
-            paramString += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();            
+            paramString += '&displayProperty=' + displayProperty.toUpperCase();            
 
             if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                 paramString += '&userOrgUnit=';
@@ -6683,7 +6715,6 @@
         var isInit = false,
             requests = [],
             callbacks = 0,
-            type = 'json',
             ajax,
             fn;
 
@@ -6714,7 +6745,7 @@
         
         // dhis2
         requests.push({
-            url: init.contextPath + '/api/systemSettings.' + type + '?key=keyCalendar&key=keyDateFormat',
+            url: init.contextPath + '/api/systemSettings.json?key=keyCalendar&key=keyDateFormat',
             disableCaching: false,
             success: function(r) {
                 var systemSettings = r.responseText ? Ext.decode(r.responseText) : r,
@@ -6725,14 +6756,20 @@
 
                 // user-account
                 userAccountConfig = {
-                    url: init.contextPath + '/api/me/user-account.' + type,
+                    url: init.contextPath + '/api/me/user-account.json',
                     disableCaching: false,
                     success: function(r) {
                         init.userAccount = r.responseText ? Ext.decode(r.responseText) : r;
 
                         var onScriptReady = function() {
                             var defaultKeyUiLocale = 'en',
-                                defaultKeyAnalysisDisplayProperty = 'name',
+                                defaultKeyAnalysisDisplayProperty = 'displayName',
+                                displayPropertyMap = {
+                                    'name': 'displayName',
+                                    'displayName': 'displayName',
+                                    'shortName': 'displayShortName',
+                                    'displayShortName': 'displayShortName'
+                                },
                                 namePropertyUrl,
                                 contextPath,
                                 keyUiLocale,
@@ -6740,13 +6777,13 @@
                                 optionSetVersionConfig;
 
                             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;
@@ -6761,7 +6798,7 @@
                             });
 
                             optionSetVersionConfig = {
-                                url: contextPath + '/api/optionSets.' + type + '?fields=id,version&paging=false',
+                                url: contextPath + '/api/optionSets.json?fields=id,version&paging=false',
                                 disableCaching: false,
                                 success: function(r) {
                                     var optionSets = (r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets) || [],
@@ -6779,7 +6816,7 @@
                                     }
 
                                     optionSetConfig = {
-                                        url: contextPath + '/api/optionSets.' + type + '?fields=id,name,version,options[code,name]&paging=false' + url,
+                                        url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url,
                                         disableCaching: false,
                                         success: function(r) {
                                             var sets = r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets;
@@ -6853,7 +6890,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.json?userOnly=true&fields=id,' + init.namePropertyUrl + ',children[id,' + init.namePropertyUrl + ']&paging=false',
             disableCaching: false,
             success: function(r) {
                 var organisationUnits = (r.responseText ? Ext.decode(r.responseText).organisationUnits : r) || [],
@@ -6884,7 +6921,7 @@
 
         // dimensions
         requests.push({
-            url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+            url: init.contextPath + '/api/dimensions.json?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/map.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-11-23 13:16:14 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-12-03 11:08:09 +0000
@@ -2960,6 +2960,14 @@
 
 		loadOrganisationUnits = function(view) {
             var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -2968,7 +2976,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3223,6 +3231,14 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3231,7 +3247,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3571,6 +3587,14 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[xLayout.displayProperty] || 'name',
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3579,7 +3603,7 @@
                         params += i !== items.length - 1 ? ';' : '';
                     }
 
-                    params += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();
+                    params += '&displayProperty=' + displayProperty.toUpperCase();
 
                     if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                         params += '&userOrgUnit=';
@@ -3644,7 +3668,15 @@
 				dxItems = view.columns[0].items,
 				isOperand = view.columns[0].dimension === dimConf.operand.objectName,
 				peItems = view.filters[0].items,
-				ouItems = view.rows[0].items;
+				ouItems = view.rows[0].items,
+                propertyMap = {
+                    'name': 'name',
+                    'displayName': 'name',
+                    'shortName': 'shortName',
+                    'displayShortName': 'shortName'
+                },
+                keyAnalysisDisplayProperty = gis.init.userAccount.settings.keyAnalysisDisplayProperty,
+                displayProperty = propertyMap[keyAnalysisDisplayProperty] || propertyMap[view.displayProperty] || 'name';
 
 			// ou
 			paramString += 'dimension=ou:';
@@ -3678,7 +3710,7 @@
 			}
 
             // display property
-            paramString += '&displayProperty=' + gis.init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();            
+            paramString += '&displayProperty=' + displayProperty.toUpperCase();            
 
             if (Ext.isArray(view.userOrgUnit) && view.userOrgUnit.length) {
                 paramString += '&userOrgUnit=';
@@ -6683,7 +6715,6 @@
         var isInit = false,
             requests = [],
             callbacks = 0,
-            type = 'json',
             ajax,
             fn;
 
@@ -6714,7 +6745,7 @@
         
         // dhis2
         requests.push({
-            url: init.contextPath + '/api/systemSettings.' + type + '?key=keyCalendar&key=keyDateFormat',
+            url: init.contextPath + '/api/systemSettings.json?key=keyCalendar&key=keyDateFormat',
             disableCaching: false,
             success: function(r) {
                 var systemSettings = r.responseText ? Ext.decode(r.responseText) : r,
@@ -6725,14 +6756,20 @@
 
                 // user-account
                 userAccountConfig = {
-                    url: init.contextPath + '/api/me/user-account.' + type,
+                    url: init.contextPath + '/api/me/user-account.json',
                     disableCaching: false,
                     success: function(r) {
                         init.userAccount = r.responseText ? Ext.decode(r.responseText) : r;
 
                         var onScriptReady = function() {
                             var defaultKeyUiLocale = 'en',
-                                defaultKeyAnalysisDisplayProperty = 'name',
+                                defaultKeyAnalysisDisplayProperty = 'displayName',
+                                displayPropertyMap = {
+                                    'name': 'displayName',
+                                    'displayName': 'displayName',
+                                    'shortName': 'displayShortName',
+                                    'displayShortName': 'displayShortName'
+                                },
                                 namePropertyUrl,
                                 contextPath,
                                 keyUiLocale,
@@ -6740,13 +6777,13 @@
                                 optionSetVersionConfig;
 
                             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;
@@ -6761,7 +6798,7 @@
                             });
 
                             optionSetVersionConfig = {
-                                url: contextPath + '/api/optionSets.' + type + '?fields=id,version&paging=false',
+                                url: contextPath + '/api/optionSets.json?fields=id,version&paging=false',
                                 disableCaching: false,
                                 success: function(r) {
                                     var optionSets = (r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets) || [],
@@ -6779,7 +6816,7 @@
                                     }
 
                                     optionSetConfig = {
-                                        url: contextPath + '/api/optionSets.' + type + '?fields=id,name,version,options[code,name]&paging=false' + url,
+                                        url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url,
                                         disableCaching: false,
                                         success: function(r) {
                                             var sets = r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets;
@@ -6853,7 +6890,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.json?userOnly=true&fields=id,' + init.namePropertyUrl + ',children[id,' + init.namePropertyUrl + ']&paging=false',
             disableCaching: false,
             success: function(r) {
                 var organisationUnits = (r.responseText ? Ext.decode(r.responseText).organisationUnits : r) || [],
@@ -6884,7 +6921,7 @@
 
         // dimensions
         requests.push({
-            url: init.contextPath + '/api/dimensions.' + type + '?fields=id,name&paging=false',
+            url: init.contextPath + '/api/dimensions.json?fields=id,displayName|rename(name)&paging=false',
             disableCaching: false,
             success: function(r) {
                 init.dimensions = r.responseText ? Ext.decode(r.responseText).dimensions : r.dimensions;