dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04423
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1470: (GIS) Zoom level and map position are now unchanged while performing orgunit assignment operation...
------------------------------------------------------------
revno: 1470
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-02-23 15:22:16 +0100
message:
(GIS) Zoom level and map position are now unchanged while performing orgunit assignment operations. Blueprint: https://blueprints.launchpad.net/dhis2/+spec/gis-persist-zoom-orgunit-relation
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.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/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-02-19 13:14:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-02-23 14:22:16 +0000
@@ -3051,7 +3051,7 @@
function onClickUnselectChoropleth(feature) {}
/*MAP DATA*/
-function loadMapData(redirect) {
+function loadMapData(redirect, position) {
Ext.Ajax.request({
url: path + 'getMapByMapLayerPath' + type,
@@ -3077,13 +3077,16 @@
MAPDATA.latitude = parseFloat(MAPDATA.latitude);
MAPDATA.zoom = parseFloat(MAPDATA.zoom);
}
+
+ if (!position) {
- if (MAPDATA.zoom != MAP.getZoom()) {
- MAP.zoomTo(MAPDATA.zoom);
+ if (MAPDATA.zoom != MAP.getZoom()) {
+ MAP.zoomTo(MAPDATA.zoom);
+ }
+
+ MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude));
}
- MAP.setCenter(new OpenLayers.LonLat(MAPDATA.longitude, MAPDATA.latitude));
-
toggleFeatureLabels(false);
if (redirect == 'choropleth') {
@@ -3091,7 +3094,7 @@
else if (redirect == 'assignment') {
getAssignOrganisationUnitData(); }
else if (redirect == 'auto-assignment') {
- getAutoAssignOrganisationUnitData(); }
+ getAutoAssignOrganisationUnitData(position); }
},
failure: function() {
alert( 'Error while retrieving map data: loadMapData' );
@@ -3260,7 +3263,7 @@
}
/*AUTO MAPPING*/
-function getAutoAssignOrganisationUnitData() {
+function getAutoAssignOrganisationUnitData(position) {
MASK.msg = 'Loading data...';
MASK.show();
@@ -3272,7 +3275,7 @@
params: { level: level, format: 'json' },
success: function( responseObject ) {
- dataReceivedAutoAssignOrganisationUnit( responseObject.responseText );
+ dataReceivedAutoAssignOrganisationUnit( responseObject.responseText, position );
},
failure: function() {
alert( 'Status', 'Error while retrieving data' );
@@ -3280,7 +3283,7 @@
});
}
-function dataReceivedAutoAssignOrganisationUnit( responseText ) {
+function dataReceivedAutoAssignOrganisationUnit( responseText, position ) {
var layers = MAP.getLayersByName('Thematic map');
var features = layers[0]['features'];
var organisationUnits = Ext.util.JSON.decode(responseText).organisationUnits;
@@ -3328,7 +3331,7 @@
Ext.messageBlack.msg('Assign organisation units', '' + msg_highlight_start + count_match + msg_highlight_end + ' organisation units assigned.<br><br>Database: ' + msg_highlight_start + organisationUnits.length + msg_highlight_end + '<br>Shapefile: ' + msg_highlight_start + features.length + msg_highlight_end);
Ext.getCmp('grid_gp').getStore().reload();
- loadMapData('assignment');
+ loadMapData('assignment', position);
},
failure: function() {
alert( 'Error: addOrUpdateMapOrganisationUnitRelations' );
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-02-17 16:28:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-02-23 14:22:16 +0000
@@ -177,7 +177,7 @@
cls = 'row-assigned';
}
- return cls;
+ return cls;
}
});
@@ -268,7 +268,7 @@
return;
}
- loadMapData('auto-assignment');
+ loadMapData('auto-assignment', true);
},
scope: this
},
@@ -298,7 +298,7 @@
Ext.messageBlack.msg('Remove all relations', 'All relations for the map ' + msg_highlight_start + Ext.getCmp('maps_cb').getRawValue() + msg_highlight_end + ' removed.');
- mapping.classify(true);
+ mapping.classify(true, true);
},
failure: function() {
alert('Error while deleting MapOrganisationUnitRelation');
@@ -352,7 +352,7 @@
Ext.messageBlack.msg('Remove relations', msg);
- mapping.classify(true);
+ mapping.classify(true, true);
},
failure: function() {
alert('Error while deleting MapOrganisationUnitRelation');
@@ -386,7 +386,7 @@
Ext.messageBlack.msg('Assign organisation units', msg_highlight_start + mapping.relation + msg_highlight_end + ' (map) assigned to ' + msg_highlight_start + name + msg_highlight_end + ' (database).');
Ext.getCmp('grid_gp').getStore().reload();
feature_popup.hide();
- loadMapData('assignment');
+ loadMapData('assignment', true);
},
failure: function() {
alert( 'Error: addOrUpdateMapOrganisationUnitRelation' );
@@ -459,7 +459,7 @@
* the widget isn't ready, or no indicator is specified, or no
* method is specified.
*/
- classify: function(exception) {
+ classify: function(exception, position) {
if (!this.ready) {
Ext.MessageBox.alert('Error', 'Component init not complete');
@@ -488,7 +488,7 @@
MASK.msg = 'Loading data...';
MASK.show();
- loadMapData('assignment');
+ loadMapData('assignment', position);
},
/**