← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2070: (GIS) Predefined legend sets can be assigned to indicator. Automatic legend sets removed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2070 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-09-06 16:09:40 +0530
message:
  (GIS) Predefined legend sets can be assigned to indicator. Automatic legend sets removed.
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/widgets/geostat/Choropleth.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-04 07:27:41 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties	2010-09-06 10:17:56 +0000
@@ -152,7 +152,7 @@
 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_indocator					= Assign to indicators
+assign_to_indicator					= Assign to indicators
 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.

=== 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-04 07:27:41 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm	2010-09-06 10:17:56 +0000
@@ -151,7 +151,7 @@
 var i18n_name_can_not_longer_than_25 = '$encoder.jsEscape($i18n.getString( 'name_can_not_longer_than_25' ) , "'")';
 var i18n_already_exists = '$encoder.jsEscape($i18n.getString( 'already_exists' ) , "'")';
 var i18n_a_legend_set_called = '$encoder.jsEscape($i18n.getString( 'a_legend_set_called' ) , "'")';
-var i18n_assign_to_indocator = '$encoder.jsEscape($i18n.getString( 'assign_to_indocator' ) , "'")';
+var i18n_assign_to_indicator = '$encoder.jsEscape($i18n.getString( 'assign_to_indicator' ) , "'")';
 var i18n_please_select_a_legend_set = '$encoder.jsEscape($i18n.getString( 'please_select_a_legend_set' ) , "'")';
 var i18n_link_legend_set_to_indicator = '$encoder.jsEscape($i18n.getString( 'link_legend_set_to_indicator' ) , "'")';
 var i18n_please_select_at_least_one_indicator = '$encoder.jsEscape($i18n.getString( 'please_select_at_least_one_indicator' ) , "'")';	

=== 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-04 07:27:41 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-06 10:32:33 +0000
@@ -763,327 +763,25 @@
 	var exportImageWindow=new Ext.Window({id:'exportimage_w',title:'<span id="window-image-title">'+ i18n_export_map_as_image +'</span>',layout:'fit',closeAction:'hide',defaults:{layout:'fit',bodyStyle:'padding:8px; border:0px'},width:250,height:158,items:[{xtype:'panel',items:[exportImagePanel]}]});
 	var exportExcelWindow=new Ext.Window({id:'exportexcel_w',title:'<span id="window-excel-title">'+i18n_export_excel+'</span>',layout:'fit',closeAction:'hide',defaults:{layout:'fit',bodyStyle:'padding:8px; border:0px'},width:260,height:157,items:[{xtype:'panel',items:[exportExcelPanel]}]});
 	
-    /* Section: automatic legend set */
-	var automaticMapLegendSetNameTextField=new Ext.form.TextField({id:'automaticmaplegendsetname_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_width});
-	var automaticMapLegendSetMethodComboBox=new Ext.form.ComboBox({id:'automaticmaplegendsetmethod_cb',isFormField:true,hideLabel:true,editable:false,valueField:'value',displayField:'text',mode:'local',emptyText:emptytext,triggerAction:'all',width:combo_width,minListWidth:combo_width,store:new Ext.data.SimpleStore({fields:['value','text'],data:[[2,'Distributed values'],[1,'Equal intervals']]})});
-	var automaticMapLegendSetClassesComboBox=new Ext.form.ComboBox({id:'automaticmaplegendsetclasses_cb',isFormField:true,hideLabel:true,editable:false,valueField:'value',displayField:'value',mode:'local',emptyText:emptytext,triggerAction:'all',value:5,width:combo_number_width,minListWidth:combo_number_width,store:new Ext.data.SimpleStore({fields:['value'],data:[[1],[2],[3],[4],[5],[6],[7],[8]]})});
-	var automaticMapLegendSetLowColorColorPalette=new Ext.ux.ColorField({id:'automaticmaplegendsetlowcolor_cp',isFormField:true,hideLabel:true,allowBlank:false,width:combo_width,minListWidth:combo_width,value:"#FFFF00"});
-	var automaticMapLegendSetHighColorColorPalette=new Ext.ux.ColorField({id:'automaticmaplegendsethighcolor_cp',isFormField:true,hideLabel:true,allowBlank:false,width:combo_width,minListWidth:combo_width,value:"#FF0000"});
-	var automaticMapLegendSetStore=new Ext.data.JsonStore({url:path_mapping+'getMapLegendSetsByType'+type,baseParams:{type:map_legend_type_automatic},root:'mapLegendSets',id:'id',fields:['id','name'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
-	
-	var automaticMapLegendSetComboBox = new Ext.form.ComboBox({
-        id: 'automaticmaplegendset_cb',
-		isFormField: true,
-		hideLabel: true,
-        typeAhead: true,
-        editable: false,
-        valueField: 'id',
-        displayField: 'name',
-        mode: 'remote',
-        forceSelection: true,
-        triggerAction: 'all',
-        emptyText: emptytext,
-        selectOnFocus: true,
-        width: combo_width,
-        minListWidth: combo_width,
-        store: automaticMapLegendSetStore,
-		listeners:{
-			'select': {
-				fn: function() {
-					var lsid = Ext.getCmp('automaticmaplegendset_cb').getValue();
-					
-					Ext.Ajax.request({
-						url: path_mapping + 'getMapLegendSetIndicators' + type,
-						method: 'POST',
-						params: { id:lsid },
-						success: function(r) {
-							var indicators = Ext.util.JSON.decode(r.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('automaticmaplegendsetindicator_ms').setValue(indicatorString);							
-						},
-						failure: function() {
-							alert( i18n_status , i18n_error_while_saving_data );
-						}
-					});
-				}
-			}
-		}					
-    });
-	
-	var automaticMapLegendSetIndicatorStore=new Ext.data.JsonStore({url:path_mapping+'getAllIndicators'+type,root:'indicators',fields:['id','name','shortName'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
-	var automaticMapLegendSetIndicatorMultiSelect=new Ext.ux.Multiselect({id:'automaticmaplegendsetindicator_ms',isFormField:true,hideLabel:true,dataFields:['id','name','shortName'],valueField:'id',displayField:'shortName',width:multiselect_width,height:getMultiSelectHeight(),store:automaticMapLegendSetIndicatorStore});
-	var automaticMapLegendSet2ComboBox=new Ext.form.ComboBox({id:'automaticmaplegendset2_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:automaticMapLegendSetStore});
-
-	var newAutomaticMapLegendSetPanel = new Ext.form.FormPanel({   
-        id: 'newautomaticmaplegendset_p',
-		bodyStyle: 'border:0px solid #fff',
-        items:
-        [   
-            { html: '<div class="window-field-label-first">'+i18n_display_name+'</div>' },
-            automaticMapLegendSetNameTextField,
-/*            { html: '<p style="padding-bottom:4px; color:' + MENU_TEXTCOLOR + ';">&nbsp;Method</p>' }, legendSetMethodComboBox, { html: '<br>' },*/
-            { html: '<div class="window-field-label">'+i18n_classes+'</div>' },
-            automaticMapLegendSetClassesComboBox,
-            { html: '<div class="window-field-label">'+i18n_low_color+'</div>' },
-            automaticMapLegendSetLowColorColorPalette,
-            { html: '<div class="window-field-label">'+i18n_high_color+'</div>' },
-            automaticMapLegendSetHighColorColorPalette,
-            {
-                xtype: 'button',
-                id: 'newautomaticmaplegendset_b',
-				isFormField: true,
-				hideLabel: true,
-                text: i18n_save,
-				cls: 'window-button',
-                handler: function() {
-                    var ln = Ext.getCmp('automaticmaplegendsetname_tf').getValue();
-        /*            var lm = Ext.getCmp('automaticmaplegendsetmethod_cb').getValue();*/
-                    var lc = Ext.getCmp('automaticmaplegendsetclasses_cb').getValue();            
-                    var llc = Ext.getCmp('automaticmaplegendsetlowcolor_cp').getValue();
-                    var lhc = Ext.getCmp('automaticmaplegendsethighcolor_cp').getValue();
-                    
-                    if (!ln || !lc) {
-                        Ext.message.msg(false, i18n_form_is_not_complete );
-                        return;
-                    }
-                    
-                    if (validateInput(ln) == false) {
-                        Ext.message.msg(false, i18n_name_can_not_longer_than_25);
-                        return;
-                    }
-                    
-                    Ext.Ajax.request({
-                        url: path_mapping + 'getAllMapLegendSets' + type,
-                        method: 'GET',
-						success: function(r) {
-                            var mapLegendSets = Ext.util.JSON.decode(r.responseText).mapLegendSets;
-                            for (var i = 0; i < mapLegendSets.length; i++) {
-                                if (ln == mapLegendSets[i].name) {
-                                    Ext.message.msg(false, i18n_a_legend_set_called+' <span class="x-msg-hl">' + ln + '</span> ' + i18n_already_exists );
-                                    return;
-                                }
-                            }
-                            
-                            Ext.Ajax.request({
-                                url: path_mapping + 'addOrUpdateMapLegendSet' + type,
-                                method: 'POST',
-                                params: { name: ln, type: map_legend_type_automatic, method: 2, classes: lc, colorLow: llc, colorHigh: lhc },
-                                success: function(r) {
-                                    Ext.message.msg(true, i18n_legend_set + ' <span class="x-msg-hl">' + ln + '</span> ' + i18n_was_registered);
-                                    Ext.getCmp('automaticmaplegendset_cb').getStore().load();
-                                    Ext.getCmp('automaticmaplegendsetname_tf').reset();
-                                    Ext.getCmp('automaticmaplegendsetclasses_cb').clearValue();
-                                    Ext.getCmp('automaticmaplegendsetlowcolor_cp').clearValue();
-                                    Ext.getCmp('automaticmaplegendsethighcolor_cp').clearValue();
-                                },
-                                failure: function() {
-                                    alert( i18n_status , i18n_error_while_saving_data );
-                                }
-                            });
-                        },
-                        failure: function() {
-                            alert( 'Error: getAllMapLegendSets' );
-                        }
-                    });
-                }
-            }
-        ]	
-    });
-	
-	var assignAutomaticMapLegendSetPanel = new Ext.form.FormPanel({   
-        id: 'assignautomaticmaplegendset_p',
-		bodyStyle: 'border:0px',
-        items:
-        [   
-            { html: '<div class="window-field-label-first">'+i18n_legend_set+'</div>' },
-            automaticMapLegendSetComboBox,
-            { html: '<div class="window-field-label">'+i18n_indicator+'</div>' },
-			automaticMapLegendSetIndicatorMultiSelect,
-            {
-                xtype: 'button',
-                id: 'assignautomaticmaplegendset_b',
-                text: i18n_assign_to_indicators,
-				cls: 'window-button',
-                handler: function() {
-                    var ls = Ext.getCmp('automaticmaplegendset_cb').getValue();
-                    var lsrw = Ext.getCmp('automaticmaplegendset_cb').getRawValue();
-                    var lims = Ext.getCmp('automaticmaplegendsetindicator_ms').getValue();
-                    
-                    if (!ls) {
-                        Ext.message.msg(false, i18n_please_select_a_legend_set );
-                        return;
-                    }
-                    
-                    if (!lims) {
-                        Ext.message.msg(false, i18n_please_select_at_least_one_indicator );
-                        return;
-                    }
-                    
-                    var array = new Array();
-                    array = lims.split(',');
-                    var params = '?indicators=' + array[0];
-                    
-                    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_mapping + 'assignIndicatorsToMapLegendSet.action' + params,
-                        method: 'POST',
-                        params: { id: ls },
-
-                        success: function(r) {
-                            Ext.message.msg(true, i18n_legend_set+' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_updated);
-                            Ext.getCmp('automaticmaplegendset_cb').getStore().load();
-                        },
-                        failure: function() {
-                            alert( 'Error: assignIndicatorsToMapLegendSet' );
-                        }
-                    });
-                }
-            }
-        ]
-    });
-    
-    var deleteAutomaticMapLegendSetPanel = new Ext.form.FormPanel({
-        id: 'deleteautomaticmaplegendset_p',
-		bodyStyle: 'border:0px solid #fff',
-        items:
-        [   
-            { html: '<div class="window-field-label-first">'+i18n_legend_set+'</p>' },
-            automaticMapLegendSet2ComboBox,
-            {
-                xtype: 'button',
-                id: 'deleteautomaticmaplegendset_b',
-                text: i18n_delete,
-				cls: 'window-button',
-                handler: function() {
-                    var ls = Ext.getCmp('automaticmaplegendset2_cb').getValue();
-                    var lsrw = Ext.getCmp('automaticmaplegendset2_cb').getRawValue();
-                    
-                    if (!ls) {
-                        Ext.message.msg(false, i18n_please_select_a_legend_set );
-                        return;
-                    }
-                    
-                    Ext.Ajax.request({
-                        url: path_mapping + 'deleteMapLegendSet' + type,
-                        method: 'GET',
-                        params: { id: ls },
-                        success: function(r) {
-                            Ext.message.msg(true, i18n_legend_set + ' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_deleted );
-                            Ext.getCmp('automaticmaplegendset_cb').getStore().load();
-                            Ext.getCmp('automaticmaplegendset_cb').clearValue();
-							Ext.getCmp('automaticmaplegendset2_cb').clearValue();
-                            Ext.getCmp('automaticmaplegendsetindicator_ms').clearValue();
-                        },
-                        failure: function() {
-                            alert( i18n_status , i18n_error_while_saving_data );
-                        }
-                    });
-                }
-            }
-        ]
-    });
-    
-    var automaticMapLegendSetWindow = new Ext.Window({
-        id: 'automaticmaplegendset_w',
-        title: '<span id="window-automaticlegendset-title">'+i18n_automatic_legend_sets+'</span>',
-		layout: 'fit',
-        closeAction: 'hide',
-		width: 245,
-        items:
-        [
-			{
-				xtype: 'tabpanel',
-				activeTab: 0,
-				layoutOnTabChange: true,
-				deferredRender: false,
-				plain: true,
-				defaults: {layout: 'fit', bodyStyle: 'padding:8px; border:0px'},
-				listeners: {
-					tabchange: function(panel, tab)
-					{
-						var w = Ext.getCmp('automaticmaplegendset_w');
-						
-						if (tab.id == 'automaticmaplegendset0') { 
-							w.setHeight(298);
-						}
-						else if (tab.id == 'automaticmaplegendset1') {
-							w.setHeight(getMultiSelectHeight() + 180);
-						}
-						else if (tab.id == 'automaticmaplegendset2') {
-							w.setHeight(151);
-						}
-					}
-				},
-				items:
-				[
-					{
-						title: '<span class="panel-tab-title">'+i18n_new+'</span>',
-						id: 'automaticmaplegendset0',
-						items:
-						[
-							newAutomaticMapLegendSetPanel
-						]
-					},
-					{
-						title: '<span class="panel-tab-title">'+i18n_assign_to_indocator+'</span>',
-						id: 'automaticmaplegendset1',
-						items:
-						[
-							assignAutomaticMapLegendSetPanel
-						]
-					},
-					{
-						title: '<span class="panel-tab-title">'+i18n_delete+'</span>',
-						id: 'automaticmaplegendset2',
-						items:
-						[
-							deleteAutomaticMapLegendSetPanel
-						]
-					}
-				]
-			}
-        ]
-    });
-	
 	/* Section: predefined legend set */
-	var predefinedMapLegendStore=new Ext.data.JsonStore({url:path_mapping+'getAllMapLegends'+type,root:'mapLegends',id:'id',fields:['id','name','startValue','endValue','color','displayString'],autoLoad:true});
-	var predefinedMapLegendSetStore=new Ext.data.JsonStore({url:path_mapping+'getMapLegendSetsByType'+type,baseParams:{type:map_legend_type_predefined},root:'mapLegendSets',id:'id',fields:['id','name'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
-	var predefinedMapLegendNameTextField=new Ext.form.TextField({id:'predefinedmaplegendname_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_width});
-	var predefinedMapLegendStartValueTextField=new Ext.form.TextField({id:'predefinedmaplegendstartvalue_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_number_width,minListWidth:combo_number_width});
-	var predefinedMapLegendEndValueTextField=new Ext.form.TextField({id:'predefinedmaplegendendvalue_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_number_width,minListWidth:combo_number_width});
-	var predefinedMapLegendColorColorPalette=new Ext.ux.ColorField({id:'predefinedmaplegendcolor_cp',isFormField:true,hideLabel:true,allowBlank:false,width:combo_width,minListWidth:combo_width,value:"#FFFF00"});
-	var predefinedMapLegendComboBox=new Ext.form.ComboBox({id:'predefinedmaplegend_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:predefinedMapLegendStore});
-	var predefinedMapLegendSetNameTextField=new Ext.form.TextField({id:'predefinedmaplegendsetname_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_width});
-	var predefinedNewMapLegendMultiSelect=new Ext.ux.Multiselect({id:'predefinednewmaplegend_ms',isFormField:true,hideLabel:true,dataFields:['id','name','startValue','endValue','color','displayString'],valueField:'id',displayField:'displayString',width:multiselect_width,height:getMultiSelectHeight(),store:predefinedMapLegendStore});
-	var predefinedMapLegendSetComboBox=new Ext.form.ComboBox({id:'predefinedmaplegendset_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:predefinedMapLegendSetStore});
-	
-	var newPredefinedMapLegendPanel = new Ext.form.FormPanel({   
+	var predefinedMapLegendStore = new Ext.data.JsonStore({url:path_mapping+'getAllMapLegends'+type,root:'mapLegends',id:'id',fields:['id','name','startValue','endValue','color','displayString'],autoLoad:true});
+	var predefinedMapLegendSetStore = new Ext.data.JsonStore({url:path_mapping+'getMapLegendSetsByType'+type,baseParams:{type:map_legend_type_predefined},root:'mapLegendSets',id:'id',fields:['id','name'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
+	var predefinedMapLegendSetIndicatorStore = new Ext.data.JsonStore({url:path_mapping+'getAllIndicators'+type,root:'indicators',fields:['id','name','shortName'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
+    var predefinedMapLegendSetDataElementStore = new Ext.data.JsonStore({url:path_mapping+'getAllDataElements'+type,root:'dataElements',fields:['id','name','shortName'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
+
+	var newPredefinedMapLegendPanel = new Ext.form.FormPanel({
         id: 'newpredefinedmaplegend_p',
 		bodyStyle: 'border:0px solid #fff',
         items:
         [   
             { html: '<div class="window-field-label-first">'+i18n_display_name+'</div>' },
-            predefinedMapLegendNameTextField,
+            new Ext.form.TextField({id:'predefinedmaplegendname_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_width}),
             { html: '<div class="window-field-label">'+i18n_start_value+'</div>' },
-            predefinedMapLegendStartValueTextField,
+            new Ext.form.TextField({id:'predefinedmaplegendstartvalue_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_number_width,minListWidth:combo_number_width}),
             { html: '<div class="window-field-label">'+i18n_end_value+'</div>' },
-            predefinedMapLegendEndValueTextField,
+            new Ext.form.TextField({id:'predefinedmaplegendendvalue_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_number_width,minListWidth:combo_number_width}),
             { html: '<div class="window-field-label">'+i18n_color+'</div>' },
-            predefinedMapLegendColorColorPalette,
+            new Ext.ux.ColorField({id:'predefinedmaplegendcolor_cp',isFormField:true,hideLabel:true,allowBlank:false,width:combo_width,minListWidth:combo_width,value:"#FFFF00"}),
             {
                 xtype: 'button',
                 id: 'newpredefinedmaplegend_b',
@@ -1151,7 +849,7 @@
         items:
         [   
             { html: '<div class="window-field-label-first">'+i18n_legend+'</p>' },
-            predefinedMapLegendComboBox,
+            new Ext.form.ComboBox({id:'predefinedmaplegend_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:predefinedMapLegendStore}),
             {
                 xtype: 'button',
                 id: 'deletepredefinedmaplegend_b',
@@ -1190,9 +888,9 @@
         items:
         [   
             { html: '<div class="window-field-label-first">'+i18n_display_name+'</div>' },
-            predefinedMapLegendSetNameTextField,
+            new Ext.form.TextField({id:'predefinedmaplegendsetname_tf',isFormField:true,hideLabel:true,emptyText:emptytext,width:combo_width}),
             { html: '<div class="window-field-label">'+i18n_legends+'</div>' },
-			predefinedNewMapLegendMultiSelect,
+			new Ext.ux.Multiselect({id:'predefinednewmaplegend_ms',isFormField:true,hideLabel:true,dataFields:['id','name','startValue','endValue','color','displayString'],valueField:'id',displayField:'displayString',width:multiselect_width,height:getMultiSelectHeight(),store:predefinedMapLegendStore}),
             {
                 xtype: 'button',
                 id: 'newpredefinedmaplegendset_b',
@@ -1249,7 +947,8 @@
                         params: { name: mlsv, type: map_legend_type_predefined },
                         success: function(r) {
                             Ext.message.msg(true, i18n_new_legend_set+' <span class="x-msg-hl">' + mlsv + '</span> ' + i18n_was_registered );
-                            Ext.getCmp('predefinedmaplegendset_cb').getStore().load();
+                            Ext.getCmp('predefinedmaplegendsetindicator_cb').getStore().load();
+                            Ext.getCmp('predefinedmaplegendsetindicator2_cb').getStore().load();
 							Ext.getCmp('maplegendset_cb').getStore().load();
 							Ext.getCmp('predefinedmaplegendsetname_tf').reset();
 							Ext.getCmp('predefinednewmaplegend_ms').clearValue();							
@@ -1269,15 +968,15 @@
         items:
         [   
             { html: '<div class="window-field-label-first">'+i18n_legend_set+'</p>' },
-            predefinedMapLegendSetComboBox,
+            new Ext.form.ComboBox({id:'predefinedmaplegendsetindicator_cb',isFormField:true,hideLabel:true,typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:predefinedMapLegendSetStore}),
             {
                 xtype: 'button',
                 id: 'deletepredefinedmaplegendset_b',
                 text: i18n_delete,
 				cls: 'window-button',
                 handler: function() {
-                    var mlsv = Ext.getCmp('predefinedmaplegendset_cb').getValue();
-                    var mlsrv = Ext.getCmp('predefinedmaplegendset_cb').getRawValue();
+                    var mlsv = Ext.getCmp('predefinedmaplegendsetindicator_cb').getValue();
+                    var mlsrv = Ext.getCmp('predefinedmaplegendsetindicator_cb').getRawValue();
                     
                     if (!mlsv) {
                         Ext.message.msg(false, i18n_please_select_a_legend_set );
@@ -1290,8 +989,9 @@
                         params: { id: mlsv },
                         success: function(r) {
                             Ext.message.msg(true, i18n_legend_set + ' <span class="x-msg-hl">' + mlsrv + '</span> ' + i18n_was_deleted);
-                            Ext.getCmp('predefinedmaplegendset_cb').getStore().load();
-                            Ext.getCmp('predefinedmaplegendset_cb').clearValue();
+                            Ext.getCmp('predefinedmaplegendsetindicator_cb').getStore().load();
+                            Ext.getCmp('predefinedmaplegendsetindicator_cb').clearValue();
+                            Ext.getCmp('predefinedmaplegendsetindicator2_cb').getStore().load();
 							Ext.getCmp('maplegendset_cb').getStore().load();
                         },
                         failure: function() {
@@ -1302,13 +1002,115 @@
             }
         ]
     });
+    
+    var assignPredefinedMapLegendSetPanel = new Ext.form.FormPanel({
+        id: 'assignpredefinedmaplegendset_p',
+		bodyStyle: 'border:0px',
+        items:
+        [
+            { html: '<div class="window-field-label-first">'+i18n_legend_set+'</div>' },
+            new Ext.form.ComboBox({
+                id: 'predefinedmaplegendsetindicator2_cb',
+                isFormField: true,
+                hideLabel: true,
+                typeAhead: true,
+                editable: false,
+                valueField: 'id',
+                displayField: 'name',
+                mode: 'remote',
+                forceSelection: true,
+                triggerAction: 'all',
+                emptyText: emptytext,
+                selectOnFocus: true,
+                width: combo_width,
+                minListWidth: combo_width,
+                store: predefinedMapLegendSetStore,
+                listeners:{
+                    'select': {
+                        fn: function() {
+                            var lsid = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue();
+                            
+                            Ext.Ajax.request({
+                                url: path_mapping + 'getMapLegendSetIndicators' + type,
+                                method: 'POST',
+                                params: { id:lsid },
+                                success: function(r) {
+                                    var indicators = Ext.util.JSON.decode(r.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('predefinedmaplegendsetindicator_ms').setValue(indicatorString);							
+                                },
+                                failure: function() {
+                                    alert( i18n_status , i18n_error_while_saving_data );
+                                }
+                            });
+                        }
+                    }
+                }					
+            }),
+            { html: '<div class="window-field-label">'+i18n_indicator+'</div>' },
+			new Ext.ux.Multiselect({id:'predefinedmaplegendsetindicator_ms',isFormField:true,hideLabel:true,dataFields:['id','name','shortName'],valueField:'id',displayField:'shortName',width:multiselect_width,height:getMultiSelectHeight(),store:predefinedMapLegendSetIndicatorStore}),
+            {
+                xtype: 'button',
+                id: 'assignpredefinedmaplegendsetindicator_b',
+                text: i18n_assign_to_indicators,
+				cls: 'window-button',
+                handler: function() {
+                    var ls = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue();
+                    var lsrw = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getRawValue();
+                    var lims = Ext.getCmp('predefinedmaplegendsetindicator_ms').getValue();
+                    
+                    if (!ls) {
+                        Ext.message.msg(false, i18n_please_select_a_legend_set);
+                        return;
+                    }
+                    
+                    if (!lims) {
+                        Ext.message.msg(false, i18n_please_select_at_least_one_indicator);
+                        return;
+                    }
+                    
+                    var array = new Array();
+                    array = lims.split(',');
+                    var params = '?indicators=' + array[0];
+                    
+                    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_mapping + 'assignIndicatorsToMapLegendSet.action' + params,
+                        method: 'POST',
+                        params: { id: ls },
+                        success: function(r) {
+                            Ext.message.msg(true, i18n_legend_set+' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_updated);
+                            Ext.getCmp('predefinedmaplegendsetindicator_cb').getStore().load();
+                        },
+                        failure: function() {
+                            alert( 'Error: assignIndicatorsToMapLegendSet' );
+                        }
+                    });
+                }
+            }
+        ]
+    });
 	
 	var predefinedMapLegendSetWindow = new Ext.Window({
         id: 'predefinedmaplegendset_w',
         title: '<span id="window-predefinedlegendset-title">'+i18n_predefined_legend_sets+'</span>',
 		layout: 'fit',
         closeAction: 'hide',
-		width: 311,
+		width: 441,
         items:
         [
 			{
@@ -1335,6 +1137,9 @@
 						else if (tab.id == 'predefinedmaplegendset3') {
 							w.setHeight(151);
 						}
+                        else if (tab.id == 'predefinedmaplegendset4') {
+                            w.setHeight(getMultiSelectHeight() + 180);
+                        }
 					}
 				},
 				items:
@@ -1366,6 +1171,13 @@
 						items: [
 							deletePredefinedMapLegendSetPanel
 						]
+					},
+					{
+                        title: '<span class="panel-tab-title">'+i18n_assign_to_indicator+'</span>',
+						id: 'predefinedmaplegendset4',
+						items: [
+							assignPredefinedMapLegendSetPanel
+						]
 					}
 				]
 			}
@@ -3571,23 +3383,6 @@
 			}			
 		}
 	});
-
-    var automaticMapLegendSetButton = new Ext.Button({
-		iconCls: 'icon-automaticlegendset',
-		tooltip: i18n_create_legend_sets_for_legend_type + ' "' + i18n_automatic + '"',
-		handler: function() {
-			var x = Ext.getCmp('center').x + 15;
-			var y = Ext.getCmp('center').y + 41;    
-			automaticMapLegendSetWindow.setPosition(x,y);
-		
-			if (automaticMapLegendSetWindow.visible) {
-				automaticMapLegendSetWindow.hide();
-			}
-			else {
-				automaticMapLegendSetWindow.show();
-			}
-		}
-	});
 	
 	var predefinedMapLegendSetButton = new Ext.Button({
 		iconCls: 'icon-predefinedlegendset',
@@ -3643,8 +3438,7 @@
 			'-',
 			favoritesButton,
 			'-',
-            automaticMapLegendSetButton,
-			predefinedMapLegendSetButton,
+            predefinedMapLegendSetButton,
 			'-',
 			helpButton,
 			'->',

=== 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-03 14:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-09-06 10:17:56 +0000
@@ -773,19 +773,22 @@
                         Ext.Ajax.request({
                             url: path_mapping + 'getMapLegendSetByIndicator' + type,
                             method: 'POST',
-                            params: { indicatorId: iId, format: 'json' },
-
-                            success: function( responseObject ) {
-                                var data = Ext.util.JSON.decode(responseObject.responseText);
-                                
-                                if (data.mapLegendSet[0].id != '') {
-//                                    Ext.getCmp('method_cb').setValue(data.mapLegendSet[0].method);
-                                    Ext.getCmp('numClasses_cb').setValue(data.mapLegendSet[0].classes);
-
-                                    Ext.getCmp('colorA_cf').setValue(data.mapLegendSet[0].colorLow);
-                                    Ext.getCmp('colorB_cf').setValue(data.mapLegendSet[0].colorHigh);
+                            params: {indicatorId: iId},
+                            success: function(r) {
+                                var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0];
+                                if (mapLegendSet.id) {
+                                    LEGEND[thematicMap].type = map_legend_type_predefined;
+                                    Ext.getCmp('maplegendtype_cb').setValue(map_legend_type_predefined);
+                                    Ext.getCmp('maplegendset_cb').showField();
+                                    Ext.getCmp('maplegendset_cb').setValue(mapLegendSet.id);
+                                    Ext.getCmp('method_cb').hideField();
+                                    Ext.getCmp('numClasses_cb').hideField();
+                                    Ext.getCmp('colorA_cf').hideField();
+                                    Ext.getCmp('colorB_cf').hideField();
+
+                                    choropleth.applyPredefinedLegend();
                                 }
-                                
+
                                 choropleth.classify(false, true);
                             },
                             failure: function()