dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38819
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19718: DV item sorting + configurable user orgunits.
------------------------------------------------------------
revno: 19718
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-05 14:57:59 +0200
message:
DV item sorting + configurable user orgunits.
modified:
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/scripts/app.js
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/table.js
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/scripts/app.js
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/core.js
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/table.js
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/table.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-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-08-04 13:19:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-08-05 12:57:59 +0000
@@ -30,7 +30,7 @@
url: url,
el: 'table2',
columns: [
- {dimension: 'pe', items: [{id: 'LAST_3_MONTHS'}]}
+ {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]}
],
rows: [
{dimension: 'ou', items: [{id: 'USER_ORGUNIT_CHILDREN'}]}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-08-04 13:19:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-08-05 12:57:59 +0000
@@ -2550,7 +2550,7 @@
onFailure = function(r) {
ns.app.viewport.setGui(layout, xLayout, isUpdateGui);
- web.mask.hide(ns.app.centerRegion);
+ web.mask.hide(ns.app.centerRegion);
if (r) {
r = Ext.decode(r.responseText);
@@ -2586,7 +2586,7 @@
onFailure(r);
},
success: function(r) {
- var metaData = Ext.decode(r.responseText).metaData;
+ var metaData = Ext.decode(r.responseText).metaData;
Ext.Ajax.request({
url: init.contextPath + '/api/analytics.json' + sortedParamString,
=== 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-08-04 13:19:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-08-05 12:57:59 +0000
@@ -346,7 +346,9 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -589,7 +591,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1245,12 +1247,12 @@
}
};
- // Set items from init/metaData/xLayout
+ // set items from init/metaData/xLayout
for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
dim = dimensions[i];
- dim.items = [];
+ dim.items = [];
metaDataDim = response.metaData[dim.objectName];
-
+
if (Ext.isArray(metaDataDim) && metaDataDim.length) {
var ids = Ext.clone(response.metaData[dim.dimensionName]);
for (var j = 0; j < ids.length; j++) {
@@ -1265,7 +1267,7 @@
}
}
- // Add missing names
+ // add missing names
dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
@@ -1282,7 +1284,7 @@
}
}
- // Remove dimensions from layout that do not exist in response
+ // remove dimensions from layout that do not exist in response
for (var i = 0, dimensionName; i < xLayout.axisDimensionNames.length; i++) {
dimensionName = xLayout.axisDimensionNames[i];
if (!Ext.Array.contains(headerNames, dimensionName)) {
@@ -2094,10 +2096,10 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
- // user organisation unit
+ // user org unit
if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
paramString += '&userOrgUnit=';
-
+
for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
}
=== 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-08-04 13:20:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-08-05 12:57:59 +0000
@@ -348,7 +348,9 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -591,7 +593,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1247,12 +1249,12 @@
}
};
- // Set items from init/metaData/xLayout
+ // set items from init/metaData/xLayout
for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
dim = dimensions[i];
- dim.items = [];
+ dim.items = [];
metaDataDim = response.metaData[dim.objectName];
-
+
if (Ext.isArray(metaDataDim) && metaDataDim.length) {
var ids = Ext.clone(response.metaData[dim.dimensionName]);
for (var j = 0; j < ids.length; j++) {
@@ -1267,7 +1269,7 @@
}
}
- // Add missing names
+ // add missing names
dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
@@ -1284,7 +1286,7 @@
}
}
- // Remove dimensions from layout that do not exist in response
+ // remove dimensions from layout that do not exist in response
for (var i = 0, dimensionName; i < xLayout.axisDimensionNames.length; i++) {
dimensionName = xLayout.axisDimensionNames[i];
if (!Ext.Array.contains(headerNames, dimensionName)) {
@@ -2096,10 +2098,10 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
- // user organisation unit
+ // user org unit
if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
paramString += '&userOrgUnit=';
-
+
for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
}
=== 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-07-15 22:36:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/plugin.html 2015-08-05 12:57:59 +0000
@@ -2,9 +2,9 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../dhis-web-commons/javascripts/ext/resources/css/ext-plugin-gray.css" />
-
+
<script type="text/javascript" src="../dhis-web-commons/javascripts/ext/ext-all.js"></script>
-
+
<script src="scripts/chart.js"></script>
<style type="text/css">
@@ -22,8 +22,9 @@
DHIS.getChart({
url: url,
el: 'chart1',
- uid: 'Z0oO5q4zPsF',
- crossDomain: false
+ uid: 'vIlITOVLOjI',
+ crossDomain: false,
+ userOrgUnit: 'qhqAxPSTUXp'
});
//DHIS.getChart({
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2015-07-15 16:23:18 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2015-08-05 12:57:59 +0000
@@ -2444,19 +2444,32 @@
web.chart.getData = function(layout, isUpdateGui) {
var xLayout,
paramString,
+ sortedParamString,
onFailure;
if (!layout) {
return;
}
- onFailure = function() {
+ onFailure = function(r) {
ns.app.viewport.setGui(layout, xLayout, isUpdateGui);
web.mask.hide(ns.app.centerRegion);
+
+ if (r) {
+ r = Ext.decode(r.responseText);
+
+ if (Ext.Array.contains([413, 414], parseInt(r.httpStatusCode))) {
+ web.analytics.validateUrl(init.contextPath + '/api/analytics.json' + paramString);
+ }
+ else {
+ ns.alert(r);
+ }
+ }
};
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';
// show mask
web.mask.show(ns.app.centerRegion);
@@ -2469,38 +2482,45 @@
'Accepts': 'application/json'
},
disableCaching: false,
- failure: function(r) {
+ failure: function(r) {
onFailure();
-
- r = Ext.decode(r.responseText);
-
- if (Ext.Array.contains([413, 414], parseInt(r.httpStatusCode))) {
- web.analytics.validateUrl(init.contextPath + '/api/analytics.json' + paramString);
- }
- else {
- ns.alert(r);
- }
},
success: function(r) {
- var xResponse,
- html,
- response = api.response.Response(Ext.decode(r.responseText));
-
- if (!response) {
- onFailure();
- return;
- }
-
- // sync xLayout with response
- xLayout = service.layout.getSyncronizedXLayout(xLayout, response);
-
- if (!xLayout) {
- return;
- }
-
- ns.app.paramString = paramString;
-
- web.chart.getChart(layout, xLayout, response, isUpdateGui);
+ 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) {
+ 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);
+ }
+ });
}
});
};
@@ -2622,7 +2642,7 @@
onDataTypeSelect,
dataType,
dataSelected,
-
+
indicatorLabel,
indicatorSearch,
indicatorFilter,
@@ -2661,7 +2681,7 @@
programIndicatorSelected,
programIndicator,
data,
-
+
rewind,
relativePeriodDefaults,
relativePeriod,
@@ -5057,7 +5077,7 @@
period.checkboxes.push(chb);
relativePeriod.valueComponentMap[chb.relativePeriodId] = chb;
}
-
+
if (chb.relativePeriodId === ns.core.init.systemInfo.analysisRelativePeriod) {
chb.setValue(true);
}
@@ -6633,7 +6653,7 @@
window.open(url, isNewTab ? '_blank' : '_top');
}
}
- };
+ };
downloadButton = Ext.create('Ext.button.Button', {
text: NS.i18n.download,
=== 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-07-15 22:36:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-08-05 12:57:59 +0000
@@ -567,14 +567,14 @@
// namespace
DV = {};
- var NS = DV;
-
- NS.instances = [];
- NS.i18n = {};
- NS.isDebug = false;
- NS.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
-
- NS.getCore = function(ns) {
+ var DV = DV;
+
+ DV.instances = [];
+ DV.i18n = {};
+ DV.isDebug = false;
+ DV.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
+
+ DV.getCore = function(ns) {
var init = ns.init,
conf = {},
api = {},
@@ -592,24 +592,24 @@
dimension: {
data: {
value: 'data',
- name: NS.i18n.data || 'Data',
+ name: DV.i18n.data || 'Data',
dimensionName: 'dx',
objectName: 'dx'
},
category: {
- name: NS.i18n.assigned_categories || 'Assigned categories',
+ name: DV.i18n.assigned_categories || 'Assigned categories',
dimensionName: 'co',
objectName: 'co',
},
indicator: {
value: 'indicators',
- name: NS.i18n.indicators || 'Indicators',
+ name: DV.i18n.indicators || 'Indicators',
dimensionName: 'dx',
objectName: 'in'
},
dataElement: {
value: 'dataElements',
- name: NS.i18n.data_elements || 'Data elements',
+ name: DV.i18n.data_elements || 'Data elements',
dimensionName: 'dx',
objectName: 'de'
},
@@ -621,25 +621,25 @@
},
dataSet: {
value: 'dataSets',
- name: NS.i18n.data_sets || 'Data sets',
+ name: DV.i18n.data_sets || 'Data sets',
dimensionName: 'dx',
objectName: 'ds'
},
eventDataItem: {
value: 'eventDataItem',
- name: NS.i18n.event_data_items || 'Event data items',
+ name: DV.i18n.event_data_items || 'Event data items',
dimensionName: 'dx',
objectName: 'di'
},
programIndicator: {
value: 'programIndicator',
- name: NS.i18n.program_indicators || 'Program indicators',
+ name: DV.i18n.program_indicators || 'Program indicators',
dimensionName: 'dx',
objectName: 'pi'
},
period: {
value: 'period',
- name: NS.i18n.periods || 'Periods',
+ name: DV.i18n.periods || 'Periods',
dimensionName: 'pe',
objectName: 'pe'
},
@@ -651,7 +651,7 @@
},
organisationUnit: {
value: 'organisationUnits',
- name: NS.i18n.organisation_units || 'Organisation units',
+ name: DV.i18n.organisation_units || 'Organisation units',
dimensionName: 'ou',
objectName: 'ou'
},
@@ -712,17 +712,17 @@
conf.period = {
periodTypes: [
- {id: 'Daily', name: NS.i18n.daily},
- {id: 'Weekly', name: NS.i18n.weekly},
- {id: 'Monthly', name: NS.i18n.monthly},
- {id: 'BiMonthly', name: NS.i18n.bimonthly},
- {id: 'Quarterly', name: NS.i18n.quarterly},
- {id: 'SixMonthly', name: NS.i18n.sixmonthly},
- {id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
- {id: 'Yearly', name: NS.i18n.yearly},
- {id: 'FinancialOct', name: NS.i18n.financial_oct},
- {id: 'FinancialJuly', name: NS.i18n.financial_july},
- {id: 'FinancialApril', name: NS.i18n.financial_april}
+ {id: 'Daily', name: DV.i18n.daily},
+ {id: 'Weekly', name: DV.i18n.weekly},
+ {id: 'Monthly', name: DV.i18n.monthly},
+ {id: 'BiMonthly', name: DV.i18n.bimonthly},
+ {id: 'Quarterly', name: DV.i18n.quarterly},
+ {id: 'SixMonthly', name: DV.i18n.sixmonthly},
+ {id: 'SixMonthlyApril', name: DV.i18n.sixmonthly_april},
+ {id: 'Yearly', name: DV.i18n.yearly},
+ {id: 'FinancialOct', name: DV.i18n.financial_oct},
+ {id: 'FinancialJuly', name: DV.i18n.financial_july},
+ {id: 'FinancialApril', name: DV.i18n.financial_april}
]
};
@@ -901,9 +901,10 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
- var config = Ext.clone(config),
- layout = {},
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
+ var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -957,6 +958,8 @@
// displayProperty: string ('name') // 'name', 'shortname', null
+ // userOrgUnit: string
+
getValidatedDimensionArray = function(dimensionArray) {
var dimensionArray = Ext.clone(dimensionArray);
@@ -1062,19 +1065,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(NS.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter.');
+ ns.alert(DV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter.');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(NS.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter.');
+ ns.alert(DV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter.');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(NS.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter.');
+ ns.alert(DV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter.');
return;
}
}
@@ -1204,6 +1207,10 @@
layout.displayProperty = config.displayProperty;
}
+ if (Ext.Array.from(config.userOrgUnit).length) {
+ layout.userOrgUnit = Ext.Array.from(config.userOrgUnit);
+ }
+
// TODO program
if (Ext.isObject(config.program)) {
layout.program = config.program;
@@ -1230,7 +1237,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1827,119 +1834,49 @@
ou = dimConf.organisationUnit.objectName,
layout;
- // Set items from init/metaData/xLayout
- for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
- dim = dimensions[i];
- dim.items = [];
- metaDataDim = response.metaData[dim.objectName];
-
- // If ou and children
- if (dim.dimensionName === ou) {
- if (isUserOrgunit || isUserOrgunitChildren || isUserOrgunitGrandChildren) {
- var userOu,
- userOuc,
- userOugc;
-
- if (init.user && isUserOrgunit) {
- userOu = [];
-
- for (var j = 0; j < init.user.ou.length; j++) {
- userOu.push({
- id: init.user.ou[j],
- name: response.metaData.names[init.user.ou[j]]
- });
- }
- }
- if (init.user && init.user.ouc && isUserOrgunitChildren) {
- userOuc = [];
-
- for (var j = 0; j < init.user.ouc.length; j++) {
- userOuc.push({
- id: init.user.ouc[j],
- name: response.metaData.names[init.user.ouc[j]]
- });
- }
-
- support.prototype.array.sort(userOuc);
- }
- if (init.user && init.user.ouc && isUserOrgunitGrandChildren) {
- var userOuOuc = [].concat(init.user.ou, init.user.ouc),
- responseOu = response.metaData[ou];
-
- userOugc = [];
-
- for (var j = 0, id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- if (!Ext.Array.contains(userOuOuc, id)) {
- userOugc.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
- }
-
- support.prototype.array.sort(userOugc);
- }
-
- dim.items = [].concat(userOu || [], userOuc || [], userOugc || []);
- }
- else if (isLevel || isGroup) {
- for (var j = 0, responseOu = response.metaData[ou], id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- dim.items.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
-
- support.prototype.array.sort(dim.items);
- }
- else {
- dim.items = Ext.clone(xLayout.dimensionNameItemsMap[dim.dimensionName]);
- }
- }
- else {
- // Items: get ids from metadata -> items
- if (Ext.isArray(metaDataDim) && metaDataDim.length) {
- var ids = Ext.clone(response.metaData[dim.dimensionName]);
- for (var j = 0; j < ids.length; j++) {
- dim.items.push({
- id: ids[j],
- name: response.metaData.names[ids[j]]
- });
- }
- }
- // Items: get items from xLayout
- else {
- dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
- }
- }
- }
+ // set items from init/metaData/xLayout
+ for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
+ dim = dimensions[i];
+ dim.items = [];
+ metaDataDim = response.metaData[dim.objectName];
+
+ if (Ext.isArray(metaDataDim) && metaDataDim.length) {
+ var ids = Ext.clone(response.metaData[dim.dimensionName]);
+ for (var j = 0; j < ids.length; j++) {
+ dim.items.push({
+ id: ids[j],
+ name: response.metaData.names[ids[j]]
+ });
+ }
+ }
+ else {
+ dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
+ }
+ }
+
+ // add missing names
+ dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
+
+ for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
+ dimItems = dimensions[i].items;
+
+ if (Ext.isArray(dimItems) && dimItems.length) {
+ for (var j = 0, item; j < dimItems.length; j++) {
+ item = dimItems[j];
+
+ if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
+ item.name = idNameMap[item.id] || '';
+ }
+ }
+ }
+ }
// Re-layout
layout = api.layout.Layout(xLayout);
- if (layout) {
- dimensions = Ext.Array.clean([].concat(layout.columns || [], layout.rows || [], layout.filters || []));
-
- for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
- dimItems = dimensions[i].items;
-
- if (Ext.isArray(dimItems) && dimItems.length) {
- for (var j = 0, item; j < dimItems.length; j++) {
- item = dimItems[j];
-
- if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
- item.name = idNameMap[item.id] || '';
- }
- }
- }
- }
-
- return service.layout.getExtendedLayout(layout);
- }
+ if (layout) {
+ return service.layout.getExtendedLayout(layout);
+ }
return null;
};
@@ -2403,10 +2340,6 @@
web.analytics = {};
web.analytics.getParamString = function(xLayout, isSorted) {
-
- // TODO
- isSorted = false;
-
var axisDimensionNames = isSorted ? xLayout.sortedAxisDimensionNames : xLayout.axisDimensionNames,
filterDimensions = isSorted ? xLayout.sortedFilterDimensions : xLayout.filterDimensions,
dimensionNameIdsMap = isSorted ? xLayout.dimensionNameSortedIdsMap : xLayout.dimensionNameIdsMap,
@@ -2466,6 +2399,15 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
+ // user org unit
+ if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
+ paramString += '&userOrgUnit=';
+
+ for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
+ paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
+ }
+ }
+
// TODO program
if (xLayout.program && xLayout.program.id) {
paramString += '&program=' + xLayout.program.id;
@@ -2634,7 +2576,7 @@
}
trendLineFields.push(regressionKey);
- xResponse.metaData.names[regressionKey] = NS.i18n.trend + ' (Total)';
+ xResponse.metaData.names[regressionKey] = DV.i18n.trend + ' (Total)';
}
else {
for (var i = 0; i < failSafeColumnIds.length; i++) {
@@ -2651,7 +2593,7 @@
}
trendLineFields.push(regressionKey);
- xResponse.metaData.names[regressionKey] = NS.i18n.trend + (ns.dashboard ? '' : ' (' + xResponse.metaData.names[failSafeColumnIds[i]] + ')');
+ xResponse.metaData.names[regressionKey] = DV.i18n.trend + (ns.dashboard ? '' : ' (' + xResponse.metaData.names[failSafeColumnIds[i]] + ')');
}
}
}
@@ -2764,7 +2706,7 @@
return Ext.Array.max(values);
};
- if (NS.isDebug) {
+ if (DV.isDebug) {
console.log("data", data);
console.log("rangeFields", store.rangeFields);
console.log("domainFields", store.domainFields);
@@ -3177,7 +3119,7 @@
},
showMarkers: false,
title: function() {
- var title = (Ext.isString(xLayout.targetLineTitle) ? xLayout.targetLineTitle : NS.i18n.target) + ' (' + xLayout.targetLineValue + ')',
+ var title = (Ext.isString(xLayout.targetLineTitle) ? xLayout.targetLineTitle : DV.i18n.target) + ' (' + xLayout.targetLineValue + ')',
ls = xLayout.legendStyle;
return ls && Ext.isNumber(ls.labelMaxLength) ? title.substr(0, ls.labelMaxLength) + '..' : title;
}()
@@ -3198,7 +3140,7 @@
},
showMarkers: false,
title: function() {
- var title = (Ext.isString(xLayout.baseLineTitle) ? xLayout.baseLineTitle : NS.i18n.base) + ' (' + xLayout.baseLineValue + ')',
+ var title = (Ext.isString(xLayout.baseLineTitle) ? xLayout.baseLineTitle : DV.i18n.base) + ' (' + xLayout.baseLineValue + ')',
ls = xLayout.legendStyle;
return ls && Ext.isNumber(ls.labelMaxLength) ? title.substr(0, ls.labelMaxLength) + '..' : title;
}()
@@ -3372,7 +3314,7 @@
return function() {
var width = ns.app.centerRegion.getWidth(),
height = ns.app.centerRegion.getHeight();
-
+
this.animate = false;
this.setWidth(ns.dashboard ? width : width - 15);
this.setHeight(ns.dashboard ? height : height - 40);
@@ -4340,7 +4282,7 @@
chart;
success = function() {
-
+
ns.app.layout = layout;
ns.app.xLayout = xLayout;
ns.app.response = response;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js 2015-07-15 16:06:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/core.js 2015-08-05 12:57:59 +0000
@@ -843,9 +843,10 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
- var config = Ext.clone(config),
- layout = {},
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
+ var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -899,6 +900,8 @@
// displayProperty: string ('name') // 'name', 'shortname', null
+ // userOrgUnit: string
+
getValidatedDimensionArray = function(dimensionArray) {
var dimensionArray = Ext.clone(dimensionArray);
@@ -1146,6 +1149,10 @@
layout.displayProperty = config.displayProperty;
}
+ if (Ext.Array.from(config.userOrgUnit).length) {
+ layout.userOrgUnit = Ext.Array.from(config.userOrgUnit);
+ }
+
// TODO program
if (Ext.isObject(config.program)) {
layout.program = config.program;
@@ -1172,7 +1179,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1769,119 +1776,49 @@
ou = dimConf.organisationUnit.objectName,
layout;
- // Set items from init/metaData/xLayout
- for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
- dim = dimensions[i];
- dim.items = [];
- metaDataDim = response.metaData[dim.objectName];
-
- // If ou and children
- if (dim.dimensionName === ou) {
- if (isUserOrgunit || isUserOrgunitChildren || isUserOrgunitGrandChildren) {
- var userOu,
- userOuc,
- userOugc;
-
- if (init.user && isUserOrgunit) {
- userOu = [];
-
- for (var j = 0; j < init.user.ou.length; j++) {
- userOu.push({
- id: init.user.ou[j],
- name: response.metaData.names[init.user.ou[j]]
- });
- }
- }
- if (init.user && init.user.ouc && isUserOrgunitChildren) {
- userOuc = [];
-
- for (var j = 0; j < init.user.ouc.length; j++) {
- userOuc.push({
- id: init.user.ouc[j],
- name: response.metaData.names[init.user.ouc[j]]
- });
- }
-
- support.prototype.array.sort(userOuc);
- }
- if (init.user && init.user.ouc && isUserOrgunitGrandChildren) {
- var userOuOuc = [].concat(init.user.ou, init.user.ouc),
- responseOu = response.metaData[ou];
-
- userOugc = [];
-
- for (var j = 0, id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- if (!Ext.Array.contains(userOuOuc, id)) {
- userOugc.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
- }
-
- support.prototype.array.sort(userOugc);
- }
-
- dim.items = [].concat(userOu || [], userOuc || [], userOugc || []);
- }
- else if (isLevel || isGroup) {
- for (var j = 0, responseOu = response.metaData[ou], id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- dim.items.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
-
- support.prototype.array.sort(dim.items);
- }
- else {
- dim.items = Ext.clone(xLayout.dimensionNameItemsMap[dim.dimensionName]);
- }
- }
- else {
- // Items: get ids from metadata -> items
- if (Ext.isArray(metaDataDim) && metaDataDim.length) {
- var ids = Ext.clone(response.metaData[dim.dimensionName]);
- for (var j = 0; j < ids.length; j++) {
- dim.items.push({
- id: ids[j],
- name: response.metaData.names[ids[j]]
- });
- }
- }
- // Items: get items from xLayout
- else {
- dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
- }
- }
- }
+ // set items from init/metaData/xLayout
+ for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
+ dim = dimensions[i];
+ dim.items = [];
+ metaDataDim = response.metaData[dim.objectName];
+
+ if (Ext.isArray(metaDataDim) && metaDataDim.length) {
+ var ids = Ext.clone(response.metaData[dim.dimensionName]);
+ for (var j = 0; j < ids.length; j++) {
+ dim.items.push({
+ id: ids[j],
+ name: response.metaData.names[ids[j]]
+ });
+ }
+ }
+ else {
+ dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
+ }
+ }
+
+ // add missing names
+ dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
+
+ for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
+ dimItems = dimensions[i].items;
+
+ if (Ext.isArray(dimItems) && dimItems.length) {
+ for (var j = 0, item; j < dimItems.length; j++) {
+ item = dimItems[j];
+
+ if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
+ item.name = idNameMap[item.id] || '';
+ }
+ }
+ }
+ }
// Re-layout
layout = api.layout.Layout(xLayout);
- if (layout) {
- dimensions = Ext.Array.clean([].concat(layout.columns || [], layout.rows || [], layout.filters || []));
-
- for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
- dimItems = dimensions[i].items;
-
- if (Ext.isArray(dimItems) && dimItems.length) {
- for (var j = 0, item; j < dimItems.length; j++) {
- item = dimItems[j];
-
- if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
- item.name = idNameMap[item.id] || '';
- }
- }
- }
- }
-
- return service.layout.getExtendedLayout(layout);
- }
+ if (layout) {
+ return service.layout.getExtendedLayout(layout);
+ }
return null;
};
@@ -2345,10 +2282,6 @@
web.analytics = {};
web.analytics.getParamString = function(xLayout, isSorted) {
-
- // TODO
- isSorted = false;
-
var axisDimensionNames = isSorted ? xLayout.sortedAxisDimensionNames : xLayout.axisDimensionNames,
filterDimensions = isSorted ? xLayout.sortedFilterDimensions : xLayout.filterDimensions,
dimensionNameIdsMap = isSorted ? xLayout.dimensionNameSortedIdsMap : xLayout.dimensionNameIdsMap,
@@ -2408,6 +2341,15 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
+ // user org unit
+ if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
+ paramString += '&userOrgUnit=';
+
+ for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
+ paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
+ }
+ }
+
// TODO program
if (xLayout.program && xLayout.program.id) {
paramString += '&program=' + xLayout.program.id;
@@ -3314,7 +3256,7 @@
return function() {
var width = ns.app.centerRegion.getWidth(),
height = ns.app.centerRegion.getHeight();
-
+
this.animate = false;
this.setWidth(ns.dashboard ? width : width - 15);
this.setHeight(ns.dashboard ? height : height - 40);
=== 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-07-15 22:36:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2015-08-05 12:57:59 +0000
@@ -567,14 +567,14 @@
// namespace
DV = {};
- var NS = DV;
-
- NS.instances = [];
- NS.i18n = {};
- NS.isDebug = false;
- NS.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
-
- NS.getCore = function(ns) {
+ var DV = DV;
+
+ DV.instances = [];
+ DV.i18n = {};
+ DV.isDebug = false;
+ DV.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
+
+ DV.getCore = function(ns) {
var init = ns.init,
conf = {},
api = {},
@@ -592,24 +592,24 @@
dimension: {
data: {
value: 'data',
- name: NS.i18n.data || 'Data',
+ name: DV.i18n.data || 'Data',
dimensionName: 'dx',
objectName: 'dx'
},
category: {
- name: NS.i18n.assigned_categories || 'Assigned categories',
+ name: DV.i18n.assigned_categories || 'Assigned categories',
dimensionName: 'co',
objectName: 'co',
},
indicator: {
value: 'indicators',
- name: NS.i18n.indicators || 'Indicators',
+ name: DV.i18n.indicators || 'Indicators',
dimensionName: 'dx',
objectName: 'in'
},
dataElement: {
value: 'dataElements',
- name: NS.i18n.data_elements || 'Data elements',
+ name: DV.i18n.data_elements || 'Data elements',
dimensionName: 'dx',
objectName: 'de'
},
@@ -621,25 +621,25 @@
},
dataSet: {
value: 'dataSets',
- name: NS.i18n.data_sets || 'Data sets',
+ name: DV.i18n.data_sets || 'Data sets',
dimensionName: 'dx',
objectName: 'ds'
},
eventDataItem: {
value: 'eventDataItem',
- name: NS.i18n.event_data_items || 'Event data items',
+ name: DV.i18n.event_data_items || 'Event data items',
dimensionName: 'dx',
objectName: 'di'
},
programIndicator: {
value: 'programIndicator',
- name: NS.i18n.program_indicators || 'Program indicators',
+ name: DV.i18n.program_indicators || 'Program indicators',
dimensionName: 'dx',
objectName: 'pi'
},
period: {
value: 'period',
- name: NS.i18n.periods || 'Periods',
+ name: DV.i18n.periods || 'Periods',
dimensionName: 'pe',
objectName: 'pe'
},
@@ -651,7 +651,7 @@
},
organisationUnit: {
value: 'organisationUnits',
- name: NS.i18n.organisation_units || 'Organisation units',
+ name: DV.i18n.organisation_units || 'Organisation units',
dimensionName: 'ou',
objectName: 'ou'
},
@@ -712,17 +712,17 @@
conf.period = {
periodTypes: [
- {id: 'Daily', name: NS.i18n.daily},
- {id: 'Weekly', name: NS.i18n.weekly},
- {id: 'Monthly', name: NS.i18n.monthly},
- {id: 'BiMonthly', name: NS.i18n.bimonthly},
- {id: 'Quarterly', name: NS.i18n.quarterly},
- {id: 'SixMonthly', name: NS.i18n.sixmonthly},
- {id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
- {id: 'Yearly', name: NS.i18n.yearly},
- {id: 'FinancialOct', name: NS.i18n.financial_oct},
- {id: 'FinancialJuly', name: NS.i18n.financial_july},
- {id: 'FinancialApril', name: NS.i18n.financial_april}
+ {id: 'Daily', name: DV.i18n.daily},
+ {id: 'Weekly', name: DV.i18n.weekly},
+ {id: 'Monthly', name: DV.i18n.monthly},
+ {id: 'BiMonthly', name: DV.i18n.bimonthly},
+ {id: 'Quarterly', name: DV.i18n.quarterly},
+ {id: 'SixMonthly', name: DV.i18n.sixmonthly},
+ {id: 'SixMonthlyApril', name: DV.i18n.sixmonthly_april},
+ {id: 'Yearly', name: DV.i18n.yearly},
+ {id: 'FinancialOct', name: DV.i18n.financial_oct},
+ {id: 'FinancialJuly', name: DV.i18n.financial_july},
+ {id: 'FinancialApril', name: DV.i18n.financial_april}
]
};
@@ -901,9 +901,10 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
- var config = Ext.clone(config),
- layout = {},
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
+ var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -957,6 +958,8 @@
// displayProperty: string ('name') // 'name', 'shortname', null
+ // userOrgUnit: string
+
getValidatedDimensionArray = function(dimensionArray) {
var dimensionArray = Ext.clone(dimensionArray);
@@ -1062,19 +1065,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(NS.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter.');
+ ns.alert(DV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter.');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(NS.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter.');
+ ns.alert(DV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter.');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(NS.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter.');
+ ns.alert(DV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter.');
return;
}
}
@@ -1204,6 +1207,10 @@
layout.displayProperty = config.displayProperty;
}
+ if (Ext.Array.from(config.userOrgUnit).length) {
+ layout.userOrgUnit = Ext.Array.from(config.userOrgUnit);
+ }
+
// TODO program
if (Ext.isObject(config.program)) {
layout.program = config.program;
@@ -1230,7 +1237,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1827,119 +1834,49 @@
ou = dimConf.organisationUnit.objectName,
layout;
- // Set items from init/metaData/xLayout
- for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
- dim = dimensions[i];
- dim.items = [];
- metaDataDim = response.metaData[dim.objectName];
-
- // If ou and children
- if (dim.dimensionName === ou) {
- if (isUserOrgunit || isUserOrgunitChildren || isUserOrgunitGrandChildren) {
- var userOu,
- userOuc,
- userOugc;
-
- if (init.user && isUserOrgunit) {
- userOu = [];
-
- for (var j = 0; j < init.user.ou.length; j++) {
- userOu.push({
- id: init.user.ou[j],
- name: response.metaData.names[init.user.ou[j]]
- });
- }
- }
- if (init.user && init.user.ouc && isUserOrgunitChildren) {
- userOuc = [];
-
- for (var j = 0; j < init.user.ouc.length; j++) {
- userOuc.push({
- id: init.user.ouc[j],
- name: response.metaData.names[init.user.ouc[j]]
- });
- }
-
- support.prototype.array.sort(userOuc);
- }
- if (init.user && init.user.ouc && isUserOrgunitGrandChildren) {
- var userOuOuc = [].concat(init.user.ou, init.user.ouc),
- responseOu = response.metaData[ou];
-
- userOugc = [];
-
- for (var j = 0, id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- if (!Ext.Array.contains(userOuOuc, id)) {
- userOugc.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
- }
-
- support.prototype.array.sort(userOugc);
- }
-
- dim.items = [].concat(userOu || [], userOuc || [], userOugc || []);
- }
- else if (isLevel || isGroup) {
- for (var j = 0, responseOu = response.metaData[ou], id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- dim.items.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
-
- support.prototype.array.sort(dim.items);
- }
- else {
- dim.items = Ext.clone(xLayout.dimensionNameItemsMap[dim.dimensionName]);
- }
- }
- else {
- // Items: get ids from metadata -> items
- if (Ext.isArray(metaDataDim) && metaDataDim.length) {
- var ids = Ext.clone(response.metaData[dim.dimensionName]);
- for (var j = 0; j < ids.length; j++) {
- dim.items.push({
- id: ids[j],
- name: response.metaData.names[ids[j]]
- });
- }
- }
- // Items: get items from xLayout
- else {
- dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
- }
- }
- }
+ // set items from init/metaData/xLayout
+ for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
+ dim = dimensions[i];
+ dim.items = [];
+ metaDataDim = response.metaData[dim.objectName];
+
+ if (Ext.isArray(metaDataDim) && metaDataDim.length) {
+ var ids = Ext.clone(response.metaData[dim.dimensionName]);
+ for (var j = 0; j < ids.length; j++) {
+ dim.items.push({
+ id: ids[j],
+ name: response.metaData.names[ids[j]]
+ });
+ }
+ }
+ else {
+ dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
+ }
+ }
+
+ // add missing names
+ dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
+
+ for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
+ dimItems = dimensions[i].items;
+
+ if (Ext.isArray(dimItems) && dimItems.length) {
+ for (var j = 0, item; j < dimItems.length; j++) {
+ item = dimItems[j];
+
+ if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
+ item.name = idNameMap[item.id] || '';
+ }
+ }
+ }
+ }
// Re-layout
layout = api.layout.Layout(xLayout);
- if (layout) {
- dimensions = Ext.Array.clean([].concat(layout.columns || [], layout.rows || [], layout.filters || []));
-
- for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
- dimItems = dimensions[i].items;
-
- if (Ext.isArray(dimItems) && dimItems.length) {
- for (var j = 0, item; j < dimItems.length; j++) {
- item = dimItems[j];
-
- if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
- item.name = idNameMap[item.id] || '';
- }
- }
- }
- }
-
- return service.layout.getExtendedLayout(layout);
- }
+ if (layout) {
+ return service.layout.getExtendedLayout(layout);
+ }
return null;
};
@@ -2403,10 +2340,6 @@
web.analytics = {};
web.analytics.getParamString = function(xLayout, isSorted) {
-
- // TODO
- isSorted = false;
-
var axisDimensionNames = isSorted ? xLayout.sortedAxisDimensionNames : xLayout.axisDimensionNames,
filterDimensions = isSorted ? xLayout.sortedFilterDimensions : xLayout.filterDimensions,
dimensionNameIdsMap = isSorted ? xLayout.dimensionNameSortedIdsMap : xLayout.dimensionNameIdsMap,
@@ -2466,6 +2399,15 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
+ // user org unit
+ if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
+ paramString += '&userOrgUnit=';
+
+ for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
+ paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
+ }
+ }
+
// TODO program
if (xLayout.program && xLayout.program.id) {
paramString += '&program=' + xLayout.program.id;
@@ -2634,7 +2576,7 @@
}
trendLineFields.push(regressionKey);
- xResponse.metaData.names[regressionKey] = NS.i18n.trend + ' (Total)';
+ xResponse.metaData.names[regressionKey] = DV.i18n.trend + ' (Total)';
}
else {
for (var i = 0; i < failSafeColumnIds.length; i++) {
@@ -2651,7 +2593,7 @@
}
trendLineFields.push(regressionKey);
- xResponse.metaData.names[regressionKey] = NS.i18n.trend + (ns.dashboard ? '' : ' (' + xResponse.metaData.names[failSafeColumnIds[i]] + ')');
+ xResponse.metaData.names[regressionKey] = DV.i18n.trend + (ns.dashboard ? '' : ' (' + xResponse.metaData.names[failSafeColumnIds[i]] + ')');
}
}
}
@@ -2764,7 +2706,7 @@
return Ext.Array.max(values);
};
- if (NS.isDebug) {
+ if (DV.isDebug) {
console.log("data", data);
console.log("rangeFields", store.rangeFields);
console.log("domainFields", store.domainFields);
@@ -3177,7 +3119,7 @@
},
showMarkers: false,
title: function() {
- var title = (Ext.isString(xLayout.targetLineTitle) ? xLayout.targetLineTitle : NS.i18n.target) + ' (' + xLayout.targetLineValue + ')',
+ var title = (Ext.isString(xLayout.targetLineTitle) ? xLayout.targetLineTitle : DV.i18n.target) + ' (' + xLayout.targetLineValue + ')',
ls = xLayout.legendStyle;
return ls && Ext.isNumber(ls.labelMaxLength) ? title.substr(0, ls.labelMaxLength) + '..' : title;
}()
@@ -3198,7 +3140,7 @@
},
showMarkers: false,
title: function() {
- var title = (Ext.isString(xLayout.baseLineTitle) ? xLayout.baseLineTitle : NS.i18n.base) + ' (' + xLayout.baseLineValue + ')',
+ var title = (Ext.isString(xLayout.baseLineTitle) ? xLayout.baseLineTitle : DV.i18n.base) + ' (' + xLayout.baseLineValue + ')',
ls = xLayout.legendStyle;
return ls && Ext.isNumber(ls.labelMaxLength) ? title.substr(0, ls.labelMaxLength) + '..' : title;
}()
@@ -3372,7 +3314,7 @@
return function() {
var width = ns.app.centerRegion.getWidth(),
height = ns.app.centerRegion.getHeight();
-
+
this.animate = false;
this.setWidth(ns.dashboard ? width : width - 15);
this.setHeight(ns.dashboard ? height : height - 40);
@@ -4340,7 +4282,7 @@
chart;
success = function() {
-
+
ns.app.layout = layout;
ns.app.xLayout = xLayout;
ns.app.response = response;
=== 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-08-04 15:52:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-08-05 12:57:59 +0000
@@ -348,7 +348,9 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -591,7 +593,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1247,12 +1249,12 @@
}
};
- // Set items from init/metaData/xLayout
+ // set items from init/metaData/xLayout
for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
dim = dimensions[i];
- dim.items = [];
+ dim.items = [];
metaDataDim = response.metaData[dim.objectName];
-
+
if (Ext.isArray(metaDataDim) && metaDataDim.length) {
var ids = Ext.clone(response.metaData[dim.dimensionName]);
for (var j = 0; j < ids.length; j++) {
@@ -1267,7 +1269,7 @@
}
}
- // Add missing names
+ // add missing names
dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
@@ -1284,7 +1286,7 @@
}
}
- // Remove dimensions from layout that do not exist in response
+ // remove dimensions from layout that do not exist in response
for (var i = 0, dimensionName; i < xLayout.axisDimensionNames.length; i++) {
dimensionName = xLayout.axisDimensionNames[i];
if (!Ext.Array.contains(headerNames, dimensionName)) {
@@ -2096,10 +2098,10 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
- // user organisation unit
+ // user org unit
if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
paramString += '&userOrgUnit=';
-
+
for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
}
=== 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-07-15 22:36:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-08-05 12:57:59 +0000
@@ -567,14 +567,14 @@
// namespace
DV = {};
- var NS = DV;
-
- NS.instances = [];
- NS.i18n = {};
- NS.isDebug = false;
- NS.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
-
- NS.getCore = function(ns) {
+ var DV = DV;
+
+ DV.instances = [];
+ DV.i18n = {};
+ DV.isDebug = false;
+ DV.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
+
+ DV.getCore = function(ns) {
var init = ns.init,
conf = {},
api = {},
@@ -592,24 +592,24 @@
dimension: {
data: {
value: 'data',
- name: NS.i18n.data || 'Data',
+ name: DV.i18n.data || 'Data',
dimensionName: 'dx',
objectName: 'dx'
},
category: {
- name: NS.i18n.assigned_categories || 'Assigned categories',
+ name: DV.i18n.assigned_categories || 'Assigned categories',
dimensionName: 'co',
objectName: 'co',
},
indicator: {
value: 'indicators',
- name: NS.i18n.indicators || 'Indicators',
+ name: DV.i18n.indicators || 'Indicators',
dimensionName: 'dx',
objectName: 'in'
},
dataElement: {
value: 'dataElements',
- name: NS.i18n.data_elements || 'Data elements',
+ name: DV.i18n.data_elements || 'Data elements',
dimensionName: 'dx',
objectName: 'de'
},
@@ -621,25 +621,25 @@
},
dataSet: {
value: 'dataSets',
- name: NS.i18n.data_sets || 'Data sets',
+ name: DV.i18n.data_sets || 'Data sets',
dimensionName: 'dx',
objectName: 'ds'
},
eventDataItem: {
value: 'eventDataItem',
- name: NS.i18n.event_data_items || 'Event data items',
+ name: DV.i18n.event_data_items || 'Event data items',
dimensionName: 'dx',
objectName: 'di'
},
programIndicator: {
value: 'programIndicator',
- name: NS.i18n.program_indicators || 'Program indicators',
+ name: DV.i18n.program_indicators || 'Program indicators',
dimensionName: 'dx',
objectName: 'pi'
},
period: {
value: 'period',
- name: NS.i18n.periods || 'Periods',
+ name: DV.i18n.periods || 'Periods',
dimensionName: 'pe',
objectName: 'pe'
},
@@ -651,7 +651,7 @@
},
organisationUnit: {
value: 'organisationUnits',
- name: NS.i18n.organisation_units || 'Organisation units',
+ name: DV.i18n.organisation_units || 'Organisation units',
dimensionName: 'ou',
objectName: 'ou'
},
@@ -712,17 +712,17 @@
conf.period = {
periodTypes: [
- {id: 'Daily', name: NS.i18n.daily},
- {id: 'Weekly', name: NS.i18n.weekly},
- {id: 'Monthly', name: NS.i18n.monthly},
- {id: 'BiMonthly', name: NS.i18n.bimonthly},
- {id: 'Quarterly', name: NS.i18n.quarterly},
- {id: 'SixMonthly', name: NS.i18n.sixmonthly},
- {id: 'SixMonthlyApril', name: NS.i18n.sixmonthly_april},
- {id: 'Yearly', name: NS.i18n.yearly},
- {id: 'FinancialOct', name: NS.i18n.financial_oct},
- {id: 'FinancialJuly', name: NS.i18n.financial_july},
- {id: 'FinancialApril', name: NS.i18n.financial_april}
+ {id: 'Daily', name: DV.i18n.daily},
+ {id: 'Weekly', name: DV.i18n.weekly},
+ {id: 'Monthly', name: DV.i18n.monthly},
+ {id: 'BiMonthly', name: DV.i18n.bimonthly},
+ {id: 'Quarterly', name: DV.i18n.quarterly},
+ {id: 'SixMonthly', name: DV.i18n.sixmonthly},
+ {id: 'SixMonthlyApril', name: DV.i18n.sixmonthly_april},
+ {id: 'Yearly', name: DV.i18n.yearly},
+ {id: 'FinancialOct', name: DV.i18n.financial_oct},
+ {id: 'FinancialJuly', name: DV.i18n.financial_july},
+ {id: 'FinancialApril', name: DV.i18n.financial_april}
]
};
@@ -901,9 +901,10 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
- var config = Ext.clone(config),
- layout = {},
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
+ var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -957,6 +958,8 @@
// displayProperty: string ('name') // 'name', 'shortname', null
+ // userOrgUnit: string
+
getValidatedDimensionArray = function(dimensionArray) {
var dimensionArray = Ext.clone(dimensionArray);
@@ -1062,19 +1065,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(NS.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter.');
+ ns.alert(DV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter.');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(NS.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter.');
+ ns.alert(DV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter.');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(NS.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter.');
+ ns.alert(DV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter.');
return;
}
}
@@ -1204,6 +1207,10 @@
layout.displayProperty = config.displayProperty;
}
+ if (Ext.Array.from(config.userOrgUnit).length) {
+ layout.userOrgUnit = Ext.Array.from(config.userOrgUnit);
+ }
+
// TODO program
if (Ext.isObject(config.program)) {
layout.program = config.program;
@@ -1230,7 +1237,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1827,119 +1834,49 @@
ou = dimConf.organisationUnit.objectName,
layout;
- // Set items from init/metaData/xLayout
- for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
- dim = dimensions[i];
- dim.items = [];
- metaDataDim = response.metaData[dim.objectName];
-
- // If ou and children
- if (dim.dimensionName === ou) {
- if (isUserOrgunit || isUserOrgunitChildren || isUserOrgunitGrandChildren) {
- var userOu,
- userOuc,
- userOugc;
-
- if (init.user && isUserOrgunit) {
- userOu = [];
-
- for (var j = 0; j < init.user.ou.length; j++) {
- userOu.push({
- id: init.user.ou[j],
- name: response.metaData.names[init.user.ou[j]]
- });
- }
- }
- if (init.user && init.user.ouc && isUserOrgunitChildren) {
- userOuc = [];
-
- for (var j = 0; j < init.user.ouc.length; j++) {
- userOuc.push({
- id: init.user.ouc[j],
- name: response.metaData.names[init.user.ouc[j]]
- });
- }
-
- support.prototype.array.sort(userOuc);
- }
- if (init.user && init.user.ouc && isUserOrgunitGrandChildren) {
- var userOuOuc = [].concat(init.user.ou, init.user.ouc),
- responseOu = response.metaData[ou];
-
- userOugc = [];
-
- for (var j = 0, id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- if (!Ext.Array.contains(userOuOuc, id)) {
- userOugc.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
- }
-
- support.prototype.array.sort(userOugc);
- }
-
- dim.items = [].concat(userOu || [], userOuc || [], userOugc || []);
- }
- else if (isLevel || isGroup) {
- for (var j = 0, responseOu = response.metaData[ou], id; j < responseOu.length; j++) {
- id = responseOu[j];
-
- dim.items.push({
- id: id,
- name: response.metaData.names[id]
- });
- }
-
- support.prototype.array.sort(dim.items);
- }
- else {
- dim.items = Ext.clone(xLayout.dimensionNameItemsMap[dim.dimensionName]);
- }
- }
- else {
- // Items: get ids from metadata -> items
- if (Ext.isArray(metaDataDim) && metaDataDim.length) {
- var ids = Ext.clone(response.metaData[dim.dimensionName]);
- for (var j = 0; j < ids.length; j++) {
- dim.items.push({
- id: ids[j],
- name: response.metaData.names[ids[j]]
- });
- }
- }
- // Items: get items from xLayout
- else {
- dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
- }
- }
- }
+ // set items from init/metaData/xLayout
+ for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
+ dim = dimensions[i];
+ dim.items = [];
+ metaDataDim = response.metaData[dim.objectName];
+
+ if (Ext.isArray(metaDataDim) && metaDataDim.length) {
+ var ids = Ext.clone(response.metaData[dim.dimensionName]);
+ for (var j = 0; j < ids.length; j++) {
+ dim.items.push({
+ id: ids[j],
+ name: response.metaData.names[ids[j]]
+ });
+ }
+ }
+ else {
+ dim.items = Ext.clone(xLayout.objectNameItemsMap[dim.objectName]);
+ }
+ }
+
+ // add missing names
+ dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
+
+ for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
+ dimItems = dimensions[i].items;
+
+ if (Ext.isArray(dimItems) && dimItems.length) {
+ for (var j = 0, item; j < dimItems.length; j++) {
+ item = dimItems[j];
+
+ if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
+ item.name = idNameMap[item.id] || '';
+ }
+ }
+ }
+ }
// Re-layout
layout = api.layout.Layout(xLayout);
- if (layout) {
- dimensions = Ext.Array.clean([].concat(layout.columns || [], layout.rows || [], layout.filters || []));
-
- for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
- dimItems = dimensions[i].items;
-
- if (Ext.isArray(dimItems) && dimItems.length) {
- for (var j = 0, item; j < dimItems.length; j++) {
- item = dimItems[j];
-
- if (Ext.isObject(item) && Ext.isString(idNameMap[item.id]) && !Ext.isString(item.name)) {
- item.name = idNameMap[item.id] || '';
- }
- }
- }
- }
-
- return service.layout.getExtendedLayout(layout);
- }
+ if (layout) {
+ return service.layout.getExtendedLayout(layout);
+ }
return null;
};
@@ -2403,10 +2340,6 @@
web.analytics = {};
web.analytics.getParamString = function(xLayout, isSorted) {
-
- // TODO
- isSorted = false;
-
var axisDimensionNames = isSorted ? xLayout.sortedAxisDimensionNames : xLayout.axisDimensionNames,
filterDimensions = isSorted ? xLayout.sortedFilterDimensions : xLayout.filterDimensions,
dimensionNameIdsMap = isSorted ? xLayout.dimensionNameSortedIdsMap : xLayout.dimensionNameIdsMap,
@@ -2466,6 +2399,15 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
+ // user org unit
+ if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
+ paramString += '&userOrgUnit=';
+
+ for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
+ paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
+ }
+ }
+
// TODO program
if (xLayout.program && xLayout.program.id) {
paramString += '&program=' + xLayout.program.id;
@@ -2634,7 +2576,7 @@
}
trendLineFields.push(regressionKey);
- xResponse.metaData.names[regressionKey] = NS.i18n.trend + ' (Total)';
+ xResponse.metaData.names[regressionKey] = DV.i18n.trend + ' (Total)';
}
else {
for (var i = 0; i < failSafeColumnIds.length; i++) {
@@ -2651,7 +2593,7 @@
}
trendLineFields.push(regressionKey);
- xResponse.metaData.names[regressionKey] = NS.i18n.trend + (ns.dashboard ? '' : ' (' + xResponse.metaData.names[failSafeColumnIds[i]] + ')');
+ xResponse.metaData.names[regressionKey] = DV.i18n.trend + (ns.dashboard ? '' : ' (' + xResponse.metaData.names[failSafeColumnIds[i]] + ')');
}
}
}
@@ -2764,7 +2706,7 @@
return Ext.Array.max(values);
};
- if (NS.isDebug) {
+ if (DV.isDebug) {
console.log("data", data);
console.log("rangeFields", store.rangeFields);
console.log("domainFields", store.domainFields);
@@ -3177,7 +3119,7 @@
},
showMarkers: false,
title: function() {
- var title = (Ext.isString(xLayout.targetLineTitle) ? xLayout.targetLineTitle : NS.i18n.target) + ' (' + xLayout.targetLineValue + ')',
+ var title = (Ext.isString(xLayout.targetLineTitle) ? xLayout.targetLineTitle : DV.i18n.target) + ' (' + xLayout.targetLineValue + ')',
ls = xLayout.legendStyle;
return ls && Ext.isNumber(ls.labelMaxLength) ? title.substr(0, ls.labelMaxLength) + '..' : title;
}()
@@ -3198,7 +3140,7 @@
},
showMarkers: false,
title: function() {
- var title = (Ext.isString(xLayout.baseLineTitle) ? xLayout.baseLineTitle : NS.i18n.base) + ' (' + xLayout.baseLineValue + ')',
+ var title = (Ext.isString(xLayout.baseLineTitle) ? xLayout.baseLineTitle : DV.i18n.base) + ' (' + xLayout.baseLineValue + ')',
ls = xLayout.legendStyle;
return ls && Ext.isNumber(ls.labelMaxLength) ? title.substr(0, ls.labelMaxLength) + '..' : title;
}()
@@ -3372,7 +3314,7 @@
return function() {
var width = ns.app.centerRegion.getWidth(),
height = ns.app.centerRegion.getHeight();
-
+
this.animate = false;
this.setWidth(ns.dashboard ? width : width - 15);
this.setHeight(ns.dashboard ? height : height - 40);
@@ -4340,7 +4282,7 @@
chart;
success = function() {
-
+
ns.app.layout = layout;
ns.app.xLayout = xLayout;
ns.app.response = response;
=== 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-08-04 15:52:30 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-08-05 12:57:59 +0000
@@ -348,7 +348,9 @@
}();
};
- api.layout.Layout = function(config, applyConfig) {
+ api.layout.Layout = function(config, applyConfig, forceApplyConfig) {
+ config = Ext.apply(config, applyConfig);
+
var layout = {},
getValidatedDimensionArray,
validateSpecialCases;
@@ -591,7 +593,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, forceApplyConfig);
}();
};
@@ -1247,12 +1249,12 @@
}
};
- // Set items from init/metaData/xLayout
+ // set items from init/metaData/xLayout
for (var i = 0, dim, metaDataDim, items; i < dimensions.length; i++) {
dim = dimensions[i];
- dim.items = [];
+ dim.items = [];
metaDataDim = response.metaData[dim.objectName];
-
+
if (Ext.isArray(metaDataDim) && metaDataDim.length) {
var ids = Ext.clone(response.metaData[dim.dimensionName]);
for (var j = 0; j < ids.length; j++) {
@@ -1267,7 +1269,7 @@
}
}
- // Add missing names
+ // add missing names
dimensions = Ext.Array.clean([].concat(xLayout.columns || [], xLayout.rows || [], xLayout.filters || []));
for (var i = 0, idNameMap = response.metaData.names, dimItems; i < dimensions.length; i++) {
@@ -1284,7 +1286,7 @@
}
}
- // Remove dimensions from layout that do not exist in response
+ // remove dimensions from layout that do not exist in response
for (var i = 0, dimensionName; i < xLayout.axisDimensionNames.length; i++) {
dimensionName = xLayout.axisDimensionNames[i];
if (!Ext.Array.contains(headerNames, dimensionName)) {
@@ -2096,10 +2098,10 @@
// display property
paramString += '&displayProperty=' + displayProperty.toUpperCase();
- // user organisation unit
+ // user org unit
if (Ext.isArray(xLayout.userOrgUnit) && xLayout.userOrgUnit.length) {
paramString += '&userOrgUnit=';
-
+
for (var i = 0; i < xLayout.userOrgUnit.length; i++) {
paramString += xLayout.userOrgUnit[i] + (i < xLayout.userOrgUnit.length - 1 ? ';' : '');
}