dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02248
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 762: (GIS) A list of available name columns now shows up in 'Register maps'.
------------------------------------------------------------
revno: 762
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-09-24 20:26:36 +0200
message:
(GIS) A list of available name columns now shows up in 'Register maps'.
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/Choropleth.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 2009-09-22 19:54:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2009-09-24 18:26:36 +0000
@@ -938,6 +938,11 @@
autoLoad: true
});
+ var nameColumnStore = new Ext.data.SimpleStore({
+ fields: ['name'],
+ data: []
+ });
+
var baseCoordinateStore = new Ext.data.JsonStore({
url: path + 'getBaseCoordinate' + type,
root: 'baseCoordinate',
@@ -991,23 +996,54 @@
width: combo_width
});
- var mapLayerPathTextField = new Ext.form.TextField({
- id: 'maplayerpath_tf',
- emptyText: MENU_EMPTYTEXT,
- width: combo_width
- });
-
var mapLayerPathComboBox = new Ext.form.ComboBox({
id: 'maplayerpath_cb',
+ typeAhead: true,
editable: false,
+ valueField: 'name',
displayField: 'name',
- valueField: 'name',
emptyText: MENU_EMPTYTEXT,
width: combo_width,
minListWidth: combo_list_width,
triggerAction: 'all',
mode: 'remote',
- store: geojsonStore
+ store: geojsonStore,
+ listeners: {
+ 'select': {
+ fn: function() {
+ var n = Ext.getCmp('maplayerpath_cb').getValue();
+
+ Ext.Ajax.request({
+ url: path + 'getGeoJson' + type,
+ method: 'POST',
+ params: {name: n},
+ success: function(r) {
+ var file = Ext.util.JSON.decode(r.responseText);
+ var keys = [];
+ var data = [];
+
+ function getKeys(object) {
+ for (var key in object) {
+ if (object.hasOwnProperty(key)) {
+ keys.push(key);
+ }
+ }
+ return keys;
+ }
+
+ var nameList = getKeys(file.features[0].properties);
+ for (var i = 0; i < nameList.length; i++) {
+ data.push(new Array(nameList[i]));
+ }
+
+ Ext.getCmp('newnamecolumn_cb').getStore().loadData(data, false);
+ },
+ failure: function() {}
+ });
+ },
+ scope: this
+ }
+ }
});
var typeComboBox = new Ext.form.ComboBox({
@@ -1026,18 +1062,32 @@
data: [['Polygon']]
})
});
-
- var newNameColumnTextField = new Ext.form.TextField({
- id: 'newnamecolumn_tf',
- emptyText: MENU_EMPTYTEXT,
- width: combo_width
- });
-
- var editNameColumnTextField = new Ext.form.TextField({
- id: 'editnamecolumn_tf',
- emptyText: MENU_EMPTYTEXT,
- width: combo_width
- });
+
+ var newNameColumnComboBox = new Ext.form.ComboBox({
+ id: 'newnamecolumn_cb',
+ editable: false,
+ displayField: 'name',
+ valueField: 'name',
+ emptyText: MENU_EMPTYTEXT,
+ width: combo_width,
+ minListWidth: combo_list_width,
+ triggerAction: 'all',
+ mode: 'local',
+ store: nameColumnStore
+ });
+
+ var editNameColumnComboBox = new Ext.form.ComboBox({
+ id: 'editnamecolumn_cb',
+ editable: false,
+ displayField: 'name',
+ valueField: 'name',
+ emptyText: MENU_EMPTYTEXT,
+ width: combo_width,
+ minListWidth: combo_list_width,
+ triggerAction: 'all',
+ mode: 'local',
+ store: nameColumnStore
+ });
var newLongitudeComboBox = new Ext.form.ComboBox({
id: 'newlongitude_cb',
@@ -1145,7 +1195,7 @@
var nn = Ext.getCmp('newname_tf').getValue();
var mlp = Ext.getCmp('maplayerpath_cb').getValue();
var t = Ext.getCmp('type_cb').getValue();
- var nc = Ext.getCmp('newnamecolumn_tf').getValue();
+ var nc = Ext.getCmp('newnamecolumn_cb').getValue();
var lon = Ext.getCmp('newlongitude_cb').getRawValue();
var lat = Ext.getCmp('newlatitude_cb').getRawValue();
var zoom = Ext.getCmp('newzoom_cb').getValue();
@@ -1214,7 +1264,7 @@
Ext.getCmp('organisationunitlevel_cb').reset();
Ext.getCmp('newname_tf').reset();
Ext.getCmp('maplayerpath_cb').reset();
- Ext.getCmp('newnamecolumn_tf').reset();
+ Ext.getCmp('newnamecolumn_cb').reset();
Ext.getCmp('newlongitude_cb').reset();
Ext.getCmp('newlatitude_cb').reset();
Ext.getCmp('newzoom_cb').reset();
@@ -1242,7 +1292,7 @@
handler: function() {
var en = Ext.getCmp('editname_tf').getValue();
var em = Ext.getCmp('editmap_cb').getValue();
- var nc = Ext.getCmp('editnamecolumn_tf').getValue();
+ var nc = Ext.getCmp('editnamecolumn_cb').getValue();
var lon = Ext.getCmp('editlongitude_cb').getRawValue();
var lat = Ext.getCmp('editlatitude_cb').getRawValue();
var zoom = Ext.getCmp('editzoom_cb').getValue();
@@ -1275,7 +1325,7 @@
Ext.getCmp('editmap_cb').reset();
Ext.getCmp('editname_tf').reset();
- Ext.getCmp('editnamecolumn_tf').reset();
+ Ext.getCmp('editnamecolumn_cb').reset();
Ext.getCmp('editlongitude_cb').reset();
Ext.getCmp('editlatitude_cb').reset();
Ext.getCmp('editzoom_cb').reset();
@@ -1384,7 +1434,7 @@
var map = Ext.util.JSON.decode( responseObject.responseText ).map[0];
Ext.getCmp('editname_tf').setValue(map.name);
- Ext.getCmp('editnamecolumn_tf').setValue(map.nameColumn);
+ Ext.getCmp('editnamecolumn_cb').setValue(map.nameColumn);
Ext.getCmp('editlongitude_cb').setValue(map.longitude);
Ext.getCmp('editlatitude_cb').setValue(map.latitude);
Ext.getCmp('editzoom_cb').setValue(map.zoom);
@@ -1393,6 +1443,34 @@
alert( 'Error while retrieving data: getAssignOrganisationUnitData' );
}
});
+
+ Ext.Ajax.request({
+ url: path + 'getGeoJson' + type,
+ method: 'POST',
+ params: {name: mlp},
+ success: function(r) {
+ var file = Ext.util.JSON.decode(r.responseText);
+ var keys = [];
+ var data = [];
+
+ function getKeys(object) {
+ for (var key in object) {
+ if (object.hasOwnProperty(key)) {
+ keys.push(key);
+ }
+ }
+ return keys;
+ }
+
+ var nameList = getKeys(file.features[0].properties);
+ for (var i = 0; i < nameList.length; i++) {
+ data.push(new Array(nameList[i]));
+ }
+
+ Ext.getCmp('editnamecolumn_cb').getStore().loadData(data, false);
+ },
+ failure: function() {}
+ });
},
scope: this
}
@@ -1423,11 +1501,10 @@
/*{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Map type</p>' }, typeComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Organisation unit level</p>' }, newMapComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Organisation unit</p>' }, multi, { html: '<br>' },*/
+ { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Display name</p>' }, newNameTextField, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Organisation unit level</p>' }, organisationUnitLevelComboBox, { html: '<br>' },
- /*{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Map source file</p>' }, mapLayerPathTextField, { html: '<br>' },*/
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Map source file</p>' }, mapLayerPathComboBox, { html: '<br>' },
- { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Display name</p>' }, newNameTextField, { html: '<br>' },
- { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Name column</p>' }, newNameColumnTextField, { html: '<br>' },
+ { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Name column</p>' }, newNameColumnComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Longitude (x)</p>' }, newLongitudeComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Latitude (y)</p>' }, newLatitudeComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Zoom</p>' }, newZoomComboBox
@@ -1439,7 +1516,7 @@
items: [
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Map</p>' }, editMapComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Display name</p>' }, editNameTextField, { html: '<br>' },
- { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Name column</p>' }, editNameColumnTextField, { html: '<br>' },
+ { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Name column</p>' }, editNameColumnComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Longitude</p>' }, editLongitudeComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Latitude</p>' }, editLatitudeComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';"> Zoom</p>' }, editZoomComboBox
@@ -2231,7 +2308,7 @@
zoomOutButton,
' ',
zoomMaxExtentButton,
- ' ','-',' ',
+ ' ','-',
favoritesButton,
'-',
legendSetButton,
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2009-09-21 22:42:56 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2009-09-24 18:26:36 +0000
@@ -721,7 +721,7 @@
this.setUrl(path + 'getPolygonShapefile.action?level=' + URL);
}
}
- else {
+ else if (MAPSOURCE == MAP_SOURCE_TYPE_SHAPEFILE) {
this.setUrl(path + 'getGeoJson.action?name=' + URL);
}
}
Follow ups