=== 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	2009-09-06 11:01:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2009-09-08 20:33:48 +0000
@@ -301,8 +301,7 @@
 
     void updateMapLegendSet( MapLegendSet legendSet );
 
-    void addOrUpdateMapLegendSet( String name, int method, int classes, String colorLow, String colorHigh,
-        Collection<String> indicators );
+    void addOrUpdateMapLegendSet( String name, int method, int classes, String colorLow, String colorHigh );
 
     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	2009-09-08 07:29:51 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-09-08 20:33:48 +0000
@@ -408,18 +408,12 @@
         mappingStore.updateMapLegendSet( mapLegendSet );
     }
 
-    public void addOrUpdateMapLegendSet( String name, int method, int classes, String colorLow, String colorHigh,
-        Collection<String> indicators )
+    public void addOrUpdateMapLegendSet( String name, int method, int classes, String colorLow, String colorHigh )
     {
         MapLegendSet mapLegendSet = getMapLegendSetByName( name );
 
         Set<Indicator> indicatorSet = new HashSet<Indicator>();
 
-        for ( String indicator : indicators )
-        {
-            indicatorSet.add( indicatorService.getIndicator( Integer.parseInt( indicator ) ) );
-        }
-
         if ( mapLegendSet != null )
         {
             mapLegendSet.setMethod( method );

=== 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	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLegendSetAction.java	2009-09-08 20:33:48 +0000
@@ -90,13 +90,6 @@
     {
         this.colorHigh = colorHigh;
     }
-
-    private Collection<String> indicators;
-
-    public void setIndicators( Collection<String> indicators )
-    {
-        this.indicators = indicators;
-    }
     
     // -------------------------------------------------------------------------
     // Action implementation
@@ -104,7 +97,7 @@
 
     public String execute()
     {
-        mappingService.addOrUpdateMapLegendSet( name, method, classes, colorLow, colorHigh, new HashSet<String>(indicators) );
+        mappingService.addOrUpdateMapLegendSet( name, method, classes, colorLow, colorHigh );
         
         return SUCCESS;
     }

=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AssignIndicatorsToMapLegendSetAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AssignIndicatorsToMapLegendSetAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AssignIndicatorsToMapLegendSetAction.java	2009-09-08 20:33:48 +0000
@@ -0,0 +1,74 @@
+package org.hisp.dhis.mapping.action;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.mapping.MappingService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AssignIndicatorsToMapLegendSetAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private MappingService mappingService;
+
+    public void setMappingService( MappingService mappingService )
+    {
+        this.mappingService = mappingService;
+    }
+    
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+    
+    private Integer id;
+    
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private Collection<String> indicators;
+    
+    public void setIndicators( Collection<String> indicators )
+    {
+        this.indicators = indicators;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        MapLegendSet mapLegendSet = mappingService.getMapLegendSet( id );
+        
+        Set<Indicator> indicatorSet = new HashSet<Indicator>();
+
+        for ( String indicator : indicators )
+        {
+            indicatorSet.add( indicatorService.getIndicator( Integer.parseInt( indicator ) ) );
+        }
+        
+        mapLegendSet.setIndicators( indicatorSet );
+        
+        mappingService.updateMapLegendSet( mapLegendSet );
+        
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetAction.java	2009-08-21 08:34:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetAction.java	2009-09-08 20:33:48 +0000
@@ -33,7 +33,7 @@
 import com.opensymphony.xwork2.Action;
 
 /**
- * @author Lars Helge Overland
+ * @author Jan Henrik Overland
  * @version $Id$
  */
 public class GetMapLegendSetAction
@@ -54,11 +54,11 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private int indicatorId;
+    private int id;
 
-    public void setIndicatorId( int indicatorId )
+    public void setId( int id )
     {
-        this.indicatorId = indicatorId;
+        this.id = id;
     }
 
     // -------------------------------------------------------------------------
@@ -79,7 +79,7 @@
     public String execute()
         throws Exception
     {
-        object = mappingService.getMapLegendSetByIndicator( indicatorId );
+        object = mappingService.getMapLegendSet( id );
         
         return SUCCESS;
     }

=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java	2009-09-08 20:33:48 +0000
@@ -0,0 +1,86 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.mapping.MappingService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class GetMapLegendSetByIndicatorAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private MappingService mappingService;
+
+    public void setMappingService( MappingService mappingService )
+    {
+        this.mappingService = mappingService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private int indicatorId;
+
+    public void setIndicatorId( int indicatorId )
+    {
+        this.indicatorId = indicatorId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private MapLegendSet object;
+
+    public MapLegendSet getObject()
+    {
+        return object;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        object = mappingService.getMapLegendSetByIndicator( indicatorId );
+        
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml	2009-09-01 09:29:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml	2009-09-08 20:33:48 +0000
@@ -146,7 +146,7 @@
     scope="prototype">
     <property name="mappingService"
       ref="org.hisp.dhis.mapping.MappingService"/>
-  </bean>	
+  </bean>
     
   <bean id="org.hisp.dhis.mapping.action.DeleteMapLegendSetAction"
     class="org.hisp.dhis.mapping.action.DeleteMapLegendSetAction"
@@ -161,12 +161,28 @@
     <property name="mappingService"
       ref="org.hisp.dhis.mapping.MappingService"/>
   </bean>
-  
+	
   <bean id="org.hisp.dhis.mapping.action.GetMapLegendSetAction"
     class="org.hisp.dhis.mapping.action.GetMapLegendSetAction"
     scope="prototype">
     <property name="mappingService"
       ref="org.hisp.dhis.mapping.MappingService"/>
+  </bean>	
+  
+  <bean id="org.hisp.dhis.mapping.action.GetMapLegendSetByIndicatorAction"
+    class="org.hisp.dhis.mapping.action.GetMapLegendSetByIndicatorAction"
+    scope="prototype">
+    <property name="mappingService"
+      ref="org.hisp.dhis.mapping.MappingService"/>
+  </bean>
+	
+  <bean id="org.hisp.dhis.mapping.action.AssignIndicatorsToMapLegendSetAction"
+    class="org.hisp.dhis.mapping.action.AssignIndicatorsToMapLegendSetAction"
+    scope="prototype">
+    <property name="mappingService"
+      ref="org.hisp.dhis.mapping.MappingService"/>
+	<property name="indicatorService"
+      ref="org.hisp.dhis.indicator.IndicatorService"/>
   </bean>
 	
   <!-- MapView -->

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml	2009-09-01 09:44:10 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml	2009-09-08 20:33:48 +0000
@@ -101,7 +101,19 @@
         
     <action name="getMapLegendSet" class="org.hisp.dhis.mapping.action.GetMapLegendSetAction">
       <result name="success" type="velocity-json">/dhis-web-mapping/jsonMapLegendSet.vm</result>
+    </action>        
+    
+	<action name="getMapLegendSetByIndicator" class="org.hisp.dhis.mapping.action.GetMapLegendSetByIndicatorAction">
+      <result name="success" type="velocity-json">/dhis-web-mapping/jsonMapLegendSet.vm</result>
     </action>
+	
+	<action name="getMapLegendSetIndicators" class="org.hisp.dhis.mapping.action.GetMapLegendSetAction">
+		<result name="success" type="velocity-json">/dhis-web-mapping/jsonMapLegendSetIndicators.vm</result>
+	</action>
+	    
+	<action name="assignIndicatorsToMapLegendSet" class="org.hisp.dhis.mapping.action.AssignIndicatorsToMapLegendSetAction">
+      <result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
+    </action>	
 	  
 	<!-- MapView -->
 	  

=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSetIndicators.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSetIndicators.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSetIndicators.vm	2009-09-08 20:33:48 +0000
@@ -0,0 +1,7 @@
+#set( $size = $object.indicators.size() )
+{ "mapLegendSet":
+  [{
+    "id": $!{object.id},
+    "indicators": [#foreach( $indicator in $object.indicators )$!{indicator.id}#if( $velocityCount < $size ),#end#end]
+  }]
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js	2009-09-06 13:31:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/mapping/script/index.js	2009-09-08 20:33:48 +0000
@@ -155,11 +155,11 @@
 		controls: [
 			new OpenLayers.Control.Navigation(),
 			new OpenLayers.Control.ArgParser(),
-			new OpenLayers.Control.Attribution(),
+			new OpenLayers.Control.Attribution()
 		]
 	});
 	this.myMap = map;
-    
+	
     MAPDATA = null;
     URL = null;
     ACTIVEPANEL = 'choropleth';
@@ -221,16 +221,16 @@
         var h = screen.height;
         
         if (h <= 800) {
-            return 120;
+            return 220;
         }
         else if (h <= 1050) {
             return 310;
         }
         else if (h <= 1200) {
-            return 530;
+            return 470;
         }
         else {
-            return 850;
+            return 900;
         }
     }
     
@@ -881,7 +881,7 @@
                 items:
                 [
                     {
-                        title:'New map',
+                        title:'New',
                         id: 'map0',
                         items:
                         [
@@ -889,7 +889,7 @@
                         ]
                     },
                     {
-                        title:'Edit map',
+                        title:'Edit',
                         id: 'map1',
                         items:
                         [
@@ -897,7 +897,7 @@
                         ]
                     },
                     {
-                        title:'Delete map',
+                        title:'Delete',
                         id: 'map2',
                         items:
                         [
@@ -994,12 +994,13 @@
     var legendSetStore = new Ext.data.JsonStore({
         url: path + 'getAllMapLegendSets' + type,
         root: 'mapLegendSets',
+		id: 'id',
         fields: ['id', 'name'],
         sortInfo: { field: 'name', direction: 'ASC' },
         autoLoad: true
     });
-    
-    var legendSetComboBox = new Ext.form.ComboBox({
+	
+	var legendSetComboBox = new Ext.form.ComboBox({
         id: 'legendset_cb',
         typeAhead: true,
         editable: false,
@@ -1012,6 +1013,52 @@
         selectOnFocus: true,
         width: combo_width,
         minListWidth: combo_width + 26,
+        store: legendSetStore,
+		listeners:{
+			'select': {
+				fn: function() {
+					var lsid = Ext.getCmp('legendset_cb').getValue();
+					
+					Ext.Ajax.request({
+						url: path + 'getMapLegendSetIndicators' + type,
+						method: 'POST',
+						params: { id:lsid },
+
+						success: function( responseObject ) {
+							var indicators = Ext.util.JSON.decode( responseObject.responseText ).mapLegendSet[0].indicators;
+							var indicatorString = '';
+							
+							for (var i = 0; i < indicators.length; i++) {
+								indicatorString += indicators[i];
+								if (i < indicators.length-1) {
+									indicatorString += ',';
+								}
+							}
+							
+							Ext.getCmp('legendsetindicator_ms').setValue(indicatorString);							
+						},
+						failure: function() {
+							alert( 'Status', 'Error while saving data' );
+						}
+					});
+				}
+			}
+		}					
+    });
+	    
+    var legendSet2ComboBox = new Ext.form.ComboBox({
+        id: 'legendset2_cb',
+        typeAhead: true,
+        editable: false,
+        valueField: 'id',
+        displayField: 'name',
+        mode: 'remote',
+        forceSelection: true,
+        triggerAction: 'all',
+        emptyText: MENU_EMPTYTEXT,
+        selectOnFocus: true,
+        width: combo_width,
+        minListWidth: combo_width + 26,
         store: legendSetStore
     });
     
@@ -1024,10 +1071,8 @@
             var lc = Ext.getCmp('legendsetclasses_cb').getValue();            
             var llc = Ext.getCmp('legendsetlowcolor_cp').getValue();
             var lhc = Ext.getCmp('legendsethighcolor_cp').getValue();
-/*            var li = Ext.getCmp('legendsetindicator_cb').getValue();*/
-            var lims = Ext.getCmp('legendsetindicator_ms').getValue();
             
-            if (!lc || !ln || !lims) {
+            if (!ln || !lc) {
                 Ext.messageRed.msg('New legend set', 'Form is not complete.');
                 return;
             }
@@ -1036,27 +1081,88 @@
                 Ext.messageRed.msg('New legend set', 'Legend set name cannot be longer than 25 characters.');
                 return;
             }
+			
+			Ext.Ajax.request({
+                url: path + 'getAllMapLegendSets' + type,
+                method: 'GET',
+
+                success: function( responseObject ) {
+                    var mapLegendSets = Ext.util.JSON.decode( responseObject.responseText ).mapLegendSets;
+					for (var i = 0; i < mapLegendSets.length; i++) {
+						if (ln == mapLegendSets[i].name) {
+							Ext.messageRed.msg('New legend set', 'A legend set called ' + msg_highlight_start + ln + msg_highlight_end + ' already exists.');
+							return;
+						}
+					}
+					
+					Ext.Ajax.request({
+						url: path + 'addOrUpdateMapLegendSet' + type,
+						method: 'POST',
+						params: { name: ln, method: 2, classes: lc, colorLow: llc, colorHigh: lhc },
+
+						success: function( responseObject ) {
+							Ext.messageBlack.msg('New legend set', 'The legend set ' + msg_highlight_start + ln + msg_highlight_end + ' was registered.');
+							Ext.getCmp('legendset_cb').getStore().reload();
+							Ext.getCmp('legendset2_cb').getStore().reload();
+							Ext.getCmp('legendsetname_tf').reset();
+							Ext.getCmp('legendsetclasses_cb').reset();
+							Ext.getCmp('legendsetlowcolor_cp').reset();
+							Ext.getCmp('legendsethighcolor_cp').reset();
+						},
+						failure: function() {
+							alert( 'Status', 'Error while saving data' );
+						}
+					});
+                },
+                failure: function() {
+                    alert( 'Error: getAllMapLegendSets' );
+                }
+            });
+           
+            
+        }
+    });
+		
+	var assignLegendSetButton = new Ext.Button({
+        id: 'assignlegendset_b',
+        text: 'Assign to indicators',
+        handler: function() {
+			var ls = Ext.getCmp('legendset_cb').getValue();
+            var lsrw = Ext.getCmp('legendset_cb').getRawValue();
+            var lims = Ext.getCmp('legendsetindicator_ms').getValue();
+            
+            if (!ls) {
+                Ext.messageRed.msg('Assign to indicators', 'Please select a legend set.');
+                return;
+            }
+			
+			if (!lims) {
+                Ext.messageRed.msg('Link legend set to indicator', 'Please select at least one indicator.');
+                return;
+            }
             
             var array = new Array();
             array = lims.split(',');
             var params = '?indicators=' + array[0];
-            
-            for (var i = 1; i < array.length; i++) {
-                array[i] = '&indicators=' + array[i];
-                params += array[i];
-            }
+			
+			if (array.length > 1) {
+				for (var i = 1; i < array.length; i++) {
+					array[i] = '&indicators=' + array[i];
+					params += array[i];
+				}
+			}
             
             Ext.Ajax.request({
-                url: path + 'addOrUpdateMapLegendSet.action' + params,
+                url: path + 'assignIndicatorsToMapLegendSet.action' + params,
                 method: 'POST',
-                params: { name: ln, method: 2, classes: lc, colorLow: llc, colorHigh: lhc },
+                params: { id: ls },
 
                 success: function( responseObject ) {
-                    Ext.messageBlack.msg('New legend set', 'The legend set ' + msg_highlight_start + ln + msg_highlight_end + ' was registered.');
+                    Ext.messageBlack.msg('Assign to indicators', 'The legend set ' + msg_highlight_start + lsrw + msg_highlight_end + ' was updated.');
                     Ext.getCmp('legendset_cb').getStore().reload();
                 },
                 failure: function() {
-                    alert( 'Status', 'Error while saving data' );
+                    alert( 'Error: assignIndicatorsToMapLegendSet' );
                 }
             });
         }
@@ -1066,8 +1172,8 @@
         id: 'deletelegendset_b',
         text: 'Delete legend set',
         handler: function() {
-            var ls = Ext.getCmp('legendset_cb').getValue();
-            var lsrw = Ext.getCmp('legendset_cb').getRawValue();
+            var ls = Ext.getCmp('legendset2_cb').getValue();
+            var lsrw = Ext.getCmp('legendset2_cb').getRawValue();
             
             if (!ls) {
                 Ext.messageRed.msg('Delete legend set', 'Please select a legend set.');
@@ -1082,8 +1188,11 @@
                 success: function( responseObject ) {
                     Ext.messageBlack.msg('Delete legend set', 'The legend set ' + msg_highlight_start + lsrw + msg_highlight_end + ' was deleted.');
                     
-                    Ext.getCmp('legendset_cb').getStore().reload();
+                    Ext.getCmp('legendset2_cb').getStore().reload();
+                    Ext.getCmp('legendset2_cb').reset();
+					Ext.getCmp('legendset_cb').getStore().reload();
                     Ext.getCmp('legendset_cb').reset();
+					Ext.getCmp('legendsetindicator_ms').reset();
                 },
                 failure: function() {
                     alert( 'Status', 'Error while saving data' );
@@ -1100,21 +1209,27 @@
 /*            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Method</p>' }, legendSetMethodComboBox, { html: '<br>' },*/
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Classes</p>' }, legendSetClassesComboBox, { html: '<br>' },
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Lowest value color</p>' }, legendSetLowColorColorPalette, { html: '<br>' },
-            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Highest value color</p>' }, legendSetHighColorColorPalette, { html: '<br>' },
-/*            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Indicator group</p>' }, legendSetIndicatorGroupComboBox, { html: '<br>' },*/
-/*            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Indicator</p>' }, legendSetIndicatorComboBox*/
+            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Highest value color</p>' }, legendSetHighColorColorPalette
+        ]
+    });
+	
+	var assignLegendSetPanel = new Ext.Panel({   
+        id: 'assignlegendset_p',
+        items:
+        [   
+            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Legend set</p>' }, legendSetComboBox, { html: '<br>' },
             { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Indicators</p>' }, legendSetIndicatorMultiSelect
         ]
     });
     
-    var deleteLegendSetPanel = new Ext.Panel({   
+    var deleteLegendSetPanel = new Ext.Panel({
         id: 'deletelegendset_p',
         items:
         [   
-            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Legend set</p>' }, legendSetComboBox
+            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Legend set</p>' }, legendSet2ComboBox
         ]
     });
-
+	
     var legendsetPanel = new Ext.Panel({
         id: 'legendset_p',
         title: '<font style="font-family:tahoma; font-weight:normal; font-size:11px; color:' + MENU_TITLECOLOR_LIGHT + ';">Register legend sets</font>',
@@ -1130,29 +1245,45 @@
                     tabchange: function(panel, tab) {
                         var nl_b = Ext.getCmp('newlegendset_b');
                         var dl_b = Ext.getCmp('deletelegendset_b');
+						var al_b = Ext.getCmp('assignlegendset_b');
                         
                         if (tab.id == 'legendset0') { 
                             nl_b.setVisible(true);
                             dl_b.setVisible(false);
+							al_b.setVisible(false);
                         }
                         else if (tab.id == 'legendset1') {
                             nl_b.setVisible(false);
                             dl_b.setVisible(true);
+							al_b.setVisible(false);
+                        }
+						else if (tab.id == 'legendset2') {
+                            nl_b.setVisible(false);
+                            dl_b.setVisible(false);
+							al_b.setVisible(true);
                         }
                     }
                 },
                 items:
                 [
                     {
-                        title:'New legend set',
+                        title:'New',
                         id: 'legendset0',
                         items:
                         [
                             newLegendSetPanel
                         ]
                     },
+					{
+                        title:'Assign to indicators',
+                        id: 'legendset2',
+                        items:
+                        [
+                            assignLegendSetPanel
+                        ]
+                    },
                     {
-                        title:'Delete legend set',
+                        title:'Delete',
                         id: 'legendset1',
                         items:
                         [
@@ -1165,7 +1296,9 @@
             
             newLegendSetButton,
             
-            deleteLegendSetButton
+            deleteLegendSetButton,
+			
+			assignLegendSetButton
         ]
     });
     
@@ -1413,7 +1546,7 @@
                 items:
                 [
                     {
-                        title:'New view',
+                        title:'New',
                         id: 'view0',
                         items:
                         [
@@ -1422,7 +1555,7 @@
                     },
                     
                     {
-                        title:'Delete view',
+                        title:'Delete',
                         id: 'view1',
                         items:
                         [
@@ -1431,7 +1564,7 @@
                     },
                     
                     {
-                        title:'Dashboard view',
+                        title:'Add to Dashboard',
                         id: 'view2',
                         items:
                         [
@@ -1676,7 +1809,7 @@
                 items:
                 [
                     {
-                        title:'New overlay',
+                        title:'New',
                         id: 'maplayer0',
                         items:
                         [
@@ -1684,7 +1817,7 @@
                         ]
                     },
                     {
-                        title:'Delete overlay',
+                        title:'Delete',
                         id: 'maplayer1',
                         items:
                         [
@@ -2172,7 +2305,6 @@
                 MAPDATA.name = Ext.getCmp('map_cb').getRawValue();
                 MAPDATA.organisationUnit = 'Country';
                 MAPDATA.organisationUnitLevel = Ext.getCmp('map_cb').getValue();
-                MAPDATA.unqiueColumn = 'name';
                 MAPDATA.nameColumn = 'name';
                 MAPDATA.longitude = COUNTRY_LONGITUDE;
                 MAPDATA.latitude = COUNTRY_LATITUDE;
@@ -2234,11 +2366,17 @@
     var features = layers[0].features;
     
     var mapvalues = Ext.util.JSON.decode(responseText).mapvalues;
+	
+	if (mapvalues.length == 0) {
+		Ext.messageRed.msg('Thematic map', 'The selected indicator, period and level returned no data.');
+		MASK.hide();
+		return;
+	}
     
     if (MAPSOURCE == 'database') {
         for (var i=0; i < features.length; i++) {
             for (var j=0; j < mapvalues.length; j++) {
-                if (features[i].attributes.value == null) {
+				if (features[i].attributes.value == null) {
                     features[i].attributes.value = 0;
                 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Choropleth.js	2009-09-06 13:05:20 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/resources/mapfish/widgets/geostat/Choropleth.js	2009-09-08 20:33:48 +0000
@@ -267,7 +267,6 @@
                             });
                             
                             this.newUrl = MAPVIEW.mapSource;
-                            choropleth.classify(false);
                         }
                     },
                     scope: this
@@ -294,14 +293,6 @@
             }
         });
         
-        legendStore = new Ext.data.JsonStore({
-            url: path + 'getMapLegendSet' + type,
-            baseParams: { format: 'json' },
-            root: 'mapLegendSet',
-            fields: ['id', 'name'],
-            autoLoad: false
-        });
-        
         this.items = [
          
         {
@@ -416,7 +407,7 @@
                         var iId = Ext.getCmp('indicator_cb').getValue();
                         
                         Ext.Ajax.request({
-                            url: path + 'getMapLegendSet' + type,
+                            url: path + 'getMapLegendSetByIndicator' + type,
                             method: 'POST',
                             params: { indicatorId: iId, format: 'json' },
 
@@ -648,7 +639,7 @@
             isFormField: true,
             fieldLabel: '',
             labelStyle: 'color:#dfe8f6;',
-            text: 'Refresh colors',
+            text: 'Refresh',
             handler: function() {
                 this.layer.setVisibility(true);
                 this.classify(true);
@@ -721,7 +712,7 @@
         if (this.newUrl) {
             URL = this.newUrl;
             this.newUrl = false;
-            
+			
             if (MAPSOURCE == MAP_SOURCE_TYPE_DATABASE) {
                 if (URL == PHU_LEVEL) {
                     this.setUrl(path + 'getPointShapefile.action?level=' + URL);

