dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32530
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16602: GIS ER EV analysis display property.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16602 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-01 15:32:07 +0200
message:
GIS ER EV analysis display property.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js
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/core.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-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2014-08-31 15:55:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2014-09-01 12:58:25 +0000
@@ -3165,7 +3165,7 @@
fields: ['id', 'name'],
proxy: {
type: 'ajax',
- url: ns.core.init.contextPath + '/api/organisationUnitGroups.json?fields=id,name&paging=false',
+ url: ns.core.init.contextPath + '/api/organisationUnitGroups.json?fields=id,' + ns.core.init.namePropertyUrl + '&paging=false',
reader: {
type: 'json',
root: 'organisationUnitGroups'
@@ -3899,7 +3899,7 @@
onDateFieldRender = function(c) {
$('#' + c.inputEl.id).calendarsPicker({
calendar: ns.core.init.calendar,
- dateFormat: ns.core.init.dateFormat
+ dateFormat: ns.core.init.systemInfo.dateFormat
});
};
@@ -3915,7 +3915,7 @@
date = greg.parseDate('yyyy-mm-dd', (new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))).toJSON().slice(0,10));
date = ns.core.init.calendar.fromJD(date.toJD());
- return ns.core.init.calendar.formatDate(ns.core.init.dateFormat, date);
+ return ns.core.init.calendar.formatDate(ns.core.init.systemInfo.dateFormat, date);
}(),
listeners: {
render: function(c) {
@@ -7066,58 +7066,74 @@
success: function(r) {
init.contextPath = Ext.decode(r.responseText).activities.dhis.href;
+ // user-account
Ext.Ajax.request({
- url: init.contextPath + '/api/system/info.json',
+ url: init.contextPath + '/api/me/user-account.json',
success: function(r) {
- var info = Ext.decode(r.responseText);
-
- // context path
- init.contextPath = info.contextPath || init.contextPath;
-
- // calendars
- init.dateFormat = info.dateFormat || 'yyyy-mm-dd';
-
- (function() {
- var dhis2PeriodUrl = '../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
- defaultCalendarId = 'gregorian',
- calendarIdMap = {'iso8601': defaultCalendarId},
- calendarId = calendarIdMap[info.calendar] || info.calendar || defaultCalendarId,
- calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
- calendarScriptUrl,
- createGenerator;
-
- // calendar
- createGenerator = function() {
- init.calendar = $.calendars.instance(calendarId);
- init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.dateFormat);
- };
-
- if (Ext.Array.contains(calendarIds, calendarId)) {
- calendarScriptUrl = '../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
-
- Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
- Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
- });
- }
- else {
- Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
- }
- }());
-
- // user info, i18n
- requests.push({
- url: init.contextPath + '/api/me/user-account.json',
+ init.userAccount = Ext.decode(r.responseText);
+
+ // system info
+ Ext.Ajax.request({
+ url: init.contextPath + '/api/system/info.json',
success: function(r) {
- var defaultKeyUiLocale = 'en';
- init.keyUiLocale = Ext.decode(r.responseText).settings.keyUiLocale || defaultKeyUiLocale;
+ init.systemInfo = Ext.decode(r.responseText);
+
+ // init
+ var defaultKeyUiLocale = 'en',
+ defaultKeyAnalysisDisplayProperty = 'name',
+ namePropertyUrl,
+ contextPath,
+ keyUiLocale,
+ dateFormat;
+
+ init.contextPath = init.systemInfo.contextPath || init.contextPath;
+ init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
+ init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+ init.systemInfo.dateFormat = init.systemInfo.dateFormat || 'yyyy-mm-dd';
+
+ contextPath = init.contextPath;
+ keyUiLocale = init.userAccount.settings.keyUiLocale;
+ keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
+ namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+ dateFormat = init.systemInfo.dateFormat;
+
+ init.namePropertyUrl = namePropertyUrl;
+
+ // calendar
+ (function() {
+ var dhis2PeriodUrl = '../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
+ defaultCalendarId = 'gregorian',
+ calendarIdMap = {'iso8601': defaultCalendarId},
+ calendarId = calendarIdMap[init.systemInfo.calendar] || init.systemInfo.calendar || defaultCalendarId,
+ calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
+ calendarScriptUrl,
+ createGenerator;
+
+ // calendar
+ createGenerator = function() {
+ init.calendar = $.calendars.instance(calendarId);
+ init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.systemInfo.dateFormat);
+ };
+
+ if (Ext.Array.contains(calendarIds, calendarId)) {
+ calendarScriptUrl = '../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
+
+ Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ });
+ }
+ else {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ }
+ }());
// i18n
- Ext.Ajax.request({
- url: 'i18n/' + init.keyUiLocale + '.properties',
+ requests.push({
+ url: 'i18n/' + keyUiLocale + '.properties',
success: function(r) {
NS.i18n = dhis2.util.parseJavaProperties(r.responseText);
- if (init.keyUiLocale !== defaultKeyUiLocale) {
+ if (keyUiLocale !== defaultKeyUiLocale) {
Ext.Ajax.request({
url: 'i18n/' + defaultKeyUiLocale + '.properties',
success: function(r) {
@@ -7131,99 +7147,98 @@
}
},
failure: function() {
- var failure = function() {
- alert('No translations found for system locale (' + init.keyUiLocale + ') or default locale (' + defaultKeyUiLocale + ').');
+ var onFailure = function() {
+ alert('No translations found for system locale (' + keyUiLocale + ') or default locale (' + defaultKeyUiLocale + ').');
};
- if (init.keyUiLocale !== defaultKeyUiLocale) {
+ if (keyUiLocale !== defaultKeyUiLocale) {
Ext.Ajax.request({
url: 'i18n/' + defaultKeyUiLocale + '.json',
success: function(r) {
- console.log('No translations found for system locale (' + init.keyUiLocale + ').');
+ console.log('No translations found for system locale (' + keyUiLocale + ').');
NS.i18n = dhis2.util.parseJavaProperties(r.responseText);
},
failure: function() {
- failure();
+ onFailure();
},
callback: fn
});
}
else {
fn();
- failure();
- }
- }
- });
- }
- });
-
- // root nodes
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userDataViewFallback=true&fields=id,name,children[id,name]&paging=false',
- success: function(r) {
- init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
- fn();
- }
- });
-
- // organisation unit levels
- requests.push({
- url: init.contextPath + '/api/organisationUnitLevels.json?fields=id,name,level&paging=false',
- success: function(r) {
- init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
-
- if (!init.organisationUnitLevels.length) {
- alert('No organisation unit levels');
- }
-
- fn();
- }
- });
-
- // user orgunits and children
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userOnly=true&fields=id,name,children[id,name]&paging=false',
- success: function(r) {
- var organisationUnits = Ext.decode(r.responseText).organisationUnits || [],
- ou = [],
- ouc = [];
-
- if (organisationUnits.length) {
- for (var i = 0, org; i < organisationUnits.length; i++) {
- org = organisationUnits[i];
-
- ou.push(org.id);
-
- if (org.children) {
- ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
- }
- }
-
- init.user = {
- ou: ou,
- ouc: ouc
- }
- }
- else {
- alert('User is not assigned to any organisation units');
- }
-
- fn();
- }
- });
-
- // dimensions
- requests.push({
- url: init.contextPath + '/api/organisationUnitGroupSets.json?fields=id,name&paging=false',
- success: function(r) {
- init.dimensions = Ext.decode(r.responseText).organisationUnitGroupSets || [];
- fn();
- }
- });
-
- for (var i = 0; i < requests.length; i++) {
- Ext.Ajax.request(requests[i]);
- }
+ onFailure();
+ }
+ }
+ });
+
+ // root nodes
+ requests.push({
+ url: contextPath + '/api/organisationUnits.json?userDataViewFallback=true&paging=false&fields=id,' + namePropertyUrl + ',children[id,' + namePropertyUrl + ']',
+ success: function(r) {
+ init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
+ fn();
+ }
+ });
+
+ // organisation unit levels
+ requests.push({
+ url: contextPath + '/api/organisationUnitLevels.json?fields=id,name,level&paging=false',
+ success: function(r) {
+ init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
+
+ if (!init.organisationUnitLevels.length) {
+ alert('No organisation unit levels');
+ }
+
+ fn();
+ }
+ });
+
+ // user orgunits and children
+ requests.push({
+ url: contextPath + '/api/organisationUnits.json?userOnly=true&fields=id,' + namePropertyUrl + ',children[id,' + namePropertyUrl + ']&paging=false',
+ success: function(r) {
+ var organisationUnits = Ext.decode(r.responseText).organisationUnits || [],
+ ou = [],
+ ouc = [];
+
+ if (organisationUnits.length) {
+ for (var i = 0, org; i < organisationUnits.length; i++) {
+ org = organisationUnits[i];
+
+ ou.push(org.id);
+
+ if (org.children) {
+ ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
+ }
+ }
+
+ init.user = init.user || {};
+ init.user.ou = ou;
+ init.user.ouc = ouc;
+ }
+ else {
+ alert('User is not assigned to any organisation units');
+ }
+
+ fn();
+ }
+ });
+
+ // dimensions
+ requests.push({
+ url: init.contextPath + '/api/organisationUnitGroupSets.json?fields=id,' + namePropertyUrl + '&paging=false',
+ success: function(r) {
+ init.dimensions = Ext.decode(r.responseText).organisationUnitGroupSets || [];
+ fn();
+ }
+ });
+
+ for (var i = 0; i < requests.length; i++) {
+ Ext.Ajax.request(requests[i]);
+ }
+ }
+ });
}
});
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2014-08-25 09:41:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2014-09-01 12:48:09 +0000
@@ -183,9 +183,9 @@
'*',
'program[id,name]',
'programStage[id,name]',
- 'columns[dimension,filter,items[id,name]]',
- 'rows[dimension,filter,items[id,name]]',
- 'filters[dimension,filter,items[id,name]]',
+ 'columns[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
+ 'rows[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
+ 'filters[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
'!lastUpdated',
'!href',
'!created',
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2014-08-31 15:55:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2014-09-01 13:00:53 +0000
@@ -2804,7 +2804,7 @@
fields: ['id', 'name'],
proxy: {
type: 'ajax',
- url: ns.core.init.contextPath + '/api/organisationUnitGroups.json?paging=false&links=false',
+ url: ns.core.init.contextPath + '/api/organisationUnitGroups.json?fields=id,' + ns.core.init.namePropertyUrl + '&paging=false',
reader: {
type: 'json',
root: 'organisationUnitGroups'
@@ -3534,7 +3534,7 @@
onDateFieldRender = function(c) {
$('#' + c.inputEl.id).calendarsPicker({
calendar: ns.core.init.calendar,
- dateFormat: ns.core.init.dateFormat
+ dateFormat: ns.core.init.systemInfo.dateFormat
});
};
@@ -3550,7 +3550,7 @@
date = greg.parseDate('yyyy-mm-dd', (new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))).toJSON().slice(0,10));
date = ns.core.init.calendar.fromJD(date.toJD());
- return ns.core.init.calendar.formatDate(ns.core.init.dateFormat, date);
+ return ns.core.init.calendar.formatDate(ns.core.init.systemInfo.dateFormat, date);
}(),
listeners: {
render: function(c) {
@@ -6702,58 +6702,74 @@
success: function(r) {
init.contextPath = Ext.decode(r.responseText).activities.dhis.href;
+ // user-account
Ext.Ajax.request({
- url: init.contextPath + '/api/system/info.json',
+ url: init.contextPath + '/api/me/user-account.json',
success: function(r) {
- var info = Ext.decode(r.responseText);
-
- // context path
- init.contextPath = info.contextPath || init.contextPath;
-
- // calendars
- init.dateFormat = info.dateFormat || 'yyyy-mm-dd';
-
- (function() {
- var dhis2PeriodUrl = '../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
- defaultCalendarId = 'gregorian',
- calendarIdMap = {'iso8601': defaultCalendarId},
- calendarId = calendarIdMap[info.calendar] || info.calendar || defaultCalendarId,
- calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
- calendarScriptUrl,
- createGenerator;
-
- // calendar
- createGenerator = function() {
- init.calendar = $.calendars.instance(calendarId);
- init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.dateFormat);
- };
-
- if (Ext.Array.contains(calendarIds, calendarId)) {
- calendarScriptUrl = '../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
-
- Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
- Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
- });
- }
- else {
- Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
- }
- }());
-
- // user info, i18n
- requests.push({
- url: init.contextPath + '/api/me/user-account.json',
+ init.userAccount = Ext.decode(r.responseText);
+
+ // system info
+ Ext.Ajax.request({
+ url: init.contextPath + '/api/system/info.json',
success: function(r) {
- var defaultKeyUiLocale = 'en';
- init.keyUiLocale = Ext.decode(r.responseText).settings.keyUiLocale || defaultKeyUiLocale;
+ init.systemInfo = Ext.decode(r.responseText);
+
+ // init
+ var defaultKeyUiLocale = 'en',
+ defaultKeyAnalysisDisplayProperty = 'name',
+ namePropertyUrl,
+ contextPath,
+ keyUiLocale,
+ dateFormat;
+
+ init.contextPath = init.systemInfo.contextPath || init.contextPath;
+ init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
+ init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+ init.systemInfo.dateFormat = init.systemInfo.dateFormat || 'yyyy-mm-dd';
+
+ contextPath = init.contextPath;
+ keyUiLocale = init.userAccount.settings.keyUiLocale;
+ keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
+ namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+ dateFormat = init.systemInfo.dateFormat;
+
+ init.namePropertyUrl = namePropertyUrl;
+
+ // calendar
+ (function() {
+ var dhis2PeriodUrl = '../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
+ defaultCalendarId = 'gregorian',
+ calendarIdMap = {'iso8601': defaultCalendarId},
+ calendarId = calendarIdMap[init.systemInfo.calendar] || init.systemInfo.calendar || defaultCalendarId,
+ calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
+ calendarScriptUrl,
+ createGenerator;
+
+ // calendar
+ createGenerator = function() {
+ init.calendar = $.calendars.instance(calendarId);
+ init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.systemInfo.dateFormat);
+ };
+
+ if (Ext.Array.contains(calendarIds, calendarId)) {
+ calendarScriptUrl = '../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
+
+ Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ });
+ }
+ else {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ }
+ }());
// i18n
- Ext.Ajax.request({
- url: 'i18n/' + init.keyUiLocale + '.properties',
+ requests.push({
+ url: 'i18n/' + keyUiLocale + '.properties',
success: function(r) {
NS.i18n = dhis2.util.parseJavaProperties(r.responseText);
- if (init.keyUiLocale !== defaultKeyUiLocale) {
+ if (keyUiLocale !== defaultKeyUiLocale) {
Ext.Ajax.request({
url: 'i18n/' + defaultKeyUiLocale + '.properties',
success: function(r) {
@@ -6767,94 +6783,98 @@
}
},
failure: function() {
- var failure = function() {
- alert('No translations found for system locale (' + init.keyUiLocale + ') or default locale (' + defaultKeyUiLocale + ').');
+ var onFailure = function() {
+ alert('No translations found for system locale (' + keyUiLocale + ') or default locale (' + defaultKeyUiLocale + ').');
};
- if (init.keyUiLocale !== defaultKeyUiLocale) {
+ if (keyUiLocale !== defaultKeyUiLocale) {
Ext.Ajax.request({
url: 'i18n/' + defaultKeyUiLocale + '.json',
success: function(r) {
- console.log('No translations found for system locale (' + init.keyUiLocale + ').');
+ console.log('No translations found for system locale (' + keyUiLocale + ').');
NS.i18n = dhis2.util.parseJavaProperties(r.responseText);
},
failure: function() {
- failure();
+ onFailure();
},
callback: fn
});
}
else {
fn();
- failure();
- }
- }
- });
- }
- });
-
- // root nodes
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userDataViewFallback=true&fields=id,name,children[id,name]',
- success: function(r) {
- init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
- fn();
- }
- });
-
- // organisation unit levels
- requests.push({
- url: init.contextPath + '/api/organisationUnitLevels.json?fields=id,name,level&paging=false',
- success: function(r) {
- init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
- fn();
- }
- });
-
- // user orgunits and children
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userOnly=true&fields=id,name,children[id,name]&paging=false',
- success: function(r) {
- var organisationUnits = Ext.decode(r.responseText).organisationUnits || [],
- ou = [],
- ouc = [];
-
- if (organisationUnits.length) {
- for (var i = 0, org; i < organisationUnits.length; i++) {
- org = organisationUnits[i];
-
- ou.push(org.id);
-
- if (org.children) {
- ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
- }
- }
-
- init.user = {
- ou: ou,
- ouc: ouc
- }
- }
- else {
- alert('User is not assigned to any organisation units');
- }
-
- fn();
- }
- });
-
- // dimensions
- requests.push({
- url: init.contextPath + '/api/organisationUnitGroupSets.json?fields=id,name&paging=false',
- success: function(r) {
- init.dimensions = Ext.decode(r.responseText).organisationUnitGroupSets || [];
- fn();
- }
- });
-
- for (var i = 0; i < requests.length; i++) {
- Ext.Ajax.request(requests[i]);
- }
+ onFailure();
+ }
+ }
+ });
+
+ // root nodes
+ requests.push({
+ url: contextPath + '/api/organisationUnits.json?userDataViewFallback=true&paging=false&fields=id,' + namePropertyUrl + ',children[id,' + namePropertyUrl + ']',
+ success: function(r) {
+ init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
+ fn();
+ }
+ });
+
+ // organisation unit levels
+ requests.push({
+ url: contextPath + '/api/organisationUnitLevels.json?fields=id,name,level&paging=false',
+ success: function(r) {
+ init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
+
+ if (!init.organisationUnitLevels.length) {
+ alert('No organisation unit levels');
+ }
+
+ fn();
+ }
+ });
+
+ // user orgunits and children
+ requests.push({
+ url: contextPath + '/api/organisationUnits.json?userOnly=true&fields=id,' + namePropertyUrl + ',children[id,' + namePropertyUrl + ']&paging=false',
+ success: function(r) {
+ var organisationUnits = Ext.decode(r.responseText).organisationUnits || [],
+ ou = [],
+ ouc = [];
+
+ if (organisationUnits.length) {
+ for (var i = 0, org; i < organisationUnits.length; i++) {
+ org = organisationUnits[i];
+
+ ou.push(org.id);
+
+ if (org.children) {
+ ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
+ }
+ }
+
+ init.user = init.user || {};
+ init.user.ou = ou;
+ init.user.ouc = ouc;
+ }
+ else {
+ alert('User is not assigned to any organisation units');
+ }
+
+ fn();
+ }
+ });
+
+ // dimensions
+ requests.push({
+ url: init.contextPath + '/api/organisationUnitGroupSets.json?fields=id,' + namePropertyUrl + '&paging=false',
+ success: function(r) {
+ init.dimensions = Ext.decode(r.responseText).organisationUnitGroupSets || [];
+ fn();
+ }
+ });
+
+ for (var i = 0; i < requests.length; i++) {
+ Ext.Ajax.request(requests[i]);
+ }
+ }
+ });
}
});
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2014-08-25 11:23:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2014-09-01 13:00:53 +0000
@@ -204,9 +204,9 @@
'*',
'program[id,name]',
'programStage[id,name]',
- 'columns[dimension,filter,items[id,name]]',
- 'rows[dimension,filter,items[id,name]]',
- 'filters[dimension,filter,items[id,name]]',
+ 'columns[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
+ 'rows[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
+ 'filters[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
'!lastUpdated',
'!href',
'!created',
=== 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 2014-08-31 20:33:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js 2014-09-01 13:01:30 +0000
@@ -4536,7 +4536,7 @@
onDateFieldRender = function(c) {
$('#' + c.inputEl.id).calendarsPicker({
calendar: gis.init.calendar,
- dateFormat: gis.init.dateFormat
+ dateFormat: gis.init.systemInfo.dateFormat
});
Ext.get(c.id).setStyle('z-index', 100000);
@@ -4554,7 +4554,7 @@
date = greg.parseDate('yyyy-mm-dd', (new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))).toJSON().slice(0,10));
date = gis.init.calendar.fromJD(date.toJD());
- return gis.init.calendar.formatDate(gis.init.dateFormat, date);
+ return gis.init.calendar.formatDate(gis.init.systemInfo.dateFormat, date);
}(),
listeners: {
render: function(c) {
@@ -8754,6 +8754,7 @@
menu: {},
handler: function(b) {
b.menu = Ext.create('Ext.menu.Menu', {
+ title: 'sddd',
closeAction: 'destroy',
shadow: false,
showSeparator: false,
@@ -9136,59 +9137,74 @@
success: function(r) {
init.contextPath = Ext.decode(r.responseText).activities.dhis.href;
- // system info
+ // user-account
Ext.Ajax.request({
- url: init.contextPath + '/api/system/info.json',
+ url: init.contextPath + '/api/me/user-account.json',
success: function(r) {
- var info = Ext.decode(r.responseText);
-
- // context path
- init.contextPath = info.contextPath || init.contextPath;
-
- // calendars
- init.dateFormat = info.dateFormat || 'yyyy-mm-dd';
-
- (function() {
- var dhis2PeriodUrl = '../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
- defaultCalendarId = 'gregorian',
- calendarIdMap = {'iso8601': defaultCalendarId},
- calendarId = calendarIdMap[info.calendar] || info.calendar || defaultCalendarId,
- calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
- calendarScriptUrl,
- createGenerator;
-
- // calendar
- createGenerator = function() {
- init.calendar = $.calendars.instance(calendarId);
- init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.dateFormat);
- };
-
- if (Ext.Array.contains(calendarIds, calendarId)) {
- calendarScriptUrl = '../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
-
- Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
- Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
- });
- }
- else {
- Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
- }
- }());
-
- // user info, i18n
- requests.push({
- url: init.contextPath + '/api/me/user-account.json',
+ init.userAccount = Ext.decode(r.responseText);
+
+ // system info
+ Ext.Ajax.request({
+ url: init.contextPath + '/api/system/info.json',
success: function(r) {
- var defaultKeyUiLocale = 'en';
- init.keyUiLocale = Ext.decode(r.responseText).settings.keyUiLocale || defaultKeyUiLocale;
+ init.systemInfo = Ext.decode(r.responseText);
+
+ // init
+ var defaultKeyUiLocale = 'en',
+ defaultKeyAnalysisDisplayProperty = 'name',
+ namePropertyUrl,
+ contextPath,
+ keyUiLocale,
+ dateFormat;
+
+ init.contextPath = init.systemInfo.contextPath || init.contextPath;
+ init.userAccount.settings.keyUiLocale = init.userAccount.settings.keyUiLocale || defaultKeyUiLocale;
+ init.userAccount.settings.keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty || defaultKeyAnalysisDisplayProperty;
+ init.systemInfo.dateFormat = init.systemInfo.dateFormat || 'yyyy-mm-dd';
+
+ contextPath = init.contextPath;
+ keyUiLocale = init.userAccount.settings.keyUiLocale;
+ keyAnalysisDisplayProperty = init.userAccount.settings.keyAnalysisDisplayProperty;
+ namePropertyUrl = keyAnalysisDisplayProperty === defaultKeyAnalysisDisplayProperty ? keyAnalysisDisplayProperty : keyAnalysisDisplayProperty + '|rename(' + defaultKeyAnalysisDisplayProperty + ')';
+ dateFormat = init.systemInfo.dateFormat;
+
+ init.namePropertyUrl = namePropertyUrl;
+
+ // calendar
+ (function() {
+ var dhis2PeriodUrl = '../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
+ defaultCalendarId = 'gregorian',
+ calendarIdMap = {'iso8601': defaultCalendarId},
+ calendarId = calendarIdMap[init.systemInfo.calendar] || init.systemInfo.calendar || defaultCalendarId,
+ calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
+ calendarScriptUrl,
+ createGenerator;
+
+ // calendar
+ createGenerator = function() {
+ init.calendar = $.calendars.instance(calendarId);
+ init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.systemInfo.dateFormat);
+ };
+
+ if (Ext.Array.contains(calendarIds, calendarId)) {
+ calendarScriptUrl = '../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
+
+ Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ });
+ }
+ else {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ }
+ }());
// i18n
- Ext.Ajax.request({
- url: 'i18n/' + init.keyUiLocale + '.properties',
+ requests.push({
+ url: 'i18n/' + keyUiLocale + '.properties',
success: function(r) {
GIS.i18n = dhis2.util.parseJavaProperties(r.responseText);
- if (init.keyUiLocale !== defaultKeyUiLocale) {
+ if (keyUiLocale !== defaultKeyUiLocale) {
Ext.Ajax.request({
url: 'i18n/' + defaultKeyUiLocale + '.properties',
success: function(r) {
@@ -9202,138 +9218,138 @@
}
},
failure: function() {
- var failure = function() {
- alert('No translations found for system locale (' + init.keyUiLocale + ') or default locale (' + defaultKeyUiLocale + ').');
+ var onFailure = function() {
+ alert('No translations found for system locale (' + keyUiLocale + ') or default locale (' + defaultKeyUiLocale + ').');
};
- if (init.keyUiLocale !== defaultKeyUiLocale) {
+ if (keyUiLocale !== defaultKeyUiLocale) {
Ext.Ajax.request({
url: 'i18n/' + defaultKeyUiLocale + '.json',
success: function(r) {
- console.log('No translations found for system locale (' + init.keyUiLocale + ').');
+ console.log('No translations found for system locale (' + keyUiLocale + ').');
GIS.i18n = dhis2.util.parseJavaProperties(r.responseText);
},
failure: function() {
- failure();
+ onFailure();
},
callback: fn
});
}
else {
fn();
- failure();
- }
- }
- });
- }
- });
-
- // root nodes
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userDataViewFallback=true&paging=false&fields=id,name,children[id,name]',
- success: function(r) {
- init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
- fn();
- }
- });
-
- // organisation unit levels
- requests.push({
- url: init.contextPath + '/api/organisationUnitLevels.json?fields=id,name,level&paging=false',
- success: function(r) {
- init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
-
- if (!init.organisationUnitLevels.length) {
- alert('No organisation unit levels');
- }
-
- fn();
- }
- });
-
- // user orgunits and children
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?userOnly=true&fields=id,name,children[id,name]&paging=false',
- success: function(r) {
- var organisationUnits = Ext.decode(r.responseText).organisationUnits || [],
- ou = [],
- ouc = [];
-
- if (organisationUnits.length) {
- for (var i = 0, org; i < organisationUnits.length; i++) {
- org = organisationUnits[i];
-
- ou.push(org.id);
-
- if (org.children) {
- ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
- }
- }
-
- init.user = init.user || {};
- init.user.ou = ou;
- init.user.ouc = ouc;
- }
- else {
- alert('User is not assigned to any organisation units');
- }
-
- fn();
- }
- });
-
- // admin
- requests.push({
- url: init.contextPath + '/api/me/authorization/F_GIS_ADMIN',
- success: function(r) {
- init.user.isAdmin = (r.responseText === 'true');
- fn();
- }
- });
-
- // indicator groups
- requests.push({
- url: init.contextPath + '/api/indicatorGroups.json?fields=id,name&paging=false',
- success: function(r) {
- init.indicatorGroups = Ext.decode(r.responseText).indicatorGroups || [];
- fn();
- }
- });
-
- // data element groups
- requests.push({
- url: init.contextPath + '/api/dataElementGroups.json?fields=id,name&paging=false',
- success: function(r) {
- init.dataElementGroups = Ext.decode(r.responseText).dataElementGroups || [];
- fn();
- }
- });
-
- // infrastructural data element group
- requests.push({
- url: init.contextPath + '/api/configuration/infrastructuralDataElements.json',
- success: function(r) {
- var obj = Ext.decode(r.responseText);
-
- init.systemSettings.infrastructuralDataElementGroup = Ext.isObject(obj) ? obj : null;
- fn();
- }
- });
-
- // infrastructural period type
- requests.push({
- url: init.contextPath + '/api/configuration/infrastructuralPeriodType.json',
- success: function(r) {
- var obj = Ext.decode(r.responseText);
-
- init.systemSettings.infrastructuralPeriodType = Ext.isObject(obj) ? obj : null;
- fn();
- }
- });
-
- for (var i = 0; i < requests.length; i++) {
- Ext.Ajax.request(requests[i]);
- }
+ onFailure();
+ }
+ }
+ });
+
+ // root nodes
+ requests.push({
+ url: contextPath + '/api/organisationUnits.json?userDataViewFallback=true&paging=false&fields=id,' + namePropertyUrl + ',children[id,' + namePropertyUrl + ']',
+ success: function(r) {
+ init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
+ fn();
+ }
+ });
+
+ // organisation unit levels
+ requests.push({
+ url: contextPath + '/api/organisationUnitLevels.json?fields=id,name,level&paging=false',
+ success: function(r) {
+ init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || [];
+
+ if (!init.organisationUnitLevels.length) {
+ alert('No organisation unit levels');
+ }
+
+ fn();
+ }
+ });
+
+ // user orgunits and children
+ requests.push({
+ url: contextPath + '/api/organisationUnits.json?userOnly=true&fields=id,' + namePropertyUrl + ',children[id,' + namePropertyUrl + ']&paging=false',
+ success: function(r) {
+ var organisationUnits = Ext.decode(r.responseText).organisationUnits || [],
+ ou = [],
+ ouc = [];
+
+ if (organisationUnits.length) {
+ for (var i = 0, org; i < organisationUnits.length; i++) {
+ org = organisationUnits[i];
+
+ ou.push(org.id);
+
+ if (org.children) {
+ ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
+ }
+ }
+
+ init.user = init.user || {};
+ init.user.ou = ou;
+ init.user.ouc = ouc;
+ }
+ else {
+ alert('User is not assigned to any organisation units');
+ }
+
+ fn();
+ }
+ });
+
+ // admin
+ requests.push({
+ url: init.contextPath + '/api/me/authorization/F_GIS_ADMIN',
+ success: function(r) {
+ init.user.isAdmin = (r.responseText === 'true');
+ fn();
+ }
+ });
+
+ // indicator groups
+ requests.push({
+ url: init.contextPath + '/api/indicatorGroups.json?fields=id,name&paging=false',
+ success: function(r) {
+ init.indicatorGroups = Ext.decode(r.responseText).indicatorGroups || [];
+ fn();
+ }
+ });
+
+ // data element groups
+ requests.push({
+ url: init.contextPath + '/api/dataElementGroups.json?fields=id,' + namePropertyUrl + '&paging=false',
+ success: function(r) {
+ init.dataElementGroups = Ext.decode(r.responseText).dataElementGroups || [];
+ fn();
+ }
+ });
+
+ // infrastructural data element group
+ requests.push({
+ url: init.contextPath + '/api/configuration/infrastructuralDataElements.json',
+ success: function(r) {
+ var obj = Ext.decode(r.responseText);
+
+ init.systemSettings.infrastructuralDataElementGroup = Ext.isObject(obj) ? obj : null;
+ fn();
+ }
+ });
+
+ // infrastructural period type
+ requests.push({
+ url: init.contextPath + '/api/configuration/infrastructuralPeriodType.json',
+ success: function(r) {
+ var obj = Ext.decode(r.responseText);
+
+ init.systemSettings.infrastructuralPeriodType = Ext.isObject(obj) ? obj : null;
+ fn();
+ }
+ });
+
+ for (var i = 0; i < requests.length; i++) {
+ Ext.Ajax.request(requests[i]);
+ }
+ }
+ });
}
});
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js 2014-08-31 20:31:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js 2014-09-01 12:07:34 +0000
@@ -2499,9 +2499,9 @@
conf.url.analysisFields = [
'*',
- 'columns[dimension,filter,items[id,name]]',
- 'rows[dimension,filter,items[id,name]]',
- 'filters[dimension,filter,items[id,name]]',
+ 'columns[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
+ 'rows[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
+ 'filters[dimension,filter,items[id,' + init.namePropertyUrl + ']]',
'!lastUpdated',
'!href',
'!created',