=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-05-05 21:14:56 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-05-13 10:42:19 +0000 @@ -60,6 +60,7 @@ public static final String FEATURETYPE_MULTIPOLYGON = "MultiPolygon"; public static final String FEATURETYPE_POLYGON = "Polygon"; public static final String FEATURETYPE_POINT = "Point"; + public static final String RESULTTYPE_SYMBOL = "Symbol"; private static final Comparator COMPARATOR = new OrganisationUnitNameComparator(); private static final Pattern JSON_COORDINATE_PATTERN = Pattern.compile( "(\\[{3}.*?\\]{3})" ); @@ -322,6 +323,13 @@ return null; } + public Integer getGroupIdInGroupSet( OrganisationUnitGroupSet groupSet ) + { + final OrganisationUnitGroup group = getGroupInGroupSet( groupSet ); + + return group != null ? group.getId() : null; + } + public String getGroupNameInGroupSet( OrganisationUnitGroupSet groupSet ) { final OrganisationUnitGroup group = getGroupInGroupSet( groupSet ); === added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSets.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSets.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSets.vm 2011-04-28 15:43:17 +0000 @@ -0,0 +1,9 @@ +#set( $size = $organisationUnitGroupSets.size() ) +{ "organisationUnitGroupSets": [ +#foreach( $groupSet in $organisationUnitGroupSets ) + { + "id": "$groupSet.id", + "name": "$!encoder.jsonEncode( ${groupSet.name} )" + }#if( $velocityCount < $size ),#end +#end +] } === added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupSetsAction.java 2011-04-28 15:43:17 +0000 @@ -0,0 +1,75 @@ +package org.hisp.dhis.commons.action; + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; +import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; + +import com.opensymphony.xwork2.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. + */ +/** + * @author Jan Henrik Overland + */ +public class GetOrganisationUnitGroupSetsAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitGroupService organisationUnitGroupService; + + public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService ) + { + this.organisationUnitGroupService = organisationUnitGroupService; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private List organisationUnitGroupSets; + + public List getOrganisationUnitGroupSets() + { + return organisationUnitGroupSets; + } + + @Override + public String execute() + throws Exception + { + organisationUnitGroupSets = new ArrayList( organisationUnitGroupService + .getAllOrganisationUnitGroupSets() ); + + return SUCCESS; + } + +} === added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsByGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsByGroupSetAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitGroupsByGroupSetAction.java 2011-04-28 15:43:17 +0000 @@ -0,0 +1,92 @@ +package org.hisp.dhis.commons.action; + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; + +import com.opensymphony.xwork2.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. + */ +/** + * @author Jan Henrik Overland + */ +public class GetOrganisationUnitGroupsByGroupSetAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitGroupService organisationUnitGroupService; + + public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService ) + { + this.organisationUnitGroupService = organisationUnitGroupService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private List organisationUnitGroups; + + public List getOrganisationUnitGroups() + { + return organisationUnitGroups; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + if ( id != null ) + { + organisationUnitGroups = new ArrayList( organisationUnitGroupService + .getOrganisationUnitGroupSet( id ).getOrganisationUnitGroups() ); + } + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-05-12 16:16:32 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-05-13 12:34:23 +0000 @@ -421,6 +421,20 @@ + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2011-05-06 12:55:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2011-05-10 08:07:40 +0000 @@ -557,6 +557,20 @@ /dhis-web-commons/ajax/jsonOrganisationUnitGroups.vm plainTextError + + + + /dhis-web-commons/ajax/jsonOrganisationUnitGroups.vm + plainTextError + + + + + /dhis-web-commons/ajax/jsonOrganisationUnitGroupSets.vm + plainTextError + === 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-02-02 16:45:37 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2011-05-13 10:42:19 +0000 @@ -31,6 +31,7 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; +import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; import org.hisp.dhis.organisationunit.OrganisationUnitGroupSetPopulator; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.system.filter.OrganisationUnitWithCoordinatesFilter; @@ -81,6 +82,13 @@ this.level = level; } + private Boolean symbol; + + public void setSymbol( Boolean symbol ) + { + this.symbol = symbol; + } + // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- @@ -107,14 +115,21 @@ FilterUtils.filter( object, new OrganisationUnitWithCoordinatesFilter() ); - for ( OrganisationUnit organisationUnit : object ) + if ( symbol != null ) { - if ( organisationUnit.getFeatureType() != null - && organisationUnit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) ) + OrganisationUnitGroupSet typeGroupSet = organisationUnitGroupService + .getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_TYPE ); + + for ( OrganisationUnit organisationUnit : object ) { - organisationUnit.setType( organisationUnit.getGroupNameInGroupSet( organisationUnitGroupService - .getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_TYPE ) ) ); + if ( organisationUnit.getFeatureType() != null + && organisationUnit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) ) + { + organisationUnit.setType( organisationUnit.getGroupNameInGroupSet( typeGroupSet ) ); + } } + + return OrganisationUnit.RESULTTYPE_SYMBOL; } return object.size() > 0 ? object.iterator().next().getFeatureType() : NONE; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2011-04-06 11:44:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2011-04-28 15:43:17 +0000 @@ -33,6 +33,10 @@ favorites = Favorites legend = Legend legendset = Legend set +group = Group +groups = Groups +groupset = Group set +groupsets = Group sets indicators = Indicators dataelements = Data elements === 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-03-08 15:14:32 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-05-13 10:42:19 +0000 @@ -325,6 +325,7 @@ /dhis-web-mapping/geojsonPoint.vm /dhis-web-mapping/geojsonPolygon.vm /dhis-web-mapping/geojsonPolygon.vm + /dhis-web-mapping/geojsonSymbol.vm /dhis-web-mapping/geojsonPolygon.vm === 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-02-02 13:36:42 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm 2011-04-12 17:22:06 +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()},"type":"$!encoder.jsonEncode( ${unit.type} )"}}#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} )","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 === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonSymbol.vm 2011-05-13 12:34:23 +0000 @@ -0,0 +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 === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2011-04-06 11:44:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2011-04-28 15:43:17 +0000 @@ -36,6 +36,10 @@ favorites: '$encoder.jsEscape($i18n.getString( 'favorites' ) , "'")', legend: '$encoder.jsEscape($i18n.getString( 'legend' ) , "'")', legendset: '$encoder.jsEscape($i18n.getString( 'legendset' ) , "'")', + group: '$encoder.jsEscape($i18n.getString( 'group' ) , "'")', + groups: '$encoder.jsEscape($i18n.getString( 'groups' ) , "'")', + groupset: '$encoder.jsEscape($i18n.getString( 'groupset' ) , "'")', + groupsets: '$encoder.jsEscape($i18n.getString( 'groupsets' ) , "'")', indicators: '$encoder.jsEscape($i18n.getString( 'indicators' ) , "'")', dataelements: '$encoder.jsEscape($i18n.getString( 'dataelements' ) , "'")', === 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-04-06 15:27:43 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2011-05-13 12:34:23 +0000 @@ -278,38 +278,16 @@ .window-info { padding:0 0 8px 0; font:bold 11px arial; - color:#444; -} -.window-info-grey { - padding:5px 0px 0px 8px; - font:normal 11px lucida sans unicode,arial; - color:#333; - background-color:#f8f8f8; + color:#222; } .window-p { padding:4px 0; } -.window-field-label-first { - padding:0 0 3px 3px; - font:normal 11px lucida sans unicode,ubuntu,arial; - color:#777; -} .window-field-label { padding:6px 0 3px 4px; font:normal 11px lucida sans unicode,ubuntu,arial; color:#777; } -.window-field-nolabel { - padding:14px 0 0 0; -} -.window-button { - padding:8px 0 0 0; -} -.window-orgunit-text { - padding:6px 6px 6px 8px; - font:normal 11px lucida sans unicode,ubuntu,arial; - color:#333; -} #window-favorites-title { padding:0 0 3px 21px; background:url('../../../images/favorite.png') no-repeat 0 0 transparent; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2011-03-30 12:12:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2011-05-11 14:09:52 +0000 @@ -18,6 +18,7 @@ + @@ -41,6 +42,8 @@
+ +
@@ -74,6 +77,7 @@ + @@ -83,19 +87,19 @@ - + - - + + - + === 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-04-06 13:34:20 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-04-12 17:22:06 +0000 @@ -10,6 +10,8 @@ setup: 'gisSetup', thematicMap: 'gisThematicMap', + thematicMap2: 'gisThematicMap2', + thematicMap3: 'gisThematicMap3', overlayRegistration: 'gisOverlay', administration: 'gisAdministration', favorites: 'gisFavoriteMapView', @@ -89,7 +91,7 @@ G.util = { expandWidget: function(widget) { - var collapsed = widget == choropleth ? symbol : choropleth; + var collapsed = widget == choropleth ? point : choropleth; collapsed.collapse(); widget.expand(); }, @@ -406,11 +408,17 @@ setPoint: function() { this.value = G.conf.thematicMap2; }, + setSymbol: function() { + this.value = G.conf.thematicMap3; + }, isPolygon: function() { return this.value === G.conf.thematicMap; }, isPoint: function() { return this.value === G.conf.thematicMap2; + }, + isSymbol: function() { + return this.value === G.conf.thematicMap3; } } }; === 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-04-06 13:34:20 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-05-13 12:34:23 +0000 @@ -271,6 +271,30 @@ } }); + var groupSetStore = new Ext.data.JsonStore({ + url: G.conf.path_commons + 'getOrganisationUnitGroupSets' + G.conf.type, + root: 'organisationUnitGroupSets', + fields: ['id', 'name'], + sortInfo: {field: 'name', direction: 'ASC'}, + autoLoad: false, + isLoaded: false, + listeners: { + 'load': G.func.storeLoadListener + } + }); + + var groupsByGroupSetStore = new Ext.data.JsonStore({ + url: G.conf.path_commons + 'getOrganisationUnitGroupsByGroupSet' + G.conf.type, + root: 'organisationUnitGroups', + fields: ['id', 'name'], + sortInfo: {field: 'name', direction: 'ASC'}, + autoLoad: false, + isLoaded: false, + listeners: { + 'load': G.func.storeLoadListener + } + }); + G.stores = { mapView: mapViewStore, polygonMapView: polygonMapViewStore, @@ -289,7 +313,9 @@ organisationUnitsAtLevel: organisationUnitsAtLevelStore, geojsonFiles: geojsonFilesStore, wmsCapabilities: wmsCapabilitiesStore, - overlay: overlayStore + overlay: overlayStore, + groupSet: groupSetStore, + groupsByGroupSet: groupsByGroupSetStore }; /* Thematic layers */ @@ -331,6 +357,25 @@ pointLayer.layerType = G.conf.map_layer_type_thematic; G.vars.map.addLayer(pointLayer); + symbolLayer = new OpenLayers.Layer.Vector('Symbol layer', { + 'visibility': false, + 'displayInLayerSwitcher': false, + 'styleMap': new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style( + OpenLayers.Util.applyDefaults( + {'fillOpacity': 1, 'strokeColor': '#222222', 'strokeWidth': 1, 'pointRadius': 5}, + OpenLayers.Feature.Vector.style['default'] + ) + ), + 'select': new OpenLayers.Style( + {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor': 'pointer'} + ) + }) + }); + + symbolLayer.layerType = G.conf.map_layer_type_thematic; + G.vars.map.addLayer(symbolLayer); + /* Init base layers */ if (G_NORMAL_MAP && G_HYBRID_MAP) { var gm_normal = new OpenLayers.Layer.Google("Google Normal", { @@ -422,7 +467,7 @@ labelSeparator: G.conf.labelseparator, editable: false }, - + {html: '
'}, {html: '
Delete favorite / Add to dashboard
'}, { @@ -469,10 +514,10 @@ params = choropleth.formValues.getAllValues.call(choropleth); } else if (G.vars.activePanel.isPoint()) { - if (!symbol.formValidation.validateForm.apply(symbol, [true])) { + if (!point.formValidation.validateForm.apply(point, [true])) { return; } - params = symbol.formValues.getAllValues.call(symbol); + params = point.formValues.getAllValues.call(point); } params.name = vn; @@ -531,8 +576,8 @@ if (v == choropleth.form.findField('mapview').getValue()) { choropleth.form.findField('mapview').clearValue(); } - if (v == symbol.form.findField('mapview').getValue()) { - symbol.form.findField('mapview').clearValue(); + if (v == point.form.findField('mapview').getValue()) { + point.form.findField('mapview').clearValue(); } } }); @@ -665,7 +710,7 @@ if (polygonLayer.visibility && pointLayer.visibility) { if (choropleth.formValidation.validateForm.call(choropleth)) { - if (symbol.formValidation.validateForm.call(symbol)) { + if (point.formValidation.validateForm.call(point)) { document.getElementById('layerField').value = 3; document.getElementById('imageLegendRowsField').value = choropleth.imageLegend.length; @@ -674,10 +719,10 @@ document.getElementById('indicatorField').value = values.mapValueTypeValue; document.getElementById('legendsField').value = G.util.getLegendsJSON.call(choropleth); - values = symbol.formValues.getImageExportValues.call(symbol); + values = point.formValues.getImageExportValues.call(point); document.getElementById('periodField2').value = values.dateValue; document.getElementById('indicatorField2').value = values.mapValueTypeValue; - document.getElementById('legendsField2').value = G.util.getLegendsJSON.call(symbol); + document.getElementById('legendsField2').value = G.util.getLegendsJSON.call(point); var str1 = document.getElementById(polygonLayer.svgId).parentNode.innerHTML; var str2 = document.getElementById(pointLayer.svgId).parentNode.innerHTML; @@ -708,12 +753,12 @@ } } else if (pointLayer.visibility) { - if (symbol.formValidation.validateForm.call(symbol)) { - values = symbol.formValues.getImageExportValues.call(symbol); + if (point.formValidation.validateForm.call(point)) { + values = point.formValues.getImageExportValues.call(point); document.getElementById('layerField').value = 2; document.getElementById('periodField').value = values.dateValue; document.getElementById('indicatorField').value = values.mapValueTypeValue; - document.getElementById('legendsField').value = G.util.getLegendsJSON.call(symbol); + document.getElementById('legendsField').value = G.util.getLegendsJSON.call(point); svg = document.getElementById(pointLayer.svgId).parentNode.innerHTML; } else { @@ -1833,7 +1878,7 @@ success: function() { Ext.message.msg(true, '' + cb.getRawValue() + ' '+ G.i18n.saved_as_date_type); choropleth.prepareMapViewDateType(); - symbol.prepareMapViewDateType(); + point.prepareMapViewDateType(); } }); } @@ -1961,6 +2006,10 @@ { nodeType: 'gx_layer', layer: 'Point layer' + }, + { + nodeType: 'gx_layer', + layer: 'Symbol layer' } ] }, @@ -2359,8 +2408,8 @@ } }); - symbol = new mapfish.widgets.geostat.Symbol({ - id: 'symbol', + point = new mapfish.widgets.geostat.Point({ + id: 'point', map: G.vars.map, layer: pointLayer, title: '' + G.i18n.point_layer + '', @@ -2372,15 +2421,15 @@ id: 'refresh', qtip: 'Refresh layer', handler: function() { - symbol.updateValues = true; - symbol.classify(); + point.updateValues = true; + point.classify(); } }, { id: 'close', qtip: 'Clear layer', handler: function() { - symbol.formValues.clearForm.call(symbol); + point.formValues.clearForm.call(point); } } ], @@ -2393,6 +2442,24 @@ } } }); + + symbol = new mapfish.widgets.geostat.Symbol({ + id: 'symbol', + map: G.vars.map, + layer: symbolLayer, + title: 'Symbol layer', + featureSelection: false, + legendDiv: 'symbollegend', + defaults: {width: 130}, + listeners: { + 'expand': function() { + G.vars.activePanel.setSymbol(); + }, + 'afterrender': function() { + this.layer.widget = this; + } + } + }); /* Section: map toolbar */ var mapLabel = new Ext.form.Label({ @@ -2429,8 +2496,8 @@ } } else if (G.vars.activePanel.isPoint()) { - if (symbol.layer.getDataExtent()) { - G.vars.map.zoomToExtent(symbol.layer.getDataExtent()); + if (point.layer.getDataExtent()) { + G.vars.map.zoomToExtent(point.layer.getDataExtent()); } } } @@ -2579,7 +2646,7 @@ tooltip: 'Administrator settings', disabled: !G.user.isAdmin, style: 'margin-top:1px', - handler: function() { + handler: function() { if (!adminWindow.hidden) { adminWindow.hide(); } @@ -2689,6 +2756,10 @@ { title: '' + G.i18n.map_legend_point + '', contentEl: 'pointlegend' + }, + { + title: 'Symbol legend', + contentEl: 'symbollegend' } ] }, @@ -2710,6 +2781,7 @@ }, items: [ choropleth, + point, symbol ] }, @@ -2734,9 +2806,10 @@ if (!Ext.isIE) { polygonLayer.svgId = svg[0].id; pointLayer.svgId = svg[1].id; + symbolLayer.svgId = svg[2].id; } - for (var i = 0, j = 2; i < G.vars.map.layers.length; i++) { + for (var i = 0, j = 3; i < G.vars.map.layers.length; i++) { if (G.vars.map.layers[i].layerType == G.conf.map_layer_type_overlay) { G.vars.map.layers[i].svgId = svg[j++].id; } @@ -2745,13 +2818,13 @@ Ext.getCmp('mapdatetype_cb').setValue(G.system.mapDateType.value); choropleth.prepareMapViewValueType(); - symbol.prepareMapViewValueType(); + point.prepareMapViewValueType(); choropleth.prepareMapViewDateType(); - symbol.prepareMapViewDateType(); + point.prepareMapViewDateType(); choropleth.prepareMapViewLegend(); - symbol.prepareMapViewLegend(); + point.prepareMapViewLegend(); G.vars.map.events.register('addlayer', null, function(e) { var svg = document.getElementsByTagName('svg'); === added directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo' === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/IconCombo.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/IconCombo.css 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/IconCombo.css 2011-05-12 15:07:02 +0000 @@ -0,0 +1,140 @@ +.ux-ic-icon-0 { + background-image:url(ux-ic-icon-0.png) ! important; +} +.ux-ic-icon-0-title { + background:url(ux-ic-icon-0.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-1 { + background-image:url(ux-ic-icon-1.png) ! important; +} +.ux-ic-icon-1-title { + background:url(ux-ic-icon-1.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-2 { + background-image:url(ux-ic-icon-2.png) ! important; +} +.ux-ic-icon-2-title { + background:url(ux-ic-icon-2.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-3 { + background-image:url(ux-ic-icon-3.png) ! important; +} +.ux-ic-icon-3-title { + background:url(ux-ic-icon-3.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-4 { + background-image:url(ux-ic-icon-4.png) ! important; +} +.ux-ic-icon-4-title { + background:url(ux-ic-icon-4.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-5 { + background-image:url(ux-ic-icon-5.png) ! important; +} +.ux-ic-icon-5-title { + background:url(ux-ic-icon-5.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-6 { + background-image:url(ux-ic-icon-6.png) ! important; +} +.ux-ic-icon-6-title { + background:url(ux-ic-icon-6.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-7 { + background-image:url(ux-ic-icon-7.png) ! important; +} +.ux-ic-icon-7-title { + background:url(ux-ic-icon-7.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-8 { + background-image:url(ux-ic-icon-8.png) ! important; +} +.ux-ic-icon-8-title { + background:url(ux-ic-icon-8.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-9 { + background-image:url(ux-ic-icon-9.png) ! important; +} +.ux-ic-icon-9-title { + background:url(ux-ic-icon-9.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-10 { + background-image:url(ux-ic-icon-10.png) ! important; +} +.ux-ic-icon-10-title { + background:url(ux-ic-icon-10.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-11 { + background-image:url(ux-ic-icon-11.png) ! important; +} +.ux-ic-icon-11-title { + background:url(ux-ic-icon-11.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-12 { + background-image:url(ux-ic-icon-12.png) ! important; +} +.ux-ic-icon-12-title { + background:url(ux-ic-icon-12.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-icon-combo-icon { + background-repeat: no-repeat; + background-position: 5px 50%; + width: 22px; + height: 16px; +} +.ux-icon-combo-input { + color: #ffffff; + z-index: -1; + padding-left: 8px; +} + +.x-form-field-wrap .ux-icon-combo-icon { + top: 3px; + left: 5px; +} +.ux-icon-combo-item { + background-repeat: no-repeat ! important; + background-position: 5px 50% ! important; + color: #f6f6f6; + height: 16px; + padding-left: 50px; +} === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/IconCombo.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/IconCombo.js 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/IconCombo.js 2011-05-12 12:36:10 +0000 @@ -0,0 +1,38 @@ +/* @author Ing. Jozef Sakalos */ +Ext.namespace('Ext.ux.plugins'); + +Ext.ux.plugins.IconCombo = function(config) { + Ext.apply(this, config); +}; + +Ext.extend(Ext.ux.plugins.IconCombo, Ext.util.Observable, { + init: function(combo) { + Ext.apply(combo, { + tpl: '' + + '
' + + '{' + combo.displayField + '}' + + '
', + + onRender: combo.onRender.createSequence(function(ct, position) { + this.wrap.applyStyles({position:'relative'}); + this.el.addClass('ux-icon-combo-input'); + + this.icon = Ext.DomHelper.append(this.el.up('div.x-form-field-wrap'), { + tag: 'div', style:'position:absolute' + }); + }), + + setIconCls: function() { + var rec = this.store.query(this.valueField, this.getValue()).itemAt(0); + if (rec) { + this.icon.className = 'ux-icon-combo-icon ' + rec.get(this.iconClsField); + } + }, + + setValue: combo.setValue.createSequence(function(value) { + this.setIconCls(); + }) + }); + } +}); === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-0.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-0.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-0.png 2011-05-12 13:23:03 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-1.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-1.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-1.png 2011-05-12 12:36:10 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-10.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-10.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-10.png 2011-05-12 14:09:31 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-11.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-11.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-11.png 2011-05-12 14:09:31 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-12.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-12.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-12.png 2011-05-12 14:09:31 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-2.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-2.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-2.png 2011-05-12 12:36:10 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-3.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-3.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-3.png 2011-05-11 14:09:52 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-4.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-4.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-4.png 2011-05-12 12:36:10 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-5.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-5.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-5.png 2011-05-12 13:23:03 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-6.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-6.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-6.png 2011-05-12 12:36:10 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-7.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-7.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-7.png 2011-05-12 12:36:10 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-8.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-8.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-8.png 2011-05-12 14:09:31 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-9.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-9.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-9.png 2011-05-12 14:09:31 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/MapFish.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/MapFish.js 2010-12-21 12:12:23 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/MapFish.js 2011-04-12 17:22:06 +0000 @@ -96,7 +96,7 @@ "core/Color.js", "core/GeoStat.js", "core/GeoStat/Choropleth.js", - //"core/GeoStat/ProportionalSymbol.js", + "core/GeoStat/Point.js", "core/GeoStat/Symbol.js", //"core/Routing.js", "core/Util.js", @@ -119,9 +119,9 @@ //"widgets/data/LayerStoreMediator.js", //"widgets/data/GridRowFeatureMediator.js", "widgets/geostat/Choropleth.js", + "widgets/geostat/Point.js", "widgets/geostat/Symbol.js" - //"widgets/geostat/Mapping.js" - //"widgets/geostat/ProportionalSymbol.js" + //"widgets/geostat/Mapping.js", //"widgets/tree/LayerTree.js", //"widgets/tree/LayerTreeExtra.js", //"widgets/toolbar/Toolbar.js", === 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-03-28 12:02:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-04-12 17:22:06 +0000 @@ -101,6 +101,12 @@ choropleth.classify(false); } else if (G.vars.activePanel.isPoint()) { + if (!point.formValidation.validateForm.call(point)) { + G.vars.mask.hide(); + } + point.classify(false); + } + else if (G.vars.activePanel.isSymbol()) { if (!symbol.formValidation.validateForm.call(symbol)) { G.vars.mask.hide(); } @@ -234,7 +240,7 @@ choropleth.imageLegend = imageLegend; } else if (G.vars.activePanel.isPoint()) { - symbol.imageLegend = imageLegend; + point.imageLegend = imageLegend; } return new mapfish.GeoStat.Classification(bins); @@ -281,11 +287,11 @@ classify: function(method, nbBins, bounds) { var mlt = G.vars.activePanel.isPolygon() ? choropleth.legend.value : G.vars.activePanel.isPoint() ? - symbol.legend.value : G.conf.map_legend_type_automatic; + point.legend.value : G.conf.map_legend_type_automatic; if (mlt == G.conf.map_legend_type_automatic) { if (method == mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS) { - var str = G.vars.activePanel.isPolygon() ? choropleth.form.findField('bounds').getValue() : symbol.form.findField('bounds').getValue(); + var str = G.vars.activePanel.isPolygon() ? choropleth.form.findField('bounds').getValue() : point.form.findField('bounds').getValue(); for (var i = 0; i < str.length; i++) { str = str.replace(' ',''); @@ -311,7 +317,7 @@ choropleth.form.findField('bounds').setValue(newInput); } else { - symbol.form.findField('bounds').setValue(newInput); + point.form.findField('bounds').setValue(newInput); } for (var k = 0; k < bounds.length; k++) { @@ -326,7 +332,7 @@ } } else if (mlt == G.conf.map_legend_type_predefined) { - bounds = G.vars.activePanel.isPolygon() ? choropleth.bounds : symbol.bounds; + bounds = G.vars.activePanel.isPolygon() ? choropleth.bounds : point.bounds; if (bounds[0] > this.minVal) { bounds.unshift(this.minVal); @@ -334,7 +340,7 @@ choropleth.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240)); } else { - symbol.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240)); + point.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240)); } } @@ -344,7 +350,7 @@ choropleth.colorInterpolation.push(new mapfish.ColorRgb(240,240,240)); } else { - symbol.colorInterpolation.push(new mapfish.ColorRgb(240,240,240)); + point.colorInterpolation.push(new mapfish.ColorRgb(240,240,240)); } } === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2011-03-16 11:49:41 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js 2011-04-11 10:29:58 +0000 @@ -21,7 +21,7 @@ * @requires core/GeoStat.js */ -mapfish.GeoStat.Symbol = OpenLayers.Class(mapfish.GeoStat, { +mapfish.GeoStat.Point = OpenLayers.Class(mapfish.GeoStat, { colors: [ new mapfish.ColorRgb(255, 255, 0), @@ -61,18 +61,18 @@ createColorInterpolation: function() { var initialColors = this.colors; var numColors = this.classification.bins.length; - var mapLegendType = symbol.form.findField('maplegendtype').getValue(); + var mapLegendType = point.form.findField('maplegendtype').getValue(); if (mapLegendType == G.conf.map_legend_type_automatic) { this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors); - for (var i = 0; i < symbol.imageLegend.length && i < this.colorInterpolation.length; i++) { - symbol.imageLegend[i].color = this.colorInterpolation[i].toHexString(); + for (var i = 0; i < point.imageLegend.length && i < this.colorInterpolation.length; i++) { + point.imageLegend[i].color = this.colorInterpolation[i].toHexString(); } } else if (mapLegendType == G.conf.map_legend_type_predefined) { - this.colorInterpolation = symbol.colorInterpolation; - for (var j = 0; j < symbol.imageLegend.length && j < this.colorInterpolation.length; j++) { - symbol.imageLegend[j].color = this.colorInterpolation[j].toHexString(); + this.colorInterpolation = point.colorInterpolation; + for (var j = 0; j < point.imageLegend.length && j < this.colorInterpolation.length; j++) { + point.imageLegend[j].color = this.colorInterpolation[j].toHexString(); } } }, @@ -157,5 +157,5 @@ } }, - CLASS_NAME: "mapfish.GeoStat.Symbol" + CLASS_NAME: "mapfish.GeoStat.Point" }); === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2011-05-12 15:07:02 +0000 @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2007 Camptocamp + * + * This file is part of MapFish Client + * + * MapFish Client is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MapFish Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MapFish Client. If not, see . + */ + +/** + * @requires core/GeoStat.js + */ + +mapfish.GeoStat.Symbol = OpenLayers.Class(mapfish.GeoStat, { + + classification: null, + + initialize: function(map, options) { + mapfish.GeoStat.prototype.initialize.apply(this, arguments); + }, + + updateOptions: function(newOptions) { + this.addOptions(newOptions); + }, + + applyClassification: function(form) { + var panel = Ext.getCmp('groups_p'); + G.stores.groupsByGroupSet.img = []; + for (var i = 0, items = panel.items.items; i < items.length; i++) { + G.stores.groupsByGroupSet.img.push(items[i].getRawValue()); + } + + var boundsArray = G.stores.groupsByGroupSet.data.items; + var rules = new Array(boundsArray.length); + for (var i = 0; i < boundsArray.length; i++) { + var rule = new OpenLayers.Rule({ + symbolizer: { + 'pointRadius': 8, + 'externalGraphic': '../resources/ext-ux/iconcombo/' + G.stores.groupsByGroupSet.img[i] + '.png' + }, + filter: new OpenLayers.Filter.Comparison({ + type: OpenLayers.Filter.Comparison.EQUAL_TO, + property: this.indicator, + value: G.stores.groupsByGroupSet.data.items[i].data.name + }) + }); + rules[i] = rule; + } + + this.extendStyle(rules); + mapfish.GeoStat.prototype.applyClassification.apply(this, arguments); + }, + + updateLegend: function() { + if (!this.legendDiv) { + return; + } + + this.legendDiv.update(""); + + for (var i = 0; i < G.stores.groupsByGroupSet.data.items.length; i++) { + var element = document.createElement("div"); + element.style.backgroundImage = 'url(../resources/ext-ux/iconcombo/' + G.stores.groupsByGroupSet.img[i] + '.png)'; + element.style.backgroundRepeat = 'no-repeat'; + element.style.width = "25px"; + element.style.height = "18px"; + element.style.cssFloat = "left"; + element.style.marginLeft = "3px"; + this.legendDiv.appendChild(element); + + element = document.createElement("div"); + element.innerHTML = G.stores.groupsByGroupSet.data.items[i].data.name; + this.legendDiv.appendChild(element); + + element = document.createElement("div"); + element.style.clear = "left"; + this.legendDiv.appendChild(element); + } + }, + + CLASS_NAME: "mapfish.GeoStat.Symbol" +}); === 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-03-30 10:34:03 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-05-12 12:36:10 +0000 @@ -217,6 +217,12 @@ }, createItems: function() { + + this.defaults = { + labelSeparator: G.conf.labelseparator, + emptyText: G.conf.emptytext + }; + this.items = [ { xtype: 'combo', @@ -231,7 +237,6 @@ triggerAction: 'all', emptyText: G.i18n.optional, selectOnFocus: true, - labelSeparator: G.conf.labelseparator, width: G.conf.combo_width, store: G.stores.polygonMapView, listeners: { @@ -263,7 +268,6 @@ xtype: 'combo', name: 'mapvaluetype', fieldLabel: G.i18n.mapvaluetype, - labelSeparator: G.conf.labelseparator, editable: false, valueField: 'id', displayField: 'name', @@ -301,8 +305,6 @@ mode: 'remote', forceSelection: true, triggerAction: 'all', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, selectOnFocus: true, width: G.conf.combo_width, store: G.stores.indicatorGroup, @@ -329,8 +331,6 @@ mode: 'remote', forceSelection: true, triggerAction: 'all', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, selectOnFocus: true, width: G.conf.combo_width, store: G.stores.indicatorsByGroup, @@ -394,8 +394,6 @@ mode: 'remote', forceSelection: true, triggerAction: 'all', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, selectOnFocus: true, width: G.conf.combo_width, store: G.stores.dataElementGroup, @@ -422,8 +420,6 @@ mode: 'remote', forceSelection: true, triggerAction: 'all', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, selectOnFocus: true, width: G.conf.combo_width, store: G.stores.dataElementsByGroup, @@ -486,8 +482,6 @@ mode: 'remote', forceSelection: true, triggerAction: 'all', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, selectOnFocus: true, width: G.conf.combo_width, store: G.stores.periodType, @@ -514,8 +508,6 @@ mode: 'remote', forceSelection: true, triggerAction: 'all', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, selectOnFocus: true, width: G.conf.combo_width, store: G.stores.periodsByTypeStore, @@ -542,8 +534,6 @@ fieldLabel: G.i18n.start_date, format: 'Y-m-d', hidden: true, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, width: G.conf.combo_width, listeners: { 'select': { @@ -564,8 +554,6 @@ fieldLabel: G.i18n.end_date, format: 'Y-m-d', hidden: true, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, width: G.conf.combo_width, listeners: { 'select': { @@ -586,8 +574,6 @@ xtype: 'textfield', name: 'boundary', fieldLabel: G.i18n.boundary, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, width: G.conf.combo_width, style: 'cursor:pointer', node: {attributes: {hasChildrenWithCoordinates: false}}, @@ -613,8 +599,6 @@ xtype: 'textfield', name: 'level', fieldLabel: G.i18n.level, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, width: G.conf.combo_width, style: 'cursor:pointer', levelComboBox: null, @@ -643,8 +627,6 @@ displayField: 'text', mode: 'local', fieldLabel: G.i18n.legend_type, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, value: this.legend.value, triggerAction: 'all', width: G.conf.combo_width, @@ -685,8 +667,6 @@ displayField: 'name', mode: 'remote', fieldLabel: G.i18n.legendset, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, triggerAction: 'all', width: G.conf.combo_width, hidden: true, @@ -710,8 +690,6 @@ valueField: 'value', displayField: 'text', mode: 'local', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, value: this.legend.method, triggerAction: 'all', width: G.conf.combo_width, @@ -746,8 +724,6 @@ xtype: 'textfield', name: 'bounds', fieldLabel: G.i18n.bounds, - labelSeparator: G.conf.labelseparator, - emptyText: G.i18n.comma_separated_values, width: G.conf.combo_width, hidden: true, listeners: { @@ -764,7 +740,6 @@ xtype: 'combo', name: 'classes', fieldLabel: G.i18n.classes, - labelSeparator: G.conf.labelseparator, editable: false, valueField: 'value', displayField: 'value', @@ -795,7 +770,6 @@ xtype: 'colorfield', name: 'startcolor', fieldLabel: G.i18n.low_color, - labelSeparator: G.conf.labelseparator, allowBlank: false, width: G.conf.combo_width, value: "#FF0000", @@ -813,7 +787,6 @@ xtype: 'colorfield', name: 'endcolor', fieldLabel: G.i18n.high_color, - labelSeparator: G.conf.labelseparator, allowBlank: false, width: G.conf.combo_width, value: "#FFFF00", @@ -912,8 +885,6 @@ forceSelection: true, triggerAction: 'all', selectOnFocus: true, - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, fieldLabel: 'Level', width: G.conf.combo_width_fieldset, minListWidth: G.conf.combo_width_fieldset, @@ -1518,7 +1489,7 @@ Ext.getCmp('viewhistory_b').addItem(this); var options = { - indicator: 'value', + indicator: 'id', method: this.form.findField('method').getValue(), numClasses: this.form.findField('classes').getValue(), colors: this.getColors() === renamed 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/Point.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-03-30 10:34:03 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-04-12 17:22:06 +0000 @@ -18,13 +18,13 @@ */ /** - * @requires core/GeoStat/Symbol.js + * @requires core/GeoStat/Point.js * @requires core/Color.js */ Ext.namespace('mapfish.widgets', 'mapfish.widgets.geostat'); -mapfish.widgets.geostat.Symbol = Ext.extend(Ext.FormPanel, { +mapfish.widgets.geostat.Point = Ext.extend(Ext.FormPanel, { layer: null, @@ -116,7 +116,7 @@ } } - mapfish.widgets.geostat.Symbol.superclass.initComponent.apply(this); + mapfish.widgets.geostat.Point.superclass.initComponent.apply(this); }, setUrl: function(url) { @@ -831,7 +831,7 @@ { xtype: 'numberfield', name: 'radiuslow', - fieldLabel: 'Low radius', + fieldLabel: 'Low point size', labelSeparator: G.conf.labelseparator, width: G.conf.combo_number_width_small, allowDecimals: false, @@ -851,7 +851,7 @@ { xtype: 'numberfield', name: 'radiushigh', - fieldLabel: 'High radius', + fieldLabel: 'High point size', labelSeparator: G.conf.labelseparator, width: G.conf.combo_number_width_small, allowDecimals: false, @@ -1071,8 +1071,8 @@ this.selectFeatures = new OpenLayers.Control.newSelectFeature( this.layer, { onHoverSelect: onHoverSelect, - onHoverUnselect: onHoverUnselect - //onClickSelect: onClickSelect + onHoverUnselect: onHoverUnselect, + onClickSelect: onClickSelect } ); @@ -1492,7 +1492,8 @@ this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' + 'parentId=' + this.organisationUnitSelection.parent.id + - '&level=' + this.organisationUnitSelection.level.level + '&level=' + this.organisationUnitSelection.level.level + + '&type=true' ); }, @@ -1580,7 +1581,7 @@ maxSize: parseInt(this.form.findField('radiushigh').getValue()) }; - this.coreComp.updateOptions(options); + this.coreComp.updateOptions(options); this.coreComp.applyClassification(); this.classificationApplied = true; @@ -1588,7 +1589,7 @@ }, onRender: function(ct, position) { - mapfish.widgets.geostat.Symbol.superclass.onRender.apply(this, arguments); + mapfish.widgets.geostat.Point.superclass.onRender.apply(this, arguments); if (this.loadMask) { this.loadMask = new Ext.LoadMask(this.bwrap, this.loadMask); this.loadMask.show(); @@ -1606,7 +1607,7 @@ 'labelGenerator': this.labelGenerator }; - this.coreComp = new mapfish.GeoStat.Symbol(this.map, coreOptions); + this.coreComp = new mapfish.GeoStat.Point(this.map, coreOptions); if (G.vars.parameter.id) { G.util.expandWidget(this); @@ -1615,4 +1616,4 @@ } }); -Ext.reg('symbol', mapfish.widgets.geostat.Symbol); +Ext.reg('point', mapfish.widgets.geostat.Point); === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-05-13 13:11:41 +0000 @@ -0,0 +1,686 @@ +/* + * Copyright (C) 2007-2008 Camptocamp| + * + * This file is part of MapFish Client + * + * MapFish Client is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MapFish Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MapFish Client. If not, see . + */ + +/** + * @requires core/GeoStat/Symbol.js + * @requires core/Color.js + */ + +Ext.namespace('mapfish.widgets', 'mapfish.widgets.geostat'); + +mapfish.widgets.geostat.Symbol = Ext.extend(Ext.FormPanel, { + + layer: null, + + format: null, + + url: null, + + featureSelection: true, + + nameAttribute: null, + + indicator: null, + + indicatorText: null, + + coreComp: null, + + classificationApplied: false, + + ready: false, + + border: false, + + loadMask: false, + + labelGenerator: null, + + colorInterpolation: false, + + newUrl: false, + + legend: false, + + imageLegend: false, + + bounds: false, + + mapView: false, + + mapData: false, + + labels: false, + + valueType: false, + + selectFeatures: false, + + organisationUnitSelection: false, + + 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'] + ] + }), + + initComponent: function() { + + this.initProperties(); + + this.createItems(); + + this.createSelectFeatures(); + + mapfish.widgets.geostat.Symbol.superclass.initComponent.apply(this); + }, + + setUrl: function(url) { + this.url = url; + this.coreComp.setUrl(this.url); + }, + + requestSuccess: function(request) { + this.ready = true; + + if (this.loadMask && this.rendered) { + this.loadMask.hide(); + } + }, + + requestFailure: function(request) { + OpenLayers.Console.error(G.i18n.ajax_request_failed); + }, + + getColors: function() { + var startColor = new mapfish.ColorRgb(); + startColor.setFromHex(this.form.findField('startcolor').getValue()); + var endColor = new mapfish.ColorRgb(); + endColor.setFromHex(this.form.findField('endcolor').getValue()); + return [startColor, endColor]; + }, + + initProperties: function() { + this.legend = { + value: G.conf.map_legend_type_automatic, + method: G.conf.classify_by_equal_intervals, + classes: 5, + reset: function() { + this.value = G.conf.map_legend_type_automatic; + this.method = G.conf.classify_by_equal_intervals; + this.classes = 5; + } + }; + + this.organisationUnitSelection = { + parent: { + id: null, + name: null, + level: null + }, + level: { + level: null, + name: null + }, + setValues: function(pid, pn, pl, ll, ln) { + this.parent.id = pid || this.parent.id; + this.parent.name = pn || this.parent.name; + this.parent.level = pl || this.parent.level; + this.level.level = ll || this.level.level; + this.level.name = ln || this.level.name; + }, + getValues: function() { + return { + parent: { + id: this.parent.id, + name: this.parent.name, + level: this.parent.level + }, + level: { + level: this.level.level, + name: this.level.name + } + }; + }, + setValuesOnDrillDown: function(pid, pn) { + this.parent.id = pid; + this.parent.name = pn; + this.parent.level = this.level.level; + this.level.level++; + this.level.name = G.stores.organisationUnitLevel.getAt( + G.stores.organisationUnitLevel.find('level', this.level.level)).data.name; + + return [this.parent.name, this.level.name]; + } + }; + + this.valueType = { + value: G.conf.map_value_type_indicator, + setIndicator: function() { + this.value = G.conf.map_value_type_indicator; + }, + setDatElement: function() { + this.value = G.conf.map_value_type_dataelement; + }, + isIndicator: function() { + return this.value == G.conf.map_value_type_indicator; + }, + isDataElement: function() { + return this.value == G.conf.map_value_type_dataelement; + } + }; + }, + + createItems: function() { + this.items = [ + { + xtype: 'textfield', + name: 'boundary', + fieldLabel: G.i18n.boundary, + emptyText: G.conf.emptytext, + labelSeparator: G.conf.labelseparator, + width: G.conf.combo_width, + style: 'cursor:pointer', + node: {attributes: {hasChildrenWithCoordinates: false}}, + selectedNode: null, + treeWindow: null, + treePanel: null, + listeners: { + 'focus': { + scope: this, + fn: function(tf) { + if (tf.treeWindow) { + tf.treeWindow.show(); + } + else { + this.createSingletonCmp.treeWindow.call(this); + } + } + } + } + }, + + { + xtype: 'textfield', + name: 'level', + fieldLabel: G.i18n.level, + emptyText: G.conf.emptytext, + labelSeparator: G.conf.labelseparator, + width: G.conf.combo_width, + style: 'cursor:pointer', + levelComboBox: null, + listeners: { + 'focus': { + scope: this, + fn: function() { + if (this.form.findField('boundary').treeWindow) { + this.form.findField('boundary').treeWindow.show(); + } + else { + this.createSingletonCmp.treeWindow.call(this); + } + } + } + } + }, + + { + xtype: 'combo', + name: 'groupset', + fieldLabel: G.i18n.groupset, + typeAhead: true, + editable: false, + valueField: 'id', + displayField: 'name', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + emptyText: G.conf.emptytext, + labelSeparator: G.conf.labelseparator, + selectOnFocus: true, + width: G.conf.combo_width, + currentValue: false, + store: G.stores.groupSet, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + var panel = Ext.getCmp('groups_p'); + if (cb.currentValue != cb.getValue() && cb.getRawValue() == 'Type') { + cb.currentValue = cb.getValue(); + G.stores.groupsByGroupSet.setBaseParam('id', cb.getValue()); + G.stores.groupsByGroupSet.load({scope: this, callback: function() { + panel.removeAll(); + + for (var i = 0; i < G.stores.groupsByGroupSet.getTotalCount(); i++) { + var combo = { + fieldLabel: G.stores.groupsByGroupSet.getAt(i).data.name, + value: i + }; + panel.add(combo); + panel.doLayout(); + } + + this.classify(false, true); + }}); + } + else if (cb.getRawValue() != 'Type') { + cb.currentValue = cb.getValue(); + panel.removeAll(); + panel.doLayout(); + } + } + } + } + }, + + { + xtype: 'panel', + id: 'groups_p', + layout: 'form', + bodyStyle: 'margin:0px; padding:8px 0px 8px 5px;', + width: '100%', + labelWidth: 195, + defaults: { + xtype: 'combo', + plugins: new Ext.ux.plugins.IconCombo(), + valueField: 'name', + displayField: 'css', + iconClsField: 'css', + editable: false, + triggerAction: 'all', + mode: 'local', + labelStyle: 'color:#000', + labelSeparator: G.conf.labelseparator, + width: 50, + listWidth: 50, + store: this.iconStore, + listeners: { + 'select': { + scope: this, + fn: function() { + this.classify(false, true); + } + } + } + } + } + ]; + }, + + createSingletonCmp: { + treeWindow: function() { + Ext.Ajax.request({ + url: G.conf.path_commons + 'getOrganisationUnits' + G.conf.type, + params: {level: 1}, + method: 'POST', + scope: this, + success: function(r) { + var rootNode = Ext.util.JSON.decode(r.responseText).organisationUnits[0]; + var rootUnit = { + id: rootNode.id, + name: rootNode.name, + level: 1, + hasChildrenWithCoordinates: rootNode.hasChildrenWithCoordinates + }; + + var w = new Ext.Window({ + title: 'Boundary and level', + closeAction: 'hide', + autoScroll: true, + height: 'auto', + autoHeight: true, + width: G.conf.window_width, + items: [ + { + xtype: 'panel', + bodyStyle: 'padding:8px; background-color:#ffffff', + items: [ + {html: '
Select outer boundary
'}, + { + xtype: 'treepanel', + bodyStyle: 'background-color:#ffffff', + height: screen.height / 3, + autoScroll: true, + lines: false, + loader: new Ext.tree.TreeLoader({ + dataUrl: G.conf.path_mapping + 'getOrganisationUnitChildren' + G.conf.type + }), + root: { + id: rootUnit.id, + text: rootUnit.name, + level: rootUnit.level, + hasChildrenWithCoordinates: rootUnit.hasChildrenWithCoordinates, + nodeType: 'async', + draggable: false, + expanded: true + }, + clickedNode: null, + listeners: { + 'click': { + scope: this, + fn: function(n) { + this.form.findField('boundary').selectedNode = n; + } + }, + 'afterrender': { + scope: this, + fn: function(tp) { + this.form.findField('boundary').treePanel = tp; + } + } + } + } + ] + }, + { + xtype: 'panel', + layout: 'form', + bodyStyle: 'padding:8px; background-color:#ffffff', + labelWidth: G.conf.label_width, + items: [ + {html: '
Select organisation unit level
'}, + { + xtype: 'combo', + fieldLabel: G.i18n.level, + editable: false, + valueField: 'level', + displayField: 'name', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + selectOnFocus: true, + emptyText: G.conf.emptytext, + labelSeparator: G.conf.labelseparator, + fieldLabel: 'Level', + width: G.conf.combo_width_fieldset, + minListWidth: G.conf.combo_width_fieldset, + store: G.stores.organisationUnitLevel, + listeners: { + 'afterrender': { + scope: this, + fn: function(cb) { + this.form.findField('level').levelComboBox = cb; + } + } + } + } + ] + } + ], + bbar: [ + '->', + { + xtype: 'button', + text: G.i18n.apply, + iconCls: 'icon-assign', + scope: this, + handler: function() { + var node = this.form.findField('boundary').selectedNode; + if (!node || !this.form.findField('level').levelComboBox.getValue()) { + return; + } + if (node.attributes.level > this.form.findField('level').levelComboBox.getValue()) { + Ext.message.msg(false, 'Level is higher than boundary level'); + return; + } + + if (Ext.getCmp('locatefeature_w')) { + Ext.getCmp('locatefeature_w').destroy(); + } + + this.organisationUnitSelection.setValues(node.attributes.id, node.attributes.text, node.attributes.level, + this.form.findField('level').levelComboBox.getValue(), this.form.findField('level').levelComboBox.getRawValue()); + + this.form.findField('boundary').setValue(node.attributes.text); + this.form.findField('level').setValue(this.form.findField('level').levelComboBox.getRawValue()); + + this.form.findField('boundary').treeWindow.hide(); + this.loadGeoJson(); + } + } + ] + }); + + var x = Ext.getCmp('center').x + G.conf.window_position_x; + var y = Ext.getCmp('center').y + G.conf.window_position_y; + w.setPosition(x,y); + w.show(); + this.form.findField('boundary').treeWindow = w; + } + }); + } + }, + + createSelectFeatures: function() { + var scope = this; + + var onHoverSelect = function onHoverSelect(feature) { + if (feature.attributes.name) { + document.getElementById('featuredatatext').innerHTML = '
' + feature.attributes.name + '
' + feature.attributes.type + '
'; + } + else { + document.getElementById('featuredatatext').innerHTML = ''; + } + }; + + var onHoverUnselect = function onHoverUnselect(feature) { + if (feature.attributes.name) { + document.getElementById('featuredatatext').innerHTML = '
' + G.i18n.no_feature_selected + '
'; + } + else { + document.getElementById('featuredatatext').innerHTML = ''; + } + }; + + 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: '' + feature.attributes.name + '', + layout: 'fit', + width: 200, + height: 225, + items: [ + { + xtype: 'panel', + layout: 'anchor', + bodyStyle: 'padding:8px', + items: [ + {html: '
Type:

' + feature.attributes.type + '

'}, + {html: '
Address:

' + feature.attributes.address + '

'}, + {html: '
Contact person:

' + feature.attributes.contactPerson + '

'}, + {html: '
Email:

' + feature.attributes.email + '

'}, + {html: '
Phone number:

' + feature.attributes.phoneNumber + '

'} + ] + } + ] + }); + + 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(); + }; + + this.selectFeatures = new OpenLayers.Control.newSelectFeature( + this.layer, { + onHoverSelect: onHoverSelect, + onHoverUnselect: onHoverUnselect, + onClickSelect: onClickSelect + } + ); + + G.vars.map.addControl(this.selectFeatures); + this.selectFeatures.activate(); + }, + + formValidation: { + validateForm: function(exception) { + if (!this.form.findField('boundary').getValue() || !this.form.findField('level').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + + if (!this.form.findField('groupset').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + + return true; + } + }, + + formValues: { + getAllValues: function() { + return { + featureType: G.conf.map_feature_type_point, + mapValueType: this.form.findField('mapvaluetype').getValue(), + indicatorGroupId: this.valueType.isIndicator() ? this.form.findField('indicatorgroup').getValue() : null, + indicatorId: this.valueType.isIndicator() ? this.form.findField('indicator').getValue() : null, + indicatorName: this.valueType.isIndicator() ? this.form.findField('indicator').getRawValue() : null, + dataElementGroupId: this.valueType.isDataElement() ? this.form.findField('dataelementgroup').getValue() : null, + dataElementId: this.valueType.isDataElement() ? this.form.findField('dataelement').getValue() : null, + dataElementName: this.valueType.isDataElement() ? this.form.findField('dataelement').getRawValue() : null, + mapDateType: G.system.mapDateType.value, + periodTypeId: G.system.mapDateType.isFixed() ? this.form.findField('periodtype').getValue() : null, + periodId: G.system.mapDateType.isFixed() ? this.form.findField('period').getValue() : null, + periodName: G.system.mapDateType.isFixed() ? this.form.findField('period').getRawValue() : null, + startDate: G.system.mapDateType.isStartEnd() ? this.form.findField('startdate').getRawValue() : null, + endDate: G.system.mapDateType.isStartEnd() ? this.form.findField('enddate').getRawValue() : null, + parentOrganisationUnitId: this.organisationUnitSelection.parent.id, + parentOrganisationUnitLevel: this.organisationUnitSelection.parent.level, + parentOrganisationUnitName: this.organisationUnitSelection.parent.name, + organisationUnitLevel: this.organisationUnitSelection.level.level, + organisationUnitLevelName: this.organisationUnitSelection.level.name, + mapLegendType: this.form.findField('maplegendtype').getValue(), + method: this.legend.value == G.conf.map_legend_type_automatic ? this.form.findField('method').getValue() : null, + classes: this.legend.value == G.conf.map_legend_type_automatic ? this.form.findField('classes').getValue() : null, + bounds: this.legend.value == G.conf.map_legend_type_automatic && this.legend.method == G.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null, + colorLow: this.legend.value == G.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null, + colorHigh: this.legend.value == G.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null, + mapLegendSetId: this.legend.value == G.conf.map_legend_type_predefined ? this.form.findField('maplegendset').getValue() : null, + radiusLow: this.form.findField('radiuslow').getValue(), + radiusHigh: this.form.findField('radiushigh').getValue(), + longitude: G.vars.map.getCenter().lon, + latitude: G.vars.map.getCenter().lat, + zoom: parseFloat(G.vars.map.getZoom()) + }; + }, + + clearForm: function() { + var boundary = this.form.findField('boundary') + var level = this.form.findField('level'); + boundary.reset(); + level.reset(); + if (boundary.treePanel && level.levelComboBox) { + boundary.treePanel.selectPath(boundary.treePanel.getRootNode().getPath()); + level.levelComboBox.clearValue(); + } + + this.layer.destroyFeatures(); + this.layer.setVisibility(false); + } + }, + + loadGeoJson: function() { + G.vars.mask.msg = G.i18n.loading_geojson; + G.vars.mask.show(); + + this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' + + 'parentId=' + this.organisationUnitSelection.parent.id + + '&level=' + this.organisationUnitSelection.level.level + + '&symbol=true' + ); + }, + + classify: function(exception, position) { + if (this.formValidation.validateForm.apply(this, [exception])) { + if (!position && this.layer.features.length) { + G.vars.map.zoomToExtent(this.layer.getDataExtent()); + } + + for (var i = 0; i < this.layer.features.length; i++) { + this.layer.features[i].attributes.labelString = this.layer.features[i].attributes.name; + } + + this.applyValues(); + } + }, + + applyValues: function() { + var options = {indicator: this.form.findField('groupset').getRawValue().toLowerCase()}; + this.coreComp.updateOptions(options); + this.coreComp.applyClassification(this.form); + this.classificationApplied = true; + + G.vars.mask.hide(); + }, + + onRender: function(ct, position) { + mapfish.widgets.geostat.Symbol.superclass.onRender.apply(this, arguments); + if (this.loadMask) { + this.loadMask = new Ext.LoadMask(this.bwrap, this.loadMask); + this.loadMask.show(); + } + + var coreOptions = { + 'layer': this.layer, + 'format': this.format, + 'url': this.url, + 'requestSuccess': this.requestSuccess.createDelegate(this), + 'requestFailure': this.requestFailure.createDelegate(this), + 'featureSelection': this.featureSelection, + 'nameAttribute': this.nameAttribute, + 'legendDiv': this.legendDiv, + 'labelGenerator': this.labelGenerator + }; + + this.coreComp = new mapfish.GeoStat.Symbol(this.map, coreOptions); + + if (G.vars.parameter.id) { + G.util.expandWidget(this); + G.vars.parameter = false; + } + } +}); + +Ext.reg('symbol', mapfish.widgets.geostat.Symbol);