dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41275
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21022: Analysis, plugin/dashboard fixes.
------------------------------------------------------------
revno: 21022
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-10 23:06:00 +0100
message:
Analysis, plugin/dashboard fixes.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js
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/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-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/table.js
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/map.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.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/plugin.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-10-02 14:16:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-11-10 22:06:00 +0000
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <script src="//localhost:8080/dhis-web-commons/javascripts/ext/ext-all.js"></script>
+ <script src="//localhost:8888/dhis-web-commons/javascripts/ext/ext-all.js"></script>
<script src="scripts/table.js"></script>
<style type="text/css">
@@ -12,8 +12,7 @@
<script>
Ext.onReady(function() {
- var url = 'https://apps.dhis2.org/demo',
- //var url = 'https://apps.dhis2.org/demo',
+ var url = 'http://localhost:8888',
username = 'admin',
password = 'district';
@@ -23,25 +22,25 @@
username: username,
password: password,
el: 'table1',
- uid: 'MwnpKMaxcPh',
+ id: 'SEMVWsnVblY',
showDimensionLabels: true
});
- DHIS.getTable({
- url: url,
- el: 'table2',
- crossDomain: true,
- username: username,
- password: password,
- columns: [
- {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]}
- ],
- rows: [
- {dimension: 'ou', items: [{id: 'LEVEL-3'}, {id: 'fdc6uOvgoji'}]}
- ],
- hideEmptyRows: true
- //userOrgUnit: ['fdc6uOvgoji', 'e1eIKM1GIF3']
- });
+ //DHIS.getTable({
+ //url: url,
+ //el: 'table2',
+ //crossDomain: true,
+ //username: username,
+ //password: password,
+ //columns: [
+ //{dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]}
+ //],
+ //rows: [
+ //{dimension: 'ou', items: [{id: 'LEVEL-3'}, {id: 'fdc6uOvgoji'}]}
+ //],
+ //hideEmptyRows: true
+ ////userOrgUnit: ['fdc6uOvgoji', 'e1eIKM1GIF3']
+ //});
});
</script>
</head>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-11-05 15:39:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-11-10 22:06:00 +0000
@@ -860,7 +860,7 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || conf.finals.style.space;
+ separator = conf.style.digitGroupSeparator[separator] ? separator : conf.finals.style.space;
if (separator === conf.finals.style.none) {
return number;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js 2015-11-10 13:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js 2015-11-10 22:06:00 +0000
@@ -793,7 +793,8 @@
// dep 1
t.getDigitGroupSeparatorValueById = function(id) {
- return t.getDigitGroupSeparatorIdMap()[id].value;
+ var separator = t.getDigitGroupSeparatorIdMap()[id];
+ return separator ? separator.value : '';
};
};
@@ -2090,7 +2091,7 @@
return number;
}
- return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, oc.getDigitGroupSeparatorValueById(separator));
+ return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, oc.getDigitGroupSeparatorValueById(separator) || '');
};
doColTotals = function() {
=== 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-10-12 11:52:06 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-11-10 22:06:00 +0000
@@ -862,9 +862,9 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || conf.finals.style.space;
+ separator = conf.style.digitGroupSeparator[separator] ? separator : conf.finals.style.space;
- if (separator === conf.finals.style.space.none) {
+ if (separator === conf.finals.style.none) {
return number;
}
@@ -3349,8 +3349,7 @@
web = ns.core.web,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
@@ -3517,7 +3516,7 @@
success: function(r) {
var metaData = Ext.decode(r.responseText).metaData;
- Ext.Ajax.request({
+ ns.ajax({
url: init.contextPath + '/api/analytics.json' + sortedParamString,
timeout: 60000,
headers: {
=== 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-09-15 23:25:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html 2015-11-10 22:06:00 +0000
@@ -17,13 +17,15 @@
<script>
Ext.onReady(function() {
- var url = 'http://localhost:8080';
+ var url = 'http://localhost:8888';
DHIS.getChart({
url: url,
el: 'chart1',
- uid: 'vIlITOVLOjI',
- crossDomain: false,
+ uid: 'LW0O27b7TdD',
+ crossDomain: true,
+ username: 'admin',
+ password: 'district',
dashboard: true
});
=== 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-10-24 19:17:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-11-10 22:06:00 +0000
@@ -4268,8 +4268,7 @@
web = ns.core.web,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
@@ -4331,12 +4330,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.chart.getData = function(layout, isUpdateGui) {
@@ -4413,45 +4407,6 @@
}, ns);
}
}, ns);
-
-
-
-
-
- //success = function(r) {
- //var response = api.response.Response((r.responseText ? Ext.decode(r.responseText) : r));
-
- //if (!response) {
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
-
- //// sync xLayout with response
- //xLayout = service.layout.getSyncronizedXLayout(xLayout, response);
-
- //if (!xLayout) {
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
-
- //ns.app.paramString = paramString;
-
- //web.chart.getChart(layout, xLayout, response, isUpdateGui);
- //};
-
- //config.url = init.contextPath + '/api/analytics.' + type + paramString;
- //config.disableCaching = false;
- //config.timeout = 60000;
- //config.headers = headers;
- //config.success = success;
- //config.failure = failure;
-
- //if (type === 'jsonp') {
- //Ext.data.JsonP.request(config);
- //}
- //else {
- //Ext.Ajax.request(config);
- //}
};
web.chart.getChart = function(layout, xLayout, response, isUpdateGui) {
=== 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-10-12 11:52:06 +0000
+++ 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
@@ -684,7 +684,8 @@
line: 'line',
area: 'area',
pie: 'pie',
- radar: 'radar'
+ radar: 'radar',
+ gauge: 'gauge'
},
server: {
column: 'COLUMN',
@@ -3360,8 +3361,8 @@
text = '',
titleFont,
titleColor,
- isPie = xLayout.type === conf.finals.chart.pie,
- isGauge = xLayout.type === conf.finals.chart.gauge;
+ isPie = xLayout.type === conf.finals.chart.client.pie,
+ isGauge = xLayout.type === conf.finals.chart.client.gauge;
if (isPie) {
ids.push(columnIds[0]);
@@ -4267,8 +4268,7 @@
web = ns.core.web,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
@@ -4330,12 +4330,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.chart.getData = function(layout, isUpdateGui) {
@@ -4412,45 +4407,6 @@
}, ns);
}
}, ns);
-
-
-
-
-
- //success = function(r) {
- //var response = api.response.Response((r.responseText ? Ext.decode(r.responseText) : r));
-
- //if (!response) {
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
-
- //// sync xLayout with response
- //xLayout = service.layout.getSyncronizedXLayout(xLayout, response);
-
- //if (!xLayout) {
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
-
- //ns.app.paramString = paramString;
-
- //web.chart.getChart(layout, xLayout, response, isUpdateGui);
- //};
-
- //config.url = init.contextPath + '/api/analytics.' + type + paramString;
- //config.disableCaching = false;
- //config.timeout = 60000;
- //config.headers = headers;
- //config.success = success;
- //config.failure = failure;
-
- //if (type === 'jsonp') {
- //Ext.data.JsonP.request(config);
- //}
- //else {
- //Ext.Ajax.request(config);
- //}
};
web.chart.getChart = function(layout, xLayout, response, isUpdateGui) {
@@ -4532,7 +4488,7 @@
xResponse = service.response.getExtendedResponse(xLayout, response);
// legend set
- if (xLayout.type === 'gauge' && Ext.Array.contains(xLayout.axisObjectNames, ind) && xLayout.objectNameIdsMap[ind].length) {
+ if (xLayout.type === 'GAUGE' && Ext.Array.contains(xLayout.axisObjectNames, ind) && xLayout.objectNameIdsMap[ind].length) {
Ext.Ajax.request({
url: ns.core.init.contextPath + '/api/indicators/' + xLayout.objectNameIdsMap[ind][0] + '.json?fields=legendSet[legends[id,name,startValue,endValue,color]]',
disableCaching: false,
=== 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-10-26 11:35:10 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js 2015-11-10 22:06:00 +0000
@@ -2786,28 +2786,16 @@
getOptionSets();
};
- if (Ext.isObject(GIS.app)) {
- Ext.Ajax.request({
- url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
- disableCaching: false,
- failure: function(r) {
- gis.alert(r);
- },
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
- else if (Ext.isObject(GIS.plugin)) {
- Ext.data.JsonP.request({
- url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.jsonp' + paramString,
- disableCaching: false,
- scope: this,
- success: function(r) {
- success(r);
- }
- });
- }
+ gis.ajax({
+ url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
+ disableCaching: false,
+ failure: function(r) {
+ gis.alert(r);
+ },
+ success: function(r) {
+ success(Ext.decode(r.responseText));
+ }
+ });
};
loadLegend = function(view) {
@@ -2972,7 +2960,6 @@
loadOrganisationUnits = function(view) {
var items = view.rows[0].items,
- isPlugin = GIS.plugin && !GIS.app,
url = function() {
var params = '?ou=ou:';
@@ -2991,7 +2978,7 @@
}
}
- return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params + '&includeGroupSets=true';
+ return gis.init.contextPath + '/api/geoFeatures.json' + params + '&includeGroupSets=true';
}(),
success,
failure;
@@ -3023,24 +3010,13 @@
gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
- if (GIS.plugin && !GIS.app) {
- Ext.data.JsonP.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
+ gis.ajax({
+ url: url,
+ disableCaching: false,
+ success: function(r) {
+ success(r);
+ }
+ });
};
loadData = function(view, features) {
@@ -3059,7 +3035,7 @@
loadLegend = function(view) {
var isPlugin = GIS.plugin && !GIS.app,
- type = isPlugin ? 'jsonp' : 'json',
+ type = 'json',
url = gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.' + type + '?fields=organisationUnitGroups[id,name,symbol]',
success;
@@ -3092,22 +3068,12 @@
afterLoad(view);
};
- if (isPlugin) {
- Ext.data.JsonP.request({
- url: url,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
+ gis.ajax({
+ url: url,
+ success: function(r) {
+ success(r);
+ }
+ });
};
addCircles = function(view) {
@@ -3257,7 +3223,6 @@
loadOrganisationUnits = function(view) {
var items = view.rows[0].items,
- isPlugin = GIS.plugin && !GIS.app,
url = function() {
var params = '?ou=ou:';
@@ -3276,13 +3241,13 @@
}
}
- return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
+ return gis.init.contextPath + '/api/geoFeatures.json' + params;
}(),
success,
failure;
success = function(r) {
- var geojson = gis.util.geojson.decode(r, 'DESC'),
+ var geojson = gis.util.geojson.decode(Ext.decode(r.responseText), 'DESC'),
format = new OpenLayers.Format.GeoJSON(),
features = gis.util.map.getTransformedFeatureArray(format.read(geojson)),
colors = ['black', 'blue', 'red', 'green', 'yellow'],
@@ -3340,27 +3305,13 @@
gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
- if (isPlugin) {
- Ext.data.JsonP.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(Ext.decode(r.responseText));
- },
- failure: function() {
- failure();
- }
- });
- }
+ gis.ajax({
+ url: url,
+ disableCaching: false,
+ success: function(r) {
+ success(r);
+ }
+ });
};
loadData = function(view, features) {
@@ -3620,7 +3571,6 @@
loadOrganisationUnits = function(view) {
var items = view.rows[0].items,
- isPlugin = GIS.plugin && !GIS.app,
url = function() {
var params = '?ou=ou:';
@@ -3639,13 +3589,13 @@
}
}
- return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
+ return gis.init.contextPath + '/api/geoFeatures.json' + params;
}(),
success,
failure;
success = function(r) {
- var geojson = gis.util.geojson.decode(r),
+ var geojson = gis.util.geojson.decode(Ext.decode(r.responseText)),
format = new OpenLayers.Format.GeoJSON(),
features = gis.util.map.getTransformedFeatureArray(format.read(geojson));
@@ -3671,27 +3621,16 @@
gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
- if (isPlugin) {
- Ext.data.JsonP.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(Ext.decode(r.responseText));
- },
- failure: function() {
- failure();
- }
- });
- }
+ gis.ajax({
+ url: url,
+ disableCaching: false,
+ success: function(r) {
+ success(r);
+ },
+ failure: function() {
+ failure();
+ }
+ });
};
loadData = function(view, features) {
@@ -3814,28 +3753,16 @@
loadLegend(view);
};
- if (Ext.isObject(GIS.app)) {
- Ext.Ajax.request({
- url: gis.init.contextPath + '/api/analytics.json' + paramString,
- disableCaching: false,
- failure: function(r) {
- gis.alert(r);
- },
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
- else if (Ext.isObject(GIS.plugin)) {
- Ext.data.JsonP.request({
- url: gis.init.contextPath + '/api/analytics.jsonp' + paramString,
- disableCaching: false,
- scope: this,
- success: function(r) {
- success(r);
- }
- });
- }
+ gis.ajax({
+ url: gis.init.contextPath + '/api/analytics.json' + paramString,
+ disableCaching: false,
+ failure: function(r) {
+ gis.alert(r);
+ },
+ success: function(r) {
+ success(Ext.decode(r.responseText));
+ }
+ });
};
loadLegend = function(view) {
@@ -3906,7 +3833,7 @@
};
loadLegendSet = function(view) {
- Ext.Ajax.request({
+ gis.ajax({
url: gis.init.contextPath + '/api/legendSets/' + view.legendSet.id + '.json?fields=' + gis.conf.url.legendSetFields.join(','),
scope: this,
disableCaching: false,
@@ -3958,7 +3885,7 @@
return;
}
- Ext.Ajax.request({
+ gis.ajax({
url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
success: function(r) {
var elements = Ext.decode(r.responseText)[elementUrl],
@@ -4440,7 +4367,7 @@
util.geojson = {};
- util.geojson.decode = function(organisationUnits, levelOrder) {
+ util.geojson.decode = function(geoFeatures, levelOrder) {
var geojson = {
type: 'FeatureCollection',
crs: {
@@ -4451,14 +4378,14 @@
},
features: []
};
-
+
levelOrder = levelOrder || 'ASC';
// sort
- util.array.sort(organisationUnits, levelOrder, 'le');
+ util.array.sort(geoFeatures, levelOrder, 'le');
- for (var i = 0, ou, gpid = '', gppg = ''; i < organisationUnits.length; i++) {
- ou = organisationUnits[i];
+ for (var i = 0, ou, gpid = '', gppg = ''; i < geoFeatures.length; i++) {
+ ou = geoFeatures[i];
// grand parent
if (Ext.isString(ou.pg) && ou.pg.length) {
@@ -7197,8 +7124,7 @@
util = gis.util,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-10-12 11:52:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-11-10 22:06:00 +0000
@@ -862,9 +862,9 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || conf.finals.style.space;
+ separator = conf.style.digitGroupSeparator[separator] ? separator : conf.finals.style.space;
- if (separator === conf.finals.style.space.none) {
+ if (separator === conf.finals.style.none) {
return number;
}
@@ -3349,8 +3349,7 @@
web = ns.core.web,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
@@ -3517,7 +3516,7 @@
success: function(r) {
var metaData = Ext.decode(r.responseText).metaData;
- Ext.Ajax.request({
+ ns.ajax({
url: init.contextPath + '/api/analytics.json' + sortedParamString,
timeout: 60000,
headers: {
=== 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-10-12 11:52:06 +0000
+++ 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
@@ -684,7 +684,8 @@
line: 'line',
area: 'area',
pie: 'pie',
- radar: 'radar'
+ radar: 'radar',
+ gauge: 'gauge'
},
server: {
column: 'COLUMN',
@@ -3360,8 +3361,8 @@
text = '',
titleFont,
titleColor,
- isPie = xLayout.type === conf.finals.chart.pie,
- isGauge = xLayout.type === conf.finals.chart.gauge;
+ isPie = xLayout.type === conf.finals.chart.client.pie,
+ isGauge = xLayout.type === conf.finals.chart.client.gauge;
if (isPie) {
ids.push(columnIds[0]);
@@ -4267,8 +4268,7 @@
web = ns.core.web,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
@@ -4330,12 +4330,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.chart.getData = function(layout, isUpdateGui) {
@@ -4412,45 +4407,6 @@
}, ns);
}
}, ns);
-
-
-
-
-
- //success = function(r) {
- //var response = api.response.Response((r.responseText ? Ext.decode(r.responseText) : r));
-
- //if (!response) {
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
-
- //// sync xLayout with response
- //xLayout = service.layout.getSyncronizedXLayout(xLayout, response);
-
- //if (!xLayout) {
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
-
- //ns.app.paramString = paramString;
-
- //web.chart.getChart(layout, xLayout, response, isUpdateGui);
- //};
-
- //config.url = init.contextPath + '/api/analytics.' + type + paramString;
- //config.disableCaching = false;
- //config.timeout = 60000;
- //config.headers = headers;
- //config.success = success;
- //config.failure = failure;
-
- //if (type === 'jsonp') {
- //Ext.data.JsonP.request(config);
- //}
- //else {
- //Ext.Ajax.request(config);
- //}
};
web.chart.getChart = function(layout, xLayout, response, isUpdateGui) {
@@ -4532,7 +4488,7 @@
xResponse = service.response.getExtendedResponse(xLayout, response);
// legend set
- if (xLayout.type === 'gauge' && Ext.Array.contains(xLayout.axisObjectNames, ind) && xLayout.objectNameIdsMap[ind].length) {
+ if (xLayout.type === 'GAUGE' && Ext.Array.contains(xLayout.axisObjectNames, ind) && xLayout.objectNameIdsMap[ind].length) {
Ext.Ajax.request({
url: ns.core.init.contextPath + '/api/indicators/' + xLayout.objectNameIdsMap[ind][0] + '.json?fields=legendSet[legends[id,name,startValue,endValue,color]]',
disableCaching: false,
=== 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-10-26 11:35:10 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js 2015-11-10 22:06:00 +0000
@@ -2786,28 +2786,16 @@
getOptionSets();
};
- if (Ext.isObject(GIS.app)) {
- Ext.Ajax.request({
- url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
- disableCaching: false,
- failure: function(r) {
- gis.alert(r);
- },
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
- else if (Ext.isObject(GIS.plugin)) {
- Ext.data.JsonP.request({
- url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.jsonp' + paramString,
- disableCaching: false,
- scope: this,
- success: function(r) {
- success(r);
- }
- });
- }
+ gis.ajax({
+ url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
+ disableCaching: false,
+ failure: function(r) {
+ gis.alert(r);
+ },
+ success: function(r) {
+ success(Ext.decode(r.responseText));
+ }
+ });
};
loadLegend = function(view) {
@@ -2972,7 +2960,6 @@
loadOrganisationUnits = function(view) {
var items = view.rows[0].items,
- isPlugin = GIS.plugin && !GIS.app,
url = function() {
var params = '?ou=ou:';
@@ -2991,7 +2978,7 @@
}
}
- return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params + '&includeGroupSets=true';
+ return gis.init.contextPath + '/api/geoFeatures.json' + params + '&includeGroupSets=true';
}(),
success,
failure;
@@ -3023,24 +3010,13 @@
gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
- if (GIS.plugin && !GIS.app) {
- Ext.data.JsonP.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
+ gis.ajax({
+ url: url,
+ disableCaching: false,
+ success: function(r) {
+ success(r);
+ }
+ });
};
loadData = function(view, features) {
@@ -3059,7 +3035,7 @@
loadLegend = function(view) {
var isPlugin = GIS.plugin && !GIS.app,
- type = isPlugin ? 'jsonp' : 'json',
+ type = 'json',
url = gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.' + type + '?fields=organisationUnitGroups[id,name,symbol]',
success;
@@ -3092,22 +3068,12 @@
afterLoad(view);
};
- if (isPlugin) {
- Ext.data.JsonP.request({
- url: url,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
+ gis.ajax({
+ url: url,
+ success: function(r) {
+ success(r);
+ }
+ });
};
addCircles = function(view) {
@@ -3257,7 +3223,6 @@
loadOrganisationUnits = function(view) {
var items = view.rows[0].items,
- isPlugin = GIS.plugin && !GIS.app,
url = function() {
var params = '?ou=ou:';
@@ -3276,13 +3241,13 @@
}
}
- return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
+ return gis.init.contextPath + '/api/geoFeatures.json' + params;
}(),
success,
failure;
success = function(r) {
- var geojson = gis.util.geojson.decode(r, 'DESC'),
+ var geojson = gis.util.geojson.decode(Ext.decode(r.responseText), 'DESC'),
format = new OpenLayers.Format.GeoJSON(),
features = gis.util.map.getTransformedFeatureArray(format.read(geojson)),
colors = ['black', 'blue', 'red', 'green', 'yellow'],
@@ -3340,27 +3305,13 @@
gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
- if (isPlugin) {
- Ext.data.JsonP.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(Ext.decode(r.responseText));
- },
- failure: function() {
- failure();
- }
- });
- }
+ gis.ajax({
+ url: url,
+ disableCaching: false,
+ success: function(r) {
+ success(r);
+ }
+ });
};
loadData = function(view, features) {
@@ -3620,7 +3571,6 @@
loadOrganisationUnits = function(view) {
var items = view.rows[0].items,
- isPlugin = GIS.plugin && !GIS.app,
url = function() {
var params = '?ou=ou:';
@@ -3639,13 +3589,13 @@
}
}
- return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
+ return gis.init.contextPath + '/api/geoFeatures.json' + params;
}(),
success,
failure;
success = function(r) {
- var geojson = gis.util.geojson.decode(r),
+ var geojson = gis.util.geojson.decode(Ext.decode(r.responseText)),
format = new OpenLayers.Format.GeoJSON(),
features = gis.util.map.getTransformedFeatureArray(format.read(geojson));
@@ -3671,27 +3621,16 @@
gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
- if (isPlugin) {
- Ext.data.JsonP.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(r);
- }
- });
- }
- else {
- Ext.Ajax.request({
- url: url,
- disableCaching: false,
- success: function(r) {
- success(Ext.decode(r.responseText));
- },
- failure: function() {
- failure();
- }
- });
- }
+ gis.ajax({
+ url: url,
+ disableCaching: false,
+ success: function(r) {
+ success(r);
+ },
+ failure: function() {
+ failure();
+ }
+ });
};
loadData = function(view, features) {
@@ -3814,28 +3753,16 @@
loadLegend(view);
};
- if (Ext.isObject(GIS.app)) {
- Ext.Ajax.request({
- url: gis.init.contextPath + '/api/analytics.json' + paramString,
- disableCaching: false,
- failure: function(r) {
- gis.alert(r);
- },
- success: function(r) {
- success(Ext.decode(r.responseText));
- }
- });
- }
- else if (Ext.isObject(GIS.plugin)) {
- Ext.data.JsonP.request({
- url: gis.init.contextPath + '/api/analytics.jsonp' + paramString,
- disableCaching: false,
- scope: this,
- success: function(r) {
- success(r);
- }
- });
- }
+ gis.ajax({
+ url: gis.init.contextPath + '/api/analytics.json' + paramString,
+ disableCaching: false,
+ failure: function(r) {
+ gis.alert(r);
+ },
+ success: function(r) {
+ success(Ext.decode(r.responseText));
+ }
+ });
};
loadLegend = function(view) {
@@ -3906,7 +3833,7 @@
};
loadLegendSet = function(view) {
- Ext.Ajax.request({
+ gis.ajax({
url: gis.init.contextPath + '/api/legendSets/' + view.legendSet.id + '.json?fields=' + gis.conf.url.legendSetFields.join(','),
scope: this,
disableCaching: false,
@@ -3958,7 +3885,7 @@
return;
}
- Ext.Ajax.request({
+ gis.ajax({
url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
success: function(r) {
var elements = Ext.decode(r.responseText)[elementUrl],
@@ -4440,7 +4367,7 @@
util.geojson = {};
- util.geojson.decode = function(organisationUnits, levelOrder) {
+ util.geojson.decode = function(geoFeatures, levelOrder) {
var geojson = {
type: 'FeatureCollection',
crs: {
@@ -4451,14 +4378,14 @@
},
features: []
};
-
+
levelOrder = levelOrder || 'ASC';
// sort
- util.array.sort(organisationUnits, levelOrder, 'le');
+ util.array.sort(geoFeatures, levelOrder, 'le');
- for (var i = 0, ou, gpid = '', gppg = ''; i < organisationUnits.length; i++) {
- ou = organisationUnits[i];
+ for (var i = 0, ou, gpid = '', gppg = ''; i < geoFeatures.length; i++) {
+ ou = geoFeatures[i];
// grand parent
if (Ext.isString(ou.pg) && ou.pg.length) {
@@ -7197,8 +7124,7 @@
util = gis.util,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-10-12 11:52:06 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-11-10 22:06:00 +0000
@@ -862,9 +862,9 @@
};
support.prototype.number.prettyPrint = function(number, separator) {
- separator = separator || conf.finals.style.space;
+ separator = conf.style.digitGroupSeparator[separator] ? separator : conf.finals.style.space;
- if (separator === conf.finals.style.space.none) {
+ if (separator === conf.finals.style.none) {
return number;
}
@@ -3349,8 +3349,7 @@
web = ns.core.web,
type = 'json',
headerMap = {
- json: 'application/json',
- jsonp: 'application/javascript'
+ json: 'application/json'
},
headers = {
'Content-Type': headerMap[type],
@@ -3517,7 +3516,7 @@
success: function(r) {
var metaData = Ext.decode(r.responseText).metaData;
- Ext.Ajax.request({
+ ns.ajax({
url: init.contextPath + '/api/analytics.json' + sortedParamString,
timeout: 60000,
headers: {