dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27894
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13895: GIS, layer validation improved.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13895 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-30 12:34:08 +0100
message:
GIS, layer validation improved.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/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-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-01-30 10:22:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-01-30 11:32:36 +0000
@@ -7836,26 +7836,34 @@
objectNameCmpMap = {},
view = {};
+ view.layer = layer.id;
+
objectNameCmpMap[dimConf.indicator.objectName] = indicator;
objectNameCmpMap[dimConf.dataElement.objectName] = dataElement;
objectNameCmpMap[dimConf.operand.objectName] = dataElement;
objectNameCmpMap[dimConf.dataSet.objectName] = dataSet;
- view.columns = [{
- dimension: vType,
- items: [{
- id: objectNameCmpMap[vType].getValue()
- }]
- }];
-
- view.rows = [treePanel.getDimension()];
-
- view.filters = [{
- dimension: dimConf.period.objectName,
- items: [{
- id: period.getValue()
- }]
- }];
+ if (objectNameCmpMap[vType].getValue()) {
+ view.columns = [{
+ dimension: vType,
+ items: [{
+ id: objectNameCmpMap[vType].getValue()
+ }]
+ }];
+ }
+
+ if (treePanel.getDimension()) {
+ view.rows = [treePanel.getDimension()];
+ }
+
+ if (period.getValue()) {
+ view.filters = [{
+ dimension: dimConf.period.objectName,
+ items: [{
+ id: period.getValue()
+ }]
+ }];
+ }
view.classes = parseInt(classes.getValue());
view.method = parseInt(method.getValue());
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2014-01-30 10:22:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2014-01-30 11:32:36 +0000
@@ -2371,12 +2371,12 @@
return function() {
if (!Ext.isObject(config)) {
- console.log('Record config is not an object: ' + config);
+ console.log('Record config is not an object', config);
return;
}
if (!Ext.isString(config.id)) {
- alert('Record id is not text: ' + config);
+ console.log('Record id is not text', config);
return;
}
@@ -2404,7 +2404,7 @@
}
if (!Ext.isString(config.dimension)) {
- console.log('Dimension name is not text: ' + config);
+ console.log('Dimension name is not text', config);
return;
}
@@ -2412,7 +2412,7 @@
var records = [];
if (!Ext.isArray(config.items)) {
- console.log('Dimension items is not an array: ' + config);
+ console.log('Dimension items is not an array', config);
return;
}
@@ -2427,7 +2427,7 @@
config.items = records;
if (!config.items.length) {
- console.log('Dimension has no valid items: ' + config);
+ console.log('Dimension has no valid items', config);
return;
}
}
@@ -2538,6 +2538,7 @@
var a = [],
objectNames = [],
dimConf = conf.finals.dimension,
+ layerConf =
isOu = false,
isOuc = false,
isOugc = false;
@@ -2553,10 +2554,17 @@
config.filters = getValidatedDimensionArray(config.filters);
if (!config.rows) {
- console.log('Organisation unit dimension is invalid');
+ console.log('Organisation unit dimension is invalid', config.rows);
return;
}
+ if (Ext.Array.contains([gis.layer.thematic1.id, gis.layer.thematic2.id, gis.layer.thematic3.id, gis.layer.thematic4.id], config.layer)) {
+ if (!config.columns) {
+ console.log('Data dimension is invalid', config.columns);
+ return;
+ }
+ }
+
// Collect object names and user orgunits
for (var i = 0, dim, dims = Ext.Array.clean([].concat(config.columns, config.rows, config.filters)); i < dims.length; i++) {
dim = dims[i];
@@ -2624,17 +2632,17 @@
return function() {
if (!Ext.isObject(config)) {
- console.log('Header is not an object: ' + config);
+ console.log('Header is not an object', config);
return;
}
if (!Ext.isString(config.name)) {
- console.log('Header name is not text: ' + config);
+ console.log('Header name is not text', config);
return;
}
if (!Ext.isBoolean(config.meta)) {
- console.log('Header meta is not boolean: ' + config);
+ console.log('Header meta is not boolean', config);
return;
}
@@ -2654,12 +2662,12 @@
var headers = [];
if (!(config && Ext.isObject(config))) {
- alert('Data response invalid');
+ alert('Data response invalid', config);
return false;
}
if (!(config.headers && Ext.isArray(config.headers))) {
- alert('Data response invalid');
+ alert('Data response invalid', config);
return false;
}
@@ -2674,17 +2682,17 @@
config.headers = headers;
if (!config.headers.length) {
- alert('No valid response headers');
+ alert('No valid response headers', config);
return;
}
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- alert('No values found');
+ alert('No values found', config);
return false;
}
if (config.headers.length !== config.rows[0].length) {
- alert('Data invalid');
+ alert('Data invalid', config);
return false;
}