=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegend.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegend.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegend.java 2011-07-13 11:32:07 +0000 @@ -43,16 +43,19 @@ private String color; + private String image; + public MapLegend() { } - public MapLegend( String name, Double startValue, Double endValue, String color ) + public MapLegend( String name, Double startValue, Double endValue, String color, String image ) { this.name = name; this.startValue = startValue; this.endValue = endValue; this.color = color; + this.image = image; } // ------------------------------------------------------------------------- @@ -141,4 +144,14 @@ { this.color = color; } + + public String getImage() + { + return image; + } + + public void setImage( String image ) + { + this.image = image; + } } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java 2010-09-09 19:19:51 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java 2011-07-13 21:01:29 +0000 @@ -45,33 +45,24 @@ private String type; - private int method; - - private int classes; - - private String colorLow; - - private String colorHigh; + private String symbolizer; private Set mapLegends = new HashSet(); private Set indicators = new HashSet(); - + private Set dataElements = new HashSet(); public MapLegendSet() { } - public MapLegendSet( String name, String type, int method, int classes, String colorLow, String colorHigh, - Set mapLegends, Set indicators, Set dataElements ) + public MapLegendSet( String name, String type, String symbolizer, Set mapLegends, + Set indicators, Set dataElements ) { this.name = name; this.type = type; - this.method = method; - this.classes = classes; - this.colorLow = colorLow; - this.colorHigh = colorHigh; + this.symbolizer = symbolizer; this.mapLegends = mapLegends; this.indicators = indicators; this.dataElements = dataElements; @@ -144,44 +135,14 @@ this.type = type; } - public int getMethod() - { - return method; - } - - public void setMethod( int method ) - { - this.method = method; - } - - public int getClasses() - { - return classes; - } - - public void setClasses( int classes ) - { - this.classes = classes; - } - - public String getColorLow() - { - return colorLow; - } - - public void setColorLow( String colorLow ) - { - this.colorLow = colorLow; - } - - public String getColorHigh() - { - return colorHigh; - } - - public void setColorHigh( String colorHigh ) - { - this.colorHigh = colorHigh; + public String getSymbolizer() + { + return symbolizer; + } + + public void setSymbolizer( String symbolizer ) + { + this.symbolizer = symbolizer; } public Set getMapLegends() === 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-06-08 13:52:49 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-07-13 21:01:29 +0000 @@ -47,6 +47,10 @@ final String MAP_VALUE_TYPE_INDICATOR = "indicator"; final String MAP_VALUE_TYPE_DATAELEMENT = "dataelement"; + + final String MAP_LEGEND_SYMBOLIZER_COLOR = "color"; + + final String MAP_LEGEND_SYMBOLIZER_IMAGE = "image"; final String MAPLEGENDSET_TYPE_AUTOMATIC = "automatic"; @@ -86,7 +90,7 @@ // MapLegend // ------------------------------------------------------------------------- - void addOrUpdateMapLegend( String name, Double startValue, Double endValue, String color ); + void addOrUpdateMapLegend( String name, Double startValue, Double endValue, String color, String image ); void deleteMapLegend( MapLegend legend ); @@ -104,8 +108,7 @@ void updateMapLegendSet( MapLegendSet legendSet ); - void addOrUpdateMapLegendSet( String name, String type, int method, int classes, String colorLow, String colorHigh, - Set mapLegends ); + void addOrUpdateMapLegendSet( String name, String type, String symbolizer, Set mapLegends ); void deleteMapLegendSet( MapLegendSet legendSet ); === 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-06-08 13:52:49 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-07-13 21:01:29 +0000 @@ -359,7 +359,7 @@ // MapLegend // ------------------------------------------------------------------------- - public void addOrUpdateMapLegend( String name, Double startValue, Double endValue, String color ) + public void addOrUpdateMapLegend( String name, Double startValue, Double endValue, String color, String image ) { MapLegend mapLegend = getMapLegendByName( name ); @@ -369,12 +369,13 @@ mapLegend.setStartValue( startValue ); mapLegend.setEndValue( endValue ); mapLegend.setColor( color ); + mapLegend.setImage( image ); mappingStore.updateMapLegend( mapLegend ); } else { - mapLegend = new MapLegend( name, startValue, endValue, color ); + mapLegend = new MapLegend( name, startValue, endValue, color, image ); mappingStore.addMapLegend( mapLegend ); } @@ -414,8 +415,7 @@ mappingStore.updateMapLegendSet( mapLegendSet ); } - public void addOrUpdateMapLegendSet( String name, String type, int method, int classes, String colorLow, - String colorHigh, Set mapLegends ) + public void addOrUpdateMapLegendSet( String name, String type, String symbolizer, Set mapLegends ) { MapLegendSet mapLegendSet = getMapLegendSetByName( name ); @@ -426,10 +426,7 @@ if ( mapLegendSet != null ) { mapLegendSet.setType( type ); - mapLegendSet.setMethod( method ); - mapLegendSet.setClasses( classes ); - mapLegendSet.setColorLow( colorLow ); - mapLegendSet.setColorHigh( colorHigh ); + mapLegendSet.setSymbolizer( symbolizer ); mapLegendSet.setMapLegends( mapLegends ); mapLegendSet.setIndicators( indicators ); mapLegendSet.setDataElements( dataElements ); @@ -438,8 +435,7 @@ } else { - mapLegendSet = new MapLegendSet( name, type, method, classes, colorLow, colorHigh, mapLegends, indicators, - dataElements ); + mapLegendSet = new MapLegendSet( name, type, symbolizer, mapLegends, indicators, dataElements ); this.mappingStore.addMapLegendSet( mapLegendSet ); } === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegend.hbm.xml' --- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegend.hbm.xml 2011-05-29 11:10:20 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegend.hbm.xml 2011-07-13 11:32:07 +0000 @@ -18,5 +18,7 @@ + + === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml' --- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml 2011-05-29 11:10:20 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml 2011-07-13 21:01:29 +0000 @@ -14,13 +14,7 @@ - - - - - - - + === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java' --- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-05-26 06:48:52 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-07-13 17:28:22 +0000 @@ -141,7 +141,7 @@ MapLegend legend = createMapLegend( 'A', 0.1, 0.2 ); mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(), legend - .getColor() ); + .getColor(), legend.getImage() ); legend = mappingService.getMapLegendByName( legend.getName() ); @@ -149,12 +149,13 @@ int id = legend.getId(); - mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), 0.3, "ColorB" ); + mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), 0.3, "ColorB", "img.png" ); assertEquals( "MapLegendA", mappingService.getMapLegend( id ).getName() ); assertEquals( 0.1, mappingService.getMapLegend( id ).getStartValue() ); assertEquals( 0.3, mappingService.getMapLegend( id ).getEndValue() ); assertEquals( "ColorB", mappingService.getMapLegend( id ).getColor() ); + assertEquals( "img.png", mappingService.getMapLegend( id ).getImage() ); } @Test @@ -163,7 +164,7 @@ MapLegend legend = createMapLegend( 'A', 0.1, 0.2 ); mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(), legend - .getColor() ); + .getColor(), legend.getImage() ); legend = mappingService.getMapLegendByName( legend.getName() ); @@ -184,9 +185,9 @@ MapLegend legend3 = createMapLegend( 'C', 0.5, 0.6 ); mappingService.addOrUpdateMapLegend( legend1.getName(), legend1.getStartValue(), legend1.getEndValue(), legend1 - .getColor() ); + .getColor(), legend1.getImage() ); mappingService.addOrUpdateMapLegend( legend3.getName(), legend3.getStartValue(), legend3.getEndValue(), legend3 - .getColor() ); + .getColor(), legend3.getImage() ); legend1 = mappingService.getMapLegendByName( legend1.getName() ); legend3 = mappingService.getMapLegendByName( legend3.getName() ); @@ -228,14 +229,10 @@ assertNotNull( legendSet ); legendSet.setName( "MapLegendSetB" ); - legendSet.setColorLow( "ColorLowB" ); - legendSet.setColorHigh( "ColorHighB" ); mappingService.updateMapLegendSet( legendSet ); assertEquals( "MapLegendSetB", mappingService.getMapLegendSetByName( "MapLegendSetB" ).getName() ); - assertEquals( "ColorLowB", mappingService.getMapLegendSetByName( "MapLegendSetB" ).getColorLow() ); - assertEquals( "ColorHighB", mappingService.getMapLegendSetByName( "MapLegendSetB" ).getColorHigh() ); } @Test === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendAction.java 2011-07-13 11:32:07 +0000 @@ -27,8 +27,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.mapping.MappingService; + import com.opensymphony.xwork2.Action; -import org.hisp.dhis.mapping.MappingService; /** * @author Jan Henrik Overland @@ -40,9 +41,9 @@ // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- - + private MappingService mappingService; - + public void setMappingService( MappingService mappingService ) { this.mappingService = mappingService; @@ -51,23 +52,23 @@ // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- - + private String name; - + public void setName( String name ) { this.name = name; } private String startValue; - + public void setStartValue( String startValue ) { this.startValue = startValue; } private String endValue; - + public void setEndValue( String endValue ) { this.endValue = endValue; @@ -79,14 +80,22 @@ { this.color = color; } - + + private String image; + + public void setImage( String image ) + { + this.image = image; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- public String execute() { - this.mappingService.addOrUpdateMapLegend( name, Double.parseDouble( startValue ), Double.parseDouble( endValue ), color ); + this.mappingService.addOrUpdateMapLegend( name, Double.parseDouble( startValue ), + Double.parseDouble( endValue ), color, image ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendSetAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendSetAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendSetAction.java 2011-07-13 21:01:29 +0000 @@ -71,33 +71,12 @@ { this.type = type; } - - private int method; - - public void setMethod( int method ) - { - this.method = method; - } - - private int classes; - - public void setClasses( int classes ) - { - this.classes = classes; - } - - private String colorLow; - - public void setColorLow( String colorLow ) - { - this.colorLow = colorLow; - } - - private String colorHigh; - - public void setColorHigh( String colorHigh ) - { - this.colorHigh = colorHigh; + + private String symbolizer; + + public void setSymbolizer( String symbolizer ) + { + this.symbolizer = symbolizer; } private Collection mapLegends; @@ -115,17 +94,16 @@ { Set legends = new HashSet(); - if ( this.mapLegends != null ) + if ( mapLegends != null ) { - for ( String legend : this.mapLegends ) + for ( String legend : mapLegends ) { - legends.add( this.mappingService.getMapLegend( Integer.parseInt( legend ) ) ); + legends.add( mappingService.getMapLegend( Integer.parseInt( legend ) ) ); } } - this.mappingService.addOrUpdateMapLegendSet( this.name, this.type, this.method, this.classes, this.colorLow, - this.colorHigh, legends ); + mappingService.addOrUpdateMapLegendSet( name, type, symbolizer, legends ); - return "success"; + return SUCCESS; } } \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetsByTypeAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetsByTypeAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetsByTypeAction.java 2011-07-13 21:01:29 +0000 @@ -29,6 +29,7 @@ import com.opensymphony.xwork2.Action; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import org.hisp.dhis.mapping.MapLegendSet; import org.hisp.dhis.mapping.MappingService; @@ -43,25 +44,32 @@ // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- - + private MappingService mappingService; - + public void setMappingService( MappingService mappingService ) { this.mappingService = mappingService; } - + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- - + private String type; - + public void setType( String type ) { this.type = type; } - + + private String symbolizer; + + public void setSymbolizer( String symbolizer ) + { + this.symbolizer = symbolizer; + } + // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- @@ -72,15 +80,44 @@ { return this.object; } - + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- public String execute() { - this.object = new ArrayList( this.mappingService.getMapLegendSetsByType( type ) ); - - return "success"; + object = new ArrayList( mappingService.getMapLegendSetsByType( type ) ); + + if ( symbolizer != null ) + { + Collection remove = new ArrayList(); + + for ( MapLegendSet legendSet : object ) + { + if ( legendSet.getSymbolizer() != null ) + { + if ( (symbolizer.equals( MappingService.MAP_LEGEND_SYMBOLIZER_COLOR ) && legendSet.getSymbolizer() + .equals( MappingService.MAP_LEGEND_SYMBOLIZER_IMAGE )) + || (symbolizer.equals( MappingService.MAP_LEGEND_SYMBOLIZER_IMAGE ) && legendSet + .getSymbolizer().equals( MappingService.MAP_LEGEND_SYMBOLIZER_COLOR )) ) + { + remove.add( legendSet ); + } + } + + else + { + if ( symbolizer.equals( MappingService.MAP_LEGEND_SYMBOLIZER_IMAGE ) ) + { + remove.add( legendSet ); + } + } + } + + object.removeAll( remove ); + } + + return SUCCESS; } } \ No newline at end of file === 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-06-30 08:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2011-07-06 19:35:22 +0000 @@ -286,7 +286,8 @@ export_image = Export image export_thematic_map_to_png = Export thematic map to PNG total_distance = Total distance -legend_ = legend symbol_layer = Symbol layer set_thematic_map_date_type = Set thematic map date type -date = Date \ No newline at end of file +date = Date +legend_symbolizer = Symbolizer +image = Image \ 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-06-30 08:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2011-07-06 19:35:22 +0000 @@ -297,8 +297,9 @@ export_image: '$encoder.jsEscape($i18n.getString( 'export_image' ) , "'")', export_thematic_map_to_png: '$encoder.jsEscape($i18n.getString( 'export_thematic_map_to_png' ) , "'")', total_distance: '$encoder.jsEscape($i18n.getString( 'total_distance' ) , "'")', - legend_: '$encoder.jsEscape($i18n.getString( 'legend_' ) , "'")', symbol_layer: '$encoder.jsEscape($i18n.getString( 'symbol_layer' ) , "'")', set_thematic_map_date_type: '$encoder.jsEscape($i18n.getString( 'set_thematic_map_date_type' ) , "'")', - date: '$encoder.jsEscape($i18n.getString( 'date' ) , "'")' + date: '$encoder.jsEscape($i18n.getString( 'date' ) , "'")', + legend_symbolizer: '$encoder.jsEscape($i18n.getString( 'legend_symbolizer' ) , "'")', + image: '$encoder.jsEscape($i18n.getString( 'image' ) , "'")' }; \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm 2010-11-25 15:08:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm 2011-07-13 21:01:29 +0000 @@ -4,6 +4,7 @@ [{ "id": "$!{object.id}", "name": "$!encoder.jsonEncode( ${object.name} )", + "symbolizer": "$!encoder.jsonEncode( ${object.symbolizer} )", "indicators": [#foreach( $indicator in $object.indicators )$!{indicator.id}#if( $velocityCount < $indicators_size ),#end#end], "dataElements": [#foreach( $dataElement in $object.dataElements )$!{dataElement.id}#if( $velocityCount < $dataelements_size ),#end#end] }] === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSets.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSets.vm 2010-11-25 15:08:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSets.vm 2011-07-13 21:01:29 +0000 @@ -4,6 +4,7 @@ { "id": "$!{legendSet.id}", "name": "$!encoder.jsonEncode( ${legendSet.name} )", + "symbolizer": "$!encoder.jsonEncode( ${legendSet.symbolizer} )", "indicators": [#foreach( $indicator in $legendSet.indicators )$!{indicator.id}#if( $velocityCount < $legendSet.indicators.size() ),#end#end], "dataElements": [#foreach( $dataElement in $legendSet.dataElements )$!{dataElement.id}#if( $velocityCount < $legendSet.dataElements.size() ),#end#end] }#if( $velocityCount < $size ),#end === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm 2010-11-25 15:08:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegends.vm 2011-07-13 11:32:07 +0000 @@ -7,7 +7,8 @@ "startValue": $!{mapLegend.startValue}, "endValue": $!{mapLegend.endValue}, "color": "$!encoder.jsonEncode( ${mapLegend.color} )", - "displayString": "$!encoder.jsonEncode( ${mapLegend.name} ), $!{mapLegend.startValue} - $!{mapLegend.endValue}, $!encoder.jsonEncode( ${mapLegend.color} )" + "image": "$!encoder.jsonEncode( ${mapLegend.image} )", + "displayString": "$!encoder.jsonEncode( ${mapLegend.name} ), $!{mapLegend.startValue} - $!{mapLegend.endValue}" }#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-06-23 19:16:44 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2011-07-03 18:52:18 +0000 @@ -285,7 +285,7 @@ .window-info { padding:0 0 8px 0; font:bold 11px arial; - color:#222; + color:#111; } .window-p { padding:4px 0; === 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-06-22 07:36:16 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2011-07-08 09:25:05 +0000 @@ -39,6 +39,8 @@
+ +
@@ -87,7 +89,7 @@ - + === 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-06-22 07:36:16 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-07-13 21:01:29 +0000 @@ -17,6 +17,7 @@ thematicMap: 'gisThematicMap', thematicMap2: 'gisThematicMap2', thematicMap3: 'gisThematicMap3', + thematicMap4: 'gisThematicMap4', overlayRegistration: 'gisOverlay', administration: 'gisAdministration', favorites: 'gisFavoriteMapView', @@ -32,14 +33,18 @@ combo_width_fieldset: 127, combo_list_width_fieldset: 127 + 17, combo_number_width: 65, - combo_number_width_small: 40, + combo_number_width_small: 44, window_width: 251, window_position_x: 55, window_position_y: 41, adminwindow_collapsed: 54, adminwindow_expanded_1: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 121 : 116, adminwindow_expanded_2: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 145 : 143, - + predefinedmaplegendsetwindow_collapsed: 123, + predefinedmaplegendsetwindow_expanded_1: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 373 : 371, + predefinedmaplegendsetwindow_expanded_2: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 323 : 320, + predefinedmaplegendsetwindow_expanded_3: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 242 : 240, + predefinedmaplegendsetwindow_expanded_4: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 240 : 238, // GUI @@ -55,8 +60,10 @@ map_source_type_database: 'database', map_source_type_geojson: 'geojson', map_source_type_shapefile: 'shapefile', - map_legend_type_automatic: 'automatic', - map_legend_type_predefined: 'predefined', + map_legend_symbolizer_color: 'color', + map_legend_symbolizer_image: 'image', + map_legendset_type_automatic: 'automatic', + map_legendset_type_predefined: 'predefined', map_layer_type_baselayer: 'baselayer', map_layer_type_overlay: 'overlay', map_layer_type_thematic: 'thematic', @@ -349,6 +356,11 @@ return p.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); }, + getTransformedPoint: function(p) { + return p.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); + }, + + createOverlay: function(name, fillColor, fillOpacity, strokeColor, strokeWidth, url) { return new OpenLayers.Layer.Vector(name, { 'visibility': false, @@ -468,6 +480,9 @@ setSymbol: function() { this.value = G.conf.thematicMap3; }, + setCentroid: function() { + this.value = G.conf.thematicMap4; + }, isPolygon: function() { return this.value === G.conf.thematicMap; }, @@ -476,9 +491,14 @@ }, isSymbol: function() { return this.value === G.conf.thematicMap3; + }, + isCentroid: function() { + return this.value === G.conf.thematicMap4; } }, + activeWidget: null, + relocate: {}, mouseMove: {} === 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-06-30 08:39:32 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-07-13 21:01:29 +0000 @@ -129,7 +129,7 @@ var predefinedMapLegendStore = new Ext.data.JsonStore({ url: G.conf.path_mapping + 'getAllMapLegends' + G.conf.type, root: 'mapLegends', - fields: ['id', 'name', 'startValue', 'endValue', 'color', 'displayString'], + fields: ['id', 'name', 'startValue', 'endValue', 'color', 'image', 'displayString'], autoLoad: false, isLoaded: false, listeners: { @@ -139,12 +139,41 @@ var predefinedMapLegendSetStore = new Ext.data.JsonStore({ url: G.conf.path_mapping + 'getMapLegendSetsByType' + G.conf.type, - baseParams: {type: G.conf.map_legend_type_predefined}, - root: 'mapLegendSets', - fields: ['id', 'name', 'indicators', 'dataelements'], - sortInfo: {field:'name', direction:'ASC'}, - autoLoad: false, - isLoaded: false, + baseParams: {type: G.conf.map_legendset_type_predefined}, + root: 'mapLegendSets', + fields: ['id', 'name', 'legendType', 'indicators', 'dataelements'], + sortInfo: {field:'name', direction:'ASC'}, + autoLoad: false, + isLoaded: false, + legendType: null, + listeners: { + 'load': G.func.storeLoadListener + } + }); + + var predefinedColorMapLegendSetStore = new Ext.data.JsonStore({ + url: G.conf.path_mapping + 'getMapLegendSetsByType' + G.conf.type, + baseParams: {type: G.conf.map_legendset_type_predefined, symbolizer: G.conf.map_legend_symbolizer_color}, + root: 'mapLegendSets', + fields: ['id', 'name', 'symbolizer', 'indicators', 'dataelements'], + sortInfo: {field:'name', direction:'ASC'}, + autoLoad: false, + isLoaded: false, + legendType: null, + listeners: { + 'load': G.func.storeLoadListener + } + }); + + var predefinedImageMapLegendSetStore = new Ext.data.JsonStore({ + url: G.conf.path_mapping + 'getMapLegendSetsByType' + G.conf.type, + baseParams: {type: G.conf.map_legendset_type_predefined, symbolizer: G.conf.map_legend_symbolizer_image}, + root: 'mapLegendSets', + fields: ['id', 'name', 'symbolizer', 'indicators', 'dataelements'], + sortInfo: {field:'name', direction:'ASC'}, + autoLoad: false, + isLoaded: false, + legendType: null, listeners: { 'load': G.func.storeLoadListener } @@ -222,6 +251,18 @@ } }); + var mapLegendTypeIconStore = new Ext.data.ArrayStore({ + fields: ['name', 'css'], + data: [ + ['0','ux-ic-icon-maplegend-type-0'], + ['1','ux-ic-icon-maplegend-type-1'], + ['2','ux-ic-icon-maplegend-type-2'], + ['3','ux-ic-icon-maplegend-type-3'], + ['4','ux-ic-icon-maplegend-type-4'], + ['5','ux-ic-icon-maplegend-type-5'] + ] + }); + G.stores = { mapView: mapViewStore, indicatorGroup: indicatorGroupStore, @@ -233,12 +274,15 @@ infrastructuralPeriodsByType: infrastructuralPeriodsByTypeStore, predefinedMapLegend: predefinedMapLegendStore, predefinedMapLegendSet: predefinedMapLegendSetStore, + predefinedColorMapLegendSet: predefinedColorMapLegendSetStore, + predefinedImageMapLegendSet: predefinedImageMapLegendSetStore, organisationUnitLevel: organisationUnitLevelStore, organisationUnitsAtLevel: organisationUnitsAtLevelStore, geojsonFiles: geojsonFilesStore, overlay: overlayStore, groupSet: groupSetStore, - groupsByGroupSet: groupsByGroupSetStore + groupsByGroupSet: groupsByGroupSetStore, + mapLegendTypeIcon: mapLegendTypeIconStore }; /* Thematic layers */ @@ -299,6 +343,25 @@ symbolLayer.layerType = G.conf.map_layer_type_thematic; G.vars.map.addLayer(symbolLayer); + centroidLayer = new OpenLayers.Layer.Vector('Centroid 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'} + ) + }) + }); + + centroidLayer.layerType = G.conf.map_layer_type_thematic; + G.vars.map.addLayer(centroidLayer); + /* Init base layers */ if (window.google) { var gmap = new OpenLayers.Layer.Google( @@ -563,7 +626,6 @@ valueField: 'id', displayField: 'text', width: G.conf.combo_width_fieldset, - mode: 'local', triggerAction: 'all' }, { @@ -606,7 +668,7 @@ { xtype: 'checkbox', id: 'exportimageincludelegend_chb', - fieldLabel: G.i18n.legend_, + fieldLabel: G.i18n.legend, labelSeparator: '', isFormField: true, checked: true @@ -728,7 +790,7 @@ items: [ { id: 'newpredefinedmaplegend_p', - title: G.i18n.legend_, + title: G.i18n.legend, items: [ { xtype: 'form', @@ -761,8 +823,41 @@ width: G.conf.combo_number_width_small }, { + xtype: 'combo', + id: 'predefinedmaplegendtype_cb', + fieldLabel: G.i18n.legend_symbolizer, + labelSeparator: G.conf.labelseparator, + editable: false, + valueField: 'id', + displayField: 'symbolizer', + width: G.conf.combo_width_fieldset, + minListWidth: G.conf.combo_width_fieldset, + mode: 'local', + triggerAction: 'all', + value: 'color', + store: new Ext.data.ArrayStore({ + fields: ['id','symbolizer'], + data: [ + [G.conf.map_legend_symbolizer_color, G.i18n.color], + [G.conf.map_legend_symbolizer_image, G.i18n.image] + ] + }), + listeners: { + 'select': function(cb) { + if (cb.getValue() == G.conf.map_legend_symbolizer_color) { + Ext.getCmp('predefinedmaplegendcolor_cf').showField(); + Ext.getCmp('predefinedmaplegendimage_cb').hideField(); + } + else if (cb.getValue() == G.conf.map_legend_symbolizer_image) { + Ext.getCmp('predefinedmaplegendcolor_cf').hideField(); + Ext.getCmp('predefinedmaplegendimage_cb').showField(); + } + } + } + }, + { xtype: 'colorfield', - id: 'predefinedmaplegendcolor_cp', + id: 'predefinedmaplegendcolor_cf', emptyText: G.conf.emptytext, labelSeparator: G.conf.labelseparator, fieldLabel: G.i18n.color, @@ -770,6 +865,23 @@ width: G.conf.combo_width_fieldset, value:"#C0C0C0" }, + { + xtype: 'combo', + id: 'predefinedmaplegendimage_cb', + plugins: new Ext.ux.plugins.IconCombo(), + valueField: 'name', + displayField: 'css', + iconClsField: 'css', + editable: false, + triggerAction: 'all', + mode: 'local', + labelSeparator: G.conf.labelseparator, + fieldLabel: G.i18n.image, + hidden: true, + width: G.conf.combo_number_width_small, + listWidth: G.conf.combo_number_width_small, + store: G.stores.mapLegendTypeIcon + }, {html: '
'}, {html: '
Delete legend
'}, { @@ -784,10 +896,15 @@ selectOnFocus: true, emptyText: G.conf.emptytext, labelSeparator: G.conf.labelseparator, - fieldLabel: G.i18n.legend_, + fieldLabel: G.i18n.legend, width: G.conf.combo_width_fieldset, minListWidth: G.conf.combo_width_fieldset, - store: G.stores.predefinedMapLegend + store: G.stores.predefinedMapLegend, + listeners: { + 'focus': function(cb) { + cb.getStore().clearFilter(); + } + } } ] }, @@ -808,14 +925,18 @@ var mln = Ext.getCmp('predefinedmaplegendname_tf').getValue(); var mlsv = parseFloat(Ext.getCmp('predefinedmaplegendstartvalue_nf').getValue()); var mlev = parseFloat(Ext.getCmp('predefinedmaplegendendvalue_nf').getValue()); - var mlc = Ext.getCmp('predefinedmaplegendcolor_cp').getValue(); + var type = Ext.getCmp('predefinedmaplegendtype_cb').getValue(); + var mlc = type == G.conf.map_legend_symbolizer_color ? + Ext.getCmp('predefinedmaplegendcolor_cf').getValue() : null; + var mli = type == G.conf.map_legend_symbolizer_image ? + Ext.getCmp('predefinedmaplegendimage_cb').getRawValue() : null; if (!Ext.isNumber(parseFloat(mlsv)) || !Ext.isNumber(mlev)) { Ext.message.msg(false, G.i18n.form_is_not_complete); return; } - if (!mln || !mlc) { + if (!mln || (!mlc && !mli)) { Ext.message.msg(false, G.i18n.form_is_not_complete); return; } @@ -830,17 +951,27 @@ return; } + var params = {}; + params.name = mln; + params.startValue = mlsv; + params.endValue = mlev; + if (type == G.conf.map_legend_symbolizer_color) { + params.color = mlc; + } + else if (type == G.conf.map_legend_symbolizer_image) { + params.image = mli; + } + Ext.Ajax.request({ url: G.conf.path_mapping + 'addOrUpdateMapLegend' + G.conf.type, method: 'POST', - params: {name: mln, startValue: mlsv, endValue: mlev, color: mlc}, + params: params, success: function(r) { Ext.message.msg(true, G.i18n.legend + ' ' + mln + ' ' + G.i18n.was_registered); G.stores.predefinedMapLegend.load(); Ext.getCmp('predefinedmaplegendname_tf').reset(); Ext.getCmp('predefinedmaplegendstartvalue_nf').reset(); Ext.getCmp('predefinedmaplegendendvalue_nf').reset(); - Ext.getCmp('predefinedmaplegendcolor_cp').reset(); } }); } @@ -878,10 +1009,10 @@ ], listeners: { expand: function() { - predefinedMapLegendSetWindow.setHeight(Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 348 : 346); + predefinedMapLegendSetWindow.setHeight(G.conf.predefinedmaplegendsetwindow_expanded_1); }, collapse: function() { - predefinedMapLegendSetWindow.setHeight(123); + predefinedMapLegendSetWindow.setHeight(G.conf.predefinedmaplegendsetwindow_collapsed); } } }, @@ -903,6 +1034,38 @@ fieldLabel: G.i18n.display_name, width: G.conf.combo_width_fieldset }, + { + xtype: 'combo', + id: 'predefinedmaplegendsettype_cb', + fieldLabel: G.i18n.legend_symbolizer, + labelSeparator: G.conf.labelseparator, + editable: false, + valueField: 'id', + displayField: 'symbolizer', + width: G.conf.combo_width_fieldset, + minListWidth: G.conf.combo_width_fieldset, + mode: 'local', + triggerAction: 'all', + store: new Ext.data.ArrayStore({ + fields: ['id','symbolizer'], + data: [ + [G.conf.map_legend_symbolizer_color, G.i18n.color], + [G.conf.map_legend_symbolizer_image, G.i18n.image] + ] + }), + listeners: { + 'select': function(cb) { + G.stores.predefinedMapLegend.filterBy( function(r, rid) { + if (cb.getValue() == G.conf.map_legend_symbolizer_color) { + return r.data.color; + } + else if (cb.getValue() == G.conf.map_legend_symbolizer_image) { + return r.data.image; + } + }); + } + } + }, {html: '
'+G.i18n.legends+'
'}, { xtype: 'multiselect', @@ -994,15 +1157,23 @@ } } + var symbolizer = Ext.getCmp('predefinedmaplegendsettype_cb').getValue(); + Ext.Ajax.request({ url: G.conf.path_mapping + 'addOrUpdateMapLegendSet.action' + params, method: 'POST', - params: {name: mlsv, type: G.conf.map_legend_type_predefined}, + params: {name: mlsv, type: G.conf.map_legendset_type_predefined, symbolizer: symbolizer}, success: function(r) { Ext.message.msg(true, G.i18n.new_legend_set+' ' + mlsv + ' ' + G.i18n.was_registered); - G.stores.predefinedMapLegendSet.load(); Ext.getCmp('predefinedmaplegendsetname_tf').reset(); - Ext.getCmp('predefinednewmaplegend_ms').reset(); + Ext.getCmp('predefinednewmaplegend_ms').reset(); + G.stores.predefinedMapLegendSet.load(); + if (symbolizer == G.conf.map_legend_symbolizer_color) { + G.stores.predefinedColorMapLegendSet.load(); + } + else if (symbolizer == G.conf.map_legend_symbolizer_image) { + G.stores.predefinedImageMapLegendSet.load(); + } } }); } @@ -1046,10 +1217,28 @@ ], listeners: { expand: function() { - predefinedMapLegendSetWindow.setHeight((G.util.getMultiSelectHeight() / 2) + (Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 298:295)); + predefinedMapLegendSetWindow.setHeight((G.util.getMultiSelectHeight() / 2) + G.conf.predefinedmaplegendsetwindow_expanded_2); + + var pmlst = Ext.getCmp('predefinedmaplegendsettype_cb'); + if (pmlst.getValue()) { + G.stores.predefinedMapLegend.filterBy( function(r) { + if (pmlst.getValue() == G.conf.map_legend_symbolizer_color) { + return r.data.color; + } + else if (pmlst.getValue() == G.conf.map_legend_symbolizer_image) { + return r.data.image; + } + }); + } + else { + pmlst.setValue(G.conf.map_legend_symbolizer_color); + G.stores.predefinedMapLegend.filterBy( function(r, rid) { + return r.data.color; + }); + } }, collapse: function() { - predefinedMapLegendSetWindow.setHeight(123); + predefinedMapLegendSetWindow.setHeight(G.conf.predefinedmaplegendsetwindow_collapsed); } } }, @@ -1168,14 +1357,14 @@ ], listeners: { expand: function() { - predefinedMapLegendSetWindow.setHeight(G.util.getMultiSelectHeight() + (Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 242 : 240)); + predefinedMapLegendSetWindow.setHeight(G.util.getMultiSelectHeight() + G.conf.predefinedmaplegendsetwindow_expanded_3); if (!G.stores.indicator.isLoaded) { G.stores.indicator.load(); } }, collapse: function() { - predefinedMapLegendSetWindow.setHeight(123); + predefinedMapLegendSetWindow.setHeight(G.conf.predefinedmaplegendsetwindow_collapsed); } } }, @@ -1294,21 +1483,21 @@ ], listeners: { expand: function() { - predefinedMapLegendSetWindow.setHeight(G.util.getMultiSelectHeight() + (Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 240 : 238)); + predefinedMapLegendSetWindow.setHeight(G.util.getMultiSelectHeight() + G.conf.predefinedmaplegendsetwindow_expanded_4); if (!G.stores.dataElement.isLoaded) { G.stores.dataElement.load(); } }, collapse: function() { - predefinedMapLegendSetWindow.setHeight(123); + predefinedMapLegendSetWindow.setHeight(G.conf.predefinedmaplegendsetwindow_collapsed); } } } ], listeners: { afterrender: function() { - predefinedMapLegendSetWindow.setHeight(Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 348 : 346); + predefinedMapLegendSetWindow.setHeight(G.conf.predefinedmaplegendsetwindow_expanded_1); } } }); @@ -1465,8 +1654,8 @@ triggerAction: 'all', labelSeparator: G.conf.labelseparator, fieldLabel: G.i18n.fill_opacity, - width: G.conf.combo_number_width, - minListWidth: G.conf.combo_number_width, + width: G.conf.combo_number_width_small, + minListWidth: G.conf.combo_number_width_small, value: 0.5, store: { xtype: 'arraystore', @@ -1494,8 +1683,8 @@ triggerAction: 'all', labelSeparator: G.conf.labelseparator, fieldLabel: G.i18n.stroke_width, - width: G.conf.combo_number_width, - minListWidth: G.conf.combo_number_width, + width: G.conf.combo_number_width_small, + minListWidth: G.conf.combo_number_width_small, value: 2, store: { xtype: 'arraystore', @@ -1714,6 +1903,10 @@ { nodeType: 'gx_layer', layer: 'Symbol layer' + }, + { + nodeType: 'gx_layer', + layer: 'Centroid layer' } ] }, @@ -2180,6 +2373,41 @@ } }); + centroid = new mapfish.widgets.geostat.Centroid({ + id: 'centroid', + title: 'Centroid layer', + map: G.vars.map, + layer: centroidLayer, + featureSelection: false, + legendDiv: 'centroidlegend', + defaults: {width: 130}, + tools: [ + { + id: 'refresh', + qtip: 'Refresh layer', + handler: function() { + centroid.updateValues = true; + centroid.classify(); + } + }, + { + id: 'close', + qtip: 'Clear layer', + handler: function() { + choropleth.formValues.clearForm.call(centroid); + } + } + ], + listeners: { + 'expand': function() { + G.vars.activePanel.setCentroid(); + }, + 'afterrender': function() { + this.layer.widget = this; + } + } + }); + /* Section: map toolbar */ var mapLabel = new Ext.form.Label({ text: G.i18n.map, @@ -2219,6 +2447,16 @@ G.vars.map.zoomToExtent(point.layer.getDataExtent()); } } + else if (G.vars.activePanel.isSymbol()) { + if (symbol.layer.getDataExtent()) { + G.vars.map.zoomToExtent(symbol.layer.getDataExtent()); + } + } + else if (G.vars.activePanel.isCentroid()) { + if (centroid.layer.getDataExtent()) { + G.vars.map.zoomToExtent(centroid.layer.getDataExtent()); + } + } } }); @@ -2330,7 +2568,7 @@ var x = Ext.getCmp('center').x + G.conf.window_position_x; var y = Ext.getCmp('center').y + G.conf.window_position_y; predefinedMapLegendSetWindow.setPosition(x,y); - predefinedMapLegendSetWindow.show(); + predefinedMapLegendSetWindow.show(); if (!G.stores.predefinedMapLegend.isLoaded) { G.stores.predefinedMapLegend.load(); } @@ -2527,6 +2765,10 @@ { title: 'Symbol layer legend', contentEl: 'symbollegend' + }, + { + title: 'Centroid layer legend', + contentEl: 'centroidlegend' } ] }, @@ -2549,7 +2791,8 @@ items: [ choropleth, point, - symbol + symbol, + centroid ] }, { @@ -2568,7 +2811,7 @@ G.util.setOpacityByLayerType(G.conf.map_layer_type_overlay, G.conf.defaultLayerOpacity); G.util.setOpacityByLayerType(G.conf.map_layer_type_thematic, G.conf.defaultLayerOpacity); symbolLayer.setOpacity(1); - + centroidLayer.setOpacity(1); var svg = document.getElementsByTagName('svg'); @@ -2587,14 +2830,16 @@ Ext.getCmp('mapdatetype_cb').setValue(G.system.mapDateType.value); choropleth.prepareMapViewValueType(); + choropleth.prepareMapViewDateType(); + choropleth.prepareMapViewLegend(); + point.prepareMapViewValueType(); - - choropleth.prepareMapViewDateType(); point.prepareMapViewDateType(); - - choropleth.prepareMapViewLegend(); point.prepareMapViewLegend(); + centroid.prepareMapViewValueType(); + centroid.prepareMapViewDateType(); + G.vars.map.events.register('addlayer', null, function(e) { var svg = document.getElementsByTagName('svg'); e.layer.svgId = svg[svg.length-1].id; @@ -2638,8 +2883,8 @@ G.vars.map.addControl(new OpenLayers.Control.ZoomBox()); G.vars.map.addControl(new OpenLayers.Control.MousePosition({ - displayClass: 'void', - div: $('mouseposition'), + displayClass: 'void', + div: $('mouseposition'), prefix: 'x:  ', separator: '
y:  ' })); @@ -2649,7 +2894,7 @@ div: $('overviewmap'), size: new OpenLayers.Size(188, 97), minRectSize: 0, - layers: [new OpenLayers.Layer.OSM.Osmarender("OSM Osmarender")] + layers: [new OpenLayers.Layer.OSM.Osmarender('OSM Osmarender')] })); G.vars.map.addControl(new OpenLayers.Control.PanPanel({ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/ext-ux.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/ext-ux.css 2011-05-19 08:26:11 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/ext-ux.css 2011-07-13 17:28:22 +0000 @@ -81,123 +81,6 @@ .x-form-check-wrap-inner input,.x-form-radio-wrap-inner input{position:absolute;-ms-filter:"alpha(opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;opacity:0;} /* IconCombo */ -.ux-ic-icon-0 { - background-image:url(iconcombo/ux-ic-icon-0.png) ! important; -} -.ux-ic-icon-0-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-1.png) ! important; -} -.ux-ic-icon-1-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-2.png) ! important; -} -.ux-ic-icon-2-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-3.png) ! important; -} -.ux-ic-icon-3-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-4.png) ! important; -} -.ux-ic-icon-4-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-5.png) ! important; -} -.ux-ic-icon-5-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-6.png) ! important; -} -.ux-ic-icon-6-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-7.png) ! important; -} -.ux-ic-icon-7-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-8.png) ! important; -} -.ux-ic-icon-8-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-9.png) ! important; -} -.ux-ic-icon-9-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-10.png) ! important; -} -.ux-ic-icon-10-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-11.png) ! important; -} -.ux-ic-icon-11-title { - background:url(iconcombo/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(iconcombo/ux-ic-icon-12.png) ! important; -} -.ux-ic-icon-12-title { - background:url(iconcombo/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%; @@ -218,5 +101,141 @@ } .x-form-field-wrap .ux-icon-combo-icon { top: 3px; - left: 5px; + left: 2px; +} + +.ux-ic-icon-groupset-type-0 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-0.png) ! important; +} +.ux-ic-icon-groupset-type-0-title { + background:url(iconcombo/ux-ic-icon-groupset-type-0.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-1 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-1.png) ! important; +} +.ux-ic-icon-groupset-type-1-title { + background:url(iconcombo/ux-ic-icon-groupset-type-1.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-2 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-2.png) ! important; +} +.ux-ic-icon-groupset-type-2-title { + background:url(iconcombo/ux-ic-icon-groupset-type-2.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-3 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-3.png) ! important; +} +.ux-ic-icon-groupset-type-3-title { + background:url(iconcombo/ux-ic-icon-groupset-type-3.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-4 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-4.png) ! important; +} +.ux-ic-icon-groupset-type-4-title { + background:url(iconcombo/ux-ic-icon-groupset-type-4.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-5 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-5.png) ! important; +} +.ux-ic-icon-groupset-type-5-title { + background:url(iconcombo/ux-ic-icon-groupset-type-5.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-6 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-6.png) ! important; +} +.ux-ic-icon-groupset-type-6-title { + background:url(iconcombo/ux-ic-icon-groupset-type-6.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-7 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-7.png) ! important; +} +.ux-ic-icon-groupset-type-7-title { + background:url(iconcombo/ux-ic-icon-groupset-type-7.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-8 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-8.png) ! important; +} +.ux-ic-icon-groupset-type-8-title { + background:url(iconcombo/ux-ic-icon-groupset-type-8.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-9 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-9.png) ! important; +} +.ux-ic-icon-groupset-type-9-title { + background:url(iconcombo/ux-ic-icon-groupset-type-9.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-10 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-10.png) ! important; +} +.ux-ic-icon-groupset-type-10-title { + background:url(iconcombo/ux-ic-icon-groupset-type-10.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-11 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-11.png) ! important; +} +.ux-ic-icon-groupset-type-11-title { + background:url(iconcombo/ux-ic-icon-groupset-type-11.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-groupset-type-12 { + background-image:url(iconcombo/ux-ic-icon-groupset-type-12.png) ! important; +} +.ux-ic-icon-groupset-type-12-title { + background:url(iconcombo/ux-ic-icon-groupset-type-12.png) no-repeat 0 0 transparent; + padding:0 0 3px 21px; + font:bold 11px arial; + color:#111; +} +.ux-ic-icon-maplegend-type-0 { + background-image:url(iconcombo/ux-ic-icon-maplegend-type-0.png) ! important; +} +.ux-ic-icon-maplegend-type-1 { + background-image:url(iconcombo/ux-ic-icon-maplegend-type-1.png) ! important; +} +.ux-ic-icon-maplegend-type-2 { + background-image:url(iconcombo/ux-ic-icon-maplegend-type-2.png) ! important; +} +.ux-ic-icon-maplegend-type-3 { + background-image:url(iconcombo/ux-ic-icon-maplegend-type-3.png) ! important; +} +.ux-ic-icon-maplegend-type-4 { + background-image:url(iconcombo/ux-ic-icon-maplegend-type-4.png) ! important; +} +.ux-ic-icon-maplegend-type-5 { + background-image:url(iconcombo/ux-ic-icon-maplegend-type-5.png) ! important; } === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/blank-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/blank-map.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/blank-map.png 2011-07-08 09:25:05 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/blank.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/blank.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/blank.png 2011-07-07 15:10:55 +0000 differ === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-0.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-0.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-1.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-1.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-10.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-10.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-11.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-11.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-12.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-12.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-2.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-2.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-3.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-3.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-4.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-4.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-5.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-5.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-6.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-6.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-7.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-7.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-8.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-8.png' === renamed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-9.png' => 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-groupset-type-9.png' === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0-map.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-maplegend-type-0-map.png 2011-07-08 09:25:05 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-0.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-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-maplegend-type-0.png 2011-07-08 09:25:05 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1-map.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-maplegend-type-1-map.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-1.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-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-maplegend-type-1.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2-map.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-maplegend-type-2-map.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-2.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-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-maplegend-type-2.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3-map.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-maplegend-type-3-map.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-3.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-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-maplegend-type-3.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4-map.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-maplegend-type-4-map.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-4.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-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-maplegend-type-4.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5-map.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5-map.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-maplegend-type-5-map.png 2011-07-13 12:30:32 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-5.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/iconcombo/ux-ic-icon-maplegend-type-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-maplegend-type-5.png 2011-07-13 12:30:32 +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 2011-04-12 17:22:06 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/MapFish.js 2011-07-05 19:34:01 +0000 @@ -98,6 +98,7 @@ "core/GeoStat/Choropleth.js", "core/GeoStat/Point.js", "core/GeoStat/Symbol.js", + "core/GeoStat/Centroid.js", //"core/Routing.js", "core/Util.js", //"core/Searcher.js", @@ -120,7 +121,8 @@ //"widgets/data/GridRowFeatureMediator.js", "widgets/geostat/Choropleth.js", "widgets/geostat/Point.js", - "widgets/geostat/Symbol.js" + "widgets/geostat/Symbol.js", + "widgets/geostat/Centroid.js" //"widgets/geostat/Mapping.js", //"widgets/tree/LayerTree.js", //"widgets/tree/LayerTreeExtra.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-06-09 09:03:56 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-07-13 21:01:29 +0000 @@ -79,7 +79,8 @@ setUrl: function(url, params) { this.url = url; if (this.url) { - OpenLayers.loadURL(this.url, '', this, this.onSuccess, this.onFailure); + var success = G.vars.activeWidget == centroid ? this.onSuccess2 : this.onSuccess; + OpenLayers.loadURL(this.url, '', this, success, this.onFailure); } }, @@ -114,6 +115,29 @@ } }, + onSuccess2: function(request) { + var doc = request.responseXML; + if (!doc || !doc.documentElement) { + doc = request.responseText; + } + + var format = this.format || new OpenLayers.Format.GeoJSON(); + this.layer.removeFeatures(this.layer.features); + + for (var i = 0, a = null, p = null, geo = format.read(doc); i < geo.length; i++) { + p = G.util.getTransformedPoint(geo[i].geometry.getCentroid()); + geo[i] = new OpenLayers.Feature.Vector(p, geo[i].attributes);; + } + + this.layer.addFeatures(geo); + this.requestSuccess(request); + + if (!centroid.formValidation.validateForm.call(centroid)) { + G.vars.mask.hide(); + } + centroid.classify(false); + }, + onFailure: function(request) { this.requestFailure(request); }, @@ -266,14 +290,11 @@ return Math.floor(1 + 3.3 * Math.log(this.nbVal, 10)); }, - classify: function(method, nbBins, bounds) { - var mlt = G.vars.activePanel.isPolygon() ? - choropleth.legend.value : G.vars.activePanel.isPoint() ? - point.legend.value : G.conf.map_legend_type_automatic; - - if (mlt == G.conf.map_legend_type_automatic) { + classify: function(method, nbBins, bounds) { + if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_automatic) { if (method == mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS) { - var str = G.vars.activePanel.isPolygon() ? choropleth.form.findField('bounds').getValue() : point.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(' ',''); @@ -313,26 +334,26 @@ bounds.push(this.maxVal); } } - else if (mlt == G.conf.map_legend_type_predefined) { - bounds = G.vars.activePanel.isPolygon() ? choropleth.bounds : point.bounds; + else if (G.vars.activeWidget.legend.value == G.conf.map_legendset_type_predefined) { + bounds = G.vars.activeWidget.bounds; if (bounds[0] > this.minVal) { - bounds.unshift(this.minVal); - if (G.vars.activePanel.isPolygon()) { - choropleth.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240)); + bounds.unshift(this.minVal); + if (G.vars.activeWidget == centroid) { + G.vars.activeWidget.symbolizerInterpolation.unshift('blank'); } else { - point.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240)); + G.vars.activeWidget.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240)); } } if (bounds[bounds.length-1] < this.maxVal) { - bounds.push(this.maxVal); - if (G.vars.activePanel.isPolygon()) { - choropleth.colorInterpolation.push(new mapfish.ColorRgb(240,240,240)); + bounds.push(this.maxVal); + if (G.vars.activeWidget == centroid) { + G.vars.activeWidget.symbolizerInterpolation.push('blank'); } else { - point.colorInterpolation.push(new mapfish.ColorRgb(240,240,240)); + G.vars.activeWidget.colorInterpolation.push(new mapfish.ColorRgb(240,240,240)); } } === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Centroid.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/Centroid.js 2011-07-13 12:24:40 +0000 @@ -0,0 +1,151 @@ +/* + * 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.Centroid = OpenLayers.Class(mapfish.GeoStat, { + + colors: [ + new mapfish.ColorRgb(120, 120, 0), + new mapfish.ColorRgb(255, 0, 0) + ], + + method: mapfish.GeoStat.Distribution.CLASSIFY_BY_QUANTILS, + + numClasses: 5, + + minSize: 3, + + maxSize: 20, + + minVal: null, + + maxVal: null, + + defaultSymbolizer: {'fillOpacity': 1}, + + classification: null, + + symbolizerInterpolation: null, + + widget: null, + + initialize: function(map, options) { + mapfish.GeoStat.prototype.initialize.apply(this, arguments); + }, + + updateOptions: function(newOptions) { + var oldOptions = OpenLayers.Util.extend({}, this.options); + this.addOptions(newOptions); + if (newOptions) { + this.setClassification(); + } + }, + + createSymbolizerInterpolation: function() { + this.widget.imageLegend = []; + this.symbolizerInterpolation = this.widget.symbolizerInterpolation; + + for (var i = 0; i < this.classification.bins.length; i++) { + this.widget.imageLegend.push({ + label: this.classification.bins[i].label.replace('  ', ' '), + color: this.symbolizerInterpolation[i] + }); + } + }, + + setClassification: function() { + var values = []; + for (var i = 0; i < this.layer.features.length; i++) { + values.push(this.layer.features[i].attributes[this.indicator]); + } + + var distOptions = { + 'labelGenerator': this.options.labelGenerator + }; + var dist = new mapfish.GeoStat.Distribution(values, distOptions); + + this.minVal = dist.minVal; + this.maxVal = dist.maxVal; + + this.classification = dist.classify( + this.method, + this.numClasses, + null + ); + + this.createSymbolizerInterpolation(); + }, + + applyClassification: function(options, widget) { + this.widget = widget; + this.updateOptions(options); + + var boundsArray = this.classification.getBoundsArray(); + var rules = new Array(boundsArray.length-1); + for (var i = 0; i < boundsArray.length-1; i++) { + var rule = new OpenLayers.Rule({ + symbolizer: { + 'pointRadius': this.symbolizerInterpolation[i] == 'blank' ? 0 : 16, + 'externalGraphic': '../resources/ext-ux/iconcombo/' + this.symbolizerInterpolation[i] + '-map.png' + }, + filter: new OpenLayers.Filter.Comparison({ + type: OpenLayers.Filter.Comparison.BETWEEN, + property: this.indicator, + lowerBoundary: boundsArray[i], + upperBoundary: boundsArray[i + 1] + }) + }); + 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 < this.classification.bins.length; i++) { + var element = document.createElement("div"); + element.style.backgroundImage = 'url(../resources/ext-ux/iconcombo/' + this.symbolizerInterpolation[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 = this.classification.bins[i].label; + this.legendDiv.appendChild(element); + + element = document.createElement("div"); + element.style.clear = "left"; + this.legendDiv.appendChild(element); + } + }, + + CLASS_NAME: "mapfish.GeoStat.Centroid" +}); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2011-05-25 13:20:20 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2011-07-13 21:01:29 +0000 @@ -65,7 +65,7 @@ var mapLegendType = this.widget.form.findField('maplegendtype').getValue(); this.widget.imageLegend = []; - this.colorInterpolation = mapLegendType == G.conf.map_legend_type_automatic ? + this.colorInterpolation = mapLegendType == G.conf.map_legendset_type_automatic ? mapfish.ColorRgb.getColorsArrayByRgbInterpolation(this.colors[0], this.colors[1], numColors) : this.widget.colorInterpolation; for (var i = 0; i < this.classification.bins.length; i++) { @@ -80,7 +80,7 @@ var values = []; for (var i = 0; i < this.layer.features.length; i++) { values.push(this.layer.features[i].attributes[this.indicator]); - } + } var distOptions = { 'labelGenerator': this.options.labelGenerator === modified file '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/Point.js 2011-05-25 13:20:20 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js 2011-07-13 21:01:29 +0000 @@ -65,7 +65,7 @@ var mapLegendType = this.widget.form.findField('maplegendtype').getValue(); this.widget.imageLegend = []; - this.colorInterpolation = mapLegendType == G.conf.map_legend_type_automatic ? + this.colorInterpolation = mapLegendType == G.conf.map_legendset_type_automatic ? mapfish.ColorRgb.getColorsArrayByRgbInterpolation(this.colors[0], this.colors[1], numColors) : this.widget.colorInterpolation; for (var i = 0; i < this.classification.bins.length; i++) { === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js 2011-07-13 21:14:52 +0000 @@ -0,0 +1,1233 @@ +/* + * 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/Centroid.js + * @requires core/Color.js + */ + +Ext.namespace('mapfish.widgets', 'mapfish.widgets.geostat'); + +mapfish.widgets.geostat.Centroid = 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, + + bounds: false, + + mapView: false, + + mapData: false, + + labels: false, + + valueType: false, + + selectFeatures: false, + + organisationUnitSelection: false, + + updateValues: false, + + isDrillDown: false, + + imageLegend: false, + + stores: false, + + infrastructuralPeriod: false, + + featureOptions: {}, + + initComponent: function() { + + this.initProperties(); + + this.createItems(); + + this.createSelectFeatures(); + + mapfish.widgets.geostat.Centroid.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_legendset_type_predefined + }; + + 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; + } + }; + + this.stores = { + mapLegendTypeIcon: new Ext.data.ArrayStore({ + fields: ['name', 'css'], + data: [ + ['0','ux-ic-icon-maplegend-type-0'], + ['1','ux-ic-icon-maplegend-type-1'], + ['2','ux-ic-icon-maplegend-type-2'], + ['3','ux-ic-icon-maplegend-type-3'], + ['4','ux-ic-icon-maplegend-type-4'], + ['5','ux-ic-icon-maplegend-type-5'], + ['6','ux-ic-icon-maplegend-type-6'], + ['7','ux-ic-icon-maplegend-type-7'], + ['8','ux-ic-icon-maplegend-type-8'], + ['9','ux-ic-icon-maplegend-type-9'] + ] + }), + indicatorsByGroup: new Ext.data.JsonStore({ + url: G.conf.path_mapping + 'getIndicatorsByIndicatorGroup' + G.conf.type, + root: 'indicators', + fields: ['id', 'name', 'shortName'], + idProperty: 'id', + sortInfo: {field: 'name', direction: 'ASC'}, + autoLoad: false, + isLoaded: false, + listeners: { + 'load': function(store) { + store.isLoaded = true; + store.each( + function fn(record) { + var name = record.get('name'); + name = name.replace('<', '<').replace('>', '>'); + record.set('name', name); + } + ); + } + } + }), + dataElementsByGroup: new Ext.data.JsonStore({ + url: G.conf.path_mapping + 'getDataElementsByDataElementGroup' + G.conf.type, + root: 'dataElements', + fields: ['id', 'name', 'shortName'], + sortInfo: {field: 'name', direction: 'ASC'}, + autoLoad: false, + isLoaded: false, + listeners: { + 'load': function(store) { + store.isLoaded = true; + store.each( + function fn(record) { + var name = record.get('name'); + name = name.replace('<', '<').replace('>', '>'); + record.set('name', name); + } + ); + } + } + }), + periodsByType: 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 + } + }) + }; + }, + + createItems: function() { + + this.defaults = { + labelSeparator: G.conf.labelseparator, + emptyText: G.conf.emptytext + }; + + this.items = [ + { + xtype: 'combo', + name: 'mapview', + fieldLabel: G.i18n.favorite, + typeAhead: true, + editable: false, + valueField: 'id', + displayField: 'name', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + emptyText: G.i18n.optional, + selectOnFocus: true, + hidden: true, + width: G.conf.combo_width, + store: G.stores.mapView, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + this.mapView = G.stores.mapView.getAt(G.stores.mapView.find('id', cb.getValue())).data; + this.updateValues = true; + + this.legend.value = this.mapView.mapLegendType; + this.legend.method = this.mapView.method || this.legend.method; + this.legend.classes = this.mapView.classes || this.legend.classes; + + G.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom); + G.system.mapDateType.value = this.mapView.mapDateType; + Ext.getCmp('mapdatetype_cb').setValue(G.system.mapDateType.value); + + this.valueType.value = this.mapView.mapValueType; + this.form.findField('mapvaluetype').setValue(this.valueType.value); + this.setMapView(); + } + } + } + }, + + //{ html: '
' }, + + { + xtype: 'combo', + name: 'mapvaluetype', + fieldLabel: G.i18n.mapvaluetype, + editable: false, + valueField: 'id', + displayField: 'name', + mode: 'local', + triggerAction: 'all', + width: G.conf.combo_width, + value: G.conf.map_value_type_indicator, + store: new Ext.data.ArrayStore({ + fields: ['id', 'name'], + data: [ + [G.conf.map_value_type_indicator, 'Indicator'], + [G.conf.map_value_type_dataelement, 'Data element'] + ] + }), + listeners: { + 'select': { + scope: this, + fn: function(cb) { + this.valueType.value = cb.getValue(); + this.prepareMapViewValueType(); + this.classify(false, true); + } + } + } + }, + + { + xtype: 'combo', + name: 'indicatorgroup', + fieldLabel: G.i18n.indicator_group, + typeAhead: true, + editable: false, + valueField: 'id', + displayField: 'name', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + selectOnFocus: true, + width: G.conf.combo_width, + store: G.stores.indicatorGroup, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + this.form.findField('indicator').clearValue(); + this.stores.indicatorsByGroup.setBaseParam('indicatorGroupId', cb.getValue()); + this.stores.indicatorsByGroup.load(); + } + } + } + }, + + { + xtype: 'combo', + name: 'indicator', + fieldLabel: G.i18n.indicator, + typeAhead: true, + editable: false, + valueField: 'id', + displayField: 'shortName', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + selectOnFocus: true, + width: G.conf.combo_width, + store: this.stores.indicatorsByGroup, + currentValue: null, + keepPosition: false, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + if (G.util.setCurrentValue.call(this, cb, 'mapview')) { + return; + } + this.updateValues = true; + this.classify(false, cb.keepPosition); + G.util.setKeepPosition(cb); + } + } + } + }, + + { + xtype: 'combo', + name: 'dataelementgroup', + fieldLabel: G.i18n.dataelement_group, + typeAhead: true, + editable: false, + valueField: 'id', + displayField: 'name', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + selectOnFocus: true, + width: G.conf.combo_width, + store: G.stores.dataElementGroup, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + this.form.findField('dataelement').clearValue(); + this.stores.dataElementsByGroup.setBaseParam('dataElementGroupId', cb.getValue()); + this.stores.dataElementsByGroup.load(); + } + } + } + }, + + { + xtype: 'combo', + name: 'dataelement', + fieldLabel: G.i18n.dataelement, + typeAhead: true, + editable: false, + valueField: 'id', + displayField: 'shortName', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + selectOnFocus: true, + width: G.conf.combo_width, + store: this.stores.dataElementsByGroup, + keepPosition: false, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + if (G.util.setCurrentValue.call(this, cb, 'mapview')) { + return; + } + this.updateValues = true; + this.classify(false, cb.keepPosition); + G.util.setKeepPosition(cb); + } + } + } + }, + + { + xtype: 'combo', + name: 'periodtype', + fieldLabel: G.i18n.period_type, + typeAhead: true, + editable: false, + valueField: 'name', + displayField: 'displayName', + mode: 'remote', + forceSelection: true, + triggerAction: 'all', + selectOnFocus: true, + width: G.conf.combo_width, + store: G.stores.periodType, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + this.form.findField('period').clearValue(); + this.stores.periodsByType.setBaseParam('name', cb.getValue()); + this.stores.periodsByType.load(); + } + } + } + }, + + { + 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: this.stores.periodsByType, + keepPosition: false, + listeners: { + 'select': { + scope: this, + fn: function(cb) { + if (G.util.setCurrentValue.call(this, cb, 'mapview')) { + return; + } + this.updateValues = true; + this.classify(false, cb.keepPosition); + G.util.setKeepPosition(cb); + } + } + } + }, + + { + xtype: 'datefield', + name: 'startdate', + fieldLabel: G.i18n.start_date, + format: 'Y-m-d', + hidden: true, + width: G.conf.combo_width, + listeners: { + 'select': { + scope: this, + fn: function(df, date) { + this.form.findField('mapview').clearValue(); + this.updateValues = true; + this.form.findField('enddate').setMinValue(date); + this.classify(false, true); + } + } + } + }, + + { + xtype: 'datefield', + name: 'enddate', + fieldLabel: G.i18n.end_date, + format: 'Y-m-d', + hidden: true, + width: G.conf.combo_width, + listeners: { + 'select': { + scope: this, + fn: function(df, date) { + this.form.findField('mapview').clearValue(); + this.updateValues = true; + this.form.findField('startdate').setMaxValue(date); + this.classify(false, true); + } + } + } + }, + + { html: '
' }, + + { + xtype: 'textfield', + name: 'boundary', + fieldLabel: G.i18n.boundary, + 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, + 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); + } + } + } + } + }, + + { html: '
' }, + + { + xtype: 'combo', + name: 'maplegendset', + editable: false, + valueField: 'id', + displayField: 'name', + mode: 'remote', + fieldLabel: G.i18n.legendset, + triggerAction: 'all', + width: G.conf.combo_width, + store: G.stores.predefinedImageMapLegendSet, + listeners: { + 'select': { + scope: this, + fn: function() { + this.applyPredefinedLegend(); + } + } + } + } + + ]; + }, + + 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: '
' + G.i18n.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: '
' + G.i18n.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: G.i18n.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.form.findField('mapview').clearValue(); + this.updateValues = true; + 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.value + '
'; + } + 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 = ''; + } + }; + + this.selectFeatures = new OpenLayers.Control.newSelectFeature( + this.layer, { + onHoverSelect: onHoverSelect, + onHoverUnselect: onHoverUnselect + } + ); + + G.vars.map.addControl(this.selectFeatures); + this.selectFeatures.activate(); + }, + + prepareMapViewValueType: function() { + var obj = {}; + if (this.valueType.isIndicator()) { + this.form.findField('indicatorgroup').showField(); + this.form.findField('indicator').showField(); + this.form.findField('dataelementgroup').hideField(); + this.form.findField('dataelement').hideField(); + obj.components = { + valueTypeGroup: this.form.findField('indicatorgroup'), + valueType: this.form.findField('indicator') + }; + obj.stores = { + valueTypeGroup: G.stores.indicatorGroup, + valueType: this.stores.indicatorsByGroup + }; + obj.mapView = { + valueTypeGroup: 'indicatorGroupId', + valueType: 'indicatorId' + }; + } + else if (this.valueType.isDataElement()) { + this.form.findField('indicatorgroup').hideField(); + this.form.findField('indicator').hideField(); + this.form.findField('dataelementgroup').showField(); + this.form.findField('dataelement').showField(); + obj.components = { + valueTypeGroup: this.form.findField('dataelementgroup'), + valueType: this.form.findField('dataelement') + }; + obj.stores = { + valueTypeGroup: G.stores.dataElementGroup, + valueType: this.stores.dataElementsByGroup + }; + obj.mapView = { + valueTypeGroup: 'dataElementGroupId', + valueType: 'dataElementId' + }; + } + return obj; + }, + + prepareMapViewDateType: function() { + var obj = {}; + if (G.system.mapDateType.isFixed()) { + this.form.findField('periodtype').showField(); + this.form.findField('period').showField(); + this.form.findField('startdate').hideField(); + this.form.findField('enddate').hideField(); + obj.components = { + c1: this.form.findField('periodtype'), + c2: this.form.findField('period') + }; + obj.stores = { + c1: G.stores.periodType, + c2: this.stores.periodsByType + }; + obj.mapView = { + c1: 'periodTypeId', + c2: 'periodId' + }; + } + else if (G.system.mapDateType.isStartEnd()) { + this.form.findField('periodtype').hideField(); + this.form.findField('period').hideField(); + this.form.findField('startdate').showField(); + this.form.findField('enddate').showField(); + obj.components = { + c1: this.form.findField('startdate'), + c2: this.form.findField('enddate') + }; + obj.mapView = { + c1: 'startDate', + c2: 'endDate' + }; + } + return obj; + }, + + setMapView: function() { + var obj = this.prepareMapViewValueType(); + + function valueTypeGroupStoreCallback() { + obj.components.valueTypeGroup.setValue(this.mapView[obj.mapView.valueTypeGroup]); + obj.stores.valueType.setBaseParam(obj.mapView.valueTypeGroup, obj.components.valueTypeGroup.getValue()); + obj.stores.valueType.load({scope: this, callback: function() { + obj.components.valueType.setValue(this.mapView[obj.mapView.valueType]); + obj.components.valueType.currentValue = this.mapView[obj.mapView.valueType]; + + obj = this.prepareMapViewDateType(); + if (G.system.mapDateType.isFixed()) { + if (obj.stores.c1.isLoaded) { + dateTypeGroupStoreCallback.call(this); + } + else { + obj.stores.c1.load({scope: this, callback: function() { + dateTypeGroupStoreCallback.call(this); + }}); + } + } + else if (G.system.mapDateType.isStartEnd()) { + obj.components.c1.setValue(new Date(this.mapView[obj.mapView.c1])); + obj.components.c2.setValue(new Date(this.mapView[obj.mapView.c2])); + + this.setMapViewLegend(); + } + }}); + } + + function dateTypeGroupStoreCallback() { + obj.components.c1.setValue(this.mapView[obj.mapView.c1]); + + obj.stores.c2.setBaseParam('name', this.mapView[obj.mapView.c1]); + obj.stores.c2.load({scope: this, callback: function() { + obj.components.c2.setValue(this.mapView[obj.mapView.c2]); + obj.components.c2.currentValue = this.mapView[obj.mapView.c2]; + obj.components.c2.keepPosition = true; + + this.setMapViewLegend(); + }}); + } + + if (obj.stores.valueTypeGroup.isLoaded) { + valueTypeGroupStoreCallback.call(this); + } + else { + obj.stores.valueTypeGroup.load({scope: this, callback: function() { + valueTypeGroupStoreCallback.call(this); + }}); + } + }, + + setMapViewLegend: function() { + function predefinedMapLegendSetStoreCallback() { + this.form.findField('maplegendset').setValue(this.mapView.mapLegendSetId); + this.applyPredefinedLegend(true); + } + + if (G.stores.predefinedMapLegendSet.isLoaded) { + predefinedMapLegendSetStoreCallback.call(this); + } + else { + G.stores.predefinedMapLegendSet.load({scope: this, callback: function() { + predefinedMapLegendSetStoreCallback.call(this); + }}); + } + }, + + setMapViewMap: function() { + this.organisationUnitSelection.setValues(this.mapView.parentOrganisationUnitId, this.mapView.parentOrganisationUnitName, + this.mapView.parentOrganisationUnitLevel, this.mapView.organisationUnitLevel, this.mapView.organisationUnitLevelName); + + G.stores.organisationUnitLevel.load(); + this.form.findField('boundary').setValue(this.mapView.parentOrganisationUnitName); + this.form.findField('level').setValue(this.mapView.organisationUnitLevelName); + + this.loadGeoJson(); + }, + + applyPredefinedLegend: function(isMapView) { + this.legend.value = G.conf.map_legendset_type_predefined; + var mls = this.form.findField('maplegendset').getValue(); + Ext.Ajax.request({ + url: G.conf.path_mapping + 'getMapLegendsByMapLegendSet' + G.conf.type, + method: 'POST', + params: {mapLegendSetId: mls}, + scope: this, + success: function(r) { + var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends; + this.symbolizerInterpolation = []; + this.bounds = []; + for (var i = 0; i < mapLegends.length; i++) { + if (this.bounds[this.bounds.length-1] != mapLegends[i].startValue) { + if (this.bounds.length !== 0) { + this.symbolizerInterpolation.push('blank'); + } + this.bounds.push(mapLegends[i].startValue); + } + this.symbolizerInterpolation.push(mapLegends[i].image); + this.bounds.push(mapLegends[i].endValue); + } + + if (isMapView) { + this.setMapViewMap(); + } + else { + this.classify(false, true); + } + } + }); + }, + + formValidation: { + validateForm: function(exception) { + if (this.form.findField('mapvaluetype').getValue() == G.conf.map_value_type_indicator) { + if (!this.form.findField('indicator').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + } + else if (this.form.findField('mapvaluetype').getValue() == G.conf.map_value_type_dataelement) { + if (!this.form.findField('dataelement').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + } + + if (G.system.mapDateType.isFixed()) { + if (!this.form.findField('period').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + } + else { + if (!this.form.findField('startdate').getValue() || !this.form.findField('enddate').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + } + + 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('maplegendset').getValue()) { + if (exception) { + Ext.message.msg(false, G.i18n.form_is_not_complete); + } + return false; + } + + return true; + } + }, + + formValues: { + getAllValues: function() { + return { + 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, + mapLegendSetId: this.form.findField('maplegendset').getValue(), + longitude: G.vars.map.getCenter().lon, + latitude: G.vars.map.getCenter().lat, + zoom: parseFloat(G.vars.map.getZoom()) + }; + }, + + getImageExportValues: function() { + return { + mapValueTypeValue: this.form.findField('mapvaluetype').getValue() == G.conf.map_value_type_indicator ? + this.form.findField('indicator').getRawValue() : this.form.findField('dataelement').getRawValue(), + dateValue: G.system.mapDateType.isFixed() ? + this.form.findField('period').getRawValue() : new Date(this.form.findField('startdate').getRawValue()).format('Y M j') + ' - ' + new Date(this.form.findField('enddate').getRawValue()).format('Y M j') + }; + }, + + clearForm: function() { + this.form.findField('mapview').clearValue(); + + this.form.findField('mapvaluetype').setValue(G.conf.map_value_type_indicator); + this.valueType.setIndicator(); + this.prepareMapViewValueType(); + this.form.findField('indicatorgroup').clearValue(); + this.form.findField('indicator').clearValue(); + this.form.findField('dataelementgroup').clearValue(); + this.form.findField('dataelement').clearValue(); + + G.system.mapDateType.setFixed(); + this.prepareMapViewDateType(); + this.form.findField('periodtype').clearValue(); + this.form.findField('period').clearValue(); + this.form.findField('startdate').reset(); + this.form.findField('enddate').reset(); + + 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(); + } + + document.getElementById(this.legendDiv).innerHTML = ''; + + this.layer.destroyFeatures(); + this.layer.setVisibility(false); + } + }, + + loadGeoJson: function() { + G.vars.mask.msg = G.i18n.loading_geojson; + G.vars.mask.show(); + G.vars.activeWidget = this; + + this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' + + 'parentId=' + this.organisationUnitSelection.parent.id + + '&level=' + this.organisationUnitSelection.level.level + ); + }, + + classify: function(exception, position) { + if (this.formValidation.validateForm.apply(this, [exception])) { + G.vars.mask.msg = G.i18n.aggregating_map_values; + G.vars.mask.show(); + + if (!position && this.layer.features.length) { + G.vars.map.zoomToExtent(this.layer.getDataExtent()); + } + + if (this.mapView) { + if (this.mapView.longitude && this.mapView.latitude && this.mapView.zoom) { + var point = G.util.getTransformedPointByXY(this.mapView.longitude, this.mapView.latitude); + G.vars.map.setCenter(new OpenLayers.LonLat(point.x, point.y), this.mapView.zoom); + } + else { + G.vars.map.zoomToExtent(this.layer.getDataExtent()); + } + this.mapView = false; + } + + if (this.updateValues) { + var dataUrl = this.valueType.isIndicator() ? 'getIndicatorMapValues' : 'getDataElementMapValues'; + var params = { + id: this.valueType.isIndicator() ? this.form.findField('indicator').getValue() : this.form.findField('dataelement').getValue(), + periodId: G.system.mapDateType.isFixed() ? this.form.findField('period').getValue() : null, + startDate: G.system.mapDateType.isStartEnd() ? new Date(this.form.findField('startdate').getValue()).format('Y-m-d') : null, + endDate: G.system.mapDateType.isStartEnd() ? new Date(this.form.findField('enddate').getValue()).format('Y-m-d') : null, + parentId: this.organisationUnitSelection.parent.id, + level: this.organisationUnitSelection.level.level + }; + + Ext.Ajax.request({ + url: G.conf.path_mapping + dataUrl + G.conf.type, + method: 'POST', + params: params, + scope: this, + success: function(r) { + var mapvalues = Ext.util.JSON.decode(r.responseText).mapValues; + + if (!this.layer.features.length) { + Ext.message.msg(false, 'No coordinates found'); + G.vars.mask.hide(); + return; + } + + if (mapvalues.length === 0) { + Ext.message.msg(false, G.i18n.current_selection_no_data); + G.vars.mask.hide(); + return; + } + + for (var i = 0; i < mapvalues.length; i++) { + for (var j = 0; j < this.layer.features.length; j++) { + if (mapvalues[i].orgUnitName == this.layer.features[j].attributes.name) { + this.layer.features[j].attributes.value = parseFloat(mapvalues[i].value); + this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (' + this.layer.features[j].attributes.value + ')'; + break; + } + } + } + + this.updateValues = false; + this.applyValues(); + } + }); + } + else { + this.applyValues(); + } + } + }, + + applyValues: function() { + Ext.getCmp('viewhistory_b').addItem(this); + + var options = { + indicator: 'value', + method: G.conf.classify_by_equal_intervals + }; + + G.vars.activeWidget = this; + this.coreComp.applyClassification(options, this); + this.classificationApplied = true; + + G.vars.mask.hide(); + }, + + onRender: function(ct, position) { + mapfish.widgets.geostat.Centroid.superclass.onRender.apply(this, arguments); + + 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.Centroid(this.map, coreOptions); + } +}); + +Ext.reg('centroid', mapfish.widgets.geostat.Centroid); === 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-06-26 06:49:46 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-07-13 21:01:29 +0000 @@ -151,11 +151,11 @@ initProperties: function() { this.legend = { - value: G.conf.map_legend_type_automatic, + value: G.conf.map_legendset_type_automatic, method: G.conf.classify_by_equal_intervals, classes: 5, reset: function() { - this.value = G.conf.map_legend_type_automatic; + this.value = G.conf.map_legendset_type_automatic; this.method = G.conf.classify_by_equal_intervals; this.classes = 5; } @@ -422,7 +422,7 @@ success: function(r) { var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0]; if (mapLegendSet.id) { - this.legend.value = G.conf.map_legend_type_predefined; + this.legend.value = G.conf.map_legendset_type_predefined; this.prepareMapViewLegend(); function load() { @@ -440,7 +440,7 @@ } } else { - this.legend.value = G.conf.map_legend_type_automatic; + this.legend.value = G.conf.map_legendset_type_automatic; this.prepareMapViewLegend(); this.classify(false, cb.keepPosition); G.util.setKeepPosition(cb); @@ -510,7 +510,7 @@ success: function(r) { var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0]; if (mapLegendSet.id) { - this.legend.value = G.conf.map_legend_type_predefined; + this.legend.value = G.conf.map_legendset_type_predefined; this.prepareMapViewLegend(); function load() { @@ -528,7 +528,7 @@ } } else { - this.legend.value = G.conf.map_legend_type_automatic; + this.legend.value = G.conf.map_legendset_type_automatic; this.prepareMapViewLegend(); this.classify(false, cb.keepPosition); G.util.setKeepPosition(cb); @@ -702,24 +702,24 @@ store: new Ext.data.ArrayStore({ fields: ['value', 'text'], data: [ - [G.conf.map_legend_type_automatic, G.i18n.automatic], - [G.conf.map_legend_type_predefined, G.i18n.predefined] + [G.conf.map_legendset_type_automatic, G.i18n.automatic], + [G.conf.map_legendset_type_predefined, G.i18n.predefined] ] }), listeners: { 'select': { scope: this, fn: function(cb) { - if (cb.getValue() == G.conf.map_legend_type_predefined && cb.getValue() != this.legend.value) { - this.legend.value = G.conf.map_legend_type_predefined; + if (cb.getValue() == G.conf.map_legendset_type_predefined && cb.getValue() != this.legend.value) { + this.legend.value = G.conf.map_legendset_type_predefined; this.prepareMapViewLegend(); if (this.form.findField('maplegendset').getValue()) { this.applyPredefinedLegend(); } } - else if (cb.getValue() == G.conf.map_legend_type_automatic && cb.getValue() != this.legend.value) { - this.legend.value = G.conf.map_legend_type_automatic; + else if (cb.getValue() == G.conf.map_legendset_type_automatic && cb.getValue() != this.legend.value) { + this.legend.value = G.conf.map_legendset_type_automatic; this.prepareMapViewLegend(); this.classify(false, true); } @@ -739,7 +739,7 @@ triggerAction: 'all', width: G.conf.combo_width, hidden: true, - store: G.stores.predefinedMapLegendSet, + store: G.stores.predefinedColorMapLegendSet, listeners: { 'select': { scope: this, @@ -1383,7 +1383,7 @@ prepareMapViewLegend: function() { this.form.findField('maplegendtype').setValue(this.legend.value); - if (this.legend.value == G.conf.map_legend_type_automatic) { + if (this.legend.value == G.conf.map_legendset_type_automatic) { this.form.findField('method').showField(); this.form.findField('startcolor').showField(); this.form.findField('endcolor').showField(); @@ -1398,7 +1398,7 @@ this.form.findField('bounds').hideField(); } } - else if (this.legend.value == G.conf.map_legend_type_predefined) { + else if (this.legend.value == G.conf.map_legendset_type_predefined) { this.form.findField('method').hideField(); this.form.findField('classes').hideField(); this.form.findField('bounds').hideField(); @@ -1472,7 +1472,7 @@ this.form.findField('radiuslow').setValue(this.mapView.radiusLow || G.conf.defaultLowRadius); this.form.findField('radiushigh').setValue(this.mapView.radiusHigh || G.conf.defaultHighRadius); - if (this.legend.value == G.conf.map_legend_type_automatic) { + if (this.legend.value == G.conf.map_legendset_type_automatic) { this.form.findField('method').setValue(this.mapView.method); this.form.findField('startcolor').setValue(this.mapView.colorLow); this.form.findField('endcolor').setValue(this.mapView.colorHigh); @@ -1486,7 +1486,7 @@ this.setMapViewMap(); } - else if (this.legend.value == G.conf.map_legend_type_predefined) { + else if (this.legend.value == G.conf.map_legendset_type_predefined) { if (G.stores.predefinedMapLegendSet.isLoaded) { predefinedMapLegendSetStoreCallback.call(this); } @@ -1511,9 +1511,8 @@ }, applyPredefinedLegend: function(isMapView) { - this.legend.value = G.conf.map_legend_type_predefined; + this.legend.value = G.conf.map_legendset_type_predefined; var mls = this.form.findField('maplegendset').getValue(); - var bounds = []; Ext.Ajax.request({ url: G.conf.path_mapping + 'getMapLegendsByMapLegendSet' + G.conf.type, method: 'POST', @@ -1533,7 +1532,7 @@ colors.push(new mapfish.ColorRgb()); colors[colors.length-1].setFromHex(mapLegends[i].color); bounds.push(mapLegends[i].endValue); - } + } this.colorInterpolation = colors; this.bounds = bounds; @@ -1591,7 +1590,7 @@ return false; } - if (this.form.findField('maplegendtype').getValue() == G.conf.map_legend_type_automatic) { + if (this.form.findField('maplegendtype').getValue() == G.conf.map_legendset_type_automatic) { if (this.form.findField('method').getValue() == G.conf.classify_with_bounds) { if (!this.form.findField('bounds').getValue()) { if (exception) { @@ -1601,7 +1600,7 @@ } } } - else if (this.form.findField('maplegendtype').getValue() == G.conf.map_legend_type_predefined) { + else if (this.form.findField('maplegendtype').getValue() == G.conf.map_legendset_type_predefined) { if (!this.form.findField('maplegendset').getValue()) { if (exception) { Ext.message.msg(false, G.i18n.form_is_not_complete); @@ -1643,12 +1642,12 @@ 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, + method: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('method').getValue() : null, + classes: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('classes').getValue() : null, + bounds: this.legend.value == G.conf.map_legendset_type_automatic && this.legend.method == G.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null, + colorLow: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('startcolor').getValue() : null, + colorHigh: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('endcolor').getValue() : null, + mapLegendSetId: this.legend.value == G.conf.map_legendset_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, @@ -1715,6 +1714,7 @@ loadGeoJson: function() { G.vars.mask.msg = G.i18n.loading_geojson; G.vars.mask.show(); + G.vars.activeWidget = this; this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' + 'parentId=' + this.organisationUnitSelection.parent.id + @@ -1806,6 +1806,7 @@ maxSize: parseInt(this.form.findField('radiushigh').getValue()) }; + G.vars.activeWidget = this; this.coreComp.applyClassification(options, this); this.classificationApplied = true; === 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-06-26 06:49:46 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-07-13 21:01:29 +0000 @@ -122,11 +122,11 @@ initProperties: function() { this.legend = { - value: G.conf.map_legend_type_automatic, + value: G.conf.map_legendset_type_automatic, method: G.conf.classify_by_equal_intervals, classes: 5, reset: function() { - this.value = G.conf.map_legend_type_automatic; + this.value = G.conf.map_legendset_type_automatic; this.method = G.conf.classify_by_equal_intervals; this.classes = 5; } @@ -393,7 +393,7 @@ success: function(r) { var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0]; if (mapLegendSet.id) { - this.legend.value = G.conf.map_legend_type_predefined; + this.legend.value = G.conf.map_legendset_type_predefined; this.prepareMapViewLegend(); function load() { @@ -411,7 +411,7 @@ } } else { - this.legend.value = G.conf.map_legend_type_automatic; + this.legend.value = G.conf.map_legendset_type_automatic; this.prepareMapViewLegend(); this.classify(false, cb.keepPosition); G.util.setKeepPosition(cb); @@ -481,7 +481,7 @@ success: function(r) { var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0]; if (mapLegendSet.id) { - this.legend.value = G.conf.map_legend_type_predefined; + this.legend.value = G.conf.map_legendset_type_predefined; this.prepareMapViewLegend(); function load() { @@ -499,7 +499,7 @@ } } else { - this.legend.value = G.conf.map_legend_type_automatic; + this.legend.value = G.conf.map_legendset_type_automatic; this.prepareMapViewLegend(); this.classify(false, cb.keepPosition); G.util.setKeepPosition(cb); @@ -673,24 +673,24 @@ store: new Ext.data.ArrayStore({ fields: ['value', 'text'], data: [ - [G.conf.map_legend_type_automatic, G.i18n.automatic], - [G.conf.map_legend_type_predefined, G.i18n.predefined] + [G.conf.map_legendset_type_automatic, G.i18n.automatic], + [G.conf.map_legendset_type_predefined, G.i18n.predefined] ] }), listeners: { 'select': { scope: this, fn: function(cb) { - if (cb.getValue() == G.conf.map_legend_type_predefined && cb.getValue() != this.legend.value) { - this.legend.value = G.conf.map_legend_type_predefined; + if (cb.getValue() == G.conf.map_legendset_type_predefined && cb.getValue() != this.legend.value) { + this.legend.value = G.conf.map_legendset_type_predefined; this.prepareMapViewLegend(); if (this.form.findField('maplegendset').getValue()) { this.applyPredefinedLegend(); } } - else if (cb.getValue() == G.conf.map_legend_type_automatic && cb.getValue() != this.legend.value) { - this.legend.value = G.conf.map_legend_type_automatic; + else if (cb.getValue() == G.conf.map_legendset_type_automatic && cb.getValue() != this.legend.value) { + this.legend.value = G.conf.map_legendset_type_automatic; this.prepareMapViewLegend(); this.classify(false, true); } @@ -1354,7 +1354,7 @@ prepareMapViewLegend: function() { this.form.findField('maplegendtype').setValue(this.legend.value); - if (this.legend.value == G.conf.map_legend_type_automatic) { + if (this.legend.value == G.conf.map_legendset_type_automatic) { this.form.findField('method').showField(); this.form.findField('startcolor').showField(); this.form.findField('endcolor').showField(); @@ -1369,7 +1369,7 @@ this.form.findField('bounds').hideField(); } } - else if (this.legend.value == G.conf.map_legend_type_predefined) { + else if (this.legend.value == G.conf.map_legendset_type_predefined) { this.form.findField('method').hideField(); this.form.findField('classes').hideField(); this.form.findField('bounds').hideField(); @@ -1443,7 +1443,7 @@ this.form.findField('radiuslow').setValue(this.mapView.radiusLow || G.conf.defaultLowRadius); this.form.findField('radiushigh').setValue(this.mapView.radiusHigh || G.conf.defaultHighRadius); - if (this.legend.value == G.conf.map_legend_type_automatic) { + if (this.legend.value == G.conf.map_legendset_type_automatic) { this.form.findField('method').setValue(this.mapView.method); this.form.findField('startcolor').setValue(this.mapView.colorLow); this.form.findField('endcolor').setValue(this.mapView.colorHigh); @@ -1457,7 +1457,7 @@ this.setMapViewMap(); } - else if (this.legend.value == G.conf.map_legend_type_predefined) { + else if (this.legend.value == G.conf.map_legendset_type_predefined) { if (G.stores.predefinedMapLegendSet.isLoaded) { predefinedMapLegendSetStoreCallback.call(this); } @@ -1482,9 +1482,8 @@ }, applyPredefinedLegend: function(isMapView) { - this.legend.value = G.conf.map_legend_type_predefined; + this.legend.value = G.conf.map_legendset_type_predefined; var mls = this.form.findField('maplegendset').getValue(); - var bounds = []; Ext.Ajax.request({ url: G.conf.path_mapping + 'getMapLegendsByMapLegendSet' + G.conf.type, method: 'POST', @@ -1562,7 +1561,7 @@ return false; } - if (this.form.findField('maplegendtype').getValue() == G.conf.map_legend_type_automatic) { + if (this.form.findField('maplegendtype').getValue() == G.conf.map_legendset_type_automatic) { if (this.form.findField('method').getValue() == G.conf.classify_with_bounds) { if (!this.form.findField('bounds').getValue()) { if (exception) { @@ -1572,7 +1571,7 @@ } } } - else if (this.form.findField('maplegendtype').getValue() == G.conf.map_legend_type_predefined) { + else if (this.form.findField('maplegendtype').getValue() == G.conf.map_legendset_type_predefined) { if (!this.form.findField('maplegendset').getValue()) { if (exception) { Ext.message.msg(false, G.i18n.form_is_not_complete); @@ -1614,12 +1613,12 @@ 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, + method: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('method').getValue() : null, + classes: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('classes').getValue() : null, + bounds: this.legend.value == G.conf.map_legendset_type_automatic && this.legend.method == G.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null, + colorLow: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('startcolor').getValue() : null, + colorHigh: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('endcolor').getValue() : null, + mapLegendSetId: this.legend.value == G.conf.map_legendset_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, @@ -1686,6 +1685,7 @@ loadGeoJson: function() { G.vars.mask.msg = G.i18n.loading_geojson; G.vars.mask.show(); + G.vars.activeWidget = this; this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' + 'parentId=' + this.organisationUnitSelection.parent.id + @@ -1777,6 +1777,7 @@ maxSize: parseInt(this.form.findField('radiushigh').getValue()) }; + G.vars.activeWidget = this; this.coreComp.applyClassification(options, this); this.classificationApplied = true; === 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-06-26 06:49:46 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-07-13 21:01:29 +0000 @@ -120,11 +120,11 @@ initProperties: function() { this.legend = { - value: G.conf.map_legend_type_automatic, + value: G.conf.map_legendset_type_automatic, method: G.conf.classify_by_equal_intervals, classes: 5, reset: function() { - this.value = G.conf.map_legend_type_automatic; + this.value = G.conf.map_legendset_type_automatic; this.method = G.conf.classify_by_equal_intervals; this.classes = 5; } @@ -192,19 +192,19 @@ 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'] + ['0','ux-ic-icon-groupset-type-0'], + ['1','ux-ic-icon-groupset-type-1'], + ['2','ux-ic-icon-groupset-type-2'], + ['3','ux-ic-icon-groupset-type-3'], + ['4','ux-ic-icon-groupset-type-4'], + ['5','ux-ic-icon-groupset-type-5'], + ['6','ux-ic-icon-groupset-type-6'], + ['7','ux-ic-icon-groupset-type-7'], + ['8','ux-ic-icon-groupset-type-8'], + ['9','ux-ic-icon-groupset-type-9'], + ['10','ux-ic-icon-groupset-type-10'], + ['11','ux-ic-icon-groupset-type-11'], + ['12','ux-ic-icon-groupset-type-12'] ] }), infrastructuralDataElementMapValue: new Ext.data.JsonStore({ @@ -342,8 +342,8 @@ mode: 'local', labelStyle: 'color:#000', labelSeparator: G.conf.labelseparator, - width: 50, - listWidth: 50, + width: G.conf.combo_number_width_small, + listWidth: G.conf.combo_number_width_small, store: this.stores.icon, listeners: { 'select': { @@ -786,12 +786,12 @@ 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, + method: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('method').getValue() : null, + classes: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('classes').getValue() : null, + bounds: this.legend.value == G.conf.map_legendset_type_automatic && this.legend.method == G.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null, + colorLow: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('startcolor').getValue() : null, + colorHigh: this.legend.value == G.conf.map_legendset_type_automatic ? this.form.findField('endcolor').getValue() : null, + mapLegendSetId: this.legend.value == G.conf.map_legendset_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, @@ -828,6 +828,7 @@ loadGeoJson: function() { G.vars.mask.msg = G.i18n.loading_geojson; G.vars.mask.show(); + G.vars.activeWidget = this; this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' + 'parentId=' + this.organisationUnitSelection.parent.id + @@ -851,6 +852,8 @@ applyValues: function() { var options = {indicator: this.form.findField('groupset').getRawValue().toLowerCase()}; + + G.vars.activeWidget = this; this.coreComp.updateOptions(options); this.coreComp.applyClassification(this.form); this.classificationApplied = true; === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/img/blank.gif' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/img/blank.gif 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/img/blank.gif 2011-07-07 19:51:56 +0000 differ