dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27010
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13391: (GIS) Event info window + (PT, DV) Data element selection bug fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13391 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 00:30:36 +0100
message:
(GIS) Event info window + (PT, DV) Data element selection bug fixed.
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
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.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 2013-12-20 14:59:56 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-12-22 23:27:34 +0000
@@ -344,8 +344,7 @@
util.gui.window = util.gui.window || {};
util.gui.window.setPositionTopRight = function(window) {
- var center = gis.viewport.centerRegion;
- window.setPosition(gis.viewport.width - (window.width + 7), center.y + 8);
+ window.setPosition(gis.viewport.centerRegion.getWidth() - (window.getWidth() + 3), gis.viewport.centerRegion.y + 58);
};
util.gui.window.setPositionTopLeft = function(window) {
@@ -1228,7 +1227,7 @@
for (var i = 0; i < valueArray.length; i++) {
valueArray[i] = Ext.String.trim(valueArray[i]);
}
-
+
return {
id: this.dataElement.id,
name: this.dataElement.name,
@@ -1257,7 +1256,7 @@
data: [
{id: 'IN', name: 'One of'}
]
- }
+ }
});
this.valueStore = Ext.create('Ext.data.Store', {
@@ -1320,8 +1319,8 @@
fn: function(cb) {
var value = cb.getValue(),
optionSetId = container.dataElement.optionSet.id;
-
- // search
+
+ // search
container.valueStore.loadOptionSet(optionSetId, value);
// trigger
@@ -1608,7 +1607,7 @@
GIS.app.WidgetWindow = function(layer, width, padding) {
width = width || gis.conf.layout.widget.window_width;
padding = padding || 5;
-
+
return Ext.create('Ext.window.Window', {
//autoShow: true,
title: layer.name,
@@ -4212,15 +4211,15 @@
},
hasDataElement: function(dataElementId) {
var hasDataElement = false;
-
- this.items.each(function(item) {
+
+ this.items.each(function(item) {
if (item.dataElement.id === dataElementId) {
hasDataElement = true;
}
});
return hasDataElement;
- }
+ }
});
addUxFromDataElement = function(element, index) {
@@ -4270,7 +4269,7 @@
};
dataElementsByStageStore.removeAt(dataElementsByStageStore.findExact('id', element.id));
- };
+ };
selectDataElements = function(items) {
var dataElements = [];
@@ -4278,7 +4277,7 @@
// data element objects
for (var i = 0, item; i < items.length; i++) {
item = items[i];
-
+
if (Ext.isString(item)) {
dataElements.push(dataElementsByStageStore.getAt(dataElementsByStageStore.findExact('id', item)).data);
}
@@ -4329,8 +4328,7 @@
columnWidth: 0.5,
style: 'margin-right: 1px',
format: 'Y-m-d',
- //value: new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))
- value: new Date('2012-01-01') //todo
+ value: new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))
});
endDate = Ext.create('Ext.form.field.Date', {
@@ -4964,7 +4962,7 @@
view.dataElements.push(panel.getRecord());
}
-
+
view.organisationUnits = treePanel.getDimension().items;
return view;
=== 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 2013-12-20 15:44:08 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2013-12-22 23:27:34 +0000
@@ -178,18 +178,20 @@
GIS.core.createSelectHandlers = function(gis, layer) {
var isRelocate = !!GIS.app ? (gis.init.user.isAdmin ? true : false) : false,
options = {},
- window,
infrastructuralPeriod,
- onHoverSelect,
- onHoverUnselect,
- onClickSelect,
- dimConf = gis.conf.finals.dimension;
+ defaultHoverSelect,
+ defaultHoverUnselect,
+ defaultClickSelect,
+ selectHandlers,
+ dimConf = gis.conf.finals.dimension,
+ defaultHoverWindow,
+ eventWindow;
- onHoverSelect = function fn(feature) {
- if (window) {
- window.destroy();
+ defaultHoverSelect = function fn(feature) {
+ if (defaultHoverWindow) {
+ defaultHoverWindow.destroy();
}
- window = Ext.create('Ext.window.Window', {
+ defaultHoverWindow = Ext.create('Ext.window.Window', {
cls: 'gis-window-widget-feature gis-plugin',
preventHeader: true,
shadow: false,
@@ -199,21 +201,21 @@
}
});
- window.show();
+ defaultHoverWindow.show();
var eastX = gis.viewport.eastRegion.getPosition()[0],
centerX = gis.viewport.centerRegion.getPosition()[0],
centerRegionCenterX = centerX + ((eastX - centerX) / 2),
centerRegionY = gis.viewport.centerRegion.getPosition()[1] + (GIS.app ? 32 : 0);
- window.setPosition(centerRegionCenterX - (window.getWidth() / 2), centerRegionY);
- };
-
- onHoverUnselect = function fn(feature) {
- window.destroy();
- };
-
- onClickSelect = function fn(feature) {
+ defaultHoverWindow.setPosition(centerRegionCenterX - (defaultHoverWindow.getWidth() / 2), centerRegionY);
+ };
+
+ defaultHoverUnselect = function fn(feature) {
+ defaultHoverWindow.destroy();
+ };
+
+ defaultClickSelect = function fn(feature) {
var showInfo,
showRelocate,
drill,
@@ -524,11 +526,48 @@
menu.showAt([gis.olmap.mouseMove.x, gis.olmap.mouseMove.y]);
};
- options.onHoverSelect = onHoverSelect;
- options.onHoverUnselect = onHoverUnselect;
-
- if (layer.id !== 'event') {
- options.onClickSelect = onClickSelect;
+ options = {
+ onHoverSelect: defaultHoverSelect,
+ onHoverUnselect: defaultHoverUnselect,
+ onClickSelect: defaultClickSelect
+ };
+
+ if (layer.id === 'event') {
+ options.onClickSelect = function fn(feature) {
+ var ignoreKeys = ['label', 'value', 'nameColumnMap', 'psi', 'ps', 'longitude', 'latitude', 'eventdate', 'ou', 'oucode', 'ouname'],
+ attributes = feature.attributes,
+ map = attributes.nameColumnMap,
+ html = '<table>',
+ titleStyle = ' style="font-weight:bold; padding-right:10px"';
+
+ // default properties
+ html += '<tr><td' + titleStyle + '>' + map['ou'] + '</td><td>' + attributes['ouname'] + '</td></tr>';
+ html += '<tr><td' + titleStyle + '>' + map['eventdate'] + '</td><td>' + attributes['eventdate'] + '</td></tr>';
+ html += '<tr><td' + titleStyle + '>' + map['longitude'] + '</td><td>' + attributes['longitude'] + '</td></tr>';
+ html += '<tr><td' + titleStyle + '>' + map['latitude'] + '</td><td>' + attributes['latitude'] + '</td></tr>';
+
+ for (var key in attributes) {
+ if (attributes.hasOwnProperty(key) && !Ext.Array.contains(ignoreKeys, key)) {
+ html += '<tr><td' + titleStyle + '>' + map[key] + '</td><td>' + attributes[key] + '</td></tr>';
+ }
+ }
+
+ html += '</table>';
+
+ if (Ext.isObject(eventWindow) && eventWindow.destroy) {
+ eventWindow.destroy();
+ }
+
+ eventWindow = Ext.create('Ext.window.Window', {
+ title: 'Event',
+ resizable: false,
+ bodyStyle: 'background-color:#fff; padding:5px',
+ html: html
+ });
+
+ eventWindow.show();
+ gis.util.gui.window.setPositionTopRight(eventWindow);
+ };
}
selectHandlers = new OpenLayers.Control.newSelectFeature(layer, options);
@@ -902,13 +941,21 @@
scope: this,
success: function(r) {
var events = [],
- features = [];
+ features = [],
+ map;
if (!r.rows) {
alert('No coordinates found');
return;
}
+ // name-column map
+ map = Ext.clone(r.metaData.names);
+
+ for (var i = 0; i < r.headers.length; i++) {
+ map[r.headers[i].name] = r.headers[i].column;
+ }
+
// events
for (var i = 0, row, obj; i < r.rows.length; i++) {
row = r.rows[i];
@@ -919,7 +966,8 @@
}
obj[gis.conf.finals.widget.value] = 0;
- obj['label'] = obj.ouname;
+ obj.label = obj.ouname;
+ obj.nameColumnMap = map;
events.push(obj);
}
@@ -949,9 +997,9 @@
indicator: gis.conf.finals.widget.value,
method: 2,
numClasses: 5,
- colors: layer.core.getColors('ffffff', 'ff0000'),
- minSize: 4,
- maxSize: 4
+ colors: layer.core.getColors('000000', '222222'),
+ minSize: 5,
+ maxSize: 5
};
layer.core.view = view;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js 2013-12-09 11:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js 2013-12-22 11:58:26 +0000
@@ -186,8 +186,8 @@
colors: [new mapfish.ColorRgb(120, 120, 0), new mapfish.ColorRgb(255, 0, 0)],
method: mapfish.GeoStat.Distribution.CLASSIFY_BY_QUANTILS,
numClasses: 5,
- minSize: 3,
- maxSize: 20,
+ minSize: 4,
+ maxSize: 4,
minVal: null,
maxVal: null,
defaultSymbolizer: {'fillOpacity': 1},
=== 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-12-20 13:39:55 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-12-22 13:34:11 +0000
@@ -2508,7 +2508,7 @@
path = '/dataElementGroups/' + uid + '.json?domainType=aggregate&links=false&paging=false';
}
else if (uid === 0) {
- path = 'dataElements.json?domainType=aggregate&paging=false&links=false';
+ path = '/dataElements.json?domainType=aggregate&paging=false&links=false';
}
if (!path) {
@@ -2556,7 +2556,8 @@
});
}
else {
- alert('Invalid parameter');
+ this.removeAll();
+ dataElementGroupComboBox.clearValue();
}
},
listeners: {
@@ -2993,7 +2994,7 @@
var store = dataElementAvailableStore,
detailLevel = dataElementDetailLevel.getValue(),
value = this.getValue();
-
+
if (value !== null) {
if (detailLevel === dimConf.dataElement.objectName) {
store.setTotalsProxy(value);
=== 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-12-16 11:18:47 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-12-22 13:34:11 +0000
@@ -2236,7 +2236,7 @@
path = '/dataElementGroups/' + uid + '.json?domainType=aggregate&links=false&paging=false';
}
else if (uid === 0) {
- path = 'dataElements.json?domainType=aggregate&paging=false&links=false';
+ path = '/dataElements.json?domainType=aggregate&paging=false&links=false';
}
if (!path) {
@@ -2284,7 +2284,8 @@
});
}
else {
- alert('Invalid parameter');
+ this.removeAll();
+ dataElementGroupComboBox.clearValue();
}
},
listeners: {