=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-03-06 11:02:06 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-03-19 18:33:19 +0000 @@ -5367,29 +5367,33 @@ // organisation unit levels requests.push({ - url: init.contextPath + '/api/organisationUnitLevels.json?paging=false&links=false', + url: init.contextPath + '/api/organisationUnitLevels/filtered.json?include=id,name,level&paging=false', success: function(r) { - init.organisationUnitLevels = Ext.decode(r.responseText).organisationUnitLevels || []; + init.organisationUnitLevels = Ext.decode(r.responseText).objects || []; fn(); } }); // user orgunits and children requests.push({ - url: init.contextPath + '/api/organisationUnits.json?userOnly=true&viewClass=detailed&links=false', + url: init.contextPath + '/api/organisationUnits/filtered.json?userOnly=true&include=id,name,children[id,name]&paging=false', success: function(r) { - var organisationUnits = Ext.decode(r.responseText).organisationUnits || []; + var organisationUnits = Ext.decode(r.responseText).objects || [], + ou = [], + ouc = []; if (organisationUnits.length) { - var ou = organisationUnits[0]; - - if (ou.id) { - init.user = { - ou: ou.id - }; - - init.user.ouc = ou.children ? Ext.Array.pluck(ou.children, 'id') : null; - }; + for (var i = 0, org; i < organisationUnits.length; i++) { + org = organisationUnits[i]; + + ou.push(org.id); + ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || [])); + } + + init.user = { + ou: ou, + ouc: ouc + } } else { alert('User is not assigned to any organisation units'); @@ -5400,13 +5404,13 @@ }); // 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(); - } - }); + //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({