← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 659: (GIS) Register maps panel improved: the 'map source file' text field replaced by a combo box that...

 

------------------------------------------------------------
revno: 659
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-09-10 14:02:04 +0700
message:
  (GIS) Register maps panel improved: the 'map source file' text field replaced by a combo box that loads all geojson files found in DHIS2_HOME/gis.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonGeoJsonFiles.vm
  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/jsonGeoJsonFiles.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonGeoJsonFiles.vm	2009-09-09 15:59:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonGeoJsonFiles.vm	2009-09-10 07:02:04 +0000
@@ -1,6 +1,8 @@
 #set( $size = $object.size() )
 { "files": [
 #foreach ( $file in $object )
-  "$!{file}"#if( $velocityCount < $size ),#end
+  {
+    "name": "$!{file}"
+  }#if( $velocityCount < $size ),#end
 #end
 ] }
\ No newline at end of file

=== 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-09 17:28:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2009-09-10 07:02:04 +0000
@@ -339,6 +339,7 @@
     
     var organisationUnitLevelStore = new Ext.data.JsonStore({
         url: path + 'getOrganisationUnitLevels' + type,
+		id: 'id',
         baseParams: { format: 'json' },
         root: 'organisationUnitLevels',
         fields: ['id', 'level', 'name'],
@@ -361,7 +362,14 @@
         fields: ['id', 'name', 'mapLayerPath', 'organisationUnitLevel'],
         autoLoad: true
     });
-
+	
+	var geojsonStore = new Ext.data.JsonStore({
+        url: path + 'getGeoJsonFiles' + type,
+        root: 'files',
+        fields: ['name'],
+        autoLoad: true
+    });
+	
     var organisationUnitComboBox = new Ext.form.ComboBox({
         id: 'organisationunit_cb',
         fieldLabel: 'Organisation unit',
@@ -393,23 +401,7 @@
         selectOnFocus: true,
         width: combo_width,
         minListWidth: combo_width + 26,
-        store: organisationUnitLevelStore,
-        listeners: {
-            'select': {
-                fn: function() {
-                    var level1 = Ext.getCmp('newmap_cb').getValue();
-                    var level2 = Ext.getCmp('organisationunitlevel_cb').getValue();
-                    var orgunit = Ext.getCmp('organisationunit_cb').getValue();
-
-                    if (level1 >= level2) { /*CURRENTLY NOT WORKING BECAUSE OF valuefield: 'id'*/
-                        organisationUnitLevelComboBox.reset();
-                        Ext.messageRed.msg('New map', 'The organisation unit selected above must be divided into a lower level than itself.');
-                        return;
-                    }
-                },
-                scope: this
-            }
-        }
+        store: organisationUnitLevelStore
     });
 
     var newNameTextField = new Ext.form.TextField({
@@ -429,6 +421,32 @@
         emptyText: MENU_EMPTYTEXT,
         width: combo_width
     });
+	
+	var mapLayerPathComboBox = new Ext.form.TextField({
+        id: 'maplayerpath_cb',
+        emptyText: MENU_EMPTYTEXT,
+        width: combo_width
+    });
+	
+	var mapLayerPathComboBox = new Ext.form.ComboBox({
+        id: 'maplayerpath_cb',
+        editable: false,
+        displayField: 'name',
+        valueField: 'name',
+		emptyText: MENU_EMPTYTEXT,
+        width: combo_width,
+        minListWidth: combo_width + 26,
+        triggerAction: 'all',
+        mode: 'remote',
+        store: geojsonStore,
+        listeners: {
+            'select': {
+                fn: function() {
+					alert(this.getStore().getById(this.getValue()).get('level'));
+                }
+            }
+        }
+    });
     
     var typeComboBox = new Ext.form.ComboBox({
         id: 'type_cb',
@@ -534,7 +552,7 @@
                     var oui = Ext.util.JSON.decode( responseObject.responseText ).organisationUnits[0].id;
                     var ouli = Ext.getCmp('organisationunitlevel_cb').getValue();
                     var nn = Ext.getCmp('newname_tf').getValue();
-                    var mlp = Ext.getCmp('maplayerpath_tf').getValue();
+                    var mlp = Ext.getCmp('maplayerpath_cb').getValue();
                     var t = Ext.getCmp('type_cb').getValue();
                     var nc = Ext.getCmp('newnamecolumn_tf').getValue();
                     var lon = Ext.getCmp('newlongitude_tf').getValue();
@@ -811,7 +829,8 @@
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Organisation unit level</p>' }, newMapComboBox, { html: '<br>' },
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Organisation unit</p>' }, multi, { html: '<br>' },*/
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Organisation unit level</p>' }, organisationUnitLevelComboBox, { html: '<br>' },
-            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Map source file</p>' }, mapLayerPathTextField, { html: '<br>' },
+            /*{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Map source file</p>' }, mapLayerPathTextField, { html: '<br>' },*/
+			{ html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Map source file</p>' }, mapLayerPathComboBox, { html: '<br>' },
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Display name</p>' }, newNameTextField, { html: '<br>' },
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Name column</p>' }, newNameColumnTextField, { html: '<br>' },
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Longitude (x)</p>' }, newLongitudeTextField, { html: '<br>' },
@@ -2073,7 +2092,7 @@
 		cls: 'x-btn-text-icon',
 		icon: '../../images/exit.png',
 		handler: function() {
-			window.location.href = '../dhis-web-portal/redirect.action'
+			window.location.href = '../../dhis-web-portal/redirect.action'
 		}
 	});
 

=== 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-08 20:33:48 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2009-09-10 07:02:04 +0000
@@ -722,7 +722,7 @@
                 }
             }
             else {
-                this.setUrl(GEOJSON_URL + URL);
+                this.setUrl(path + 'getGeoJson.action?name=' + URL);
             }
         }