dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22728
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11018: (DV, PT) Orgunit order issue fixed + Improved validation.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11018 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-05-27 16:16:37 +0200
message:
(DV, PT) Orgunit order issue fixed + Improved validation.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js
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/core.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-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-05-27 12:22:12 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-05-27 14:09:32 +0000
@@ -3416,13 +3416,7 @@
validateSpecialCases = function(layout) {
var dimConf = pt.conf.finals.dimension;
- //dimensionNames = [],
- //layoutObjects = [].concat(Ext.clone(layout.columns || []), Ext.clone(layout.rows || []), Ext.clone(layout.filters || []));
- // Layout names
- //for (var i = 0; i < layoutObjects.length; i++) {
- //dimensionNames.push(layoutObjects[i].dimension);
- //}
if (!layout) {
return;
}
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-05-27 13:05:57 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-05-27 13:57:28 +0000
@@ -760,8 +760,8 @@
return function() {
var headerNames = getHeaderNames(),
xOuDimension = xLayout.objectNameDimensionsMap[dimConf.organisationUnit.objectName],
- isUserOrgunit = xOuDimension && Ext.Array.contains(xOuDimension.items, 'USER_ORGUNIT'),
- isUserOrgunitChildren = xOuDimension && Ext.Array.contains(xOuDimension.items, 'USER_ORGUNIT_CHILDREN'),
+ isUserOrgunit = xOuDimension && Ext.Array.contains(xOuDimension.ids, 'USER_ORGUNIT'),
+ isUserOrgunitChildren = xOuDimension && Ext.Array.contains(xOuDimension.ids, 'USER_ORGUNIT_CHILDREN'),
co = dimConf.category.objectName,
ou = dimConf.organisationUnit.objectName,
layout;
@@ -880,7 +880,7 @@
if (header.meta) {
// Items
- header.items = Ext.clone(xLayout.dimensionNameIdsMap[header.name]);
+ header.items = Ext.clone(xLayout.dimensionNameIdsMap[header.name]) || [];
// Size
header.size = header.items.length;
=== 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 2013-05-27 13:08:55 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-05-27 14:14:21 +0000
@@ -3765,17 +3765,19 @@
validateSpecialCases = function(layout) {
var dimConf = dv.conf.finals.dimension,
- dimensions = [].concat(layout.columns, layout.rows, layout.filters),
+ dimensions,
objectNameDimensionMap = {};
+ if (!layout) {
+ return;
+ }
+
+ dimensions = [].concat(layout.columns, layout.rows, layout.filters);
+
for (var i = 0; i < dimensions.length; i++) {
objectNameDimensionMap[dimensions[i].dimension] = dimensions[i];
}
- if (!layout) {
- return;
- }
-
if (layout.filters && layout.filters.length) {
for (var i = 0; i < layout.filters.length; i++) {
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-05-27 13:08:55 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-05-27 14:14:21 +0000
@@ -697,25 +697,42 @@
getSyncronizedXLayout = function(xLayout, response) {
var dimensions = [].concat(xLayout.columns, xLayout.rows, xLayout.filters),
xOuDimension = xLayout.objectNameDimensionsMap[dimConf.organisationUnit.objectName],
- isUserOrgunit = xOuDimension && Ext.Array.contains(xOuDimension.items, 'USER_ORGUNIT'),
- isUserOrgunitChildren = xOuDimension && Ext.Array.contains(xOuDimension.items, 'USER_ORGUNIT_CHILDREN'),
- peItems = [],
- ouItems = [],
+ isUserOrgunit = xOuDimension && Ext.Array.contains(xOuDimension.ids, 'USER_ORGUNIT'),
+ isUserOrgunitChildren = xOuDimension && Ext.Array.contains(xOuDimension.ids, 'USER_ORGUNIT_CHILDREN'),
+ ou = dimConf.organisationUnit.objectName,
layout;
- // Use metaData ids if any
+ // 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)) {
- items = [];
-
- for (var j = 0; j < metaDataDim.length; j++) {
- items.push({id: metaDataDim[j]});
- }
-
- dim.items = items;
+ // If ou and children
+ if (dim.dimensionName === ou) {
+ if (isUserOrgunit || isUserOrgunitChildren) {
+ if (isUserOrgunit) {
+ dim.items = dim.items.concat(dv.init.user.ou);
+ }
+ if (isUserOrgunitChildren) {
+ dim.items = dim.items.concat(dv.init.user.ouc);
+ }
+ }
+ else {
+ dim.items = Ext.clone(xLayout.dimensionNameItemsMap[dim.dimensionName]);
+ }
+ }
+ else {
+ // Items: get ids from metadata -> items
+ if (Ext.isArray(metaDataDim) && dim.dimensionName !== dimConf.organisationUnit.dimensionName) {
+ for (var j = 0, ids = Ext.clone(response.metaData[dim.dimensionName]); j < ids.length; j++) {
+ dim.items.push({id: ids[j]});
+ }
+ }
+ // Items: get items from xLayout
+ else {
+ dim.items = Ext.clone(xLayout.dimensionNameItemsMap[dim.dimensionName]);
+ }
}
}
@@ -766,20 +783,14 @@
if (header.meta) {
- // Items: get ids from metadata
- if (Ext.isArray(response.metaData[header.name])) {
- header.items = Ext.clone(response.metaData[header.name]);
- }
- // Items: get ids from xLayout
- else {
- header.items = xLayout.dimensionNameIdsMap[header.name];
- }
-
- // Collect ids
- ids = ids.concat(header.items);
+ // Items
+ header.items = Ext.clone(xLayout.dimensionNameIdsMap[header.name]) || [];
// Size
header.size = header.items.length;
+
+ // Collect ids, used by extendMetaData
+ ids = ids.concat(header.items);
}
}
@@ -862,9 +873,8 @@
rowDimensionName = xLayout.rows[0].dimensionName,
data = [],
- //columnIds = columnDimensionName === pe ? xResponse.metaData.pe : xLayout.extended.dimensionNameItemsMap[columnDimensionName],
- columnIds = Ext.isArray(xResponse.metaData[columnDimensionName]) ? xResponse.metaData[columnDimensionName] : xLayout.dimensionNameIdsMap[columnDimensionName],
- rowIds = Ext.isArray(xResponse.metaData[rowDimensionName]) ? xResponse.metaData[rowDimensionName] : xLayout.dimensionNameIdsMap[rowDimensionName],
+ columnIds = xLayout.columnIds,
+ rowIds = xLayout.rowIds,
trendLineFields = [],
targetLineFields = [],
baseLineFields = [],