dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22729
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11019: (PT, DV) Improved validation.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11019 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-05-27 16:53:37 +0200
message:
(PT, DV) Improved validation.
modified:
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/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/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-05-27 13:57:28 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-05-27 14:51:20 +0000
@@ -2022,35 +2022,37 @@
return;
}
- // At least one period specified
- a = [].concat(config.columns, config.rows, config.filters);
- for (var i = 0; i < a.length; i++) {
- if (a[i]) {
- objectNames.push(a[i].dimension);
+ // Get object names and isOu/isOuc
+ for (var i = 0, dim, dims = [].concat(config.columns, config.rows, config.filters); i < dims.length; i++) {
+ dim = dims[i];
+
+ if (dim) {
+
+ // Object names
+ if (Ext.isString(dim.dimension)) {
+ objectNames.push(dim.dimension);
+ }
+
+ // isOu/isOuc
+ if (dim.dimension === dimConf.organisationUnit.objectName && Ext.isArray(dim.items)) {
+ for (var j = 0; j < dim.items.length; j++) {
+ if (dim.items[j].id === 'USER_ORGUNIT') {
+ isOu = true;
+ }
+ else if (dim.items[j].id === 'USER_ORGUNIT_CHILDREN') {
+ isOuc = true;
+ }
+ }
+ }
}
}
+ // At least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
alert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
return;
}
- dims = [].concat(config.columns, config.rows, config.filters);
- for (var i = 0, dim; i < dims.length; i++) {
- dim = dims[i];
-
- if (dim) {
- for (var j = 0; j < dims[i].items.length; j++) {
- if (dims[i].items[j].id === 'USER_ORGUNIT') {
- isOu = true;
- }
- else if (dims[i].items[j].id === 'USER_ORGUNIT_CHILDREN') {
- isOuc = true;
- }
- }
- }
- }
-
// Layout
layout.columns = config.columns;
layout.rows = config.rows;
=== 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 14:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-05-27 14:51:20 +0000
@@ -1901,7 +1901,10 @@
return function() {
var a = [],
objectNames = [],
- dimConf = dv.conf.finals.dimension;
+ dimConf = dv.conf.finals.dimension,
+ dims,
+ isOu = false,
+ isOuc = false;
config.columns = getValidatedDimensionArray(config.columns);
config.rows = getValidatedDimensionArray(config.rows);
@@ -1927,11 +1930,28 @@
return;
}
- // At least one period specified
- a = [].concat(config.columns, config.rows, config.filters);
- for (var i = 0; i < a.length; i++) {
- if (a[i]) {
- objectNames.push(a[i].dimension);
+ // Get object names and isOu/isOuc
+ for (var i = 0, dim, dims = [].concat(config.columns, config.rows, config.filters); i < dims.length; i++) {
+ dim = dims[i];
+
+ if (dim) {
+
+ // Object names
+ if (Ext.isString(dim.dimension)) {
+ objectNames.push(dim.dimension);
+ }
+
+ // isOu/isOuc
+ if (dim.dimension === dimConf.organisationUnit.objectName && Ext.isArray(dim.items)) {
+ for (var j = 0; j < dim.items.length; j++) {
+ if (dim.items[j].id === 'USER_ORGUNIT') {
+ isOu = true;
+ }
+ else if (dim.items[j].id === 'USER_ORGUNIT_CHILDREN') {
+ isOuc = true;
+ }
+ }
+ }
}
}
@@ -1967,8 +1987,8 @@
layout.rangeAxisTitle = Ext.isString(config.rangeAxisLabel) && !Ext.isEmpty(config.rangeAxisLabel) ? config.rangeAxisLabel :
(Ext.isString(config.rangeAxisTitle) && !Ext.isEmpty(config.rangeAxisTitle) ? config.rangeAxisTitle : undefined);
- layout.userOrganisationUnit = Ext.isBoolean(config.userOrganisationUnit) ? config.userOrganisationUnit : false;
- layout.userOrganisationUnitChildren = Ext.isBoolean(config.userOrganisationUnitChildren) ? config.userOrganisationUnitChildren : false;
+ layout.userOrganisationUnit = isOu;
+ layout.userOrganisationUnitChildren = isOuc;
layout.parentGraphMap = Ext.isObject(config.parentGraphMap) ? config.parentGraphMap : undefined;