dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27299
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13568: PT, dynamic config url.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13568 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-01-03 18:40:45 +0100
message:
PT, dynamic config url.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.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-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-01-03 17:22:29 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-01-03 17:40:45 +0000
@@ -4805,8 +4805,8 @@
text += '<script src="http://dhis2-cdn.org/v214/ext/ext-all.js"></script>\n';
text += '<script src="http://dhis2-cdn.org/v214/plugin/table.js"></script>\n\n';
text += '<script>\n';
- text += 'var base = "' + ns.core.init.host + '";\n\n';
- text += 'DHIS.getTable( url: base, el: "table1", ' + JSON.stringify(ns.core.service.layout.layout2plugin(ns.app.layout, 'table1'), null, 2) + ');\n';
+ text += 'var base = "' + ns.core.init.contextPath + '";\n\n';
+ text += 'DHIS.getTable({' + JSON.stringify(ns.core.service.layout.layout2plugin(ns.app.layout, 'table1'), null, 2) + ');\n';
text += '</script>\n</head>\n\n<body>\n';
text += '<div id="table1"></div>\n';
text += '</body>\n</html>';
@@ -5422,88 +5422,86 @@
success: function(r) {
var i18nArray = Ext.decode(r.responseText);
- // i18n
- requests.push({
- url: init.contextPath + '/api/i18n?package=org.hisp.dhis.pivot',
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'Accepts': 'application/json'
- },
- params: Ext.encode(i18nArray),
- success: function(r) {
- NS.i18n = Ext.decode(r.responseText);
- fn();
- }
- });
-
- // root nodes
- requests.push({
- url: init.contextPath + '/api/organisationUnits.json?level=1&paging=false&links=false&viewClass=detailed',
- success: function(r) {
- init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
- fn();
- }
- });
-
- // organisation unit levels
- requests.push({
- url: init.contextPath + '/api/organisationUnitLevels.json?paging=false&links=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&viewClass=detailed&links=false',
- success: function(r) {
- var organisationUnits = Ext.decode(r.responseText).organisationUnits || [];
-
- if (organisationUnits.length) {
- var ou = organisationUnits[0];
-
- init.user = {
- ou: ou.id,
- ouc: Ext.Array.pluck(ou.children, 'id')
- };
-
- fn();
- }
- }
- });
-
- // legend sets
- requests.push({
- url: init.contextPath + '/api/mapLegendSets.json?viewClass=detailed&links=false&paging=false',
- success: function(r) {
- init.legendSets = Ext.decode(r.responseText).mapLegendSets || [];
- fn();
- }
- });
-
- // dimensions
- requests.push({
- url: init.contextPath + '/api/dimensions.json?links=false&paging=false',
- success: function(r) {
- init.dimensions = Ext.decode(r.responseText).dimensions || [];
- fn();
- }
- });
-
- // host url
- requests.push({
+ Ext.Ajax.request({
url: init.contextPath + '/api/system/context.json',
success: function(r) {
- init.host = Ext.decode(r.responseText).contextPath || '';
- fn();
+ init.contextPath = Ext.decode(r.responseText).contextPath || init.contextPath;
+
+ // i18n
+ requests.push({
+ url: init.contextPath + '/api/i18n?package=org.hisp.dhis.pivot',
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Accepts': 'application/json'
+ },
+ params: Ext.encode(i18nArray),
+ success: function(r) {
+ NS.i18n = Ext.decode(r.responseText);
+ fn();
+ }
+ });
+
+ // root nodes
+ requests.push({
+ url: init.contextPath + '/api/organisationUnits.json?level=1&paging=false&links=false&viewClass=detailed',
+ success: function(r) {
+ init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
+ fn();
+ }
+ });
+
+ // organisation unit levels
+ requests.push({
+ url: init.contextPath + '/api/organisationUnitLevels.json?paging=false&links=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&viewClass=detailed&links=false',
+ success: function(r) {
+ var organisationUnits = Ext.decode(r.responseText).organisationUnits || [];
+
+ if (organisationUnits.length) {
+ var ou = organisationUnits[0];
+
+ init.user = {
+ ou: ou.id,
+ ouc: Ext.Array.pluck(ou.children, 'id')
+ };
+ }
+
+ fn();
+ }
+ });
+
+ // legend sets
+ requests.push({
+ url: init.contextPath + '/api/mapLegendSets.json?viewClass=detailed&links=false&paging=false',
+ success: function(r) {
+ init.legendSets = Ext.decode(r.responseText).mapLegendSets || [];
+ fn();
+ }
+ });
+
+ // dimensions
+ requests.push({
+ url: init.contextPath + '/api/dimensions.json?links=false&paging=false',
+ success: function(r) {
+ init.dimensions = Ext.decode(r.responseText).dimensions || [];
+ fn();
+ }
+ });
+
+ for (var i = 0; i < requests.length; i++) {
+ Ext.Ajax.request(requests[i]);
+ }
}
});
-
- for (var i = 0; i < requests.length; i++) {
- Ext.Ajax.request(requests[i]);
- }
}
});
}