=== 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 2015-04-28 11:33:27 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-04-29 10:28:46 +0000 @@ -8125,8 +8125,6 @@ objectStores: ['optionSets'] }); - dhis2.er.store.open(); - // requests Ext.Ajax.request({ url: 'manifest.webapp', @@ -8322,80 +8320,80 @@ success: function() { var store = dhis2.er.store; - // check if idb has any option sets - store.count('optionSets').done( function(count) { - - if (count === 0) { - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false', - success: function(r) { - var sets = Ext.decode(r.responseText).optionSets; - - if (sets.length) { - store.setAll('optionSets', sets).done(fn); - } - else { - fn(); - } - } - }); - } - else { - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,version&paging=false', - success: function(r) { - var optionSets = Ext.decode(r.responseText).optionSets || [], - ids = [], - url = '', - callbacks = 0, - checkOptionSet, - updateStore; - - updateStore = function() { - if (++callbacks === optionSets.length) { - if (!ids.length) { - fn(); - return; - } - - for (var i = 0; i < ids.length; i++) { - url += '&filter=id:eq:' + ids[i]; - } - - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url, - success: function(r) { - var sets = Ext.decode(r.responseText).optionSets; - - store.setAll('optionSets', sets).done(fn); - } + store.open().done( function() { + + // check if idb has any option sets + store.getKeys('optionSets').done( function(keys) { + if (keys.length === 0) { + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false', + success: function(r) { + var sets = Ext.decode(r.responseText).optionSets; + + if (sets.length) { + store.setAll('optionSets', sets).done(fn); + } + else { + fn(); + } + } + }); + } + else { + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,version&paging=false', + success: function(r) { + var optionSets = Ext.decode(r.responseText).optionSets || [], + ids = [], + url = '', + callbacks = 0, + checkOptionSet, + updateStore; + + updateStore = function() { + if (++callbacks === optionSets.length) { + if (!ids.length) { + fn(); + return; + } + + for (var i = 0; i < ids.length; i++) { + url += '&filter=id:eq:' + ids[i]; + } + + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url, + success: function(r) { + var sets = Ext.decode(r.responseText).optionSets; + + store.setAll('optionSets', sets).done(fn); + } + }); + } + }; + + registerOptionSet = function(optionSet) { + store.get('optionSets', optionSet.id).done( function(obj) { + if (!Ext.isObject(obj) || obj.version !== optionSet.version) { + ids.push(optionSet.id); + } + + updateStore(); }); - } - }; - - registerOptionSet = function(optionSet) { - store.get('optionSets', optionSet.id).done( function(obj) { - if (!Ext.isObject(obj) || obj.version !== optionSet.version) { - ids.push(optionSet.id); - } - - updateStore(); - }); - }; - - if (optionSets.length) { - store.open().done( function() { + }; + + if (optionSets.length) { for (var i = 0; i < optionSets.length; i++) { registerOptionSet(optionSets[i]); } - }); - } - else { - fn(); - } - } - }); - } + } + else { + fn(); + } + } + }); + } + }); }); } }); === 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 2015-04-28 11:33:27 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-04-29 10:28:46 +0000 @@ -7785,8 +7785,6 @@ objectStores: ['optionSets'] }); - dhis2.ev.store.open(); - // requests Ext.Ajax.request({ url: 'manifest.webapp', @@ -7982,80 +7980,80 @@ success: function() { var store = dhis2.ev.store; - // check if idb has any option sets - store.count('optionSets').done( function(count) { - - if (count === 0) { - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false', - success: function(r) { - var sets = Ext.decode(r.responseText).optionSets; - - if (sets.length) { - store.setAll('optionSets', sets).done(fn); - } - else { - fn(); - } - } - }); - } - else { - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,version&paging=false', - success: function(r) { - var optionSets = Ext.decode(r.responseText).optionSets || [], - ids = [], - url = '', - callbacks = 0, - checkOptionSet, - updateStore; - - updateStore = function() { - if (++callbacks === optionSets.length) { - if (!ids.length) { - fn(); - return; - } - - for (var i = 0; i < ids.length; i++) { - url += '&filter=id:eq:' + ids[i]; - } - - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url, - success: function(r) { - var sets = Ext.decode(r.responseText).optionSets; - - store.setAll('optionSets', sets).done(fn); - } + store.open().done( function() { + + // check if idb has any option sets + store.getKeys('optionSets').done( function(keys) { + if (keys.length === 0) { + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false', + success: function(r) { + var sets = Ext.decode(r.responseText).optionSets; + + if (sets.length) { + store.setAll('optionSets', sets).done(fn); + } + else { + fn(); + } + } + }); + } + else { + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,version&paging=false', + success: function(r) { + var optionSets = Ext.decode(r.responseText).optionSets || [], + ids = [], + url = '', + callbacks = 0, + checkOptionSet, + updateStore; + + updateStore = function() { + if (++callbacks === optionSets.length) { + if (!ids.length) { + fn(); + return; + } + + for (var i = 0; i < ids.length; i++) { + url += '&filter=id:eq:' + ids[i]; + } + + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url, + success: function(r) { + var sets = Ext.decode(r.responseText).optionSets; + + store.setAll('optionSets', sets).done(fn); + } + }); + } + }; + + registerOptionSet = function(optionSet) { + store.get('optionSets', optionSet.id).done( function(obj) { + if (!Ext.isObject(obj) || obj.version !== optionSet.version) { + ids.push(optionSet.id); + } + + updateStore(); }); - } - }; - - registerOptionSet = function(optionSet) { - store.get('optionSets', optionSet.id).done( function(obj) { - if (!Ext.isObject(obj) || obj.version !== optionSet.version) { - ids.push(optionSet.id); - } - - updateStore(); - }); - }; - - if (optionSets.length) { - store.open().done( function() { + }; + + if (optionSets.length) { for (var i = 0; i < optionSets.length; i++) { registerOptionSet(optionSets[i]); } - }); - } - else { - fn(); - } - } - }); - } + } + else { + fn(); + } + } + }); + } + }); }); } }); === 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 2015-04-28 12:48:00 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js 2015-04-29 10:28:46 +0000 @@ -9750,8 +9750,6 @@ objectStores: ['optionSets'] }); - dhis2.gis.store.open(); - // inject google maps GIS_GM = { ready: false, @@ -10044,80 +10042,80 @@ success: function() { var store = dhis2.gis.store; - // check if idb has any option sets - store.count('optionSets').done( function(count) { - - if (count === 0) { - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false', - success: function(r) { - var sets = Ext.decode(r.responseText).optionSets; - - if (sets.length) { - store.setAll('optionSets', sets).done(fn); - } - else { - fn(); - } - } - }); - } - else { - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,version&paging=false', - success: function(r) { - var optionSets = Ext.decode(r.responseText).optionSets || [], - ids = [], - url = '', - callbacks = 0, - checkOptionSet, - updateStore; - - updateStore = function() { - if (++callbacks === optionSets.length) { - if (!ids.length) { - fn(); - return; - } - - for (var i = 0; i < ids.length; i++) { - url += '&filter=id:eq:' + ids[i]; - } - - Ext.Ajax.request({ - url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url, - success: function(r) { - var sets = Ext.decode(r.responseText).optionSets; - - store.setAll('optionSets', sets).done(fn); - } + store.open().done( function() { + + // check if idb has any option sets + store.getKeys('optionSets').done( function(keys) { + if (keys.length === 0) { + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false', + success: function(r) { + var sets = Ext.decode(r.responseText).optionSets; + + if (sets.length) { + store.setAll('optionSets', sets).done(fn); + } + else { + fn(); + } + } + }); + } + else { + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,version&paging=false', + success: function(r) { + var optionSets = Ext.decode(r.responseText).optionSets || [], + ids = [], + url = '', + callbacks = 0, + checkOptionSet, + updateStore; + + updateStore = function() { + if (++callbacks === optionSets.length) { + if (!ids.length) { + fn(); + return; + } + + for (var i = 0; i < ids.length; i++) { + url += '&filter=id:eq:' + ids[i]; + } + + Ext.Ajax.request({ + url: contextPath + '/api/optionSets.json?fields=id,name,version,options[code,name]&paging=false' + url, + success: function(r) { + var sets = Ext.decode(r.responseText).optionSets; + + store.setAll('optionSets', sets).done(fn); + } + }); + } + }; + + registerOptionSet = function(optionSet) { + store.get('optionSets', optionSet.id).done( function(obj) { + if (!Ext.isObject(obj) || obj.version !== optionSet.version) { + ids.push(optionSet.id); + } + + updateStore(); }); - } - }; - - registerOptionSet = function(optionSet) { - store.get('optionSets', optionSet.id).done( function(obj) { - if (!Ext.isObject(obj) || obj.version !== optionSet.version) { - ids.push(optionSet.id); - } - - updateStore(); - }); - }; - - if (optionSets.length) { - store.open().done( function() { + }; + + if (optionSets.length) { for (var i = 0; i < optionSets.length; i++) { registerOptionSet(optionSets[i]); } - }); - } - else { - fn(); - } - } - }); - } + } + else { + fn(); + } + } + }); + } + }); }); } }); === 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-01-26 15:12:42 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-04-29 13:19:02 +0000 @@ -24,7 +24,8 @@ uid: 'C0rhAq1oklh', showDimensionLabels: true, displayDensity: 'compact', - fontSize: 'normal' + fontSize: 'normal', + userOrganisationUnit: 'abc' }); DHIS.getTable({ === 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-04-23 15:36:12 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-04-29 13:19:02 +0000 @@ -360,6 +360,8 @@ // displayProperty: string ('name') // 'name', 'shortname', null + // userOrganisationUnit: string + getValidatedDimensionArray = function(dimensionArray) { var dimensionArray = Ext.clone(dimensionArray); @@ -529,6 +531,11 @@ layout.displayProperty = config.displayProperty; } + if (Ext.isString(config.userOrganisationUnit)) { + layout.userOrganisationUnit = config.userOrganisationUnit; + } + + // validate if (!validateSpecialCases()) { return; } @@ -2009,6 +2016,11 @@ // display property paramString += '&displayProperty=' + displayProperty.toUpperCase(); + // user organisation unit + if (Ext.isString(xLayout.userOrganisationUnit)) { + paramString += '&userOrganisationUnit=' + xLayout.userOrganisationUnit; + } + return paramString; }; === 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-04-23 15:36:12 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-04-29 13:19:02 +0000 @@ -15,7 +15,7 @@ styleEl = document.createElement("style"); styleEl.setAttribute("type", "text/css"); - + if (id) { styleEl.setAttribute("id", id); } @@ -387,6 +387,8 @@ // topLimit: integer (100) //5, 10, 20, 50, 100 + // userOrganisationUnit: string + getValidatedDimensionArray = function(dimensionArray) { var dimensionArray = Ext.clone(dimensionArray); @@ -550,6 +552,11 @@ layout.displayProperty = config.displayProperty; } + if (Ext.isString(config.userOrganisationUnit)) { + layout.userOrganisationUnit = config.userOrganisationUnit; + } + + // validate if (!validateSpecialCases()) { return; } @@ -2015,6 +2022,11 @@ // display property paramString += '&displayProperty=' + displayProperty.toUpperCase(); + // user organisation unit + if (Ext.isString(xLayout.userOrganisationUnit)) { + paramString += '&userOrganisationUnit=' + xLayout.userOrganisationUnit; + } + return paramString; }; === 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-04-23 15:36:12 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-04-29 13:19:02 +0000 @@ -387,6 +387,8 @@ // topLimit: integer (100) //5, 10, 20, 50, 100 + // userOrganisationUnit: string + getValidatedDimensionArray = function(dimensionArray) { var dimensionArray = Ext.clone(dimensionArray); @@ -550,6 +552,10 @@ layout.displayProperty = config.displayProperty; } + if (Ext.isString(config.userOrganisationUnit)) { + layout.userOrganisationUnit = config.userOrganisationUnit; + } + if (!validateSpecialCases()) { return; } @@ -2015,6 +2021,11 @@ // display property paramString += '&displayProperty=' + displayProperty.toUpperCase(); + // user organisation unit + if (Ext.isString(xLayout.userOrganisationUnit)) { + paramString += '&userOrganisationUnit=' + xLayout.userOrganisationUnit; + } + return paramString; }; === 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-04-23 15:36:12 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-04-29 13:19:02 +0000 @@ -387,6 +387,8 @@ // topLimit: integer (100) //5, 10, 20, 50, 100 + // userOrganisationUnit: string + getValidatedDimensionArray = function(dimensionArray) { var dimensionArray = Ext.clone(dimensionArray); @@ -550,6 +552,10 @@ layout.displayProperty = config.displayProperty; } + if (Ext.isString(config.userOrganisationUnit)) { + layout.userOrganisationUnit = config.userOrganisationUnit; + } + if (!validateSpecialCases()) { return; } @@ -2008,6 +2014,11 @@ // display property paramString += '&displayProperty=' + displayProperty.toUpperCase(); + // user organisation unit + if (Ext.isString(xLayout.userOrganisationUnit)) { + paramString += '&userOrganisationUnit=' + xLayout.userOrganisationUnit; + } + return paramString; };