dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12511
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3865: (GIS) Infrastructural data sheet for facilities implemented. Select data element group and period...
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3865 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-06-10 13:53:28 +0200
message:
(GIS) Infrastructural data sheet for facilities implemented. Select data element group and period type in the system settings module.
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/information2.png
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllDataElementGroupSetsAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetInfrastructuralDataElementMapValuesAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonDataElementGroupSets.vm
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInfrastructuralAggregatedMapValues.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedMapValue.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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java
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/struts.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonSymbol.vm
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonAggregatedMapValues.vm
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/jsonminAggregatedMapValues.vm
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css
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/index.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/theme/gray-extend/xtheme-gray-extend.css
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js
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/Point.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedMapValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedMapValue.java 2011-01-25 20:50:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedMapValue.java 2011-06-08 13:52:49 +0000
@@ -40,6 +40,8 @@
private int periodId;
+ private String dataElementName;
+
private double value;
private double factor;
@@ -56,11 +58,12 @@
{
}
- public AggregatedMapValue( int organisationUnitId, String organisationUnitName, int periodId, double value, double factor, double numeratorValue, double denominatorValue )
+ public AggregatedMapValue( int organisationUnitId, String organisationUnitName, int periodId, String dataElementName, double value, double factor, double numeratorValue, double denominatorValue )
{
this.organisationUnitId = organisationUnitId;
this.organisationUnitName = organisationUnitName;
this.periodId = periodId;
+ this.dataElementName = dataElementName;
this.value = value;
this.factor = factor;
this.numeratorValue = numeratorValue;
@@ -122,6 +125,16 @@
this.periodId = periodId;
}
+ public String getDataElementName()
+ {
+ return dataElementName;
+ }
+
+ public void setDataElementName( String dataElementName )
+ {
+ this.dataElementName = dataElementName;
+ }
+
public double getValue()
{
return value;
=== 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-05-20 15:23:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-06-08 13:52:49 +0000
@@ -79,6 +79,8 @@
Collection<AggregatedMapValue> getDataElementMapValues( Integer dataElementId, Period period, Date startDate, Date endDate,
Integer parentOrganisationUnitId, Integer level );
+
+ Collection<AggregatedMapValue> getInfrastructuralDataElementMapValues( Integer periodId, Integer organisationUnitId );
// -------------------------------------------------------------------------
// MapLegend
=== 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-05-20 15:23:50 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-06-08 13:52:49 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.aggregation.AggregationService;
+import org.hisp.dhis.configuration.ConfigurationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
@@ -119,7 +120,7 @@
}
private AggregatedDataValueService aggregatedDataValueService;
-
+
public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
{
this.aggregatedDataValueService = aggregatedDataValueService;
@@ -131,14 +132,21 @@
{
this.systemSettingManager = systemSettingManager;
}
-
+
private CurrentUserService currentUserService;
-
+
public void setCurrentUserService( CurrentUserService currentUserService )
{
this.currentUserService = currentUserService;
}
+ private ConfigurationService configurationService;
+
+ public void setConfigurationService( ConfigurationService configurationService )
+ {
+ this.configurationService = configurationService;
+ }
+
// -------------------------------------------------------------------------
// MappingService implementation
// -------------------------------------------------------------------------
@@ -158,10 +166,11 @@
private Collection<OrganisationUnit> getOrganisationUnits( Integer parentOrganisationUnitId, Integer level )
{
Collection<OrganisationUnit> organisationUnits = null;
-
+
if ( parentOrganisationUnitId != null && level != null )
{
- organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( level, organisationUnitService.getOrganisationUnit( parentOrganisationUnitId ) );
+ organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( level, organisationUnitService
+ .getOrganisationUnit( parentOrganisationUnitId ) );
}
else if ( level != null )
{
@@ -178,47 +187,50 @@
// -------------------------------------------------------------------------
// IndicatorMapValues
// -------------------------------------------------------------------------
-
+
/**
- * Generates a collection AggregatedMapValues. Only one of Period and start/end
- * date can be specified. At least one of parent organisation unit and level
- * must be specified. Period should be specified with "real time" aggregation
- * strategy, any may be specified with "batch" aggregation strategy.
+ * Generates a collection AggregatedMapValues. Only one of Period and
+ * start/end date can be specified. At least one of parent organisation unit
+ * and level must be specified. Period should be specified with "real time"
+ * aggregation strategy, any may be specified with "batch" aggregation
+ * strategy.
*
* @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 parentOrganisationUnitId the parent OrganisationUnit identifier.
+ * Ignored if null.
* @param level the OrganisationUnit level. Ignored if null.
* @return a collection of AggregatedMapValues.
*/
- public Collection<AggregatedMapValue> getIndicatorMapValues( Integer indicatorId, Period period, Date startDate, Date endDate,
- Integer parentOrganisationUnitId, Integer level )
+ public Collection<AggregatedMapValue> getIndicatorMapValues( Integer indicatorId, Period period, Date startDate,
+ Date endDate, Integer parentOrganisationUnitId, Integer level )
{
- String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY, DEFAULT_AGGREGATION_STRATEGY );
-
- Assert.isTrue( !( period != null && ( startDate != null || endDate != null ) ) );
- Assert.isTrue( !( aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) && period == null ) );
- Assert.isTrue( !( indicatorId == null || parentOrganisationUnitId == null || level == null ) );
-
+ String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
+ DEFAULT_AGGREGATION_STRATEGY );
+
+ Assert.isTrue( !(period != null && (startDate != null || endDate != null)) );
+ Assert.isTrue( !(aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) && period == null) );
+ Assert.isTrue( !(indicatorId == null || parentOrganisationUnitId == null || level == null) );
+
Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
Indicator indicator = indicatorService.getIndicator( indicatorId );
-
+
if ( period != null )
{
startDate = period.getStartDate();
endDate = period.getEndDate();
}
-
+
for ( OrganisationUnit organisationUnit : getOrganisationUnits( parentOrganisationUnitId, level ) )
{
if ( organisationUnit.hasCoordinates() )
{
- Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ?
- aggregationService.getAggregatedIndicatorValue( indicator, startDate, endDate, organisationUnit ) :
- aggregatedDataValueService.getAggregatedValue( indicator, period, organisationUnit );
+ Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
+ .getAggregatedIndicatorValue( indicator, startDate, endDate, organisationUnit )
+ : aggregatedDataValueService.getAggregatedValue( indicator, period, organisationUnit );
value = value != null ? value : 0; // TODO improve
@@ -233,51 +245,54 @@
return values;
}
-
+
// -------------------------------------------------------------------------
// DataElementMapValues
// -------------------------------------------------------------------------
/**
- * Generates a collection AggregatedMapValues. Only one of Period and start/end
- * date can be specified. At least one of parent organisation unit and level
- * must be specified. Period should be specified with "real time" aggregation
- * strategy, any may be specified with "batch" aggregation strategy.
+ * Generates a collection AggregatedMapValues. Only one of Period and
+ * start/end date can be specified. At least one of parent organisation unit
+ * and level must be specified. Period should be specified with "real time"
+ * aggregation strategy, any may be specified with "batch" aggregation
+ * strategy.
*
* @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 parentOrganisationUnitId the parent OrganisationUnit identifier.
+ * Ignored if null.
* @param level the OrganisationUnit level. Ignored if null.
* @return a collection of AggregatedMapValues.
*/
- public Collection<AggregatedMapValue> getDataElementMapValues( Integer dataElementId, Period period, Date startDate, Date endDate,
- Integer parentOrganisationUnitId, Integer level )
+ public Collection<AggregatedMapValue> getDataElementMapValues( Integer dataElementId, Period period,
+ Date startDate, Date endDate, Integer parentOrganisationUnitId, Integer level )
{
- String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY, DEFAULT_AGGREGATION_STRATEGY );
-
- Assert.isTrue( !( period != null && ( startDate != null || endDate != null ) ) );
- Assert.isTrue( !( aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) && period == null ) );
- Assert.isTrue( !( dataElementId == null || parentOrganisationUnitId == null || level == null ) );
-
+ String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
+ DEFAULT_AGGREGATION_STRATEGY );
+
+ Assert.isTrue( !(period != null && (startDate != null || endDate != null)) );
+ Assert.isTrue( !(aggregationStrategy.equals( AGGREGATION_STRATEGY_BATCH ) && period == null) );
+ Assert.isTrue( !(dataElementId == null || parentOrganisationUnitId == null || level == null) );
+
Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
DataElement dataElement = dataElementService.getDataElement( dataElementId );
-
+
if ( period != null )
{
startDate = period.getStartDate();
endDate = period.getEndDate();
}
-
+
for ( OrganisationUnit organisationUnit : getOrganisationUnits( parentOrganisationUnitId, level ) )
{
if ( organisationUnit.hasCoordinates() )
{
- Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ?
- aggregationService.getAggregatedDataValue( dataElement, null, startDate, endDate, organisationUnit ) :
- aggregatedDataValueService.getAggregatedValue( dataElement, period, organisationUnit );
+ Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
+ .getAggregatedDataValue( dataElement, null, startDate, endDate, organisationUnit )
+ : aggregatedDataValueService.getAggregatedValue( dataElement, period, organisationUnit );
value = value != null ? value : 0; // TODO improve
@@ -290,9 +305,56 @@
}
}
- return values;
- }
-
+ return values;
+ }
+
+ public Collection<AggregatedMapValue> getInfrastructuralDataElementMapValues( Integer periodId, Integer organisationUnitId )
+ {
+ String aggregationStrategy = (String) systemSettingManager.getSystemSetting( KEY_AGGREGATION_STRATEGY,
+ DEFAULT_AGGREGATION_STRATEGY );
+
+ DataElementGroup group = configurationService.getConfiguration().getInfrastructuralDataElements();
+
+ if ( group == null )
+ {
+ group = dataElementService.getAllDataElementGroups().iterator().next();
+ }
+
+ Period period = periodService.getPeriod( periodId );
+
+ Date startDate = new Date(), endDate = new Date();
+
+ if ( period != null )
+ {
+ startDate = period.getStartDate();
+ endDate = period.getEndDate();
+ }
+
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ Collection<AggregatedMapValue> values = new HashSet<AggregatedMapValue>();
+
+ if ( group != null )
+ {
+ for ( DataElement dataElement : group.getMembers() )
+ {
+ Double value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
+ .getAggregatedDataValue( dataElement, null, startDate, endDate, organisationUnit )
+ : aggregatedDataValueService.getAggregatedValue( dataElement, period, organisationUnit );
+
+ value = value != null ? value : 0; // TODO improve
+
+ AggregatedMapValue mapValue = new AggregatedMapValue();
+ mapValue.setDataElementName( dataElement.getShortName() );
+ mapValue.setValue( value );
+
+ values.add( mapValue );
+ }
+ }
+
+ return values;
+ }
+
// -------------------------------------------------------------------------
// MapLegend
// -------------------------------------------------------------------------
@@ -467,7 +529,7 @@
{
return mappingStore.addMapView( mapView );
}
-
+
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,
@@ -476,7 +538,7 @@
String longitude, String latitude, int zoom )
{
User user = system ? null : currentUserService.getCurrentUser();
-
+
IndicatorGroup indicatorGroup = null;
Indicator indicator = null;
@@ -508,10 +570,10 @@
OrganisationUnitLevel level = organisationUnitService.getOrganisationUnitLevelByLevel( organisationUnitLevel );
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, colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ) );
+
+ addMapView( new MapView( name, user, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement,
+ mapDateType, periodType, period, startDate, endDate, parent, level, mapLegendType, method, classes, bounds,
+ colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ) );
}
public void updateMapView( MapView mapView )
@@ -545,7 +607,7 @@
public Collection<MapView> getAllMapViews()
{
User user = currentUserService.getCurrentUser();
-
+
Collection<MapView> mapViews = mappingStore.getAllMapViews( user );
if ( mapViews.size() > 0 )
@@ -563,7 +625,7 @@
public Collection<MapView> getMapViewsByFeatureType( String featureType )
{
User user = currentUserService.getCurrentUser();
-
+
Collection<MapView> mapViews = mappingStore.getMapViewsByFeatureType( featureType, user );
for ( MapView mapView : mapViews )
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-01-26 00:07:38 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-06-08 13:52:49 +0000
@@ -30,6 +30,8 @@
ref="org.hisp.dhis.aggregation.AggregatedDataValueService"/>
<property name="currentUserService"
ref="org.hisp.dhis.user.CurrentUserService"/>
+ <property name="configurationService"
+ ref="org.hisp.dhis.configuration.ConfigurationService"/>
</bean>
<!-- Store definitions -->
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/information2.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/information2.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/information2.png 2011-06-09 13:20:00 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java 2011-06-09 14:43:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java 2011-06-10 11:47:41 +0000
@@ -33,9 +33,14 @@
import java.util.List;
import java.util.SortedMap;
+import org.hisp.dhis.configuration.Configuration;
import org.hisp.dhis.configuration.ConfigurationService;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.options.style.StyleManager;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.Filter;
import org.hisp.dhis.system.util.FilterUtils;
import org.hisp.dhis.user.UserGroup;
@@ -55,7 +60,7 @@
implements Action
{
private static final Filter<Module> startableFilter = new StartableModuleFilter();
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -66,14 +71,14 @@
{
this.systemSettingManager = systemSettingManager;
}
-
+
private ModuleManager moduleManager;
public void setModuleManager( ModuleManager moduleManager )
{
this.moduleManager = moduleManager;
}
-
+
private StyleManager styleManager;
public void setStyleManager( StyleManager styleManager )
@@ -81,6 +86,20 @@
this.styleManager = styleManager;
}
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
private UserGroupService userGroupService;
public void setUserGroupService( UserGroupService userGroupService )
@@ -94,24 +113,24 @@
{
this.configurationService = configurationService;
}
-
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
-
+
private SortedMap<String, String> flags;
public SortedMap<String, String> getFlags()
{
return flags;
}
-
+
private List<Module> modules;
-
+
public List<Module> getModules()
{
return modules;
- }
+ }
private SortedMap<String, String> styles;
@@ -119,7 +138,7 @@
{
return styles;
}
-
+
private String currentStyle;
public String getCurrentStyle()
@@ -135,7 +154,7 @@
}
private UserGroup feedbackRecipients;
-
+
public UserGroup getFeedbackRecipients()
{
return feedbackRecipients;
@@ -148,30 +167,57 @@
return aggregationStrategies;
}
+ private Configuration configuration;
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ private List<DataElementGroup> dataElementGroups;
+
+ public List<DataElementGroup> getDataElementGroups()
+ {
+ return dataElementGroups;
+ }
+
+ private List<PeriodType> periodTypes;
+
+ public List<PeriodType> getPeriodTypes()
+ {
+ return periodTypes;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
-
+
public String execute()
- {
- flags = systemSettingManager.getFlags();
-
+ {
+ flags = systemSettingManager.getFlags();
+
modules = moduleManager.getMenuModules();
-
+
FilterUtils.filter( modules, startableFilter );
-
+
styles = styleManager.getStyles();
currentStyle = styleManager.getCurrentStyle();
aggregationStrategies = systemSettingManager.getAggregationStrategies();
-
+
+ configuration = configurationService.getConfiguration();
+
+ dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+
+ periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
+
userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
-
+
Collections.sort( userGroups, new UserGroupComparator() );
-
+
feedbackRecipients = configurationService.getConfiguration().getFeedbackRecipients();
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java 2011-06-09 14:43:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetSystemSettingsAction.java 2011-06-10 11:47:41 +0000
@@ -27,19 +27,24 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.options.SystemSettingManager.*;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_AGGREGATION_STRATEGY;
import static org.hisp.dhis.options.SystemSettingManager.KEY_APPLICATION_TITLE;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_COMPLETENESS_OFFSET;
import static org.hisp.dhis.options.SystemSettingManager.KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED;
import static org.hisp.dhis.options.SystemSettingManager.KEY_FACTOR_OF_DEVIATION;
import static org.hisp.dhis.options.SystemSettingManager.KEY_FLAG;
import static org.hisp.dhis.options.SystemSettingManager.KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART;
import static org.hisp.dhis.options.SystemSettingManager.KEY_START_MODULE;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_SYSTEM_IDENTIFIER;
import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.configuration.Configuration;
import org.hisp.dhis.configuration.ConfigurationService;
+import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.options.style.StyleManager;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.user.UserGroupService;
import com.opensymphony.xwork2.Action;
@@ -82,13 +87,27 @@
{
this.configurationService = configurationService;
}
-
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
-
+
private String systemIdentifier;
-
+
public void setSystemIdentifier( String systemIdentifier )
{
this.systemIdentifier = systemIdentifier;
@@ -115,6 +134,20 @@
this.startModule = startModule;
}
+ private Integer infrastructuralDataElements;
+
+ public void setInfrastructuralDataElements( Integer infrastructuralDataElements )
+ {
+ this.infrastructuralDataElements = infrastructuralDataElements;
+ }
+
+ private String infrastructuralPeriodType;
+
+ public void setInfrastructuralPeriodType( String infrastructuralPeriodType )
+ {
+ this.infrastructuralPeriodType = infrastructuralPeriodType;
+ }
+
private Boolean omitIndicatorsZeroNumeratorDataMart;
public void setOmitIndicatorsZeroNumeratorDataMart( Boolean omitIndicatorsZeroNumeratorDataMart )
@@ -142,16 +175,16 @@
{
this.currentStyle = style;
}
-
+
private String aggregationStrategy;
public void setAggregationStrategy( String aggregationStrategy )
{
this.aggregationStrategy = aggregationStrategy;
}
-
+
private Integer feedbackRecipients;
-
+
public void setFeedbackRecipients( Integer feedbackRecipients )
{
this.feedbackRecipients = feedbackRecipients;
@@ -167,7 +200,7 @@
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
-
+
public String execute()
{
applicationTitle = StringUtils.trimToNull( applicationTitle );
@@ -181,22 +214,41 @@
{
startModule = null;
}
-
+
systemSettingManager.saveSystemSetting( KEY_SYSTEM_IDENTIFIER, systemIdentifier );
systemSettingManager.saveSystemSetting( KEY_APPLICATION_TITLE, applicationTitle );
systemSettingManager.saveSystemSetting( KEY_FLAG, flag );
systemSettingManager.saveSystemSetting( KEY_START_MODULE, startModule );
- systemSettingManager.saveSystemSetting( KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART, omitIndicatorsZeroNumeratorDataMart );
- systemSettingManager.saveSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, disableDataEntryWhenCompleted );
+ systemSettingManager.saveSystemSetting( KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART,
+ omitIndicatorsZeroNumeratorDataMart );
+ systemSettingManager
+ .saveSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, disableDataEntryWhenCompleted );
systemSettingManager.saveSystemSetting( KEY_FACTOR_OF_DEVIATION, factorDeviation );
styleManager.setCurrentStyle( currentStyle );
systemSettingManager.saveSystemSetting( KEY_AGGREGATION_STRATEGY, aggregationStrategy );
systemSettingManager.saveSystemSetting( KEY_COMPLETENESS_OFFSET, completenessOffset );
-
+
Configuration configuration = configurationService.getConfiguration();
- configuration.setFeedbackRecipients( userGroupService.getUserGroup( feedbackRecipients ) );
+
+ if ( feedbackRecipients != null )
+ {
+ configuration.setFeedbackRecipients( userGroupService.getUserGroup( feedbackRecipients ) );
+ }
+
+ if ( infrastructuralDataElements != null )
+ {
+ configuration.setInfrastructuralDataElements( dataElementService
+ .getDataElementGroup( infrastructuralDataElements ) );
+ }
+
+ if ( infrastructuralPeriodType != null )
+ {
+ configuration.setInfrastructuralPeriodType( periodService.getPeriodTypeByClass( PeriodType
+ .getPeriodTypeByName( infrastructuralPeriodType ).getClass() ) );
+ }
+
configurationService.setConfiguration( configuration );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml 2011-06-09 14:43:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml 2011-06-10 11:47:41 +0000
@@ -9,11 +9,13 @@
<bean id="org.hisp.dhis.settings.action.system.GetSystemSettingsAction"
class="org.hisp.dhis.settings.action.system.GetSystemSettingsAction"
scope="prototype">
- <property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
- <property name="moduleManager" ref="org.hisp.dhis.webportal.module.ModuleManager" />
- <property name="styleManager" ref="org.hisp.dhis.options.style.StyleManager" />
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService"/>
- <property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService"/>
+ <property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager"/>
+ <property name="moduleManager" ref="org.hisp.dhis.webportal.module.ModuleManager"/>
+ <property name="styleManager" ref="org.hisp.dhis.options.style.StyleManager"/>
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService"/>
+ <property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService"/>
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService"/>
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService"/>
</bean>
<bean id="org.hisp.dhis.settings.action.system.SetSystemSettingsAction"
@@ -23,6 +25,8 @@
<property name="styleManager" ref="org.hisp.dhis.options.style.StyleManager" />
<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService"/>
<property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService"/>
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService"/>
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService"/>
</bean>
<!-- User settings -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2011-06-09 14:43:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2011-06-10 11:47:41 +0000
@@ -91,5 +91,7 @@
days_after_period_timeliness = Days after period end to qualify for timely data submission
system_identifier = System identifier
can_be_set_once = can only be set once
+infrastructural_data_elements = Infrastructural data elements
+infrastructural_period_type = Infrastructural period type
feedback_recipients = Feedback recipients
no_feedback_recipients = No message recipients
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm 2011-06-09 14:43:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemSettings.vm 2011-06-10 11:47:41 +0000
@@ -51,6 +51,26 @@
</select>
</p>
+<h4>$i18n.getString( "infrastructural_data_elements" )</h4>
+
+<p>
+<select name="infrastructuralDataElements" style="width:30em">
+ #foreach ( $group in $dataElementGroups )
+ <option value="$group.id" #if( $group.id == $configuration.infrastructuralDataElements.id )selected="selected"#end>$group.name</option>
+ #end
+</select>
+</p>
+
+<h4>$i18n.getString( "infrastructural_period_type" )</h4>
+
+<p>
+<select name="infrastructuralPeriodType" style="width:30em">
+ #foreach ( $type in $periodTypes )
+ <option value="$type.name" #if( $type.name == $configuration.infrastructuralPeriodType.name )selected="selected"#end>$type.name</option>
+ #end
+</select>
+</p>
+
<h4>$i18n.getString( "feedback_recipients" )</h4>
<p>
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllDataElementGroupSetsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllDataElementGroupSetsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllDataElementGroupSetsAction.java 2011-06-06 14:30:38 +0000
@@ -0,0 +1,82 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupSetNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ * @version $Id$
+ */
+public class GetAllDataElementGroupSetsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<DataElementGroupSet> object;
+
+ public List<DataElementGroupSet> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = new ArrayList<DataElementGroupSet>( dataElementService.getAllDataElementGroupSets() );
+
+ Collections.sort( object, new DataElementGroupSetNameComparator() );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2011-05-23 16:04:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2011-06-09 13:05:20 +0000
@@ -82,13 +82,6 @@
this.level = level;
}
- private Boolean symbol;
-
- public void setSymbol( Boolean symbol )
- {
- this.symbol = symbol;
- }
-
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -114,8 +107,10 @@
object = organisationUnitService.getOrganisationUnitsAtLevel( level, parent );
FilterUtils.filter( object, new OrganisationUnitWithCoordinatesFilter() );
+
+ String returnType = object.size() > 0 ? object.iterator().next().getFeatureType() : NONE;
- if ( symbol != null )
+ if ( returnType.equals( OrganisationUnit.FEATURETYPE_POINT ) )
{
OrganisationUnitGroupSet typeGroupSet = organisationUnitGroupService
.getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_TYPE );
@@ -128,19 +123,8 @@
organisationUnit.setType( organisationUnit.getGroupNameInGroupSet( typeGroupSet ) );
}
}
-
- if ( object.size() > 0 && object.iterator().next().getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
- {
- return OrganisationUnit.RESULTTYPE_SYMBOL;
- }
-
- else
- {
- object.clear();
- return NONE;
- }
}
- return object.size() > 0 ? object.iterator().next().getFeatureType() : NONE;
+ return returnType;
}
}
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetInfrastructuralDataElementMapValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetInfrastructuralDataElementMapValuesAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetInfrastructuralDataElementMapValuesAction.java 2011-06-08 13:52:49 +0000
@@ -0,0 +1,98 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * 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 java.util.Collection;
+
+import org.hisp.dhis.aggregation.AggregatedMapValue;
+import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.system.util.DateUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ * @version $Id$
+ */
+public class GetInfrastructuralDataElementMapValuesAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer periodId;
+
+ public void setPeriodId( Integer periodId )
+ {
+ this.periodId = periodId;
+ }
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<AggregatedMapValue> object;
+
+ public Collection<AggregatedMapValue> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = mappingService.getInfrastructuralDataElementMapValues( periodId, organisationUnitId );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2011-02-01 10:49:05 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2011-06-08 13:52:49 +0000
@@ -34,10 +34,14 @@
import java.util.Collections;
import java.util.List;
+import org.hisp.dhis.configuration.ConfigurationService;
+import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.mapping.MapLayer;
import org.hisp.dhis.mapping.MapView;
import org.hisp.dhis.mapping.MappingService;
import org.hisp.dhis.mapping.comparator.MapLayerNameComparator;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.user.UserSettingService;
import com.opensymphony.xwork2.Action;
@@ -66,6 +70,20 @@
{
this.userSettingService = userSettingService;
}
+
+ private ConfigurationService configurationService;
+
+ public void setConfigurationService( ConfigurationService configurationService )
+ {
+ this.configurationService = configurationService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
// -------------------------------------------------------------------------
// Input
@@ -109,6 +127,20 @@
{
return overlays;
}
+
+ private DataElementGroup infrastructuralDataElements;
+
+ public DataElementGroup getInfrastructuralDataElements()
+ {
+ return infrastructuralDataElements;
+ }
+
+ private PeriodType infrastructuralPeriodType;
+
+ public PeriodType getInfrastructuralPeriodType()
+ {
+ return infrastructuralPeriodType;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -135,7 +167,11 @@
overlays = new ArrayList<MapLayer>( mappingService.getMapLayersByType( MappingService.MAP_LAYER_TYPE_OVERLAY ) );
- Collections.sort( overlays, new MapLayerNameComparator() );
+ Collections.sort( overlays, new MapLayerNameComparator() );
+
+ infrastructuralDataElements = configurationService.getConfiguration().getInfrastructuralDataElements();
+
+ infrastructuralPeriodType = configurationService.getConfiguration().getInfrastructuralPeriodType();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java 2011-03-08 14:55:19 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java 2011-06-09 08:28:38 +0000
@@ -27,7 +27,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.configuration.Configuration;
+import org.hisp.dhis.configuration.ConfigurationService;
import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import com.opensymphony.xwork2.Action;
@@ -49,10 +53,24 @@
this.systemSettingManager = systemSettingManager;
}
+ private ConfigurationService configurationService;
+
+ public void setConfigurationService( ConfigurationService configurationService )
+ {
+ this.configurationService = configurationService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
-
+
private String googleKey;
public void setGoogleKey( String googleKey )
@@ -60,6 +78,13 @@
this.googleKey = googleKey;
}
+ private String infrastructuralPeriodType;
+
+ public void setInfrastructuralPeriodType( String infrastructuralPeriodType )
+ {
+ this.infrastructuralPeriodType = infrastructuralPeriodType;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -71,7 +96,20 @@
{
systemSettingManager.saveSystemSetting( SystemSettingManager.KEY_GOOGLE_MAPS_API_KEY, googleKey );
}
-
+
+ if ( infrastructuralPeriodType != null )
+ {
+ Configuration configuration = configurationService.getConfiguration();
+
+ PeriodType periodType = infrastructuralPeriodType != null && !infrastructuralPeriodType.isEmpty() ? periodService
+ .getPeriodTypeByClass( PeriodType.getPeriodTypeByName( infrastructuralPeriodType ).getClass() )
+ : null;
+
+ configuration.setInfrastructuralPeriodType( periodType );
+
+ configurationService.setConfiguration( configuration );
+ }
+
return SUCCESS;
}
-}
+}
\ No newline at end of file
=== 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-04-22 18:38:43 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-06-08 13:52:49 +0000
@@ -14,8 +14,10 @@
<bean id="org.hisp.dhis.mapping.action.InitializeAction"
class="org.hisp.dhis.mapping.action.InitializeAction"
scope="prototype">
+ <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
<property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
- <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+ <property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
<!-- OrganisationUnit -->
@@ -74,6 +76,9 @@
class="org.hisp.dhis.mapping.action.SetMapSystemSettingsAction"
scope="prototype">
<property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
+ <property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+
</bean>
<bean id="org.hisp.dhis.mapping.action.DeleteMapSystemSettingsAction"
@@ -96,6 +101,11 @@
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
+ <bean id="org.hisp.dhis.mapping.action.GetInfrastructuralDataElementMapValuesAction"
+ class="org.hisp.dhis.mapping.action.GetInfrastructuralDataElementMapValuesAction" scope="prototype">
+ <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+ </bean>
+
<!-- MapLegend -->
<bean id="org.hisp.dhis.mapping.action.AddOrUpdateMapLegendAction"
@@ -256,6 +266,12 @@
<!-- DataElement -->
+ <bean id="org.hisp.dhis.mapping.action.GetAllDataElementGroupSetsAction"
+ class="org.hisp.dhis.mapping.action.GetAllDataElementGroupSetsAction"
+ scope="prototype">
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ </bean>
+
<bean id="org.hisp.dhis.mapping.action.GetAllDataElementGroupsAction"
class="org.hisp.dhis.mapping.action.GetAllDataElementGroupsAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-05-13 10:42:19 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-06-09 13:05:20 +0000
@@ -57,7 +57,7 @@
<result name="success" type="velocity-json">
/dhis-web-mapping/void.vm</result>
</action>
-
+
<!-- OrganisationUnit -->
<action name="getAllOrganisationUnitLevels"
@@ -105,6 +105,12 @@
<result name="success" type="velocity-json">
/dhis-web-mapping/jsonminAggregatedMapValues.vm</result>
</action>
+
+ <action name="getInfrastructuralDataElementMapValues"
+ class="org.hisp.dhis.mapping.action.GetInfrastructuralDataElementMapValuesAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-mapping/jsonInfrastructuralAggregatedMapValues.vm</result>
+ </action>
<!-- MapLegend -->
@@ -286,6 +292,12 @@
<!-- DataElement -->
+ <action name="getAllDataElementGroupSets"
+ class="org.hisp.dhis.mapping.action.GetAllDataElementGroupSetsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-mapping/jsonDataElementGroupSets.vm</result>
+ </action>
+
<action name="getAllDataElementGroups"
class="org.hisp.dhis.mapping.action.GetAllDataElementGroupsAction">
<result name="success" type="velocity-json">
@@ -325,7 +337,6 @@
<result name="Point" type="velocity-json">/dhis-web-mapping/geojsonPoint.vm</result>
<result name="Polygon" type="velocity-json">/dhis-web-mapping/geojsonPolygon.vm</result>
<result name="MultiPolygon" type="velocity-json">/dhis-web-mapping/geojsonPolygon.vm</result>
- <result name="Symbol" type="velocity-json">/dhis-web-mapping/geojsonSymbol.vm</result>
<result name="none" type="velocity-json">/dhis-web-mapping/geojsonPolygon.vm</result>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm 2011-04-12 17:22:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm 2011-06-09 12:04:11 +0000
@@ -1,2 +1,2 @@
#set( $size = $object.size() )
-{"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":"Point","coordinates":$!encoder.jsEncode( $!{unit.validCoordinates} )},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode( ${unit.name} )","hasChildrenWithCoordinates":$!{unit.hasChildrenWithCoordinates()}#if ($type),"type":"$!encoder.jsonEncode( ${unit.type} )"#end}}#if( $velocityCount < $size ),#end #end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
+{"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":"Point","coordinates":$!encoder.jsEncode( $!{unit.validCoordinates} )},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode( ${unit.name} )","ft":"$!encoder.jsonEncode( ${unit.featureType} )","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})"}}#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/geojsonSymbol.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonSymbol.vm 2011-05-13 12:34:23 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonSymbol.vm 2011-06-09 12:04:11 +0000
@@ -1,2 +1,2 @@
#set($size = $object.size())
-{"type": "FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":"Point","coordinates": $!encoder.jsEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})","type":"$!encoder.jsonEncode(${unit.type})","code":"$!encoder.jsonEncode(${unit.code})","contactPerson":"$!encoder.jsonEncode(${unit.contactPerson})","address":"$!encoder.jsonEncode(${unit.address})","email":"$!encoder.jsonEncode(${unit.email} )","phoneNumber": "$!encoder.jsonEncode(${unit.phoneNumber})"}}#if($velocityCount<$size),#end#end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
+{"type": "FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":"Point","coordinates": $!encoder.jsEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})","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})"}}#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/jsonAggregatedMapValues.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonAggregatedMapValues.vm 2010-05-06 11:27:10 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonAggregatedMapValues.vm 2011-06-08 15:22:35 +0000
@@ -1,5 +1,5 @@
#set( $size = $object.size() )
-{ "mapvalues": [
+{ "mapValues": [
#foreach( $value in $object )
{
"orgUnitId": "$!{value.organisationUnitId}",
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonDataElementGroupSets.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonDataElementGroupSets.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonDataElementGroupSets.vm 2011-06-06 14:30:38 +0000
@@ -0,0 +1,2 @@
+#set( $size = $object.size() )
+{"dataElementGroupSets":[#foreach( $dataElementGroupSet in $object ) {"id":"$!{dataElementGroupSet.id}","name":"$!encoder.jsonEncode( ${dataElementGroupSet.name} )" }#if( $velocityCount < $size ),#end#end]}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInfrastructuralAggregatedMapValues.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInfrastructuralAggregatedMapValues.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInfrastructuralAggregatedMapValues.vm 2011-06-09 08:32:10 +0000
@@ -0,0 +1,1 @@
+#set( $size = $object.size() ){"mapValues":[#foreach( $value in $object ){"dataElementName":"$!{value.dataElementName}","value":$!{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/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2011-01-07 12:59:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2011-06-08 13:52:49 +0000
@@ -1,4 +1,3 @@
-#set( $baseLaysersSize = $baseLayers.size() )
#set( $overlaysSize = $overlays.size() )
{
"mapView": {
@@ -37,25 +36,10 @@
"mapDateType": "$!encoder.jsonEncode( ${mapDateType} )"
},
"systemSettings": {
- "aggregationStrategy": "$!encoder.jsonEncode( ${aggregationStrategy} )"
+ "aggregationStrategy": "$!encoder.jsonEncode( ${aggregationStrategy} )",
+ "infrastructuralDataElements": "$!{infrastructuralDataElements.id}",
+ "infrastructuralPeriodType": "$!{infrastructuralPeriodType.name}"
},
- "baseLayers": [
-#foreach( $baseLayer in $baseLayers )
- {
- "data": {
- "id": "$!{baseLayer.id}",
- "name": "$!encoder.jsonEncode( ${baseLayer.name} )",
- "type": "$!encoder.jsonEncode( ${baseLayer.type} )",
- "mapSource": "$!encoder.jsonEncode( ${baseLayer.mapSource} )",
- "layer": "$!encoder.jsonEncode( ${baseLayer.layer} )",
- "fillColor": "$!encoder.jsonEncode( ${baseLayer.fillColor} )",
- "fillOpacity": "$!{baseLayer.fillOpacity}",
- "strokeColor": "$!encoder.jsonEncode( ${baseLayer.strokeColor} )",
- "strokeWidth": "$!{baseLayer.strokeWidth}"
- }
- }#if( $velocityCount < $baseLaysersSize ),#end
-#end
- ],
"overlays": [
#foreach( $overlay in $overlays )
{
=== 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 2010-10-29 11:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm 2011-06-08 15:22:35 +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 ){"orgUnitId":"$!{value.organisationUnitId}","orgUnitName":"$!{value.organisationUnitName}","value":"$!{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/css/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2011-05-27 08:42:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2011-06-09 13:05:20 +0000
@@ -340,6 +340,12 @@
font:bold 11px arial;
color:#111;
}
+.window-information-title {
+ padding:0 0 3px 21px;
+ background:url('../../../images/information2.png') no-repeat 0 0 transparent;
+ font:bold 11px arial;
+ color:#111;
+}
/* Ext Panel */
.panel-title {
@@ -361,14 +367,27 @@
}
/* Ext Gridpanel */
+td.x-grid3-hd-over, td.sort-desc, td.sort-asc, td.x-grid3-hd-menu-open {
+ border-left-color:#eeeeee;
+}
+.x-grid3-header-offset {
+ padding-left:0px;
+}
.x-grid3-cell-inner {
color:#111111;
font-size:10px;
font-family:arial,ubuntu;
}
.x-grid3-hd-inner {
- color:#111111;
- font: bold 11px arial,ubuntu;
+ color:#0a0a0a;
+ font: 11px arial,ubuntu;
+}
+.x-grid3-row {
+ border-color:#ffffff;
+ border-bottom-color:#eeeeee;
+}
+.x-grid3-row-over {
+ color:red;
}
.sort-asc .x-grid3-sort-icon {
display:none;
@@ -376,9 +395,10 @@
#featuregrid_gp .x-grid3-header {
display:none;
}
-#featuregrid_gp .x-grid3-row {
- border-right:0px none;
- border-left:0px none;
+
+/* Ext TableLayout */
+.x-table-layout-cell {
+ vertical-align:top;
}
/* DHIS Help */
=== 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-05-26 13:44:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-06-08 12:11:42 +0000
@@ -36,6 +36,10 @@
window_width: 251,
window_position_x: 55,
window_position_y: 41,
+ adminwindow_collapsed: 77,
+ adminwindow_expanded_1: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 171 : 166,
+ adminwindow_expanded_2: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 145 : 143,
+
// GUI
@@ -497,7 +501,9 @@
isStartEnd: function() {
return this.value === G.conf.map_date_type_start_end;
}
- }
+ },
+
+ infrastructuralPeriodType: null
};
G.func = {
=== 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-05-27 08:42:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-06-10 11:47:41 +0000
@@ -1,4 +1,4 @@
-Ext.onReady( function() {
+Ext.onReady( function() {
Ext.BLANK_IMAGE_URL = '../resources/ext-ux/theme/gray-extend/gray-extend/s.gif';
Ext.override(Ext.form.Field,{showField:function(){this.show();this.container.up('div.x-form-item').setDisplayed(true);},hideField:function(){this.hide();this.container.up('div.x-form-item').setDisplayed(false);}});
Ext.QuickTips.init();
@@ -22,6 +22,8 @@
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;
@@ -156,6 +158,28 @@
}
});
+ var infrastructuralPeriodTypeStore = new Ext.data.JsonStore({
+ url: G.conf.path_mapping + 'getAllPeriodTypes' + G.conf.type,
+ root: 'periodTypes',
+ fields: ['name', 'displayName'],
+ autoLoad: false,
+ isLoaded: false,
+ listeners: {
+ 'load': G.func.storeLoadListener
+ }
+ });
+
+ var infrastructuralPeriodsByTypeStore = new Ext.data.JsonStore({
+ url: G.conf.path_mapping + 'getPeriodsByPeriodType' + G.conf.type,
+ root: 'periods',
+ fields: ['id', 'name'],
+ autoLoad: false,
+ isLoaded: false,
+ listeners: {
+ 'load': G.func.storeLoadListener
+ }
+ });
+
var predefinedMapLegendStore = new Ext.data.JsonStore({
url: G.conf.path_mapping + 'getAllMapLegends' + G.conf.type,
root: 'mapLegends',
@@ -261,7 +285,9 @@
dataElementsByGroup: dataElementsByGroupStore,
dataElement: dataElementStore,
periodType: periodTypeStore,
- periodsByTypeStore: periodsByTypeStore,
+ periodsByType: periodsByTypeStore,
+ infrastructuralPeriodType: infrastructuralPeriodTypeStore,
+ infrastructuralPeriodsByType: infrastructuralPeriodsByTypeStore,
predefinedMapLegend: predefinedMapLegendStore,
predefinedMapLegendSet: predefinedMapLegendSetStore,
organisationUnitLevel: organisationUnitLevelStore,
@@ -579,7 +605,7 @@
/* Section: export map */
var exportImageWindow = new Ext.Window({
id: 'exportimage_w',
- title: '<span id="window-image-title">Image export</span>',
+ title: '<span id="window-image-title">Export image</span>',
layout: 'fit',
closeAction: 'hide',
width: G.conf.window_width,
@@ -1641,143 +1667,6 @@
}
]
});
-
- /* Section: base layers */
- var baselayersWindow = new Ext.Window({
- id: 'baselayers_w',
- title: '<span id="window-maplayer-title">' + G.i18n.baselayers + '</span>',
- layout: 'fit',
- closeAction: 'hide',
- width: G.conf.window_width,
- height: 229,
- items: [
- {
- xtype: 'form',
- bodyStyle: 'padding:8px',
- items: [
- {html: '<div class="window-info">Register new base layer</div>'},
- {
- xtype: 'textfield',
- id: 'maplayerbaselayersname_tf',
- emptytext: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
- fieldLabel: G.i18n.display_name,
- width: G.conf.combo_width_fieldset,
- autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '35'}
- },
- {
- xtype: 'textfield',
- id: 'maplayerbaselayersurl_tf',
- emptytext: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
- fieldLabel: G.i18n.url,
- width: G.conf.combo_width_fieldset,
- },
- {
- xtype: 'textfield',
- id: 'maplayerbaselayerslayer_tf',
- emptytext: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
- fieldLabel: G.i18n.layer,
- width: G.conf.combo_width_fieldset,
- },
- {html: '<div class="window-p"></div>'},
- {html: '<div class="window-info">Delete overlay</div>'},
- {
- xtype: 'combo',
- id: 'maplayerbaselayers_cb',
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- emptytext: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
- fieldLabel: G.i18n.baselayer,
- width: G.conf.combo_width_fieldset,
- store: G.stores.baseLayer
- }
- ]
- }
- ],
- bbar: [
- '->',
- {
- xtype: 'button',
- id: 'newmaplayerbaselayers_b',
- text: G.i18n.register,
- iconCls: 'icon-add',
- handler: function() {
- var mlbn = Ext.getCmp('maplayerbaselayersname_tf').getValue();
- var mlbu = Ext.getCmp('maplayerbaselayersurl_tf').getValue();
- var mlbl = Ext.getCmp('maplayerbaselayerslayer_tf').getValue();
-
- if (!mlbn || !mlbu || !mlbl) {
- Ext.message.msg(false, G.i18n.form_is_not_complete);
- return;
- }
-
- if (G.stores.baseLayer.find('name', mlbn) !== -1) {
- Ext.message.msg(false, G.i18n.name + ' <span class="x-msg-hl">' + mlbn + '</span> ' + G.i18n.is_already_in_use);
- return;
- }
-
- Ext.Ajax.request({
- url: G.conf.path_mapping + 'addOrUpdateMapLayer' + G.conf.type,
- method: 'POST',
- params: {name: mlbn, type: G.conf.map_layer_type_baselayer, mapSource: mlbu, layer: mlbl, fillColor: '', fillOpacity: 0, strokeColor: '', strokeWidth: 0},
- success: function(r) {
- Ext.message.msg(true, G.i18n.baselayer + '<span class="x-msg-hl"> ' + mlbn + '</span> ' + G.i18n.registered);
- G.vars.map.addLayers([
- new OpenLayers.Layer.WMS(mlbn, mlbu, {layers: mlbl})
- ]);
-
- G.stores.baseLayer.load();
- Ext.getCmp('maplayerbaselayersname_tf').reset();
- Ext.getCmp('maplayerbaselayersurl_tf').reset();
- Ext.getCmp('maplayerbaselayerslayer_tf').reset();
- }
- });
- }
- },
- {
- xtype: 'button',
- id: 'deletemaplayerbaselayers_b',
- text: G.i18n.delete_,
- iconCls: 'icon-remove',
- handler: function() {
- var ml = Ext.getCmp('maplayerbaselayers_cb').getValue();
- var mln = Ext.getCmp('maplayerbaselayers_cb').getRawValue();
-
- if (!ml) {
- Ext.message.msg(false, G.i18n.please_select_a_baselayer);
- return;
- }
-
- Ext.Ajax.request({
- url: G.conf.path_mapping + 'deleteMapLayer' + G.conf.type,
- method: 'POST',
- params: {id: ml},
- success: function(r) {
- Ext.message.msg(true, G.i18n.baselayer + ' <span class="x-msg-hl">' + mln + '</span> '+G.i18n.deleted);
- G.stores.baseLayer.load({callback: function() {
- Ext.getCmp('maplayerbaselayers_cb').clearValue();
- var names = G.stores.baseLayer.collect('name');
-
- for (var i = 0; i < names.length; i++) {
- G.vars.map.getLayersByName(names[i])[0].setVisibility(false);
- }
-
- G.vars.map.getLayersByName(mln)[0].destroy(false);
- }});
- }
- });
-
- }
- }
- ]
- });
/* Section: administrator settings */
var adminWindow = new Ext.Window({
@@ -1786,8 +1675,8 @@
layout: 'accordion',
closeAction: 'hide',
width: G.conf.window_width,
- height: 145,
- minHeight: 77,
+ height: G.conf.adminwindow_expanded_1,
+ minHeight: G.conf.adminwindow_collapsed,
items: [
{
title: 'Google Maps',
@@ -1857,11 +1746,13 @@
}
],
listeners: {
- expand: function() {
- adminWindow.setHeight(Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 170 : 166);
+ expand: {
+ fn: function() {
+ adminWindow.setHeight(G.conf.adminwindow_expanded_1);
+ }
},
collapse: function() {
- adminWindow.setHeight(77);
+ adminWindow.setHeight(G.conf.adminwindow_collapsed);
}
}
},
@@ -1920,17 +1811,17 @@
],
listeners: {
expand: function() {
- adminWindow.setHeight(Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 145 : 143);
+ adminWindow.setHeight(G.conf.adminwindow_expanded_2);
},
collapse: function() {
- adminWindow.setHeight(77);
+ adminWindow.setHeight(G.conf.adminwindow_collapsed);
}
}
- }
+ }
],
listeners: {
afterrender: function() {
- adminWindow.setHeight(Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 170 : 166);
+ adminWindow.setHeight(G.conf.adminwindow_expanded_1);
}
}
});
@@ -2050,7 +1941,7 @@
id: 'locatefeature_tf',
emptyText: G.conf.emptytext,
labelSeparator: G.conf.labelseparator,
- fieldLabel: G.i18n.feature_filter,
+ fieldLabel: 'Text filter',
width: G.conf.combo_width_fieldset,
enableKeyEvents: true,
listeners: {
@@ -2663,7 +2554,9 @@
tooltip: 'Administrator settings',
disabled: !G.user.isAdmin,
style: 'margin-top:1px',
- handler: function() {
+ handler: function() {
+console.log(G.stores.infrastructuralDataElementMapValue);
+return;
if (!adminWindow.hidden) {
adminWindow.hide();
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/theme/gray-extend/xtheme-gray-extend.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/theme/gray-extend/xtheme-gray-extend.css 2011-05-19 08:26:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/theme/gray-extend/xtheme-gray-extend.css 2011-06-09 09:40:41 +0000
@@ -478,7 +478,6 @@
td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-asc .x-grid3-hd-inner, td.x-grid3-hd-menu-open .x-grid3-hd-inner {
background-color:#f2f2f2;
background-image:url(gray-extend/grid/grid3-hrow-over.gif);
-
}
.sort-asc .x-grid3-sort-icon {
background-image: url(gray-extend/grid/sort_asc.gif);
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-05-25 12:46:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-06-09 09:03:56 +0000
@@ -167,8 +167,8 @@
mapfish.GeoStat.Distribution = OpenLayers.Class({
- labelGenerator: function(bin, binIndex, nbBins, maxDec) {
- return this.defaultLabelGenerator(bin, binIndex, nbBins, maxDec);
+ labelGenerator: function(bin, binIndex, nbBins) {
+ return this.defaultLabelGenerator(bin, binIndex, nbBins);
},
values: null,
@@ -187,9 +187,9 @@
this.maxVal = this.nbVal ? mapfish.Util.max(this.values) : 0;
},
- defaultLabelGenerator: function(bin, binIndex, nbBins, maxDec) {
- lower = parseFloat(bin.lowerBound).toFixed(maxDec);
- upper = parseFloat(bin.upperBound).toFixed(maxDec);
+ defaultLabelGenerator: function(bin, binIndex, nbBins) {
+ lower = parseFloat(bin.lowerBound).toFixed(1);
+ upper = parseFloat(bin.upperBound).toFixed(1);
return lower + ' - ' + upper + ' ( ' + bin.nbVal + ' )';
},
@@ -197,7 +197,6 @@
var bins = [];
var binCount = [];
var sortedValues = [];
- var maxDec = 0;
for (var i = 0; i < this.values.length; i++) {
sortedValues.push(this.values[i]);
@@ -219,18 +218,11 @@
}
binCount[nbBins - 1] = this.nbVal - mapfish.Util.sum(binCount);
-
- for (var l = 0; l < bounds.length; l++) {
- var dec = G.util.getNumberOfDecimals(bounds[l].toString(), ".");
- maxDec = dec > maxDec ? dec : maxDec;
- }
-
- maxDec = maxDec > 3 ? 3 : maxDec;
for (var m = 0; m < nbBins; m++) {
bins[m] = new mapfish.GeoStat.Bin(binCount[m], bounds[m], bounds[m + 1], m == (nbBins - 1));
var labelGenerator = this.labelGenerator || this.defaultLabelGenerator;
- bins[m].label = labelGenerator(bins[m], m, nbBins, maxDec);
+ bins[m].label = labelGenerator(bins[m], m, nbBins);
}
return new mapfish.GeoStat.Classification(bins);
=== 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-05-26 13:44:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-06-10 11:47:41 +0000
@@ -78,6 +78,10 @@
imageLegend: false,
+ stores: false,
+
+ infrastructuralPeriod: false,
+
initComponent: function() {
this.initProperties();
@@ -212,6 +216,20 @@
return this.value == G.conf.map_value_type_dataelement;
}
};
+
+ this.stores = {
+ infrastructuralDataElementMapValue: new Ext.data.JsonStore({
+ url: G.conf.path_mapping + 'getInfrastructuralDataElementMapValues' + G.conf.type,
+ root: 'mapValues',
+ fields: ['dataElementName', 'value'],
+ sortInfo: {field: 'dataElementName', direction: 'ASC'},
+ autoLoad: false,
+ isLoaded: false,
+ listeners: {
+ 'load': G.func.storeLoadListener
+ }
+ })
+ };
},
createItems: function() {
@@ -488,8 +506,8 @@
scope: this,
fn: function(cb) {
this.form.findField('period').clearValue();
- G.stores.periodsByTypeStore.setBaseParam('name', cb.getValue());
- G.stores.periodsByTypeStore.load();
+ G.stores.periodsByType.setBaseParam('name', cb.getValue());
+ G.stores.periodsByType.load();
}
}
}
@@ -508,7 +526,7 @@
triggerAction: 'all',
selectOnFocus: true,
width: G.conf.combo_width,
- store: G.stores.periodsByTypeStore,
+ store: G.stores.periodsByType,
keepPosition: false,
listeners: {
'select': {
@@ -1012,32 +1030,141 @@
};
var onClickSelect = function onClickSelect(feature) {
- if (feature.attributes.hasChildrenWithCoordinates) {
- if (G.vars.locateFeatureWindow) {
- G.vars.locateFeatureWindow.destroy();
- }
-
- scope.updateValues = true;
- scope.isDrillDown = true;
-
- function organisationUnitLevelCallback() {
- var names = this.organisationUnitSelection.setValuesOnDrillDown(feature.attributes.id, feature.attributes.name);
- this.form.findField('boundary').setValue(names[0]);
- this.form.findField('level').setValue(names[1]);
- this.loadGeoJson();
- }
-
- if (G.stores.organisationUnitLevel.isLoaded) {
- organisationUnitLevelCallback.call(scope);
+ if (feature.attributes.ft == G.conf.map_feature_type_point) {
+ if (scope.featureInfoWindow) {
+ scope.featureInfoWindow.destroy();
+ }
+
+ function fn() {
+ scope.featureInfoWindow = new Ext.Window({
+ title: '<span class="window-information-title">' + feature.attributes.name + '</span>',
+ layout: 'table',
+ width: G.conf.window_width + 178,
+ height: G.util.getMultiSelectHeight() + 100,
+ bodyStyle: 'background-color:#fff',
+ defaults: {
+ bodyStyle: 'vertical-align:top',
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ },
+ layoutConfig: {
+ columns: 2
+ },
+ items: [
+ {
+ xtype: 'panel',
+ layout: 'anchor',
+ bodyStyle: 'padding:8px 4px 8px 8px',
+ width: 160,
+ items: [
+ {html: '<div class="window-info">Type<p style="font-weight:normal">' + feature.attributes.type + '</p></div>'},
+ {html: '<div class="window-info">Code<p style="font-weight:normal">' + feature.attributes.code + '</p></div>'},
+ {html: '<div class="window-info">Address<p style="font-weight:normal">' + feature.attributes.ad + '</p></div>'},
+ {html: '<div class="window-info">Contact person<p style="font-weight:normal">' + feature.attributes.cp + '</p></div>'},
+ {html: '<div class="window-info">Email<p style="font-weight:normal">' + feature.attributes.em + '</p></div>'},
+ {html: '<div class="window-info">Phone number<p style="font-weight:normal">' + feature.attributes.pn + '</p></div>'}
+ ]
+ },
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px 8px 8px 4px',
+ width: G.conf.window_width + 20,
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">Infrastructural data</div>'},
+ {
+ xtype: 'combo',
+ name: 'period',
+ fieldLabel: G.i18n.period,
+ typeAhead: true,
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ width: G.conf.combo_width,
+ store: G.stores.infrastructuralPeriodsByType,
+ keepPosition: false,
+ listeners: {
+ 'select': function(cb) {
+ scope.infrastructuralPeriod = cb.getValue();
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+ }
+ },
+ {html: '<div style="padding:4px 0 0 0"></div>'},
+ {
+ xtype: 'grid',
+ height: G.util.getMultiSelectHeight(),
+ width: 242,
+ cm: new Ext.grid.ColumnModel({
+ columns: [
+ {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
+ {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
+ ]
+ }),
+ disableSelection: true,
+ viewConfig: {forceFit: true},
+ store: scope.stores.infrastructuralDataElementMapValue
+ }
+ ]
+ }
+ ]
+ });
+
+ if (scope.infrastructuralPeriod) {
+ scope.featureInfoWindow.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+
+ scope.featureInfoWindow.setPagePosition(Ext.getCmp('east').x - (G.conf.window_width + 178 + 15 + 5), Ext.getCmp('center').y + 41);
+ scope.featureInfoWindow.show();
+ }
+
+ if (G.stores.infrastructuralPeriodsByType.isLoaded) {
+ fn();
}
else {
- G.stores.organisationUnitLevel.load({scope: scope, callback: function() {
- organisationUnitLevelCallback.call(this);
+ G.stores.infrastructuralPeriodsByType.setBaseParam('name', G.system.infrastructuralPeriodType);
+ G.stores.infrastructuralPeriodsByType.load({callback: function() {
+ fn();
}});
}
}
else {
- Ext.message.msg(false, G.i18n.no_coordinates_found);
+ if (feature.attributes.hasChildrenWithCoordinates) {
+ if (G.vars.locateFeatureWindow) {
+ G.vars.locateFeatureWindow.destroy();
+ }
+
+ scope.updateValues = true;
+ scope.isDrillDown = true;
+
+ function organisationUnitLevelCallback() {
+ var names = this.organisationUnitSelection.setValuesOnDrillDown(feature.attributes.id, feature.attributes.name);
+ this.form.findField('boundary').setValue(names[0]);
+ this.form.findField('level').setValue(names[1]);
+ this.loadGeoJson();
+ }
+
+ if (G.stores.organisationUnitLevel.isLoaded) {
+ organisationUnitLevelCallback.call(scope);
+ }
+ else {
+ G.stores.organisationUnitLevel.load({scope: scope, callback: function() {
+ organisationUnitLevelCallback.call(this);
+ }});
+ }
+ }
+ else {
+ Ext.message.msg(false, G.i18n.no_coordinates_found);
+ }
}
};
@@ -1107,7 +1234,7 @@
};
obj.stores = {
c1: G.stores.periodType,
- c2: G.stores.periodsByTypeStore
+ c2: G.stores.periodsByType
};
obj.mapView = {
c1: 'periodTypeId',
@@ -1510,7 +1637,7 @@
params: params,
scope: this,
success: function(r) {
- var mapvalues = Ext.util.JSON.decode(r.responseText).mapvalues;
+ var mapvalues = Ext.util.JSON.decode(r.responseText).mapValues;
if (!this.layer.features.length) {
Ext.message.msg(false, 'No coordinates found');
=== 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-05-26 13:44:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-06-10 11:47:41 +0000
@@ -78,6 +78,10 @@
imageLegend: false,
+ stores: false,
+
+ infrastructuralPeriod: false,
+
initComponent: function() {
this.initProperties();
@@ -183,6 +187,20 @@
return this.value == G.conf.map_value_type_dataelement;
}
};
+
+ this.stores = {
+ infrastructuralDataElementMapValue: new Ext.data.JsonStore({
+ url: G.conf.path_mapping + 'getInfrastructuralDataElementMapValues' + G.conf.type,
+ root: 'mapValues',
+ fields: ['dataElementName', 'value'],
+ sortInfo: {field: 'dataElementName', direction: 'ASC'},
+ autoLoad: false,
+ isLoaded: false,
+ listeners: {
+ 'load': G.func.storeLoadListener
+ }
+ })
+ };
},
createItems: function() {
@@ -459,8 +477,8 @@
scope: this,
fn: function(cb) {
this.form.findField('period').clearValue();
- G.stores.periodsByTypeStore.setBaseParam('name', cb.getValue());
- G.stores.periodsByTypeStore.load();
+ G.stores.periodsByType.setBaseParam('name', cb.getValue());
+ G.stores.periodsByType.load();
}
}
}
@@ -479,7 +497,7 @@
triggerAction: 'all',
selectOnFocus: true,
width: G.conf.combo_width,
- store: G.stores.periodsByTypeStore,
+ store: G.stores.periodsByType,
keepPosition: false,
listeners: {
'select': {
@@ -983,32 +1001,141 @@
};
var onClickSelect = function onClickSelect(feature) {
- if (feature.attributes.hasChildrenWithCoordinates) {
- if (G.vars.locateFeatureWindow) {
- G.vars.locateFeatureWindow.destroy();
- }
-
- scope.updateValues = true;
- scope.isDrillDown = true;
-
- function organisationUnitLevelCallback() {
- var names = this.organisationUnitSelection.setValuesOnDrillDown(feature.attributes.id, feature.attributes.name);
- this.form.findField('boundary').setValue(names[0]);
- this.form.findField('level').setValue(names[1]);
- this.loadGeoJson();
- }
-
- if (G.stores.organisationUnitLevel.isLoaded) {
- organisationUnitLevelCallback.call(scope);
+ if (feature.attributes.ft == G.conf.map_feature_type_point) {
+ if (scope.featureInfoWindow) {
+ scope.featureInfoWindow.destroy();
+ }
+
+ function fn() {
+ scope.featureInfoWindow = new Ext.Window({
+ title: '<span class="window-information-title">' + feature.attributes.name + '</span>',
+ layout: 'table',
+ width: G.conf.window_width + 178,
+ height: G.util.getMultiSelectHeight() + 100,
+ bodyStyle: 'background-color:#fff',
+ defaults: {
+ bodyStyle: 'vertical-align:top',
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ },
+ layoutConfig: {
+ columns: 2
+ },
+ items: [
+ {
+ xtype: 'panel',
+ layout: 'anchor',
+ bodyStyle: 'padding:8px 4px 8px 8px',
+ width: 160,
+ items: [
+ {html: '<div class="window-info">Type<p style="font-weight:normal">' + feature.attributes.type + '</p></div>'},
+ {html: '<div class="window-info">Code<p style="font-weight:normal">' + feature.attributes.code + '</p></div>'},
+ {html: '<div class="window-info">Address<p style="font-weight:normal">' + feature.attributes.ad + '</p></div>'},
+ {html: '<div class="window-info">Contact person<p style="font-weight:normal">' + feature.attributes.cp + '</p></div>'},
+ {html: '<div class="window-info">Email<p style="font-weight:normal">' + feature.attributes.em + '</p></div>'},
+ {html: '<div class="window-info">Phone number<p style="font-weight:normal">' + feature.attributes.pn + '</p></div>'}
+ ]
+ },
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px 8px 8px 4px',
+ width: G.conf.window_width + 20,
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">Infrastructural data</div>'},
+ {
+ xtype: 'combo',
+ name: 'period',
+ fieldLabel: G.i18n.period,
+ typeAhead: true,
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ width: G.conf.combo_width,
+ store: G.stores.infrastructuralPeriodsByType,
+ keepPosition: false,
+ listeners: {
+ 'select': function(cb) {
+ scope.infrastructuralPeriod = cb.getValue();
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+ }
+ },
+ {html: '<div style="padding:4px 0 0 0"></div>'},
+ {
+ xtype: 'grid',
+ height: G.util.getMultiSelectHeight(),
+ width: 242,
+ cm: new Ext.grid.ColumnModel({
+ columns: [
+ {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
+ {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
+ ]
+ }),
+ disableSelection: true,
+ viewConfig: {forceFit: true},
+ store: scope.stores.infrastructuralDataElementMapValue
+ }
+ ]
+ }
+ ]
+ });
+
+ if (scope.infrastructuralPeriod) {
+ scope.featureInfoWindow.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+
+ scope.featureInfoWindow.setPagePosition(Ext.getCmp('east').x - (G.conf.window_width + 178 + 15 + 5), Ext.getCmp('center').y + 41);
+ scope.featureInfoWindow.show();
+ }
+
+ if (G.stores.infrastructuralPeriodsByType.isLoaded) {
+ fn();
}
else {
- G.stores.organisationUnitLevel.load({scope: scope, callback: function() {
- organisationUnitLevelCallback.call(this);
+ G.stores.infrastructuralPeriodsByType.setBaseParam('name', G.system.infrastructuralPeriodType);
+ G.stores.infrastructuralPeriodsByType.load({callback: function() {
+ fn();
}});
}
}
else {
- Ext.message.msg(false, G.i18n.no_coordinates_found);
+ if (feature.attributes.hasChildrenWithCoordinates) {
+ if (G.vars.locateFeatureWindow) {
+ G.vars.locateFeatureWindow.destroy();
+ }
+
+ scope.updateValues = true;
+ scope.isDrillDown = true;
+
+ function organisationUnitLevelCallback() {
+ var names = this.organisationUnitSelection.setValuesOnDrillDown(feature.attributes.id, feature.attributes.name);
+ this.form.findField('boundary').setValue(names[0]);
+ this.form.findField('level').setValue(names[1]);
+ this.loadGeoJson();
+ }
+
+ if (G.stores.organisationUnitLevel.isLoaded) {
+ organisationUnitLevelCallback.call(scope);
+ }
+ else {
+ G.stores.organisationUnitLevel.load({scope: scope, callback: function() {
+ organisationUnitLevelCallback.call(this);
+ }});
+ }
+ }
+ else {
+ Ext.message.msg(false, G.i18n.no_coordinates_found);
+ }
}
};
@@ -1078,7 +1205,7 @@
};
obj.stores = {
c1: G.stores.periodType,
- c2: G.stores.periodsByTypeStore
+ c2: G.stores.periodsByType
};
obj.mapView = {
c1: 'periodTypeId',
@@ -1481,7 +1608,7 @@
params: params,
scope: this,
success: function(r) {
- var mapvalues = Ext.util.JSON.decode(r.responseText).mapvalues;
+ var mapvalues = Ext.util.JSON.decode(r.responseText).mapValues;
if (!this.layer.features.length) {
Ext.message.msg(false, 'No coordinates found');
=== 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-05-23 16:04:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-06-10 11:47:41 +0000
@@ -76,24 +76,9 @@
iconCombos: [],
- iconStore: new Ext.data.ArrayStore({
- fields: ['name', 'css'],
- data: [
- ['0','ux-ic-icon-0'],
- ['1','ux-ic-icon-1'],
- ['2','ux-ic-icon-2'],
- ['3','ux-ic-icon-3'],
- ['4','ux-ic-icon-4'],
- ['5','ux-ic-icon-5'],
- ['6','ux-ic-icon-6'],
- ['7','ux-ic-icon-7'],
- ['8','ux-ic-icon-8'],
- ['9','ux-ic-icon-9'],
- ['10','ux-ic-icon-10'],
- ['11','ux-ic-icon-11'],
- ['12','ux-ic-icon-12']
- ]
- }),
+ stores: false,
+
+ infrastructuralPeriod: false,
initComponent: function() {
@@ -200,6 +185,38 @@
return this.value == G.conf.map_value_type_dataelement;
}
};
+
+ this.stores = {
+ icon: new Ext.data.ArrayStore({
+ fields: ['name', 'css'],
+ data: [
+ ['0','ux-ic-icon-0'],
+ ['1','ux-ic-icon-1'],
+ ['2','ux-ic-icon-2'],
+ ['3','ux-ic-icon-3'],
+ ['4','ux-ic-icon-4'],
+ ['5','ux-ic-icon-5'],
+ ['6','ux-ic-icon-6'],
+ ['7','ux-ic-icon-7'],
+ ['8','ux-ic-icon-8'],
+ ['9','ux-ic-icon-9'],
+ ['10','ux-ic-icon-10'],
+ ['11','ux-ic-icon-11'],
+ ['12','ux-ic-icon-12']
+ ]
+ }),
+ infrastructuralDataElementMapValue: new Ext.data.JsonStore({
+ url: G.conf.path_mapping + 'getInfrastructuralDataElementMapValues' + G.conf.type,
+ root: 'mapValues',
+ fields: ['dataElementName', 'value'],
+ sortInfo: {field: 'dataElementName', direction: 'ASC'},
+ autoLoad: false,
+ isLoaded: false,
+ listeners: {
+ 'load': G.func.storeLoadListener
+ }
+ })
+ };
},
createItems: function() {
@@ -325,7 +342,7 @@
labelSeparator: G.conf.labelseparator,
width: 50,
listWidth: 50,
- store: this.iconStore,
+ store: this.stores.icon,
listeners: {
'select': {
scope: this,
@@ -505,36 +522,143 @@
};
var onClickSelect = function onClickSelect(feature) {
- var featureInfoWindow = scope.form.findField('groupset').featureInfoWindow;
- if (featureInfoWindow) {
- featureInfoWindow.destroy();
- }
-
- var cssCls = G.stores.groupsByGroupSet.img[G.stores.groupsByGroupSet.find('name', feature.attributes.type)] + '-title';
- featureInfoWindow = new Ext.Window({
- title: '<span class="' + cssCls + '">' + feature.attributes.name + '</span>',
- layout: 'fit',
- width: 200,
- height: 225,
- items: [
- {
- xtype: 'panel',
- layout: 'anchor',
- bodyStyle: 'padding:8px',
+ if (feature.attributes.ft == G.conf.map_feature_type_point) {
+ if (scope.featureInfoWindow) {
+ scope.featureInfoWindow.destroy();
+ }
+
+ function fn() {
+ var cssCls = G.stores.groupsByGroupSet.img[G.stores.groupsByGroupSet.find('name', feature.attributes.type)] + '-title';
+ scope.featureInfoWindow = new Ext.Window({
+ title: '<span class="' + cssCls + '">' + feature.attributes.name + '</span>',
+ layout: 'table',
+ width: G.conf.window_width + 178,
+ height: G.util.getMultiSelectHeight() + 100,
+ bodyStyle: 'background-color:#fff',
+ defaults: {
+ bodyStyle: 'vertical-align:top',
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ },
+ layoutConfig: {
+ columns: 2
+ },
items: [
- {html: '<div class="window-info">Type:<p style="font-weight:normal">' + feature.attributes.type + '</p></div>'},
- {html: '<div class="window-info">Address:<p style="font-weight:normal">' + feature.attributes.address + '</p></div>'},
- {html: '<div class="window-info">Contact person:<p style="font-weight:normal">' + feature.attributes.contactPerson + '</p></div>'},
- {html: '<div class="window-info">Email:<p style="font-weight:normal">' + feature.attributes.email + '</p></div>'},
- {html: '<div class="window-info">Phone number:<p style="font-weight:normal">' + feature.attributes.phoneNumber + '</p></div>'}
+ {
+ xtype: 'panel',
+ layout: 'anchor',
+ bodyStyle: 'padding:8px 4px 8px 8px',
+ width: 160,
+ items: [
+ {html: '<div class="window-info">Type<p style="font-weight:normal">' + feature.attributes.type + '</p></div>'},
+ {html: '<div class="window-info">Code<p style="font-weight:normal">' + feature.attributes.code + '</p></div>'},
+ {html: '<div class="window-info">Address<p style="font-weight:normal">' + feature.attributes.ad + '</p></div>'},
+ {html: '<div class="window-info">Contact person<p style="font-weight:normal">' + feature.attributes.cp + '</p></div>'},
+ {html: '<div class="window-info">Email<p style="font-weight:normal">' + feature.attributes.em + '</p></div>'},
+ {html: '<div class="window-info">Phone number<p style="font-weight:normal">' + feature.attributes.pn + '</p></div>'}
+ ]
+ },
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px 8px 8px 4px',
+ width: G.conf.window_width + 20,
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">Infrastructural data</div>'},
+ {
+ xtype: 'combo',
+ name: 'period',
+ fieldLabel: G.i18n.period,
+ typeAhead: true,
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ width: G.conf.combo_width,
+ store: G.stores.infrastructuralPeriodsByType,
+ keepPosition: false,
+ listeners: {
+ 'select': function(cb) {
+ scope.infrastructuralPeriod = cb.getValue();
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+ }
+ },
+ {html: '<div style="padding:4px 0 0 0"></div>'},
+ {
+ xtype: 'grid',
+ height: G.util.getMultiSelectHeight(),
+ width: 242,
+ cm: new Ext.grid.ColumnModel({
+ columns: [
+ {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
+ {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
+ ]
+ }),
+ disableSelection: true,
+ viewConfig: {forceFit: true},
+ store: scope.stores.infrastructuralDataElementMapValue
+ }
+ ]
+ }
]
- }
- ]
- });
-
- featureInfoWindow.setPagePosition(Ext.getCmp('east').x - (G.conf.window_width + 15 + 5 - 51), Ext.getCmp('center').y + 41);
- scope.form.findField('groupset').featureInfoWindow = featureInfoWindow;
- featureInfoWindow.show();
+ });
+
+ if (scope.infrastructuralPeriod) {
+ scope.featureInfoWindow.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+
+ scope.featureInfoWindow.setPagePosition(Ext.getCmp('east').x - (G.conf.window_width + 178 + 15 + 5), Ext.getCmp('center').y + 41);
+ scope.featureInfoWindow.show();
+ }
+
+ if (G.stores.infrastructuralPeriodsByType.isLoaded) {
+ fn();
+ }
+ else {
+ G.stores.infrastructuralPeriodsByType.setBaseParam('name', G.system.infrastructuralPeriodType);
+ G.stores.infrastructuralPeriodsByType.load({callback: function() {
+ fn();
+ }});
+ }
+ }
+ else {
+ if (feature.attributes.hasChildrenWithCoordinates) {
+ if (G.vars.locateFeatureWindow) {
+ G.vars.locateFeatureWindow.destroy();
+ }
+
+ scope.updateValues = true;
+ scope.isDrillDown = true;
+
+ function organisationUnitLevelCallback() {
+ var names = this.organisationUnitSelection.setValuesOnDrillDown(feature.attributes.id, feature.attributes.name);
+ this.form.findField('boundary').setValue(names[0]);
+ this.form.findField('level').setValue(names[1]);
+ this.loadGeoJson();
+ }
+
+ if (G.stores.organisationUnitLevel.isLoaded) {
+ organisationUnitLevelCallback.call(scope);
+ }
+ else {
+ G.stores.organisationUnitLevel.load({scope: scope, callback: function() {
+ organisationUnitLevelCallback.call(this);
+ }});
+ }
+ }
+ else {
+ Ext.message.msg(false, G.i18n.no_coordinates_found);
+ }
+ }
};
this.selectFeatures = new OpenLayers.Control.newSelectFeature(
@@ -637,8 +761,7 @@
this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' +
'parentId=' + this.organisationUnitSelection.parent.id +
- '&level=' + this.organisationUnitSelection.level.level +
- '&symbol=true'
+ '&level=' + this.organisationUnitSelection.level.level
);
},
Follow ups