← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 470: Map view combobox now only loads mapviews with map source type as stored in the user settings.

 

------------------------------------------------------------
revno: 470
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-08-04 14:36:02 +0700
message:
  Map view combobox now only loads mapviews with map source type as stored in the user settings.
modified:
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js
  gis/dhis-web-mapping/src/main/webapp/mfbase/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-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-07-13 20:00:15 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-08-04 07:36:02 +0000
@@ -36,7 +36,6 @@
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -522,6 +521,23 @@
 
     public Collection<MapView> getAllMapViews()
     {
-        return mappingStore.getAllMapViews();
+        Collection<MapView> selectedMapViews = new ArrayList<MapView>();
+        
+        Collection<MapView> mapViews = mappingStore.getAllMapViews();
+  
+        String mapSourceType = (String) userSettingService.getUserSetting( KEY_MAP_SOURCE_TYPE, MAP_SOURCE_TYPE_DATABASE );
+        
+        if (mapViews != null)
+        {
+            for (MapView mapView : mapViews)
+            {
+                if (mapView.getMapSourceType().equals( mapSourceType ))
+                {
+                    selectedMapViews.add( mapView );
+                }
+            }
+        }
+        
+        return selectedMapViews;
     }
 }

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js	2009-07-31 17:22:28 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js	2009-08-04 07:36:02 +0000
@@ -162,6 +162,7 @@
     STATIC1LOADED = false;
     MAP_SOURCE_TYPE_DATABASE = 'database';
     MAP_SOURCE_TYPE_SHAPEFILE = 'shapefile';
+    MAPSOURCE = null;
     
     Ext.Ajax.request(
     {
@@ -1214,7 +1215,7 @@
 
                 success: function( responseObject )
                 {
-                    Ext.messageBlack.msg('New map view', 'The view ' + vn + ' was registered.');
+                    Ext.messageBlack.msg('New map view', 'The view ' + msg_highlight_start + vn + msg_highlight_end + ' was registered.');
                     
                     Ext.getCmp('view_cb').getStore().reload();
                     Ext.getCmp('mapview_cb').getStore().reload();

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js	2009-07-14 11:49:09 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js	2009-08-04 07:36:02 +0000
@@ -182,7 +182,7 @@
                                 failure: function()
                                 {
                                   alert( 'Status', 'Error while retrieving data' );
-                                } 
+                                }
                             });
                         }
                     },