← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2178: (GIS) Legend bugs fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2178 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-09-20 01:19:52 +0200
message:
  (GIS) Legend bugs fixed.
modified:
  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/webapp/dhis-web-mapping/i18n.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
  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/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-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	2010-09-17 10:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties	2010-09-19 23:12:37 +0000
@@ -15,7 +15,7 @@
 high_color							= High color
 refresh								= Refresh
 optional							= Optional
-loading								= Loading...
+loading								= Loading..
 automatic							= Automatic
 predefined							= Predefined
 equal_intervals						= Equal intervals
@@ -32,38 +32,38 @@
 status								= Status
 bounds								= Bounds
 comma_separated_values				= Comma separated values
-ajax_request_failed					= Ajax request failed.
+ajax_request_failed					= Ajax request failed
 error								= Error
-component_init_not_complete			= Component init not complete.
-form_is_not_complete				= Form is not complete.
+component_init_not_complete			= Component init not complete
+form_is_not_complete				= Form is not complete
 filter								= Filter
 assign_all							= Assign all
 auto_assign							= Auto-assign
-please_select_map					= Please select a map.
+please_select_map					= Please select a map
 auto_assignment						= Auto assignment
 remove_all							= Remove all
 remove_all_relations				= Remove all relations
 all_relations_for_the_map			= All relations for the map
-removed								= removed.
-error_while_deleting_relation_map_and_oranisation_unit = Error while deleting relation between map and organisation unit.
+removed								= removed
+error_while_deleting_relation_map_and_oranisation_unit = Error while deleting relation between map and organisation unit
 remove_selected						= Remove selected
 remove_relation						= Remove relation
-please_select_least_one_organisation_unit_in_the_list = Please select at least one organisation unit in the list.
+please_select_least_one_organisation_unit_in_the_list = Please select at least one organisation unit in the list
 assign								= Assign
 organisation_units					= Organisation units
 assigned_to							= assigned to
-is_already_assigned					= is already assigned.
+is_already_assigned					= is already assigned
 database							= database
 min_size							= Min size
 max_size							= Max size
-select_a_value						= Select a value...
-organisation_units_assigned			= organisation units assigned.
+select_a_value						= Select a value..
+organisation_units_assigned			= organisation units assigned
 applying_organisation_units_relations = Applying organisation units relations
 assigning							= Assigning
 assigned							= assigned
 no									= no 
-creating_map						= Creating map...
-current_selection_no_data 			= The current selection returned no data.
+creating_map						= Creating map..
+current_selection_no_data 			= The current selection returned no data
 creating_choropleth					= Creating choropleth..
 assign_organisation_unit			= Assign organisation unit
 no_feature_selected					= No feature selected
@@ -86,20 +86,20 @@
 assign_organisation_units_to_map	= Assign organisation units to map
 map_layers							= Map layers
 and									= and
-was_saved_as_base_coordinate		= was saved as base coordinate.
-error_while_saving_data				= Error while saving data.
-is_saved_as_map_source				= is saved as map source.
-is_already_selected					= is already selected.
+was_saved_as_base_coordinate		= was saved as base coordinate
+error_while_saving_data				= Error while saving data
+is_saved_as_map_source				= is saved as map source
+is_already_selected					= is already selected
 delete								= Delete
 save								= Save
 new									= New
 overlays							= Overlays
 was_registered						= was registered
-is_already_in_use					= is already in use.
+is_already_in_use					= is already in use
 new_overlay							= New overlay
 name								= Name
-overlay_name_cannot_be_longer_than_25_characters = Overlay name cannot be longer than 25 characters.
-overlay_form_is_not_complete		= Overlay form is not complete.
+overlay_name_cannot_be_longer_than_25_characters = Overlay name cannot be longer than 25 characters
+overlay_form_is_not_complete		= Overlay form is not complete
 display_name						= Display name
 map_source_file						= Map source file
 fill_color							= Fill color
@@ -108,8 +108,8 @@
 stroke_width						= Stroke width
 delete_overlay						= Delete overlay
 overlay								= overlay
-was_deleted							= was deleted.
-please_select_an_overlay			= Please select an overlay.
+was_deleted							= was deleted
+please_select_an_overlay			= Please select an overlay
 select								= Select
 title								= Title
 preview								= Preview
@@ -122,8 +122,8 @@
 name_column							= Name column
 organisation_unit_level				= Organisation unit level
 map_source_file						= Map source file
-please_enter_map_title				= Please enter a map title.
-please_render_map_fist				= Please render the thematic map first.
+please_enter_map_title				= Please enter a map title
+please_render_map_fist				= Please render the thematic map first
 include_legend						= Include legend
 include_values						= Include values
 export_excel						= Export spreadsheet
@@ -136,28 +136,28 @@
 add_to_dashboard					= Add to dashboard
 dashboard_map_view					= Dashboard map view
 the_view							= The view
-was_added_to_dashboard				= was added to dashboard.
-please_select_a_map_view			= Please select a map view.
+was_added_to_dashboard				= was added to dashboard
+please_select_a_map_view			= Please select a map view
 view								= View
 delete_map_view						= Delete map view
-was_deleted							= was deleted.
+was_deleted							= was deleted
 new_map_view						= New map view
 there_is_already_a_map_view_called	= There is already a map view called
-map_view_name_cannot_be_longer_than_25_characters = Map view name cannot contain more than 25 characters.
-thematic_map_form_is_not_complete	= Thematic map form is not complete.
-map_view_form_is_not_complete		= Map view form is not complete.
+map_view_name_cannot_be_longer_than_25_characters = Map view name cannot contain more than 25 characters
+thematic_map_form_is_not_complete	= Thematic map form is not complete
+map_view_form_is_not_complete		= Map view form is not complete
 save								= Save
-saving_current_thematic_map_selection = Saving current thematic map selection.
+saving_current_thematic_map_selection = Saving current thematic map selection
 new_legend_set						= New legend set
-name_can_not_longer_than_25			= Name cannot contain more than 25 characters.
-already_exists						= already exists.
+name_can_not_longer_than_25			= Name cannot contain more than 25 characters
+already_exists						= already exists
 a_legend_set_called					= A legend set called
 assign_to_indicator					= Assign to indicators
 assign_to_dataelement				= Assign to data elements
 please_select_a_legend_set			= Please select a legend set
 link_legend_set_to_indicator		= Link legend set to indicator
-please_select_at_least_one_indicator	= Please select at least one indicator.
-was_updated							= was updated.
+please_select_at_least_one_indicator	= Please select at least one indicator
+was_updated							= was updated
 automatic_legend_sets				= Automatic legend sets
 start_value							= Start value
 end_value							= End value
@@ -166,27 +166,27 @@
 legend								= Legend
 please_select_a_legend				= Please select a legend
 legends								= Legends
-overlapping_legends_are_not_allowed	= Overlapping legends are not allowed.
-please_select_at_least_one_legend	= Please select at least one legend.
+overlapping_legends_are_not_allowed	= Overlapping legends are not allowed
+please_select_at_least_one_legend	= Please select at least one legend
 predefined_legend_sets				= Predefined legend sets
 assignment							= Assignment
 geoserver_shapefiles				= Geoserver shapefiles
 must_be_a_number					= must be a number
-must_be_between_-180_and_180		= must be between -180 and 180.
-must_be_between_-90_and_90			= must be between -90 and 90.
+must_be_between_-180_and_180		= must be between -180 and 180
+must_be_between_-90_and_90			= must be between -90 and 90
 there_is_already_a_map_called		= There is already a map called
 the_source_file						= The source file
-selected_relations_removed			= Selected relations removed.
+selected_relations_removed			= Selected relations removed
 the_source_file						= The source file
 delete_baselayer					= Delete base layer
-please_select_a_baselayer			= Please select a base layer.
+please_select_a_baselayer			= Please select a base layer
 baselayer							= Base layer
 baselayers							= Base layers
 url									= URL
 layer								= Layer
 new_baselayer						= New base layer
-baselayer_form_is_not_complete		= Base layer form is not complete.
-baselayer_name_cannot_be_longer_than_25_characters = Base layer name cannot contain more than 25 characters.
+baselayer_form_is_not_complete		= Base layer form is not complete
+baselayer_name_cannot_be_longer_than_25_characters = Base layer name cannot contain more than 25 characters
 mapvaluetype						= Map value type
 dataelement_group					= Data el. group
 dataelement							= Data element
@@ -196,14 +196,15 @@
 aggregating_map_values				= Aggregating map values..
 loading_geojson						= Loading geojson..
 date_type							= Date type
-saved_as_date_type					= saved as date type.
+saved_as_date_type					= saved as date type
 start_date							= Start date
 end_date							= End date
 fixed_periods						= Fixed periods
 start_end_dates						= Start-end dates
-please_expand_layer_panel			= Please expand the layer panel you want to print.
-has_no_orgunits						= has no organisation units.
+please_expand_layer_panel			= Please expand the layer panel you want to print
+has_no_orgunits						= has no organisation units
 highlight_color						= Highlight color
 feature_filter						= Feature filter
 locate_features						= Locate features
-no_coordinates_found				= No coordinates found.
+no_coordinates_found				= No coordinates found
+image_resolution					= Resolution

=== 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	2010-09-17 10:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm	2010-09-19 23:12:37 +0000
@@ -205,4 +205,5 @@
 var i18n_highlight_color = '$encoder.jsEscape($i18n.getString( 'highlight_color' ) , "'")';
 var i18n_feature_filter = '$encoder.jsEscape($i18n.getString( 'feature_filter' ) , "'")';
 var i18n_locate_features = '$encoder.jsEscape($i18n.getString( 'locate_features' ) , "'")';
-var i18n_no_coordinates_found = '$encoder.jsEscape($i18n.getString( 'no_coordinates_found' ) , "'")';
\ No newline at end of file
+var i18n_no_coordinates_found = '$encoder.jsEscape($i18n.getString( 'no_coordinates_found' ) , "'")';
+var i18n_image_resolution = '$encoder.jsEscape($i18n.getString( 'image_resolution' ) , "'")';
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-17 10:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-19 23:12:37 +0000
@@ -62,6 +62,8 @@
 function getMultiSelectHeight(){var h=screen.height;if(h<=800){return 220;}else if(h<=1050){return 310;}else if(h<=1200){return 470;}else{return 900;}}
 /* Make map view numbers numeric */
 function getNumericMapView(mapView){mapView.id=parseFloat(mapView.id);mapView.indicatorGroupId=parseFloat(mapView.indicatorGroupId);mapView.indicatorId=parseFloat(mapView.indicatorId);mapView.periodId=parseFloat(mapView.periodId);mapView.method=parseFloat(mapView.method);mapView.classes=parseFloat(mapView.classes);mapView.mapLegendSetId=parseFloat(mapView.mapLegendSetId);mapView.longitude=parseFloat(mapView.longitude);mapView.latitude=parseFloat(mapView.latitude);mapView.zoom=parseFloat(mapView.zoom);return mapView;}
+/* Get number of decimals */
+function getNumberOfDecimals(x,dec_sep){var tmp=new String();tmp=x;if(tmp.indexOf(dec_sep)>-1){return tmp.length-tmp.indexOf(dec_sep)-1;}else{return 0;}}
 /* Toggle feature labels */
 function getActivatedOpenLayersStyleMap(nameColumn) {
     return new OpenLayers.StyleMap({'default':new OpenLayers.Style(OpenLayers.Util.applyDefaults({'fillOpacity':1,'strokeColor':'#222222','strokeWidth':1,'label':'${labelString}','fontFamily':'arial,lucida sans unicode','fontWeight':'bold','fontSize':14},OpenLayers.Feature.Vector.style['default'])), 'select':new OpenLayers.Style({'strokeColor':'#000000','strokeWidth':2,'cursor':'pointer'})});
@@ -342,7 +344,7 @@
 							
 							for (var i = 0; i < mapViews.length; i++) {
 								if (mapViews[i].name == vn) {
-									Ext.message.msg(false, i18n_there_is_already_a_map_view_called + ' <span class="x-msg-hl">' + vn + '</span>.');
+									Ext.message.msg(false, i18n_there_is_already_a_map_view_called + ' <span class="x-msg-hl">' + vn + '</span>');
 									return;
 								}
 							}
@@ -374,7 +376,7 @@
                                     zoom: zoom
                                 },
 								success: function(r) {
-									Ext.message.msg(true, 'The view <span class="x-msg-hl">' + vn + '</span> ' + i18n_was_registered + '.');
+									Ext.message.msg(true, 'The view <span class="x-msg-hl">' + vn + '</span> ' + i18n_was_registered);
 									Ext.getCmp('view_cb').getStore().load();
 									Ext.getCmp('mapview_cb').getStore().load();
 									Ext.getCmp('viewname_tf').reset();
@@ -556,21 +558,21 @@
 				displayField: 'text',
 				isFormField: true,
 				width: combo_width_fieldset,
-				minListWidth: combo_list_width_fieldset,
 				mode: 'local',
 				triggerAction: 'all'
 			},
 			{
 				xtype: 'combo',
 				id: 'exportimagequality_cb',
-				fieldLabel: i18n_image_quality,
+				// fieldLabel: i18n_image_resolution,
+                fieldLabel: 'Image resolution',
 				labelSeparator: labelseparator,
 				editable: false,
 				valueField: 'id',
 				displayField: 'text',
 				isFormField: true,
 				width: combo_width_fieldset,
-				minListWidth: combo_list_width_fieldset,
+				minListWidth: combo_width_fieldset,
 				mode: 'local',
 				triggerAction: 'all',
 				value: 1,
@@ -807,7 +809,7 @@
                             var mapLegends = Ext.util.JSON.decode(r.responseText).mapLegends;
                             for (var i = 0; i < mapLegends.length; i++) {
                                 if (mln == mapLegends[i].name) {
-                                    Ext.message.msg(false, i18n_legend + '<span class="x-msg-hl">' + ln + '</span> ' + i18n_already_exists);
+                                    Ext.message.msg(false, i18n_legend + '<span class="x-msg-hl">' + mln + '</span> ' + i18n_already_exists);
                                     return;
                                 }
                             }
@@ -822,7 +824,7 @@
                                     Ext.getCmp('predefinedmaplegendname_tf').reset();
                                     Ext.getCmp('predefinedmaplegendstartvalue_tf').reset();
                                     Ext.getCmp('predefinedmaplegendendvalue_tf').reset();
-                                    Ext.getCmp('predefinedmaplegendcolor_cp').clearValue();
+                                    Ext.getCmp('predefinedmaplegendcolor_cp').reset();
                                 },
                                 failure: function() {
                                     alert( 'Error: addOrUpdateMapLegend' );
@@ -946,7 +948,7 @@
                             Ext.getCmp('predefinedmaplegendsetindicator2_cb').getStore().load();
 							Ext.getCmp('maplegendset_cb').getStore().load();
 							Ext.getCmp('predefinedmaplegendsetname_tf').reset();
-							Ext.getCmp('predefinednewmaplegend_ms').clearValue();							
+							Ext.getCmp('predefinednewmaplegend_ms').reset();							
                         },
                         failure: function() {
                             alert( 'Error: addOrUpdateMapLegendSet' );
@@ -3730,37 +3732,37 @@
                     proportionalSymbol,
                     shapefilePanel,
                     mapping,
-					adminPanel,
-					{
-						xtype: 'print-multi',
-						id: 'printMultiPage_p',
-						title: '<span class="panel-title">Print multi page PDF</span>',
-						formConfig: {
-							labelWidth: 65,
-							bodyStyle: 'padding: 7px;',
-							defaults: {
-								width: 140,
-								listWidth: 140
-							}
-						},
-						columns: [
-							{
-								header: 'Map title',
-								width: 80,
-								dataIndex: 'mapTitle',
-								editor: new Ext.form.TextField()
-							},
-							{
-								header: 'Comment',
-								dataIndex: 'comment',
-								editor: new Ext.form.TextField()
-							}
-						],
-						border: false,
-						map: MAP,
-						configUrl: printConfigUrl,
-						overrides: layerOverrides
-					}
+					adminPanel //,
+					// {
+						// xtype: 'print-multi',
+						// id: 'printMultiPage_p',
+						// title: '<span class="panel-title">Print multi page PDF</span>',
+						// formConfig: {
+							// labelWidth: 65,
+							// bodyStyle: 'padding: 7px;',
+							// defaults: {
+								// width: 140,
+								// listWidth: 140
+							// }
+						// },
+						// columns: [
+							// {
+								// header: 'Map title',
+								// width: 80,
+								// dataIndex: 'mapTitle',
+								// editor: new Ext.form.TextField()
+							// },
+							// {
+								// header: 'Comment',
+								// dataIndex: 'comment',
+								// editor: new Ext.form.TextField()
+							// }
+						// ],
+						// border: false,
+						// map: MAP,
+						// configUrl: printConfigUrl,
+						// overrides: layerOverrides
+					// }
                 ]
             },
             {
@@ -3779,7 +3781,7 @@
 	
     shapefilePanel.hide();
 	mapping.hide();
-	Ext.getCmp('printMultiPage_p').hide();
+	// Ext.getCmp('printMultiPage_p').hide();
 	ACTIVEPANEL = thematicMap;
     
 	/* Section: map controls */

=== 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	2010-08-31 10:27:02 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js	2010-09-19 23:12:37 +0000
@@ -381,22 +381,13 @@
      */
     defaultLabelGenerator: function(bin, binIndex, nbBins) {
 		if (ACTIVEPANEL == organisationUnitAssignment) {
-            if (bin.upperBound < 1) {
-                return 'Available' + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
-            }
-            else {
-                return 'Assigned' + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
-            }
+            return bin.upperBound < 1 ?
+                'Available' + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )' : 'Assigned' + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
 		}
 		else {
-            var upper = parseFloat(bin.upperBound);
-            
-            if (bin.upperBound > bin.lowerBound) {
-                if (binIndex < nbBins-1) {
-                    upper -= parseFloat("0.1");
-                }
-            }
-			return parseFloat(bin.lowerBound).toFixed(1) + ' - ' + upper.toFixed(1) + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
+            lower = getNumberOfDecimals(bin.lowerBound.toString(), ".") > 2 ? Math.round(parseFloat(bin.lowerBound) * 100) / 100 : parseFloat(bin.lowerBound);
+            upper = getNumberOfDecimals(bin.upperBound.toString(), ".") > 2 ? Math.round(parseFloat(bin.upperBound) * 100) / 100 : parseFloat(bin.upperBound);            
+            return lower + ' - ' + upper + '&nbsp;&nbsp; ( ' + bin.nbVal + ' )';
 		}
     },
 
@@ -501,17 +492,11 @@
      * {<mapfish.GeoStat.Classification>} Classification
      */
     classify: function(method, nbBins, bounds) {
-		var mlt;
-        if (ACTIVEPANEL == thematicMap) {
-            mlt = Ext.getCmp('maplegendtype_cb').getValue();
-        }
-        else if (ACTIVEPANEL == thematicMap2) {
-            mlt = Ext.getCmp('maplegendtype_cb2').getValue();
-        }
-        else if (ACTIVEPANEL == organisationUnitAssignment) {
-            mlt = map_legend_type_automatic;
-        }
-
+        var mlt = ACTIVEPANEL == thematicMap ?
+            LEGEND[thematicMap].type : ACTIVEPANEL == thematicMap2 ?
+                LEGEND[thematicMap2].type : ACTIVEPANEL == organisationUnitAssignment ?
+                    map_legend_type_automatic : map_legend_type_automatic;
+    
 		if (mlt == map_legend_type_automatic) {
 			if (method == mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS) {
 				var str = ACTIVEPANEL == thematicMap ? Ext.getCmp('bounds_tf').getValue() : Ext.getCmp('bounds_tf2').getValue();
@@ -559,10 +544,8 @@
 		}
 		else if (mlt == map_legend_type_predefined) {
 			bounds = ACTIVEPANEL == thematicMap ? choropleth.bounds : proportionalSymbol.bounds;
-			if (bounds[0] <= this.minVal) {
-				bounds[0] = this.minVal;
-			}
-			else {
+
+			if (bounds[0] > this.minVal) {
 				bounds.unshift(this.minVal);
                 if (ACTIVEPANEL == thematicMap) {
                     choropleth.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240));
@@ -571,11 +554,8 @@
                     proportionalSymbol.colorInterpolation.unshift(new mapfish.ColorRgb(240,240,240));
                 }
 			}
-			
-			if (bounds[bounds.length-1] >= this.maxVal) {
-				bounds[bounds.length-1] = this.maxVal;
-			}
-			else {
+
+			if (bounds[bounds.length-1] < this.maxVal) {
 				bounds.push(this.maxVal);
                 if (ACTIVEPANEL == thematicMap) {
                     choropleth.colorInterpolation.push(new mapfish.ColorRgb(240,240,240));

=== 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	2010-09-03 14:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js	2010-09-19 23:12:37 +0000
@@ -110,7 +110,8 @@
         var initialColors = this.colors;
         var numColors = this.classification.bins.length;
 		var mapLegendType = ACTIVEPANEL == organisationUnitAssignment ?
-            map_legend_type_automatic : Ext.getCmp('maplegendtype_cb').getValue();
+            map_legend_type_automatic : ACTIVEPANEL == thematicMap ?
+                Ext.getCmp('maplegendtype_cb').getValue() : Ext.getCmp('maplegendtype_cb2').getValue();
 		
 		if (mapLegendType == map_legend_type_automatic) {
 			this.colorInterpolation = choropleth.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
@@ -120,7 +121,7 @@
 		}
 		else if (mapLegendType == map_legend_type_predefined) {
 			this.colorInterpolation = choropleth.colorInterpolation;
-            for (var i = 0; i < choropleth.colorInterpolation.length && i < choropleth.colorInterpolation.length; i++) {
+            for (var i = 0; i < choropleth.imageLegend.length && i < choropleth.colorInterpolation.length; i++) {
                 choropleth.imageLegend[i].color = choropleth.colorInterpolation[i].toHexString();
             }
 		}

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js	2010-09-04 06:08:10 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js	2010-09-19 23:12:37 +0000
@@ -128,7 +128,7 @@
 		}
 		else if (mapLegendType == map_legend_type_predefined) {
 			this.colorInterpolation = proportionalSymbol.colorInterpolation;
-			for (var i = 0; i < proportionalSymbol.colorInterpolation.length && i < proportionalSymbol.colorInterpolation.length; i++) {
+			for (var i = 0; i < proportionalSymbol.imageLegend.length && i < proportionalSymbol.colorInterpolation.length; i++) {
 				proportionalSymbol.imageLegend[i].color = proportionalSymbol.colorInterpolation[i].toHexString();
 			}
 		}

=== 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	2010-09-17 10:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-09-19 23:12:37 +0000
@@ -151,7 +151,7 @@
 				var bounds = [];
 				for (var i = 0; i < mapLegends.length; i++) {
 					if (bounds[bounds.length-1] != mapLegends[i].startValue) {
-						if (bounds.length !== 0) {
+						if (bounds.length != 0) {
 							colors.push(new mapfish.ColorRgb(240,240,240));
 						}
 						bounds.push(mapLegends[i].startValue);
@@ -171,32 +171,6 @@
 		});
 	},
     
-    validateForm2: function() {
-        if (!Ext.getCmp('indicator_cb').getValue() && !Ext.getCmp('dataelement_cb').getValue()) {
-            return false;
-        }
-        if (!Ext.getCmp('period_cb').getValue()) {
-            return false;
-        }
-        if (!Ext.getCmp('map_cb').getValue() && !Ext.getCmp('map_tf').getValue()) {
-            return false;
-        }
-        if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_predefined) {
-            if (!Ext.getCmp('maplegendset_cb').getValue()) {
-                return false;
-            }
-        }
-        else {
-            if (Ext.getCmp('method_cb').getValue() == classify_with_bounds) {
-                if (!Ext.getCmp('bounds_tf').getValue()) {
-                    return false;
-                }
-            }
-        }
-        
-        return true;
-    },
-    
     initComponent: function() {
     
         mapViewStore = new Ext.data.JsonStore({
@@ -788,6 +762,24 @@
 
                                     choropleth.applyPredefinedLegend();
                                 }
+                                else {
+                                    if (LEGEND[thematicMap].type == map_legend_type_predefined) {
+                                        LEGEND[thematicMap].type = map_legend_type_automatic;
+                                        Ext.getCmp('maplegendtype_cb').setValue(LEGEND[thematicMap].type);
+                                        Ext.getCmp('method_cb').showField();
+                                        if (Ext.getCmp('method_cb').getValue() == classify_with_bounds) {
+                                            Ext.getCmp('bounds_tf').showField();
+                                            Ext.getCmp('numClasses_cb').hideField();
+                                        }
+                                        else {
+                                            Ext.getCmp('bounds_tf').hideField();
+                                            Ext.getCmp('numClasses_cb').showField();
+                                        }
+                                        Ext.getCmp('colorA_cf').showField();
+                                        Ext.getCmp('colorB_cf').showField();
+                                        Ext.getCmp('maplegendset_cb').hideField();
+                                    }
+                                }       
 
                                 choropleth.classify(false, true);
                             },
@@ -1182,7 +1174,7 @@
 							Ext.getCmp('maplegendset_cb').showField();
 							
 							if (Ext.getCmp('maplegendset_cb').getValue()) {
-								this.classify(false, true);
+                                choropleth.applyPredefinedLegend();
 							}
                         }
                         else if (Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_automatic && Ext.getCmp('maplegendtype_cb').getValue() != LEGEND[thematicMap].type) {
@@ -1200,7 +1192,7 @@
 							Ext.getCmp('colorB_cf').showField();
 							Ext.getCmp('maplegendset_cb').hideField();
                             
-                            this.classify(false, true);
+                            choropleth.classify(false, true);
                         }
                     },
                     scope: this

=== 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	2010-09-17 10:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2010-09-19 23:12:37 +0000
@@ -170,32 +170,6 @@
 			}
 		});
 	},
-    
-    validateForm2: function() {
-        if (!Ext.getCmp('indicator_cb2').getValue() && !Ext.getCmp('dataelement_cb2').getValue()) {
-            return false;
-        }
-        if (!Ext.getCmp('period_cb2').getValue()) {
-            return false;
-        }
-        if (!Ext.getCmp('map_cb2').getValue() && !Ext.getCmp('map_tf2').getValue()) {
-            return false;
-        }
-        if (Ext.getCmp('maplegendtype_cb2').getValue() == map_legend_type_predefined) {
-            if (!Ext.getCmp('maplegendset_cb2').getValue()) {
-                return false;
-            }
-        }
-        else {
-            if (Ext.getCmp('method_cb2').getValue() == classify_with_bounds) {
-                if (!Ext.getCmp('bounds_tf2').getValue()) {
-                    return false;
-                }
-            }
-        }
-        
-        return true;
-    },
 	
     initComponent : function() {
     
@@ -1182,7 +1156,7 @@
 							Ext.getCmp('maplegendset_cb2').showField();
 							
 							if (Ext.getCmp('maplegendset_cb2').getValue()) {
-								this.classify(false, true);
+								proportionalSymbol.applyPredefinedLegend();
 							}
                         }
                         else if (Ext.getCmp('maplegendtype_cb2').getValue() == map_legend_type_automatic && Ext.getCmp('maplegendtype_cb2').getValue() != LEGEND[thematicMap2].type) {
@@ -1200,7 +1174,7 @@
 							Ext.getCmp('colorB_cf2').showField();
 							Ext.getCmp('maplegendset_cb2').hideField();
                             
-                            this.classify(false, true);
+                            proportionalSymbol.classify(false, true);
                         }
                     },
                     scope: this