=== 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-11 22:00:37 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html 2015-09-15 23:25:51 +0000 @@ -24,8 +24,7 @@ el: 'chart1', uid: 'vIlITOVLOjI', crossDomain: false, - dashboard: true, - userOrgUnit: 'qhqAxPSTUXp' + dashboard: true }); //DHIS.getChart({ === 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-09-11 22:00:37 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-09-15 23:25:51 +0000 @@ -4299,62 +4299,116 @@ web.chart.getData = function(layout, isUpdateGui) { var xLayout, paramString, - success, - failure, - config = {}; + sortedParamString, + onFailure; if (!layout) { return; } + onFailure = function(r) { + if (!ns.skipMask) { + web.mask.hide(ns.app.centerRegion); + } + }; + xLayout = service.layout.getExtendedLayout(layout); - paramString = web.analytics.getParamString(xLayout, true); + paramString = web.analytics.getParamString(xLayout) + '&skipData=true'; + sortedParamString = web.analytics.getParamString(xLayout, true) + '&skipMeta=true'; // mask if (!ns.skipMask) { web.mask.show(ns.app.centerRegion); } - 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); - }; - - failure = function(r) { - if (!ns.skipMask) { - web.mask.hide(ns.app.centerRegion); - } - }; - - 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); - } + ns.ajax({ + url: init.contextPath + '/api/analytics.json' + paramString, + timeout: 60000, + headers: { + 'Content-Type': 'application/json', + 'Accepts': 'application/json' + }, + disableCaching: false, + failure: function(r) { + onFailure(r); + }, + success: function(r) { + var metaData = Ext.decode(r.responseText).metaData; + + ns.ajax({ + url: init.contextPath + '/api/analytics.json' + sortedParamString, + timeout: 60000, + headers: { + 'Content-Type': 'application/json', + 'Accepts': 'application/json' + }, + disableCaching: false, + failure: function(r) { + onFailure(r); + }, + success: function(r) { + var response = api.response.Response(Ext.decode(r.responseText)); + + if (!response) { + onFailure(); + return; + } + + response.metaData = metaData; + + // sync xLayout with response + xLayout = service.layout.getSyncronizedXLayout(xLayout, response); + + if (!xLayout) { + return; + } + + ns.app.paramString = sortedParamString; + + web.chart.getChart(layout, xLayout, response, isUpdateGui); + } + }, 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-09-11 22:00:37 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2015-09-15 23:25:51 +0000 @@ -4299,62 +4299,116 @@ web.chart.getData = function(layout, isUpdateGui) { var xLayout, paramString, - success, - failure, - config = {}; + sortedParamString, + onFailure; if (!layout) { return; } + onFailure = function(r) { + if (!ns.skipMask) { + web.mask.hide(ns.app.centerRegion); + } + }; + xLayout = service.layout.getExtendedLayout(layout); - paramString = web.analytics.getParamString(xLayout, true); + paramString = web.analytics.getParamString(xLayout) + '&skipData=true'; + sortedParamString = web.analytics.getParamString(xLayout, true) + '&skipMeta=true'; // mask if (!ns.skipMask) { web.mask.show(ns.app.centerRegion); } - 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); - }; - - failure = function(r) { - if (!ns.skipMask) { - web.mask.hide(ns.app.centerRegion); - } - }; - - 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); - } + ns.ajax({ + url: init.contextPath + '/api/analytics.json' + paramString, + timeout: 60000, + headers: { + 'Content-Type': 'application/json', + 'Accepts': 'application/json' + }, + disableCaching: false, + failure: function(r) { + onFailure(r); + }, + success: function(r) { + var metaData = Ext.decode(r.responseText).metaData; + + ns.ajax({ + url: init.contextPath + '/api/analytics.json' + sortedParamString, + timeout: 60000, + headers: { + 'Content-Type': 'application/json', + 'Accepts': 'application/json' + }, + disableCaching: false, + failure: function(r) { + onFailure(r); + }, + success: function(r) { + var response = api.response.Response(Ext.decode(r.responseText)); + + if (!response) { + onFailure(); + return; + } + + response.metaData = metaData; + + // sync xLayout with response + xLayout = service.layout.getSyncronizedXLayout(xLayout, response); + + if (!xLayout) { + return; + } + + ns.app.paramString = sortedParamString; + + web.chart.getChart(layout, xLayout, response, isUpdateGui); + } + }, 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-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-09-11 22:00:37 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-09-15 23:25:51 +0000 @@ -4299,62 +4299,116 @@ web.chart.getData = function(layout, isUpdateGui) { var xLayout, paramString, - success, - failure, - config = {}; + sortedParamString, + onFailure; if (!layout) { return; } + onFailure = function(r) { + if (!ns.skipMask) { + web.mask.hide(ns.app.centerRegion); + } + }; + xLayout = service.layout.getExtendedLayout(layout); - paramString = web.analytics.getParamString(xLayout, true); + paramString = web.analytics.getParamString(xLayout) + '&skipData=true'; + sortedParamString = web.analytics.getParamString(xLayout, true) + '&skipMeta=true'; // mask if (!ns.skipMask) { web.mask.show(ns.app.centerRegion); } - 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); - }; - - failure = function(r) { - if (!ns.skipMask) { - web.mask.hide(ns.app.centerRegion); - } - }; - - 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); - } + ns.ajax({ + url: init.contextPath + '/api/analytics.json' + paramString, + timeout: 60000, + headers: { + 'Content-Type': 'application/json', + 'Accepts': 'application/json' + }, + disableCaching: false, + failure: function(r) { + onFailure(r); + }, + success: function(r) { + var metaData = Ext.decode(r.responseText).metaData; + + ns.ajax({ + url: init.contextPath + '/api/analytics.json' + sortedParamString, + timeout: 60000, + headers: { + 'Content-Type': 'application/json', + 'Accepts': 'application/json' + }, + disableCaching: false, + failure: function(r) { + onFailure(r); + }, + success: function(r) { + var response = api.response.Response(Ext.decode(r.responseText)); + + if (!response) { + onFailure(); + return; + } + + response.metaData = metaData; + + // sync xLayout with response + xLayout = service.layout.getSyncronizedXLayout(xLayout, response); + + if (!xLayout) { + return; + } + + ns.app.paramString = sortedParamString; + + web.chart.getChart(layout, xLayout, response, isUpdateGui); + } + }, 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) {