=== 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 2011-05-20 15:23:50 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2011-12-01 16:08:37 +0000 @@ -46,7 +46,7 @@ private int id; private String name; - + private User user; private String mapValueType; @@ -65,10 +65,6 @@ private Period period; - private String startDate; - - private String endDate; - private OrganisationUnit parentOrganisationUnit; private OrganisationUnitLevel organisationUnitLevel; @@ -101,12 +97,11 @@ { } - public MapView( String name, User user, String mapValueType, IndicatorGroup indicatorGroup, - Indicator indicator, DataElementGroup dataElementGroup, DataElement dataElement, String mapDateType, - PeriodType periodType, Period period, String startDate, String endDate, - OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel, String mapLegendType, - Integer method, Integer classes, String bounds, String colorLow, String colorHigh, MapLegendSet mapLegendSet, - Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ) + public MapView( String name, User user, String mapValueType, IndicatorGroup indicatorGroup, Indicator indicator, + DataElementGroup dataElementGroup, DataElement dataElement, String mapDateType, PeriodType periodType, + Period period, OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel, + String mapLegendType, Integer method, Integer classes, String bounds, String colorLow, String colorHigh, + MapLegendSet mapLegendSet, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ) { this.name = name; this.user = user; @@ -118,8 +113,6 @@ this.mapDateType = mapDateType; this.periodType = periodType; this.period = period; - this.startDate = startDate; - this.endDate = endDate; this.parentOrganisationUnit = parentOrganisationUnit; this.organisationUnitLevel = organisationUnitLevel; this.mapLegendType = mapLegendType; @@ -292,26 +285,6 @@ this.period = period; } - public String getStartDate() - { - return startDate; - } - - public void setStartDate( String startDate ) - { - this.startDate = startDate; - } - - public String getEndDate() - { - return endDate; - } - - public void setEndDate( String endDate ) - { - this.endDate = endDate; - } - public OrganisationUnit getParentOrganisationUnit() { return parentOrganisationUnit; === 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 2011-12-01 15:43:25 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-12-01 16:08:37 +0000 @@ -72,13 +72,15 @@ // IndicatorMapValue // ------------------------------------------------------------------------- - Collection getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, Integer level ); + Collection getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, + Integer level ); // ------------------------------------------------------------------------- // DataMapValue // ------------------------------------------------------------------------- - Collection getDataElementMapValues( int dataElementId, int periodId, int parentOrganisationUnitId, Integer level ); + Collection getDataElementMapValues( int dataElementId, int periodId, + int parentOrganisationUnitId, Integer level ); Collection getInfrastructuralDataElementMapValues( Integer periodId, Integer organisationUnitId ); @@ -129,10 +131,10 @@ int addMapView( MapView mapView ); void addMapView( String name, boolean system, String mapValueType, Integer indicatorGroupId, Integer indicatorId, - Integer dataElementGroupId, Integer dataElementId, String periodTypeName, Integer periodId, String startDate, - String endDate, Integer parentOrganisationUnitId, Integer organisationUnitLevel, String mapLegendType, - Integer method, Integer classes, String bounds, String colorLow, String colorHigh, Integer mapLegendSetId, - Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ); + Integer dataElementGroupId, Integer dataElementId, String periodTypeName, Integer periodId, + Integer parentOrganisationUnitId, Integer organisationUnitLevel, String mapLegendType, Integer method, + Integer classes, String bounds, String colorLow, String colorHigh, Integer mapLegendSetId, Integer radiusLow, + Integer radiusHigh, String longitude, String latitude, int zoom ); void updateMapView( MapView mapView ); === 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 2011-12-01 15:43:25 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-12-01 16:08:37 +0000 @@ -178,19 +178,18 @@ * * @param indicatorId the Indicator identifier. * @param period the Period identifier. Ignored if null. - * @param startDate the start date. Ignored if null. - * @param endDate the end date. Ignored if null. * @param parentOrganisationUnitId the parent OrganisationUnit identifier. * Ignored if null. * @param level the OrganisationUnit level. Ignored if null. * @return a collection of AggregatedMapValues. */ - public Collection getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, Integer level ) + public Collection getIndicatorMapValues( int indicatorId, int periodId, + int parentOrganisationUnitId, Integer level ) { Collection units = getOrganisationUnits( parentOrganisationUnitId, level ); - Collection values = aggregatedDataValueService. - getAggregatedIndicatorMapValues( indicatorId, periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) ); + Collection values = aggregatedDataValueService.getAggregatedIndicatorMapValues( + indicatorId, periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) ); for ( AggregatedMapValue value : values ) { @@ -224,10 +223,10 @@ int parentOrganisationUnitId, Integer level ) { Collection units = getOrganisationUnits( parentOrganisationUnitId, level ); - - Collection values = aggregatedDataValueService. - getAggregatedDataMapValues( dataElementId, periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) ); - + + Collection values = aggregatedDataValueService.getAggregatedDataMapValues( dataElementId, + periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) ); + for ( AggregatedMapValue value : values ) { value.setValue( MathUtils.getRounded( value.getValue(), 2 ) ); @@ -444,10 +443,9 @@ public void addMapView( String name, boolean system, String mapValueType, Integer indicatorGroupId, Integer indicatorId, Integer dataElementGroupId, Integer dataElementId, String periodTypeName, - Integer periodId, String startDate, String endDate, Integer parentOrganisationUnitId, - Integer organisationUnitLevel, String mapLegendType, Integer method, Integer classes, String bounds, - String colorLow, String colorHigh, Integer mapLegendSetId, Integer radiusLow, Integer radiusHigh, - String longitude, String latitude, int zoom ) + Integer periodId, Integer parentOrganisationUnitId, Integer organisationUnitLevel, String mapLegendType, + Integer method, Integer classes, String bounds, String colorLow, String colorHigh, Integer mapLegendSetId, + Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ) { User user = system ? null : currentUserService.getCurrentUser(); @@ -484,7 +482,7 @@ MapLegendSet mapLegendSet = mapLegendSetId != null ? getMapLegendSet( mapLegendSetId ) : null; addMapView( new MapView( name, user, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement, - mapDateType, periodType, period, startDate, endDate, parent, level, mapLegendType, method, classes, bounds, + mapDateType, periodType, period, parent, level, mapLegendType, method, classes, bounds, colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ) ); } === 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 2011-05-29 11:10:20 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2011-12-01 16:08:37 +0000 @@ -35,10 +35,6 @@ - - - - === 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 2011-10-23 09:25:05 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-12-01 16:08:37 +0000 @@ -140,8 +140,8 @@ { MapLegend legend = createMapLegend( 'A', 0.1, 0.2 ); - mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(), legend - .getColor(), legend.getImage() ); + mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(), + legend.getColor(), legend.getImage() ); legend = mappingService.getMapLegendByName( legend.getName() ); @@ -163,8 +163,8 @@ { MapLegend legend = createMapLegend( 'A', 0.1, 0.2 ); - mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(), legend - .getColor(), legend.getImage() ); + mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(), + legend.getColor(), legend.getImage() ); legend = mappingService.getMapLegendByName( legend.getName() ); @@ -184,10 +184,10 @@ MapLegend legend2 = createMapLegend( 'B', 0.3, 0.4 ); MapLegend legend3 = createMapLegend( 'C', 0.5, 0.6 ); - mappingService.addOrUpdateMapLegend( legend1.getName(), legend1.getStartValue(), legend1.getEndValue(), legend1 - .getColor(), legend1.getImage() ); - mappingService.addOrUpdateMapLegend( legend3.getName(), legend3.getStartValue(), legend3.getEndValue(), legend3 - .getColor(), legend3.getImage() ); + mappingService.addOrUpdateMapLegend( legend1.getName(), legend1.getStartValue(), legend1.getEndValue(), + legend1.getColor(), legend1.getImage() ); + mappingService.addOrUpdateMapLegend( legend3.getName(), legend3.getStartValue(), legend3.getEndValue(), + legend3.getColor(), legend3.getImage() ); legend1 = mappingService.getMapLegendByName( legend1.getName() ); legend3 = mappingService.getMapLegendByName( legend3.getName() ); @@ -250,11 +250,11 @@ int idB = mappingService.addMapLegendSet( legendSet2 ); int idC = mappingService.addMapLegendSet( legendSet3 ); - List autoTypes = new ArrayList( mappingService - .getMapLegendSetsByType( MappingService.MAPLEGENDSET_TYPE_AUTOMATIC ) ); + List autoTypes = new ArrayList( + mappingService.getMapLegendSetsByType( MappingService.MAPLEGENDSET_TYPE_AUTOMATIC ) ); - List predefinedTypes = new ArrayList( mappingService - .getMapLegendSetsByType( MappingService.MAPLEGENDSET_TYPE_PREDEFINED ) ); + List predefinedTypes = new ArrayList( + mappingService.getMapLegendSetsByType( MappingService.MAPLEGENDSET_TYPE_PREDEFINED ) ); assertTrue( autoTypes.contains( mappingService.getMapLegendSet( idA ) ) ); assertTrue( !autoTypes.contains( mappingService.getMapLegendSet( idB ) ) ); @@ -285,8 +285,8 @@ mappingService.updateMapLegendSet( legendSet1 ); mappingService.updateMapLegendSet( legendSet2 ); - assertEquals( "2", mappingService.getMapLegendSet( idB ), mappingService - .getMapLegendSetByDataElement( dataElement.getId() ) ); + assertEquals( "2", mappingService.getMapLegendSet( idB ), + mappingService.getMapLegendSetByDataElement( dataElement.getId() ) ); } @@ -334,7 +334,7 @@ public void testAddGetMapView() { MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); @@ -351,7 +351,7 @@ public void testGetDeleteMapViewByName() { MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); @@ -368,14 +368,14 @@ public void testGetAllMapViews() { MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, "", - "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", - "B", mapLegendSet, 5, 20, "2", "2", 1 ); + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, + organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", + mapLegendSet, 5, 20, "2", "2", 1 ); mappingService.addMapView( mapView1 ); mappingService.addMapView( mapView2 ); @@ -389,19 +389,19 @@ public void testGetMapViewsByFeatureType() { MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, "", - "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", - "B", mapLegendSet, 5, 20, "2", "2", 1 ); + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, + organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", + mapLegendSet, 5, 20, "2", "2", 1 ); MapView mapView3 = new MapView( "MapViewC", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, - indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, "", - "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", - "B", mapLegendSet, 5, 20, "3", "3", 1 ); + indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, + organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", + mapLegendSet, 5, 20, "3", "3", 1 ); mappingService.addMapView( mapView1 ); mappingService.addMapView( mapView2 ); === 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 2011-05-20 15:38:01 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java 2011-12-01 16:08:37 +0000 @@ -118,8 +118,8 @@ { MapView mapView = new MapView( "MapViewA", new User(), MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, new DataElementGroup(), new DataElement(), MappingService.MAP_DATE_TYPE_FIXED, periodType, - period, "", "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, - "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 ); + period, organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", + "B", mapLegendSet, 5, 20, "1", "1", 1 ); int idA = mappingStore.addMapView( mapView ); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java 2011-05-20 15:23:50 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java 2011-12-01 15:49:20 +0000 @@ -116,20 +116,6 @@ this.periodId = periodId; } - private String startDate; - - public void setStartDate( String startDate ) - { - this.startDate = startDate; - } - - private String endDate; - - public void setEndDate( String endDate ) - { - this.endDate = endDate; - } - private Integer parentOrganisationUnitId; public void setParentOrganisationUnitId( Integer parentOrganisationUnitId ) @@ -236,7 +222,7 @@ throws Exception { mappingService.addMapView( name, system, mapValueType, indicatorGroupId, indicatorId, - dataElementGroupId, dataElementId, periodTypeId, periodId, startDate, endDate, parentOrganisationUnitId, + dataElementGroupId, dataElementId, periodTypeId, periodId, parentOrganisationUnitId, organisationUnitLevel, mapLegendType, method, classes, bounds, colorLow, colorHigh, mapLegendSetId, radiusLow, radiusHigh, longitude, latitude, zoom ); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm 2011-11-12 12:54:31 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm 2011-12-01 15:49:20 +0000 @@ -1,1 +1,1 @@ -#set($size=$object.size()){"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":#if($!{unit.featureType}=="Point")"Point"#else "MultiPolygon"#end,"coordinates":$!encoder.jsonEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})"#if($!{unit.featureType}!="Point"),"hasChildrenWithCoordinates":$!{unit.hasChildrenWithCoordinates()}#end#if($!{unit.featureType}=="Point"),"type":"$!encoder.jsonEncode(${unit.type})","code":"$!encoder.jsonEncode(${unit.code})","cp":"$!encoder.jsonEncode(${unit.contactPerson})","ad":"$!encoder.jsonEncode(${unit.address})","em":"$!encoder.jsonEncode(${unit.email})","pn":"$!encoder.jsonEncode(${unit.phoneNumber})"#end}}#if($velocityCount<$size),#end#end],"crs":{"type":"EPSG","properties":{"code":"4326"}}} \ No newline at end of file +#set($size=$object.size()){"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":#if($!{unit.featureType}=="Point")"Point"#else "MultiPolygon"#end,"coordinates":$!encoder.jsonEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})"#if($!{unit.featureType}!="Point"),"hcwc":$!{unit.hasChildrenWithCoordinates()}#end#if($!{unit.featureType}=="Point"),"type":"$!encoder.jsonEncode(${unit.type})","code":"$!encoder.jsonEncode(${unit.code})","cp":"$!encoder.jsonEncode(${unit.contactPerson})","ad":"$!encoder.jsonEncode(${unit.address})","em":"$!encoder.jsonEncode(${unit.email})","pn":"$!encoder.jsonEncode(${unit.phoneNumber})"#end}}#if($velocityCount<$size),#end#end],"crs":{"type":"EPSG","properties":{"code":"4326"}}} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2011-08-20 10:16:56 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2011-12-01 15:49:20 +0000 @@ -13,8 +13,6 @@ "mapDateType": "$!encoder.jsonEncode( ${mapView.mapDateTypeNullSafe} )", "periodTypeId": "$!encoder.jsonEncode( ${mapView.periodType.name} )", "periodId": "$!{mapView.period.id}", - "startDate": "$!encoder.jsonEncode( ${mapView.startDate} )", - "endDate": "$!encoder.jsonEncode( ${mapView.endDate} )", "parentOrganisationUnitId": "$!{mapView.parentOrganisationUnit.id}", "parentOrganisationUnitName": "$!encoder.jsonEncode( ${mapView.parentOrganisationUnit.name} )", "parentOrganisationUnitLevel": "$!{mapView.parentOrganisationUnit.level}", @@ -37,7 +35,6 @@ "mapDateType": "$!encoder.jsonEncode( ${mapDateType} )" }, "systemSettings": { - "aggregationStrategy": "$!encoder.jsonEncode( ${aggregationStrategy} )", "infrastructuralDataElements": "$!{infrastructuralDataElements.id}", "infrastructuralPeriodType": "$!{infrastructuralPeriodType.name}" }, === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm 2011-01-26 00:07:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm 2011-12-01 15:49:20 +0000 @@ -12,8 +12,6 @@ "mapDateType": "$!encoder.jsonEncode( ${object.mapDateTypeNullSafe} )", "periodTypeId": "$!encoder.jsonEncode( ${object.periodType.name} )", "periodId": "$!{object.period.id}", - "startDate": "$!encoder.jsonEncode( ${object.startDate} )", - "endDate": "$!encoder.jsonEncode( ${object.endDate} )", "parentOrganisationUnitId": "$!{object.parentOrganisationUnit.id}", "parentOrganisationUnitName": "$!encoder.jsonEncode( ${object.parentOrganisationUnit.name} )", "parentOrganisationUnitLevel": "$!{object.parentOrganisationUnit.level}", === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm 2011-01-26 00:07:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm 2011-12-01 15:49:20 +0000 @@ -14,8 +14,6 @@ "mapDateType": "$!encoder.jsonEncode( ${mapView.mapDateTypeNullSafe} )", "periodTypeId": "$!encoder.jsonEncode( ${mapView.periodType.name} )", "periodId": "$!{mapView.period.id}", - "startDate": "$!encoder.jsonEncode( ${mapView.startDate} )", - "endDate": "$!encoder.jsonEncode( ${mapView.endDate} )", "parentOrganisationUnitId": "$!{mapView.parentOrganisationUnit.id}", "parentOrganisationUnitName": "$!encoder.jsonEncode( ${mapView.parentOrganisationUnit.name} )", "parentOrganisationUnitLevel": "$!{mapView.parentOrganisationUnit.level}", === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm 2011-06-08 15:22:35 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm 2011-12-01 15:49:20 +0000 @@ -1,1 +1,1 @@ -#set( $size = $object.size() ){"mapValues":[#foreach( $value in $object ){"orgUnitId":"$!{value.organisationUnitId}","orgUnitName":"$!{value.organisationUnitName}","value":"$!{value.value}"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file +#set( $size = $object.size() ){"mapValues":[#foreach( $value in $object ){"oi":"$!{value.organisationUnitId}","v":"$!{value.value}"}#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/javascript/global.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-11-29 13:44:05 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-12-01 15:49:20 +0000 @@ -643,8 +643,6 @@ this.legend.classes = this.mapView.classes || this.legend.classes; G.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom); - G.system.mapDateType.value = this.mapView.mapDateType; - Ext.getCmp('mapdatetype_cb').setValue(G.system.mapDateType.value); this.valueType.value = this.mapView.mapValueType; this.cmp.mapValueType.setValue(this.valueType.value); @@ -716,25 +714,7 @@ isAdmin: false }; -G.system = { - aggregationStrategy: null, - - mapDateType: { - value: null, - setFixed: function() { - this.value = G.conf.map_date_type_fixed; - }, - setStartEnd: function() { - this.value = G.conf.map_date_type_start_end; - }, - isFixed: function() { - return this.value === G.conf.map_date_type_fixed; - }, - isStartEnd: function() { - return this.value === G.conf.map_date_type_start_end; - } - }, - +G.system = { infrastructuralPeriodType: null, rootNode: null @@ -1153,7 +1133,7 @@ c2 + mapView.parentOrganisationUnitName + spanEnd + c1 + '( ' + mapView.organisationUnitLevelName + ' )' + spanEnd + c2 + (mapView.mapValueType == G.conf.map_value_type_indicator ? mapView.indicatorName : mapView.dataElementName) + spanEnd + - c1 + (mapView.mapDateType == G.conf.map_date_type_fixed ? mapView.periodName : (mapView.startDate + ' - ' + mapView.endDate)) + spanEnd + + c1 + mapView.periodName + spanEnd + spanEnd; for (var i = 0; i < this.menu.items.items.length; i++) { === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-11-22 14:14:29 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-12-01 15:49:20 +0000 @@ -23,21 +23,19 @@ G.user.initBaseLayers = init.baseLayers; G.user.initOverlays = init.overlays; G.user.isAdmin = init.security.isAdmin; - G.system.aggregationStrategy = init.systemSettings.aggregationStrategy; G.system.infrastructuralDataElements = init.systemSettings.infrastructuralDataElements; G.system.infrastructuralPeriodType = init.systemSettings.infrastructuralPeriodType; - G.system.mapDateType.value = G.system.aggregationStrategy == G.conf.aggregation_strategy_batch ? - G.conf.map_date_type_fixed : init.userSettings.mapDateType; G.system.rootNode = init.rootNode; /* Section: stores */ var mapViewStore = new Ext.data.JsonStore({ url: G.conf.path_mapping + 'getAllMapViews' + G.conf.type, root: 'mapViews', - fields: [ 'id', 'name', 'userId', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId', - 'mapDateType', 'periodTypeId', 'periodId', 'startDate', 'endDate', 'parentOrganisationUnitId', 'parentOrganisationUnitName', - 'parentOrganisationUnitLevel', 'organisationUnitLevel', 'organisationUnitLevelName', 'mapLegendType', 'method', 'classes', - 'bounds', 'colorLow', 'colorHigh', 'mapLegendSetId', 'radiusLow', 'radiusHigh', 'longitude', 'latitude', 'zoom' + fields: [ + 'id', 'name', 'userId', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId', + 'periodTypeId', 'periodId', 'parentOrganisationUnitId', 'parentOrganisationUnitName', 'parentOrganisationUnitLevel', + 'organisationUnitLevel', 'organisationUnitLevelName', 'mapLegendType', 'method', 'classes', 'bounds', 'colorLow', 'colorHigh', + 'mapLegendSetId', 'radiusLow', 'radiusHigh', 'longitude', 'latitude', 'zoom' ], autoLoad: false, isLoaded: false, @@ -1963,87 +1961,6 @@ ] }); - /* Section: administrator settings */ - var adminWindow = new Ext.Window({ - id: 'admin_w', - title: 'Administrator settings', - layout: 'accordion', - closeAction: 'hide', - width: G.conf.window_width, - height: G.conf.adminwindow_expanded_1, - minHeight: G.conf.adminwindow_collapsed, - items: [ - { - title: 'Date', - items: [ - { - xtype: 'form', - bodyStyle: 'padding:8px', - labelWidth: G.conf.label_width, - items: [ - {html: '
Set thematic map date type
'}, - { - xtype: 'combo', - id: 'mapdatetype_cb', - fieldLabel: G.i18n.date_type, - labelSeparator: G.conf.labelseparator, - disabled: G.system.aggregationStrategy === G.conf.aggregation_strategy_batch, - disabledClass: 'combo-disabled', - editable: false, - valueField: 'value', - displayField: 'text', - mode: 'local', - value: G.conf.map_date_type_fixed, - triggerAction: 'all', - width: G.conf.combo_width_fieldset, - minListWidth: G.conf.combo_width_fieldset, - store: { - xtype: 'arraystore', - fields: ['value', 'text'], - data: [ - [G.conf.map_date_type_fixed, G.i18n.fixed_periods], - [G.conf.map_date_type_start_end, G.i18n.start_end_dates] - ] - }, - listeners: { - 'select': function(cb) { - if (cb.getValue() !== G.system.mapDateType.value) { - G.system.mapDateType.value = cb.getValue(); - Ext.Ajax.request({ - url: G.conf.path_mapping + 'setMapUserSettings' + G.conf.type, - method: 'POST', - params: {mapDateType: G.system.mapDateType.value}, - success: function() { - Ext.message.msg(true, '' + cb.getRawValue() + ' '+ G.i18n.saved_as_date_type); - choropleth.prepareMapViewDateType(); - point.prepareMapViewDateType(); - } - }); - } - } - } - } - ] - } - ], - listeners: { - expand: function() { - adminWindow.setHeight(G.conf.adminwindow_expanded_1); - }, - collapse: function() { - adminWindow.setHeight(G.conf.adminwindow_collapsed); - } - } - } - ], - listeners: { - afterrender: function() { - adminWindow.setHeight(G.conf.adminwindow_expanded_1); - } - } - }); - adminWindow.setPagePosition(G.conf.window_x_left,G.conf.window_y_left); - var layerTree = new Ext.tree.TreePanel({ id: 'layertree_tp', title: '' + G.i18n.map_layers + '', @@ -2775,22 +2692,7 @@ control.window.hide(); } } - }); - - var adminButton = new Ext.Button({ - iconCls: 'icon-admin', - tooltip: 'Administrator settings', - disabled: !G.user.isAdmin, - style: 'margin-top:1px', - handler: function() { - if (!adminWindow.hidden) { - adminWindow.hide(); - } - else { - adminWindow.show(this.id); - } - } - }); + }); var helpButton = new Ext.Button({ iconCls: 'icon-help', @@ -2845,7 +2747,6 @@ measureDistanceButton, ' ', '-', - adminButton, helpButton, '->', exitButton,' ' @@ -2941,19 +2842,17 @@ G.vars.map.layers[i].svgId = svg[j++].id; } } - - Ext.getCmp('mapdatetype_cb').setValue(G.system.mapDateType.value); choropleth.prepareMapViewValueType(); - choropleth.prepareMapViewDateType(); + choropleth.prepareMapViewPeriod(); choropleth.prepareMapViewLegend(); point.prepareMapViewValueType(); - point.prepareMapViewDateType(); + point.prepareMapViewPeriod(); point.prepareMapViewLegend(); centroid.prepareMapViewValueType(); - centroid.prepareMapViewDateType(); + centroid.prepareMapViewPeriod(); G.vars.map.events.register('addlayer', null, function(e) { var svg = document.getElementsByTagName('svg'); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js 2011-10-10 15:08:48 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js 2011-12-01 15:49:20 +0000 @@ -588,40 +588,6 @@ } }); - this.cmp.startDate = new Ext.form.DateField({ - fieldLabel: G.i18n.start_date, - format: 'Y-m-d', - hidden: true, - width: G.conf.combo_width, - listeners: { - 'select': { - scope: this, - fn: function(df, date) { - this.updateValues = true; - this.cmp.endDate.setMinValue(date); - this.classify(false, true); - } - } - } - }); - - this.cmp.endDate = new Ext.form.DateField({ - fieldLabel: G.i18n.end_date, - format: 'Y-m-d', - hidden: true, - width: G.conf.combo_width, - listeners: { - 'select': { - scope: this, - fn: function(df, date) { - this.updateValues = true; - this.cmp.startDate.setMaxValue(date); - this.classify(false, true); - } - } - } - }); - this.cmp.mapLegendSet = new Ext.form.ComboBox({ editable: false, valueField: 'id', @@ -724,8 +690,6 @@ this.cmp.dataElement, this.cmp.periodType, this.cmp.period, - this.cmp.startDate, - this.cmp.endDate, { html: '
' }, { html: '
Legend options
' }, this.cmp.mapLegendSet @@ -830,40 +794,22 @@ return obj; }, - prepareMapViewDateType: function() { + prepareMapViewPeriod: function() { var obj = {}; - if (G.system.mapDateType.isFixed()) { - this.cmp.periodType.show(); - this.cmp.period.show(); - this.cmp.startDate.hide(); - this.cmp.endDate.hide(); - obj.components = { - c1: this.cmp.periodType, - c2: this.cmp.period - }; - obj.stores = { - c1: G.stores.periodType, - c2: this.stores.periodsByType - }; - obj.mapView = { - c1: 'periodTypeId', - c2: 'periodId' - }; - } - else if (G.system.mapDateType.isStartEnd()) { - this.cmp.periodType.hide(); - this.cmp.period.hide(); - this.cmp.startDate.show(); - this.cmp.endDate.show(); - obj.components = { - c1: this.cmp.startDate, - c2: this.cmp.endDate - }; - obj.mapView = { - c1: 'startDate', - c2: 'endDate' - }; - } + this.cmp.periodType.show(); + this.cmp.period.show(); + obj.components = { + c1: this.cmp.periodType, + c2: this.cmp.period + }; + obj.stores = { + c1: G.stores.periodType, + c2: this.stores.periodsByType + }; + obj.mapView = { + c1: 'periodTypeId', + c2: 'periodId' + }; return obj; }, @@ -877,23 +823,15 @@ obj.components.valueType.setValue(this.mapView[obj.mapView.valueType]); obj.components.valueType.currentValue = this.mapView[obj.mapView.valueType]; - obj = this.prepareMapViewDateType(); - if (G.system.mapDateType.isFixed()) { - if (obj.stores.c1.isLoaded) { + obj = this.prepareMapViewPeriod(); + if (obj.stores.c1.isLoaded) { + dateTypeGroupStoreCallback.call(this); + } + else { + obj.stores.c1.load({scope: this, callback: function() { dateTypeGroupStoreCallback.call(this); - } - else { - obj.stores.c1.load({scope: this, callback: function() { - dateTypeGroupStoreCallback.call(this); - }}); - } + }}); } - else if (G.system.mapDateType.isStartEnd()) { - obj.components.c1.setValue(new Date(this.mapView[obj.mapView.c1])); - obj.components.c2.setValue(new Date(this.mapView[obj.mapView.c2])); - - this.setMapViewLegend(); - } }}); } @@ -1002,16 +940,9 @@ return false; } } - - if (G.system.mapDateType.isFixed()) { - if (!this.cmp.period.getValue()) { - return false; - } - } - else { - if (!this.cmp.startDate.getValue() || !this.cmp.endDate.getValue()) { - return false; - } + + if (!this.cmp.period.getValue()) { + return false; } if (!this.cmp.parent.selectedNode || !this.cmp.level.getValue()) { @@ -1053,12 +984,9 @@ dataElementGroupId: this.valueType.isDataElement() ? this.cmp.dataElementGroup.getValue() : null, dataElementId: this.valueType.isDataElement() ? this.cmp.dataElement.getValue() : null, dataElementName: this.valueType.isDataElement() ? this.cmp.dataElement.getRawValue() : null, - mapDateType: G.system.mapDateType.value, - periodTypeId: G.system.mapDateType.isFixed() ? this.cmp.periodType.getValue() : null, - periodId: G.system.mapDateType.isFixed() ? this.cmp.period.getValue() : null, - periodName: G.system.mapDateType.isFixed() ? this.cmp.period.getRawValue() : null, - startDate: G.system.mapDateType.isStartEnd() ? this.cmp.startDate.getRawValue() : null, - endDate: G.system.mapDateType.isStartEnd() ? this.cmp.endDate.getRawValue() : null, + periodTypeId: this.cmp.periodType.getValue(), + periodId: this.cmp.period.getValue(), + periodName: this.cmp.period.getRawValue(), parentOrganisationUnitId: this.organisationUnitSelection.parent.id, parentOrganisationUnitLevel: this.organisationUnitSelection.parent.level, parentOrganisationUnitName: this.organisationUnitSelection.parent.name, @@ -1074,7 +1002,7 @@ getLegendInfo: function() { return { name: this.valueType.isIndicator() ? this.cmp.indicator.getRawValue() : this.cmp.dataElement.getRawValue(), - time: G.system.mapDateType.isFixed() ? this.cmp.period.getRawValue() : this.cmp.startDate.getRawValue() + ' to ' + this.cmp.endDate.getRawValue(), + time: this.cmp.period.getRawValue(), map: this.organisationUnitSelection.level.name + ' / ' + this.organisationUnitSelection.parent.name }; }, @@ -1083,8 +1011,7 @@ return { mapValueTypeValue: this.cmp.mapValueType.getValue() == G.conf.map_value_type_indicator ? this.cmp.indicator.getRawValue() : this.cmp.dataElement.getRawValue(), - dateValue: G.system.mapDateType.isFixed() ? - this.cmp.period.getRawValue() : new Date(this.cmp.startDate.getRawValue()).format('Y M j') + ' - ' + new Date(this.cmp.endDate.getRawValue()).format('Y M j') + dateValue: this.cmp.period.getRawValue() }; }, @@ -1097,12 +1024,9 @@ this.cmp.dataElementGroup.clearValue(); this.cmp.dataElement.clearValue(); - G.system.mapDateType.setFixed(); - this.prepareMapViewDateType(); + this.prepareMapViewPeriod(); this.cmp.periodType.clearValue(); this.cmp.period.clearValue(); - this.cmp.startDate.reset(); - this.cmp.endDate.reset(); this.cmp.mapLegendSet.clearValue(); @@ -1151,9 +1075,7 @@ var dataUrl = this.valueType.isIndicator() ? 'getIndicatorMapValues' : 'getDataElementMapValues'; var params = { id: this.valueType.isIndicator() ? this.cmp.indicator.getValue() : this.cmp.dataElement.getValue(), - periodId: G.system.mapDateType.isFixed() ? this.cmp.period.getValue() : null, - startDate: G.system.mapDateType.isStartEnd() ? new Date(this.cmp.startDate.getValue()).format('Y-m-d') : null, - endDate: G.system.mapDateType.isStartEnd() ? new Date(this.cmp.endDate.getValue()).format('Y-m-d') : null, + periodId: this.cmp.period.getValue(), parentId: this.organisationUnitSelection.parent.id, level: this.organisationUnitSelection.level.level }; @@ -1180,8 +1102,8 @@ for (var i = 0; i < mapvalues.length; i++) { for (var j = 0; j < this.layer.features.length; j++) { - if (mapvalues[i].orgUnitName == this.layer.features[j].attributes.name) { - this.layer.features[j].attributes.value = parseFloat(mapvalues[i].value); + if (mapvalues[i].oi == this.layer.features[j].attributes.id) { + this.layer.features[j].attributes.value = parseFloat(mapvalues[i].v); this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (' + this.layer.features[j].attributes.value + ')'; this.layer.features[j].attributes.name = G.util.cutString(this.layer.features[j].attributes.name, 30); break; === 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 2011-11-23 11:55:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-12-01 15:49:20 +0000 @@ -164,7 +164,6 @@ scope: this, fn: function(nf) { this.filtering.options.gt = nf.getValue(); - } } } @@ -184,7 +183,6 @@ scope: this, fn: function(nf) { this.filtering.options.lt = nf.getValue(); - } } } @@ -682,42 +680,6 @@ } }); - this.cmp.startDate = new Ext.form.DateField({ - fieldLabel: G.i18n.start_date, - format: 'Y-m-d', - hidden: true, - width: G.conf.combo_width, - listeners: { - 'select': { - scope: this, - fn: function(df, date) { - this.cmp.mapview.clearValue(); - this.updateValues = true; - this.cmp.endDate.setMinValue(date); - this.classify(false, true); - } - } - } - }); - - this.cmp.endDate = new Ext.form.DateField({ - fieldLabel: G.i18n.end_date, - format: 'Y-m-d', - hidden: true, - width: G.conf.combo_width, - listeners: { - 'select': { - scope: this, - fn: function(df, date) { - this.cmp.mapview.clearValue(); - this.updateValues = true; - this.cmp.startDate.setMaxValue(date); - this.classify(false, true); - } - } - } - }); - this.cmp.mapLegendType = new Ext.form.ComboBox({ editable: false, valueField: 'value', @@ -1004,8 +966,6 @@ this.cmp.dataElement, this.cmp.periodType, this.cmp.period, - this.cmp.startDate, - this.cmp.endDate, { html: '
' }, { html: '
Legend options
' }, this.cmp.mapLegendType, @@ -1245,7 +1205,7 @@ scope.featureOptions.menu.showAt([G.vars.mouseMove.x, G.vars.mouseMove.y]); } else { - if (feature.attributes.hasChildrenWithCoordinates) { + if (feature.attributes.hcwc) { if (G.vars.locateFeatureWindow) { G.vars.locateFeatureWindow.destroy(); } @@ -1335,40 +1295,22 @@ return obj; }, - prepareMapViewDateType: function() { - var obj = {}; - if (G.system.mapDateType.isFixed()) { - this.cmp.periodType.show(); - this.cmp.period.show(); - this.cmp.startDate.hide(); - this.cmp.endDate.hide(); - obj.components = { - c1: this.cmp.periodType, - c2: this.cmp.period - }; - obj.stores = { - c1: G.stores.periodType, - c2: this.stores.periodsByType - }; - obj.mapView = { - c1: 'periodTypeId', - c2: 'periodId' - }; - } - else if (G.system.mapDateType.isStartEnd()) { - this.cmp.periodType.hide(); - this.cmp.period.hide(); - this.cmp.startDate.show(); - this.cmp.endDate.show(); - obj.components = { - c1: this.cmp.startDate, - c2: this.cmp.endDate - }; - obj.mapView = { - c1: 'startDate', - c2: 'endDate' - }; - } + prepareMapViewPeriod: function() { + var obj = {}; + this.cmp.periodType.show(); + this.cmp.period.show(); + obj.components = { + c1: this.cmp.periodType, + c2: this.cmp.period + }; + obj.stores = { + c1: G.stores.periodType, + c2: this.stores.periodsByType + }; + obj.mapView = { + c1: 'periodTypeId', + c2: 'periodId' + }; return obj; }, @@ -1410,23 +1352,15 @@ obj.components.valueType.setValue(this.mapView[obj.mapView.valueType]); obj.components.valueType.currentValue = this.mapView[obj.mapView.valueType]; - obj = this.prepareMapViewDateType(); - if (G.system.mapDateType.isFixed()) { - if (obj.stores.c1.isLoaded) { + obj = this.prepareMapViewPeriod(); + if (obj.stores.c1.isLoaded) { + dateTypeGroupStoreCallback.call(this); + } + else { + obj.stores.c1.load({scope: this, callback: function() { dateTypeGroupStoreCallback.call(this); - } - else { - obj.stores.c1.load({scope: this, callback: function() { - dateTypeGroupStoreCallback.call(this); - }}); - } + }}); } - else if (G.system.mapDateType.isStartEnd()) { - obj.components.c1.setValue(new Date(this.mapView[obj.mapView.c1])); - obj.components.c2.setValue(new Date(this.mapView[obj.mapView.c2])); - - this.setMapViewLegend(); - } }}); } @@ -1545,7 +1479,7 @@ } else { this.classify(false, true); - } + } } }); }, @@ -1564,18 +1498,10 @@ return false; } } - - if (G.system.mapDateType.isFixed()) { - if (!this.cmp.period.getValue()) { - this.window.cmp.apply.disable(); - return false; - } - } - else { - if (!this.cmp.startDate.getValue() || !this.cmp.endDate.getValue()) { - this.window.cmp.apply.disable(); - return false; - } + + if (!this.cmp.period.getValue()) { + this.window.cmp.apply.disable(); + return false; } if (!this.cmp.parent.selectedNode || !this.cmp.level.getValue()) { @@ -1633,12 +1559,9 @@ dataElementGroupId: this.valueType.isDataElement() ? this.cmp.dataElementGroup.getValue() : null, dataElementId: this.valueType.isDataElement() ? this.cmp.dataElement.getValue() : null, dataElementName: this.valueType.isDataElement() ? this.cmp.dataElement.getRawValue() : null, - mapDateType: G.system.mapDateType.value, - periodTypeId: G.system.mapDateType.isFixed() ? this.cmp.periodType.getValue() : null, - periodId: G.system.mapDateType.isFixed() ? this.cmp.period.getValue() : null, - periodName: G.system.mapDateType.isFixed() ? this.cmp.period.getRawValue() : null, - startDate: G.system.mapDateType.isStartEnd() ? this.cmp.startDate.getRawValue() : null, - endDate: G.system.mapDateType.isStartEnd() ? this.cmp.endDate.getRawValue() : null, + periodTypeId: this.cmp.periodType.getValue(), + periodId: this.cmp.period.getValue(), + periodName: this.cmp.period.getRawValue(), parentOrganisationUnitId: this.organisationUnitSelection.parent.id, parentOrganisationUnitLevel: this.organisationUnitSelection.parent.level, parentOrganisationUnitName: this.organisationUnitSelection.parent.name, @@ -1662,7 +1585,7 @@ getLegendInfo: function() { return { name: this.valueType.isIndicator() ? this.cmp.indicator.getRawValue() : this.cmp.dataElement.getRawValue(), - time: G.system.mapDateType.isFixed() ? this.cmp.period.getRawValue() : this.cmp.startDate.getRawValue() + ' to ' + this.cmp.endDate.getRawValue(), + time: this.cmp.period.getRawValue(), map: this.organisationUnitSelection.level.name + ' / ' + this.organisationUnitSelection.parent.name }; }, @@ -1671,8 +1594,7 @@ return { mapValueTypeValue: this.cmp.mapValueType.getValue() == G.conf.map_value_type_indicator ? this.cmp.indicator.getRawValue() : this.cmp.dataElement.getRawValue(), - dateValue: G.system.mapDateType.isFixed() ? - this.cmp.period.getRawValue() : new Date(this.cmp.startDate.getRawValue()).format('Y M j') + ' - ' + new Date(this.cmp.endDate.getRawValue()).format('Y M j') + dateValue: this.cmp.period.getRawValue() }; }, @@ -1687,12 +1609,9 @@ this.cmp.dataElementGroup.clearValue(); this.cmp.dataElement.clearValue(); - G.system.mapDateType.setFixed(); - this.prepareMapViewDateType(); + this.prepareMapViewPeriod(); this.cmp.periodType.clearValue(); this.cmp.period.clearValue(); - this.cmp.startDate.reset(); - this.cmp.endDate.reset(); this.cmp.level.clearValue(); this.cmp.parent.reset(); @@ -1751,9 +1670,7 @@ var dataUrl = this.valueType.isIndicator() ? 'getIndicatorMapValues' : 'getDataElementMapValues'; var params = { id: this.valueType.isIndicator() ? this.cmp.indicator.getValue() : this.cmp.dataElement.getValue(), - periodId: G.system.mapDateType.isFixed() ? this.cmp.period.getValue() : null, - startDate: G.system.mapDateType.isStartEnd() ? new Date(this.cmp.startDate.getValue()).format('Y-m-d') : null, - endDate: G.system.mapDateType.isStartEnd() ? new Date(this.cmp.endDate.getValue()).format('Y-m-d') : null, + periodId: this.cmp.period.getValue(), parentId: this.organisationUnitSelection.parent.id, level: this.organisationUnitSelection.level.level }; @@ -1780,8 +1697,8 @@ for (var i = 0; i < mapvalues.length; i++) { for (var j = 0; j < this.layer.features.length; j++) { - if (mapvalues[i].orgUnitName == this.layer.features[j].attributes.name) { - this.layer.features[j].attributes.value = parseFloat(mapvalues[i].value); + if (mapvalues[i].oi == this.layer.features[j].attributes.id) { + this.layer.features[j].attributes.value = parseFloat(mapvalues[i].v); this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (' + this.layer.features[j].attributes.value + ')'; this.layer.features[j].attributes.fixedName = G.util.cutString(this.layer.features[j].attributes.name, 30); break; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-11-23 11:55:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-12-01 15:49:20 +0000 @@ -154,6 +154,12 @@ fieldLabel: 'Greater than', width: G.conf.combo_number_width_small, listeners: { + 'afterrender': { + scope: this, + fn: function(nf) { + this.filtering.cmp.gt = nf; + } + }, 'change': { scope: this, fn: function(nf) { @@ -167,6 +173,12 @@ fieldLabel: 'Lower than', width: G.conf.combo_number_width_small, listeners: { + 'afterrender': { + scope: this, + fn: function(nf) { + this.filtering.cmp.lt = nf; + } + }, 'change': { scope: this, fn: function(nf) { @@ -187,6 +199,14 @@ scope: this, handler: function() { this.filtering.filter.call(this); + }, + listeners: { + 'afterrender': { + scope: this, + fn: function(b) { + this.filtering.cmp.button = b; + } + } } } ], @@ -660,42 +680,6 @@ } }); - this.cmp.startDate = new Ext.form.DateField({ - fieldLabel: G.i18n.start_date, - format: 'Y-m-d', - hidden: true, - width: G.conf.combo_width, - listeners: { - 'select': { - scope: this, - fn: function(df, date) { - this.cmp.mapview.clearValue(); - this.updateValues = true; - this.cmp.endDate.setMinValue(date); - this.classify(false, true); - } - } - } - }); - - this.cmp.endDate = new Ext.form.DateField({ - fieldLabel: G.i18n.end_date, - format: 'Y-m-d', - hidden: true, - width: G.conf.combo_width, - listeners: { - 'select': { - scope: this, - fn: function(df, date) { - this.cmp.mapview.clearValue(); - this.updateValues = true; - this.cmp.startDate.setMaxValue(date); - this.classify(false, true); - } - } - } - }); - this.cmp.mapLegendType = new Ext.form.ComboBox({ editable: false, valueField: 'value', @@ -982,8 +966,6 @@ this.cmp.dataElement, this.cmp.periodType, this.cmp.period, - this.cmp.startDate, - this.cmp.endDate, { html: '
' }, { html: '
Legend options
' }, this.cmp.mapLegendType, @@ -1223,7 +1205,7 @@ scope.featureOptions.menu.showAt([G.vars.mouseMove.x, G.vars.mouseMove.y]); } else { - if (feature.attributes.hasChildrenWithCoordinates) { + if (feature.attributes.hcwc) { if (G.vars.locateFeatureWindow) { G.vars.locateFeatureWindow.destroy(); } @@ -1313,40 +1295,22 @@ return obj; }, - prepareMapViewDateType: function() { - var obj = {}; - if (G.system.mapDateType.isFixed()) { - this.cmp.periodType.show(); - this.cmp.period.show(); - this.cmp.startDate.hide(); - this.cmp.endDate.hide(); - obj.components = { - c1: this.cmp.periodType, - c2: this.cmp.period - }; - obj.stores = { - c1: G.stores.periodType, - c2: this.stores.periodsByType - }; - obj.mapView = { - c1: 'periodTypeId', - c2: 'periodId' - }; - } - else if (G.system.mapDateType.isStartEnd()) { - this.cmp.periodType.hide(); - this.cmp.period.hide(); - this.cmp.startDate.show(); - this.cmp.endDate.show(); - obj.components = { - c1: this.cmp.startDate, - c2: this.cmp.endDate - }; - obj.mapView = { - c1: 'startDate', - c2: 'endDate' - }; - } + prepareMapViewPeriod: function() { + var obj = {}; + this.cmp.periodType.show(); + this.cmp.period.show(); + obj.components = { + c1: this.cmp.periodType, + c2: this.cmp.period + }; + obj.stores = { + c1: G.stores.periodType, + c2: this.stores.periodsByType + }; + obj.mapView = { + c1: 'periodTypeId', + c2: 'periodId' + }; return obj; }, @@ -1388,23 +1352,15 @@ obj.components.valueType.setValue(this.mapView[obj.mapView.valueType]); obj.components.valueType.currentValue = this.mapView[obj.mapView.valueType]; - obj = this.prepareMapViewDateType(); - if (G.system.mapDateType.isFixed()) { - if (obj.stores.c1.isLoaded) { + obj = this.prepareMapViewPeriod(); + if (obj.stores.c1.isLoaded) { + dateTypeGroupStoreCallback.call(this); + } + else { + obj.stores.c1.load({scope: this, callback: function() { dateTypeGroupStoreCallback.call(this); - } - else { - obj.stores.c1.load({scope: this, callback: function() { - dateTypeGroupStoreCallback.call(this); - }}); - } + }}); } - else if (G.system.mapDateType.isStartEnd()) { - obj.components.c1.setValue(new Date(this.mapView[obj.mapView.c1])); - obj.components.c2.setValue(new Date(this.mapView[obj.mapView.c2])); - - this.setMapViewLegend(); - } }}); } @@ -1512,7 +1468,7 @@ colors[colors.length-1].setFromHex(mapLegends[i].color); names.push(mapLegends[i].name); bounds.push(mapLegends[i].endValue); - } + } this.colorInterpolation = colors; this.bounds = bounds; @@ -1542,18 +1498,10 @@ return false; } } - - if (G.system.mapDateType.isFixed()) { - if (!this.cmp.period.getValue()) { - this.window.cmp.apply.disable(); - return false; - } - } - else { - if (!this.cmp.startDate.getValue() || !this.cmp.endDate.getValue()) { - this.window.cmp.apply.disable(); - return false; - } + + if (!this.cmp.period.getValue()) { + this.window.cmp.apply.disable(); + return false; } if (!this.cmp.parent.selectedNode || !this.cmp.level.getValue()) { @@ -1611,12 +1559,9 @@ dataElementGroupId: this.valueType.isDataElement() ? this.cmp.dataElementGroup.getValue() : null, dataElementId: this.valueType.isDataElement() ? this.cmp.dataElement.getValue() : null, dataElementName: this.valueType.isDataElement() ? this.cmp.dataElement.getRawValue() : null, - mapDateType: G.system.mapDateType.value, - periodTypeId: G.system.mapDateType.isFixed() ? this.cmp.periodType.getValue() : null, - periodId: G.system.mapDateType.isFixed() ? this.cmp.period.getValue() : null, - periodName: G.system.mapDateType.isFixed() ? this.cmp.period.getRawValue() : null, - startDate: G.system.mapDateType.isStartEnd() ? this.cmp.startDate.getRawValue() : null, - endDate: G.system.mapDateType.isStartEnd() ? this.cmp.endDate.getRawValue() : null, + periodTypeId: this.cmp.periodType.getValue(), + periodId: this.cmp.period.getValue(), + periodName: this.cmp.period.getRawValue(), parentOrganisationUnitId: this.organisationUnitSelection.parent.id, parentOrganisationUnitLevel: this.organisationUnitSelection.parent.level, parentOrganisationUnitName: this.organisationUnitSelection.parent.name, @@ -1640,7 +1585,7 @@ getLegendInfo: function() { return { name: this.valueType.isIndicator() ? this.cmp.indicator.getRawValue() : this.cmp.dataElement.getRawValue(), - time: G.system.mapDateType.isFixed() ? this.cmp.period.getRawValue() : this.cmp.startDate.getRawValue() + ' to ' + this.cmp.endDate.getRawValue(), + time: this.cmp.period.getRawValue(), map: this.organisationUnitSelection.level.name + ' / ' + this.organisationUnitSelection.parent.name }; }, @@ -1649,8 +1594,7 @@ return { mapValueTypeValue: this.cmp.mapValueType.getValue() == G.conf.map_value_type_indicator ? this.cmp.indicator.getRawValue() : this.cmp.dataElement.getRawValue(), - dateValue: G.system.mapDateType.isFixed() ? - this.cmp.period.getRawValue() : new Date(this.cmp.startDate.getRawValue()).format('Y M j') + ' - ' + new Date(this.cmp.endDate.getRawValue()).format('Y M j') + dateValue: this.cmp.period.getRawValue() }; }, @@ -1665,12 +1609,9 @@ this.cmp.dataElementGroup.clearValue(); this.cmp.dataElement.clearValue(); - G.system.mapDateType.setFixed(); - this.prepareMapViewDateType(); + this.prepareMapViewPeriod(); this.cmp.periodType.clearValue(); this.cmp.period.clearValue(); - this.cmp.startDate.reset(); - this.cmp.endDate.reset(); this.cmp.level.clearValue(); this.cmp.parent.reset(); @@ -1729,9 +1670,7 @@ var dataUrl = this.valueType.isIndicator() ? 'getIndicatorMapValues' : 'getDataElementMapValues'; var params = { id: this.valueType.isIndicator() ? this.cmp.indicator.getValue() : this.cmp.dataElement.getValue(), - periodId: G.system.mapDateType.isFixed() ? this.cmp.period.getValue() : null, - startDate: G.system.mapDateType.isStartEnd() ? new Date(this.cmp.startDate.getValue()).format('Y-m-d') : null, - endDate: G.system.mapDateType.isStartEnd() ? new Date(this.cmp.endDate.getValue()).format('Y-m-d') : null, + periodId: this.cmp.period.getValue(), parentId: this.organisationUnitSelection.parent.id, level: this.organisationUnitSelection.level.level }; @@ -1758,8 +1697,8 @@ for (var i = 0; i < mapvalues.length; i++) { for (var j = 0; j < this.layer.features.length; j++) { - if (mapvalues[i].orgUnitName == this.layer.features[j].attributes.name) { - this.layer.features[j].attributes.value = parseFloat(mapvalues[i].value); + if (mapvalues[i].oi == this.layer.features[j].attributes.id) { + this.layer.features[j].attributes.value = parseFloat(mapvalues[i].v); this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (' + this.layer.features[j].attributes.value + ')'; this.layer.features[j].attributes.fixedName = G.util.cutString(this.layer.features[j].attributes.name, 30); break; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-11-23 11:55:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-12-01 15:49:20 +0000 @@ -742,7 +742,6 @@ getAllValues: function() { return { featureType: G.conf.map_feature_type_point, - mapDateType: G.system.mapDateType.value, parentOrganisationUnitId: this.organisationUnitSelection.parent.id, parentOrganisationUnitLevel: this.organisationUnitSelection.parent.level, parentOrganisationUnitName: this.organisationUnitSelection.parent.name,