dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01461
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 460: MapView now supports both database and shapefiles.
------------------------------------------------------------
revno: 460
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-07-13 22:00:15 +0200
message:
MapView now supports both database and shapefiles.
removed:
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceUserSettingAction.java
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceUserSettingAction.java
added:
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceTypeUserSettingAction.java
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceTypeUserSettingAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
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/MapViewDeletionHandler.java
dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java
dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java
gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
gis/dhis-web-mapping/src/main/resources/xwork.xml
gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm
gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm
gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapViews.vm
gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2009-05-28 11:18:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2009-07-13 20:00:15 +0000
@@ -38,6 +38,9 @@
*/
public class MapView
{
+ public static final String MAP_SOURCE_TYPE_DATABASE = "database";
+ public static final String MAP_SOURCE_TYPE_SHAPEFILE = "shapefile";
+
private int id;
private String name;
@@ -50,7 +53,9 @@
private Period period;
- private Map map;
+ private String mapSourceType;
+
+ private String mapSource;
private int method;
@@ -64,7 +69,7 @@
{
}
- public MapView( String name, IndicatorGroup indicatorGroup, Indicator indicator, PeriodType periodType, Period period, Map map,
+ public MapView( String name, IndicatorGroup indicatorGroup, Indicator indicator, PeriodType periodType, Period period, String mapSourceType, String mapSource,
int method, int classes, String colorLow, String colorHigh )
{
this.name = name;
@@ -72,7 +77,8 @@
this.indicator = indicator;
this.periodType = periodType;
this.period = period;
- this.map = map;
+ this.mapSourceType = mapSourceType;
+ this.mapSource = mapSource;
this.method = method;
this.classes = classes;
this.colorLow = colorLow;
@@ -176,14 +182,24 @@
this.period = period;
}
- public Map getMap()
- {
- return map;
- }
-
- public void setMap( Map map )
- {
- this.map = map;
+ public String getMapSourceType()
+ {
+ return mapSourceType;
+ }
+
+ public void setMapSourceType( String mapSourceType )
+ {
+ this.mapSourceType = mapSourceType;
+ }
+
+ public String getMapSource()
+ {
+ return mapSource;
+ }
+
+ public void setMapSource( String mapSource )
+ {
+ this.mapSource = mapSource;
}
public int getMethod()
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-07-13 11:45:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-07-13 20:00:15 +0000
@@ -40,11 +40,10 @@
{
final String ID = MappingService.class.getName();
- final String KEY_MAP_SOURCE = "mapSource";
-
- final String MAP_SOURCE_DATABASE = "database";
-
- final String MAP_SOURCE_SHAPEFILE = "shapefile";
+ final String KEY_MAP_SOURCE_TYPE = "mapSource";
+
+ final String MAP_SOURCE_TYPE_DATABASE = "database";
+ final String MAP_SOURCE_TYPE_SHAPEFILE = "shapefile";
// -------------------------------------------------------------------------
// Map
@@ -324,12 +323,12 @@
int addMapView( MapView mapView );
int addMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
- String mapLayerPath, int method, int classes, String colorLow, String colorHigh );
+ String mapSourceType, String mapSource, int method, int classes, String colorLow, String colorHigh );
void updateMapView( MapView mapView );
void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
- String mapLayerPath, int method, int classes, String colorLow, String colorHigh );
+ String mapSourceType, String mapSource, int method, int classes, String colorLow, String colorHigh );
void deleteMapView( MapView view );
=== 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 11:45:16 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-07-13 20:00:15 +0000
@@ -36,6 +36,7 @@
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;
@@ -213,9 +214,9 @@
public Collection<Map> getAllUserMaps()
{
- String type = (String) userSettingService.getUserSetting( KEY_MAP_SOURCE, MAP_SOURCE_DATABASE );
+ String type = (String) userSettingService.getUserSetting( KEY_MAP_SOURCE_TYPE, MAP_SOURCE_TYPE_DATABASE );
- return type.equals( MAP_SOURCE_DATABASE ) ? getAllGeneratedMaps() : getAllMaps();
+ return type != null && type.equals( MAP_SOURCE_TYPE_DATABASE ) ? getAllGeneratedMaps() : getAllMaps();
}
// -------------------------------------------------------------------------
@@ -433,7 +434,7 @@
}
public int addMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
- String mapLayerPath, int method, int classes, String colorLow, String colorHigh )
+ String mapSourceType, String mapSource, int method, int classes, String colorLow, String colorHigh )
{
MapView mapView = new MapView();
@@ -445,14 +446,14 @@
.getClass() );
Period period = periodService.getPeriod( periodId );
-
- Map map = mappingStore.getMapByMapLayerPath( mapLayerPath );
-
+
+ mapView.setName( name );
mapView.setIndicatorGroup( indicatorGroup );
mapView.setIndicator( indicator );
mapView.setPeriodType( periodType );
mapView.setPeriod( period );
- mapView.setMap( map );
+ mapView.setMapSourceType( mapSourceType );
+ mapView.setMapSource( mapSource );
mapView.setMethod( method );
mapView.setClasses( classes );
mapView.setColorLow( colorLow );
@@ -466,8 +467,8 @@
mappingStore.updateMapView( mapView );
}
- public void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName,
- int periodId, String mapLayerPath, int method, int classes, String colorLow, String colorHigh )
+ public void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
+ String mapSourceType, String mapSource, int method, int classes, String colorLow, String colorHigh )
{
IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( indicatorGroupId );
@@ -478,17 +479,17 @@
Period period = periodService.getPeriod( periodId );
- Map map = mappingStore.getMapByMapLayerPath( mapLayerPath );
-
MapView mapView = mappingStore.getMapViewByName( name );
if ( mapView != null )
{
+ mapView.setName( name );
mapView.setIndicatorGroup( indicatorGroup );
mapView.setIndicator( indicator );
mapView.setPeriodType( periodType );
mapView.setPeriod( period );
- mapView.setMap( map );
+ mapView.setMapSourceType( mapSourceType );
+ mapView.setMapSource( mapSource );
mapView.setMethod( method );
mapView.setClasses( classes );
mapView.setColorLow( colorLow );
@@ -498,8 +499,7 @@
}
else
{
- mapView = new MapView( name, indicatorGroup, indicator, periodType, period, map, method, classes, colorLow,
- colorHigh );
+ mapView = new MapView( name, indicatorGroup, indicator, periodType, period, mapSourceType, mapSource, method, classes, colorLow, colorHigh );
addMapView( mapView );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java 2009-06-08 16:02:06 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java 2009-07-13 20:00:15 +0000
@@ -103,7 +103,7 @@
{
for ( MapView mapView : mappingService.getAllMapViews() )
{
- if ( mapView.getMap().equals( map ) )
+ if ( mapView.getMapSource().equals( map.getMapLayerPath() ) )
{
mappingService.deleteMapView( mapView );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2009-05-27 10:26:48 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2009-07-13 20:00:15 +0000
@@ -25,8 +25,9 @@
<many-to-one name="period" class="org.hisp.dhis.period.Period"
column="periodid" foreign-key="fk_mapview_periodid"/>
- <many-to-one name="map" class="org.hisp.dhis.mapping.Map"
- column="mapid" foreign-key="fk_mapview_mapid"/>
+ <property name="mapSourceType"/>
+
+ <property name="mapSource"/>
<property name="method"/>
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2009-07-06 21:49:26 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2009-07-13 20:00:15 +0000
@@ -69,7 +69,7 @@
private Map mapB;
private MapOrganisationUnitRelation mapOrganisationUnitRelationA;
- private MapOrganisationUnitRelation mapOrganisationUnitRelationB;
+ private MapOrganisationUnitRelation mapOrganisationUnitRelationB;
// -------------------------------------------------------------------------
// Fixture
@@ -198,7 +198,7 @@
{
mappingService.addMap( mapA );
- MapView mapView = new MapView( "MapViewA", indicatorGroup, indicator, periodType, period, mapA, 1, 1, "A", "B" );
+ MapView mapView = new MapView( "MapViewA", indicatorGroup, indicator, periodType, period, MapView.MAP_SOURCE_TYPE_SHAPEFILE, "sl_districts", 1, 1, "A", "B" );
int idA = mappingService.addMapView( mapView );
@@ -207,6 +207,5 @@
assertEquals( indicator, mappingService.getMapView( idA ).getIndicator() );
assertEquals( periodType, mappingService.getMapView( idA ).getPeriodType() );
assertEquals( period, mappingService.getMapView( idA ).getPeriod() );
- assertEquals( mapA, mappingService.getMapView( idA ).getMap() );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java 2009-07-13 20:00:15 +0000
@@ -147,17 +147,16 @@
@Test
public void testAddGetMapView()
{
- mappingStore.addMap( mapA );
-
- MapView mapView = new MapView( "MapViewA", indicatorGroup, indicator, periodType, period, mapA, 1, 1, "A", "B" );
-
- int idA = mappingStore.addMapView( mapView );
-
- assertEquals( mapView, mappingStore.getMapView( idA ) );
- assertEquals( indicatorGroup, mappingStore.getMapView( idA ).getIndicatorGroup() );
- assertEquals( indicator, mappingStore.getMapView( idA ).getIndicator() );
- assertEquals( periodType, mappingStore.getMapView( idA ).getPeriodType() );
- assertEquals( period, mappingStore.getMapView( idA ).getPeriod() );
- assertEquals( mapA, mappingStore.getMapView( idA ).getMap() );
+ mappingService.addMap( mapA );
+
+ MapView mapView = new MapView( "MapViewA", indicatorGroup, indicator, periodType, period, MapView.MAP_SOURCE_TYPE_SHAPEFILE, "sl_districts", 1, 1, "A", "B" );
+
+ int idA = mappingService.addMapView( mapView );
+
+ assertEquals( mapView, mappingService.getMapView( idA ) );
+ assertEquals( indicatorGroup, mappingService.getMapView( idA ).getIndicatorGroup() );
+ assertEquals( indicator, mappingService.getMapView( idA ).getIndicator() );
+ assertEquals( periodType, mappingService.getMapView( idA ).getPeriodType() );
+ assertEquals( period, mappingService.getMapView( idA ).getPeriod() );
}
}
=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java 2009-06-02 12:13:35 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java 2009-07-13 20:00:15 +0000
@@ -88,11 +88,18 @@
this.periodId = periodId;
}
- private String mapLayerPath;
-
- public void setMapLayerPath( String mapLayerPath )
- {
- this.mapLayerPath = mapLayerPath;
+ private String mapSourceType;
+
+ public void setMapSourceType( String mapSourceType )
+ {
+ this.mapSourceType = mapSourceType;
+ }
+
+ private String mapSource;
+
+ public void setMapSource( String mapSource )
+ {
+ this.mapSource = mapSource;
}
private int method;
@@ -130,7 +137,7 @@
public String execute()
throws Exception
{
- mappingService.addOrUpdateMapView( name, indicatorGroupId, indicatorId, periodTypeId, periodId, mapLayerPath,
+ mappingService.addOrUpdateMapView( name, indicatorGroupId, indicatorId, periodTypeId, periodId, mapSourceType, mapSource,
method, classes, colorLow, colorHigh );
return SUCCESS;
=== added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceTypeUserSettingAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceTypeUserSettingAction.java 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceTypeUserSettingAction.java 2009-07-13 20:00:15 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.mapping.action;
+
+import static org.hisp.dhis.mapping.MappingService.KEY_MAP_SOURCE_TYPE;
+import static org.hisp.dhis.mapping.MappingService.MAP_SOURCE_TYPE_DATABASE;
+
+import org.hisp.dhis.user.UserSettingService;
+
+import com.opensymphony.xwork.Action;
+
+public class GetMapSourceTypeUserSettingAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserSettingService userSettingService;
+
+ public void setUserSettingService( UserSettingService userSettingService )
+ {
+ this.userSettingService = userSettingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String object;
+
+ public String getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = (String) userSettingService.getUserSetting( KEY_MAP_SOURCE_TYPE, MAP_SOURCE_TYPE_DATABASE );
+
+ return SUCCESS;
+ }
+
+}
=== removed file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceUserSettingAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceUserSettingAction.java 2009-07-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSourceUserSettingAction.java 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-package org.hisp.dhis.mapping.action;
-
-import static org.hisp.dhis.mapping.MappingService.KEY_MAP_SOURCE;
-import static org.hisp.dhis.mapping.MappingService.MAP_SOURCE_DATABASE;
-
-import org.hisp.dhis.user.UserSettingService;
-
-import com.opensymphony.xwork.Action;
-
-public class GetMapSourceUserSettingAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserSettingService userSettingService;
-
- public void setUserSettingService( UserSettingService userSettingService )
- {
- this.userSettingService = userSettingService;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private String object;
-
- public String getObject()
- {
- return object;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- object = (String) userSettingService.getUserSetting( KEY_MAP_SOURCE, MAP_SOURCE_DATABASE );
-
- return SUCCESS;
- }
-
-}
=== added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceTypeUserSettingAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceTypeUserSettingAction.java 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceTypeUserSettingAction.java 2009-07-13 20:00:15 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.mapping.action;
+
+import static org.hisp.dhis.mapping.MappingService.KEY_MAP_SOURCE_TYPE;
+
+import org.hisp.dhis.user.UserSettingService;
+
+import com.opensymphony.xwork.Action;
+
+public class SetMapSourceTypeUserSettingAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserSettingService userSettingService;
+
+ public void setUserSettingService( UserSettingService userSettingService )
+ {
+ this.userSettingService = userSettingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String mapSourceType;
+
+ public void setMapSourceType( String mapSourceType )
+ {
+ this.mapSourceType = mapSourceType;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ userSettingService.saveUserSetting( KEY_MAP_SOURCE_TYPE, mapSourceType );
+
+ return SUCCESS;
+ }
+}
=== removed file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceUserSettingAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceUserSettingAction.java 2009-07-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSourceUserSettingAction.java 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-package org.hisp.dhis.mapping.action;
-
-import static org.hisp.dhis.mapping.MappingService.KEY_MAP_SOURCE;
-
-import org.hisp.dhis.user.UserSettingService;
-
-import com.opensymphony.xwork.Action;
-
-public class SetMapSourceUserSettingAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserSettingService userSettingService;
-
- public void setUserSettingService( UserSettingService userSettingService )
- {
- this.userSettingService = userSettingService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private String mapSource;
-
- public void setMapSource( String mapSource )
- {
- this.mapSource = mapSource;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- userSettingService.saveUserSetting( KEY_MAP_SOURCE, mapSource );
-
- return SUCCESS;
- }
-}
=== modified file 'gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-07-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-07-13 20:00:15 +0000
@@ -70,15 +70,15 @@
ref="org.hisp.dhis.datamart.DataMartStore"/>
</bean>
- <bean id="org.hisp.dhis.mapping.action.SetMapSourceUserSettingAction"
- class="org.hisp.dhis.mapping.action.SetMapSourceUserSettingAction"
+ <bean id="org.hisp.dhis.mapping.action.SetMapSourceTypeUserSettingAction"
+ class="org.hisp.dhis.mapping.action.SetMapSourceTypeUserSettingAction"
scope="prototype">
<property name="userSettingService"
ref="org.hisp.dhis.user.UserSettingService"/>
</bean>
- <bean id="org.hisp.dhis.mapping.action.GetMapSourceUserSettingAction"
- class="org.hisp.dhis.mapping.action.GetMapSourceUserSettingAction"
+ <bean id="org.hisp.dhis.mapping.action.GetMapSourceTypeUserSettingAction"
+ class="org.hisp.dhis.mapping.action.GetMapSourceTypeUserSettingAction"
scope="prototype">
<property name="userSettingService"
ref="org.hisp.dhis.user.UserSettingService"/>
=== modified file 'gis/dhis-web-mapping/src/main/resources/xwork.xml'
--- gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-07-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-07-13 20:00:15 +0000
@@ -49,11 +49,11 @@
<result name="success" type="velocity-json">/dhis-web-mapping/jsonAggregatedMapValues.vm</result>
</action>
- <action name="setMapSourceUserSetting" class="org.hisp.dhis.mapping.action.SetMapSourceUserSettingAction">
+ <action name="setMapSourceTypeUserSetting" class="org.hisp.dhis.mapping.action.SetMapSourceTypeUserSettingAction">
<result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
</action>
- <action name="getMapSourceUserSetting" class="org.hisp.dhis.mapping.action.GetMapSourceUserSettingAction">
+ <action name="getMapSourceTypeUserSetting" class="org.hisp.dhis.mapping.action.GetMapSourceTypeUserSettingAction">
<result name="success" type="velocity-json">/dhis-web-mapping/jsonUserSetting.vm</result>
</action>
=== modified file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm 2009-06-25 11:18:23 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm 2009-07-13 20:00:15 +0000
@@ -6,7 +6,8 @@
"indicatorId": $!{object.indicator.id},
"periodTypeId": "$!encoder.jsEncode( ${object.periodType.name} )",
"periodId": $!{object.period.id},
- "mapLayerPath": "$!encoder.jsEncode( ${object.map.mapLayerPath} )",
+ "mapSourceType": "$!encoder.jsEncode( ${object.mapSourceType} )",
+ "mapSource": "$!encoder.jsEncode( ${object.mapSource} )",
"method": $!{object.method},
"classes": $!{object.classes},
"colorLow": "$!encoder.jsEncode( ${object.colorLow} )",
=== modified file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm 2009-06-25 11:18:23 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm 2009-07-13 20:00:15 +0000
@@ -8,7 +8,8 @@
"indicatorId": $!{mapView.indicator.id},
"periodTypeId": $!{mapView.periodType.id},
"periodId": $!{mapView.period.id},
- "mapLayerPath": "$!encoder.jsEncode( ${mapView.map.mapLayerPath} )",
+ "mapSourceType": "$!encoder.jsEncode( ${object.mapSourceType} )",
+ "mapSource": "$!encoder.jsEncode( ${object.mapSource} )",
"method": $!{mapView.method},
"classes": $!{mapView.classes},
"colorLow": "$!encoder.jsEncode( ${mapView.colorLow} )",
=== modified file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapViews.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapViews.vm 2009-06-25 11:18:23 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapViews.vm 2009-07-13 20:00:15 +0000
@@ -3,7 +3,9 @@
#foreach( $mapView in $object )
{
"id": $!{mapView.id},
- "name": "$!encoder.jsEncode( ${mapView.name} )"
+ "name": "$!encoder.jsEncode( ${mapView.name} )",
+ "mapSourceType": "$!encoder.jsEncode( ${object.mapSourceType} )",
+ "mapSource": "$!encoder.jsEncode( ${object.mapSource} )",
}#if( $velocityCount < $size ),#end
#end
] }
\ No newline at end of file
=== 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-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js 2009-07-13 20:00:15 +0000
@@ -58,12 +58,12 @@
PARAMETER = null;
BOUNDS = 0;
STATIC1LOADED = false;
- MAP_SOURCE_DATABASE = 'database';
- MAP_SOURCE_SHAPEFILE = 'shapefile';
+ MAP_SOURCE_TYPE_DATABASE = 'database';
+ MAP_SOURCE_TYPE_SHAPEFILE = 'shapefile';
Ext.Ajax.request(
{
- url: path + 'getMapSourceUserSetting' + type,
+ url: path + 'getMapSourceTypeUserSetting' + type,
method: 'GET',
success: function( responseObject )
@@ -1081,17 +1081,19 @@
text: 'Register new view',
handler: function()
{
+alert(1);
var vn = Ext.getCmp('viewname_tf').getValue();
var ig = Ext.getCmp('indicatorgroup_cb').getValue();
var i = Ext.getCmp('indicator_cb').getValue();
var pt = Ext.getCmp('periodtype_cb').getValue();
var p = Ext.getCmp('period_cb').getValue();
- var m = Ext.getCmp('map_cb').getValue();
+ var mst = MAPSOURCE;
+ var ms = Ext.getCmp('map_cb').getValue();
var c = Ext.getCmp('numClasses').getValue();
var ca = Ext.getCmp('colorA_cf').getValue();
var cb = Ext.getCmp('colorB_cf').getValue();
- if (!vn || !ig || !i || !pt || !p || !m || !c )
+ if (!vn || !ig || !i || !pt || !p || !mst || !ms || !c )
{
Ext.messageRed.msg('New map view', 'Thematic map form is not complete.');
return;
@@ -1107,11 +1109,11 @@
{
url: path + 'addOrUpdateMapView' + type,
method: 'POST',
- params: { name: vn, indicatorGroupId: ig, indicatorId: i, periodTypeId: pt, periodId: p, mapLayerPath: m, method: 2, classes: c, colorLow: ca, colorHigh: cb },
+ params: { name: vn, indicatorGroupId: ig, indicatorId: i, periodTypeId: pt, periodId: p, mapSourceType: mst, mapSource: ms, method: 2, classes: c, colorLow: ca, colorHigh: cb },
success: function( responseObject )
{
- Ext.messageRed.msg('New map view', 'The view ' + vn + ' was registered.');
+ Ext.messageBlack.msg('New map view', 'The view ' + vn + ' was registered.');
Ext.getCmp('view_cb').getStore().reload();
Ext.getCmp('mapview_cb').getStore().reload();
@@ -1364,9 +1366,9 @@
Ext.Ajax.request(
{
- url: path + 'setMapSourceUserSetting' + type,
+ url: path + 'setMapSourceTypeUserSetting' + type,
method: 'POST',
- params: { mapSource: msv },
+ params: { mapSourceType: msv },
success: function( responseObject )
{
@@ -1633,11 +1635,12 @@
var south_panel = Ext.getCmp('south-panel');
var height = 230;
+ var collapsed = 48;
var padding_x = 15;
var padding_y = 22;
var x = center_panel.x + padding_x;
- var y = south_panel.y - height - padding_y;
+ var y = south_panel.y + collapsed - height - padding_y;
popup_feature = new Ext.Window({
title: 'Organisation unit',
=== 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-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-07-13 20:00:15 +0000
@@ -165,6 +165,8 @@
MAPVIEWACTIVE = true;
MAPVIEW = Ext.util.JSON.decode(responseObject.responseText).mapView[0];
+ MAPSOURCE = MAPVIEW.mapSourceType;
+
Ext.getCmp('mapview_cb').setValue(MAPVIEW.id);
Ext.getCmp('numClasses').setValue(MAPVIEW.classes);
@@ -173,7 +175,7 @@
Ext.getCmp('indicatorgroup_cb').setValue(MAPVIEW.indicatorGroupId);
- var igId = Ext.getCmp('indicatorgroup_cb').getValue();
+ var igId = MAPVIEW.indicatorGroupId;
indicatorStore.baseParams = { indicatorGroupId: igId, format: 'json' };
indicatorStore.reload();
},
@@ -250,10 +252,29 @@
fn: function() {
if (MAPVIEWACTIVE) {
Ext.getCmp('period_cb').setValue(MAPVIEW.periodId);
- Ext.getCmp('map_cb').setValue(MAPVIEW.mapLayerPath);
- MAPVIEWACTIVE = false;
-
- this.newUrl = MAPVIEW.mapLayerPath;
+
+ var mst = MAPVIEW.mapSourceType;
+
+ Ext.Ajax.request(
+ {
+ url: path + 'setMapSourceTypeUserSetting' + type,
+ method: 'POST',
+ params: { mapSourceType: mst },
+
+ success: function( responseObject )
+ {
+ Ext.getCmp('map_cb').getStore().reload();
+ Ext.getCmp('maps_cb').getStore().reload();
+
+ Ext.getCmp('mapsource_cb').setValue(MAPSOURCE);
+ },
+ failure: function()
+ {
+ alert( 'Error: setMapSourceTypeUserSetting' );
+ }
+ });
+
+ this.newUrl = MAPVIEW.mapSource;
choropleth.classify(false);
}
},
@@ -268,7 +289,18 @@
root: 'maps',
fields: ['id', 'name', 'mapLayerPath', 'organisationUnitLevel'],
sortInfo: { field: 'organisationUnitLevel', direction: 'ASC' },
- autoLoad: true
+ autoLoad: true,
+ listeners: {
+ 'load': {
+ fn: function() {
+ if (MAPVIEWACTIVE) {
+ Ext.getCmp('map_cb').setValue(MAPVIEW.mapSource);
+ MAPVIEWACTIVE = false;
+ choropleth.classify(false);
+ }
+ }
+ }
+ }
});
legendStore = new Ext.data.JsonStore({
@@ -313,6 +345,8 @@
MAPVIEWACTIVE = true;
MAPVIEW = Ext.util.JSON.decode(responseObject.responseText).mapView[0];
+ MAPSOURCE = MAPVIEW.mapSourceType;
+
Ext.getCmp('numClasses').setValue(MAPVIEW.classes);
Ext.getCmp('colorA_cf').setValue(MAPVIEW.colorLow);
Ext.getCmp('colorB_cf').setValue(MAPVIEW.colorHigh);
@@ -510,8 +544,7 @@
Ext.getCmp('mapview_cb').reset();
}
- var mlp = Ext.getCmp('map_cb').getValue();
- this.newUrl = mlp;
+ this.newUrl = Ext.getCmp('map_cb').getValue();
this.classify(false);
},
scope: this
@@ -754,7 +787,7 @@
URL = this.newUrl;
this.newUrl = false;
- if (MAPSOURCE == MAP_SOURCE_DATABASE)
+ if (MAPSOURCE == MAP_SOURCE_TYPE_DATABASE)
{
if (URL == 4) {
this.setUrl(path + 'getPointShapefile.action?level=' + URL);
--
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.