=== 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-09-15 22:59:55 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-09-15 23:16:55 +0000 @@ -3469,57 +3469,72 @@ web.pivot.getData = function(layout, isUpdateGui) { var xLayout, paramString, - success, - failure, - config = {}; + sortedParamString, + onFailure; if (!layout) { return; } + onFailure = function(r) { + if (!appConfig.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 (!appConfig.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.pivot.createTable(layout, response, null, isUpdateGui); - }; - - failure = function(r) { - if (!appConfig.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; - - ns.ajax(config, ns); + 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; + + Ext.Ajax.request({ + 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) { + ns.app.dateCreate = new Date(); + + var response = api.response.Response(Ext.decode(r.responseText)); + + if (!response) { + onFailure(); + return; + } + + response.metaData = metaData; + + ns.app.paramString = sortedParamString; + + web.pivot.createTable(layout, response, null, isUpdateGui); + } + }, ns); + } + }, ns); }; web.pivot.createTable = function(layout, response, xResponse, isUpdateGui) { === 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-09-15 22:59:55 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-09-15 23:16:55 +0000 @@ -3469,57 +3469,72 @@ web.pivot.getData = function(layout, isUpdateGui) { var xLayout, paramString, - success, - failure, - config = {}; + sortedParamString, + onFailure; if (!layout) { return; } + onFailure = function(r) { + if (!appConfig.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 (!appConfig.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.pivot.createTable(layout, response, null, isUpdateGui); - }; - - failure = function(r) { - if (!appConfig.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; - - ns.ajax(config, ns); + 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; + + Ext.Ajax.request({ + 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) { + ns.app.dateCreate = new Date(); + + var response = api.response.Response(Ext.decode(r.responseText)); + + if (!response) { + onFailure(); + return; + } + + response.metaData = metaData; + + ns.app.paramString = sortedParamString; + + web.pivot.createTable(layout, response, null, isUpdateGui); + } + }, ns); + } + }, ns); }; web.pivot.createTable = function(layout, response, xResponse, isUpdateGui) { === 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-09-15 22:59:55 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-09-15 23:16:55 +0000 @@ -3469,57 +3469,72 @@ web.pivot.getData = function(layout, isUpdateGui) { var xLayout, paramString, - success, - failure, - config = {}; + sortedParamString, + onFailure; if (!layout) { return; } + onFailure = function(r) { + if (!appConfig.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 (!appConfig.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.pivot.createTable(layout, response, null, isUpdateGui); - }; - - failure = function(r) { - if (!appConfig.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; - - ns.ajax(config, ns); + 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; + + Ext.Ajax.request({ + 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) { + ns.app.dateCreate = new Date(); + + var response = api.response.Response(Ext.decode(r.responseText)); + + if (!response) { + onFailure(); + return; + } + + response.metaData = metaData; + + ns.app.paramString = sortedParamString; + + web.pivot.createTable(layout, response, null, isUpdateGui); + } + }, ns); + } + }, ns); }; web.pivot.createTable = function(layout, response, xResponse, isUpdateGui) {