=== added file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/MapViewFixedDateTypeFilter.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/MapViewFixedDateTypeFilter.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/MapViewFixedDateTypeFilter.java 2011-01-11 09:59:19 +0000 @@ -0,0 +1,45 @@ +package org.hisp.dhis.system.filter; + +/* + * Copyright (c) 2004-2010, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import org.hisp.dhis.mapping.MapView; +import org.hisp.dhis.mapping.MappingService; +import org.hisp.dhis.system.util.Filter; + +/** + * @author Jan Henrik Overland + */ +public class MapViewFixedDateTypeFilter + implements Filter +{ + @Override + public boolean retain( MapView object ) + { + return object != null && object.getMapDateType().equals( MappingService.MAP_DATE_TYPE_FIXED ); + } +} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-01-10 14:35:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-01-11 10:12:49 +0000 @@ -127,7 +127,12 @@ public String execute() throws Exception { - Period period = periodService.getPeriod( periodId ); + Period period = null; + + if ( periodId != null ) + { + period = periodService.getPeriod( periodId ); + } object = mappingService.getIndicatorMapValues( id, period, DateUtils.getMediumDate( startDate ), DateUtils .getMediumDate( endDate ), parentId, level ); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewsByFeatureTypeAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewsByFeatureTypeAction.java 2010-11-29 16:36:25 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewsByFeatureTypeAction.java 2011-01-11 09:59:19 +0000 @@ -27,6 +27,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.hisp.dhis.options.SystemSettingManager.AGGREGATION_STRATEGY_BATCH; +import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_AGGREGATION_STRATEGY; +import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -34,6 +38,9 @@ import org.hisp.dhis.mapping.MapView; import org.hisp.dhis.mapping.MappingService; import org.hisp.dhis.mapping.comparator.MapViewNameComparator; +import org.hisp.dhis.options.SystemSettingManager; +import org.hisp.dhis.system.filter.MapViewFixedDateTypeFilter; +import org.hisp.dhis.system.util.FilterUtils; import com.opensymphony.xwork2.Action; @@ -55,6 +62,13 @@ this.mappingService = mappingService; } + private SystemSettingManager systemSettingManager; + + public void setSystemSettingManager( SystemSettingManager systemSettingManager ) + { + this.systemSettingManager = systemSettingManager; + } + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- @@ -85,6 +99,14 @@ { object = new ArrayList( mappingService.getMapViewsByFeatureType( featureType ) ); + String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY, + DEFAULT_AGGREGATION_STRATEGY ); + + if ( aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) ) + { + FilterUtils.filter( object, new MapViewFixedDateTypeFilter() ); + } + Collections.sort( object, new MapViewNameComparator() ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-01-10 16:07:53 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-01-11 09:59:19 +0000 @@ -181,6 +181,7 @@ + ' + rv + ' ' + G.i18n.added_to_dashboard); Ext.getCmp('favorite_cb').clearValue(); @@ -1838,6 +1840,7 @@ id: 'mapdatetype_cb', fieldLabel: G.i18n.date_type, labelSeparator: G.conf.labelseparator, + disabled: G.system.aggregationStrategy == G.conf.aggregation_strategy_batch, editable: false, valueField: 'value', displayField: 'text', @@ -1863,7 +1866,7 @@ method: 'POST', params: {mapDateType: G.vars.mapDateType.value}, success: function() { - Ext.message.msg(true, '' + cb.getRawValue() + ' '+G.i18n.saved_as_date_type); + Ext.message.msg(true, '' + cb.getRawValue() + ' '+ G.i18n.saved_as_date_type); choropleth.prepareMapViewDateType(); symbol.prepareMapViewDateType(); } @@ -1873,7 +1876,7 @@ } } ] - } + } ] }); @@ -2299,7 +2302,7 @@ var favoritesButton = new Ext.Button({ iconCls: 'icon-favorite', tooltip: G.i18n.favorite_map_views, - disabled: !G.vars.user.isAdmin, + disabled: !G.user.isAdmin, handler: function() { var x = Ext.getCmp('center').x + 15; var y = Ext.getCmp('center').y + 41; @@ -2353,7 +2356,7 @@ var predefinedMapLegendSetButton = new Ext.Button({ iconCls: 'icon-predefinedlegendset', tooltip: G.i18n.create_predefined_legend_sets, - disabled: !G.vars.user.isAdmin, + disabled: !G.user.isAdmin, handler: function() { var x = Ext.getCmp('center').x + 15; var y = Ext.getCmp('center').y + 41; @@ -2374,7 +2377,7 @@ var adminButton = new Ext.Button({ iconCls: 'icon-admin', tooltip: 'Administrator settings', - disabled: !G.vars.user.isAdmin, + disabled: !G.user.isAdmin, handler: function() { var x = Ext.getCmp('center').x + 15; var y = Ext.getCmp('center').y + 41;