← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2289: (GIS) Appropriate zoom level and map positioning applied automatically + misc bugs fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2289 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-30 16:38:10 +0200
message:
  (GIS) Appropriate zoom level and map positioning applied automatically + misc bugs fixed.
modified:
  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/util.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/msg/msg.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/Mapping.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/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-30 11:57:08 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-30 14:35:12 +0000
@@ -6,8 +6,6 @@
 var MAPSOURCE;
 /* Fixed periods or from-to dates */
 var MAPDATETYPE;
-/* Filename or level */
-var URL;
 /* Active mapview id parameter from URL */
 var PARAMETER;
 /* Current expanded accordion panel */
@@ -24,10 +22,6 @@
 FEATURE[thematicMap2] = {};
 /* Global chart for show/hide */
 var CHART;
-/* Current map value types */
-var VALUETYPE = {};
-VALUETYPE.polygon = map_value_type_indicator;
-VALUETYPE.point = map_value_type_indicator;
 /* Top level organisation unit */
 var TOPLEVELUNIT = {};
 /* Locate feature window */
@@ -3075,7 +3069,7 @@
                                                     GLOBALS.util.toggleFeatureLabels(choropleth);
                                                 }
                                                 else if (ACTIVEPANEL == organisationUnitAssignment) {
-                                                    GLOBALS.util.toggleFeatureLabelsAssignment(true, mapping);
+                                                    GLOBALS.util.toggleFeatureLabelsAssignment();
                                                 }
                                                 else {
                                                     Ext.message.msg(false, 'Please use <span class="x-msg-hl">Point layer</span> options');
@@ -3286,18 +3280,18 @@
         id: 'mapping',
         map: MAP,
         layer: choroplethLayer,
-        title: '<span class="panel-title">'+i18n_assign_organisation_units_to_map+'</span>',
+        title: '<span class="panel-title">' + i18n_assign_organisation_units_to_map + '</span>',
         url: 'init',
         featureSelection: false,
-        legendDiv: 'choroplethLegend',
+        legendDiv: 'polygonlegend',
         defaults: {width: 130},
         listeners: {
             expand: {
                 fn: function() {
                     ACTIVEPANEL = organisationUnitAssignment;
-                    choroplethLayer.setVisibility(false);
-                    proportionalSymbolLayer.setVisibility(false);
-                    mapping.classify(false, true);
+                    this.layer.setVisibility(false);
+                    proportionalSymbol.layer.setVisibility(false);
+                    this.classify(false, true);
                 }
             }
         }
@@ -3314,8 +3308,7 @@
 		tooltip: i18n_zoom_in,
 		handler:function() {
 			MAP.zoomIn();
-		},
-		scope: this
+		}
 	});
 	
 	var zoomOutButton = new Ext.Button({
@@ -3323,17 +3316,30 @@
 		tooltip: i18n_zoom_out,
 		handler:function() {
 			MAP.zoomOut();
-		},
-		scope: this
+		}
 	});
 	
 	var zoomMaxExtentButton = new Ext.Button({
 		iconCls: 'icon-zoommin',
 		tooltip: i18n_zoom_to_visible_extent,
 		handler: function() {
-			MAP.zoomToMaxExtent();
-		},
-		scope: this
+            if (ACTIVEPANEL == thematicMap) {
+                if (choropleth.layer.getDataExtent()) {
+                    MAP.zoomToExtent(choropleth.layer.getDataExtent());
+                }
+                else {
+                    Ext.message.msg(false, 'Vector layer is empty');
+                }
+            }
+            else if (ACTIVEPANEL == thematicMap2) {
+                if (proportionalSymbol.layer.getDataExtent()) {
+                    MAP.zoomToExtent(proportionalSymbol.layer.getDataExtent());
+                }
+                else {
+                    Ext.message.msg(false, 'Vector layer is empty');
+                }
+            }
+        }
 	});
 	
 	var favoritesButton = new Ext.Button({

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js	2010-09-30 11:57:08 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js	2010-09-30 14:35:12 +0000
@@ -1,4 +1,5 @@
 var GLOBALS = {};
+
 GLOBALS.util = {
     
     /* Detect mapview parameter in URL */
@@ -43,6 +44,13 @@
                 h <= 1200 ? 470 : 900;
     },
 
+    getGridPanelHeight: function() {
+        var h = screen.height;
+        return h <= 800 ? 180 :
+            h <= 1050 ? 480 :
+                h <= 1200 ? 600 : 900;
+    },
+
     /* Make map view numbers numeric */
     getNumericMapView: function(mapView) {
         mapView.id = parseFloat(mapView.id);
@@ -127,30 +135,24 @@
         widget.applyValues();
     },
 
-    toggleFeatureLabelsAssignment: function(classify, layer) {
+    toggleFeatureLabelsAssignment: function() {
         function activateLabels(scope) {
-            layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
-            LABELS[organisationUnitAssignment] = true;
+            mapping.layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
+            mapping.labels = true;
         }
         function deactivateLabels(scope) {
-            layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
-            LABELS[organisationUnitAssignment] = false;
+            mapping.layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
+            mapping.labels = false;
         }
         
-        if (classify) {
-            if (LABELS[organisationUnitAssignment]) {
-                deactivateLabels(this);
-            }
-            else {
-                activateLabels(this);
-            }
-            mapping.classify(false,true);
+        if (mapping.labels) {
+            deactivateLabels(this);
         }
         else {
-            if (LABELS[organisationUnitAssignment]) {
-                activateLabels(this);
-            }
+            activateLabels(this);
         }
+        
+        mapping.classify(false, true);
     },
 
     /* Sort values */

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/msg/msg.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/msg/msg.js	2010-07-14 02:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/ext-ux/msg/msg.js	2010-09-30 14:35:12 +0000
@@ -18,7 +18,7 @@
             msgCt.alignTo(document, 't-t');
             var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
             var m = Ext.DomHelper.append(msgCt, {html:createBox(bool, s)}, true);
-            m.slideIn('t').pause(2).ghost("t", {remove:true});
+            m.slideIn('t').pause(3).ghost("t", {remove:true});
         },
         
         init : function(){

=== 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-30 11:57:08 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2010-09-30 14:35:12 +0000
@@ -70,6 +70,8 @@
     
     labels: false,
     
+    valueType: false,
+    
     stores: false,
     
     initComponent: function() {
@@ -77,8 +79,8 @@
         this.legend.type = map_legend_type_automatic;
         this.legend.method = 2;
         this.legend.classes = 5;
-        
         this.mapData = {};
+        this.valueType = map_value_type_indicator;
         
         mapViewStore = new Ext.data.JsonStore({
             url: path_mapping + 'getAllMapViews' + type,
@@ -105,7 +107,7 @@
 									Ext.getCmp('mapsource_cb').setValue(MAPSOURCE);
                                     Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
                                     Ext.getCmp('mapview_cb').setValue(this.mapView.id);
-                                    VALUETYPE.polygon = this.mapView.mapValueType;
+                                    this.valueType = this.mapView.mapValueType;
                                     
                                     if (this.mapView.mapLegendType == map_legend_type_automatic) {
                                         this.legend.type = map_legend_type_automatic;
@@ -502,7 +504,7 @@
                                 Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
                                 
                                 Ext.getCmp('mapvaluetype_cb').setValue(this.mapView.mapValueType);
-								VALUETYPE.polygon = this.mapView.mapValueType;
+								this.valueType = this.mapView.mapValueType;
                                 
                                 if (this.mapView.mapValueType == map_value_type_indicator) {
                                     Ext.getCmp('indicatorgroup_cb').showField();
@@ -597,14 +599,14 @@
 							Ext.getCmp('indicator_cb').showField();
 							Ext.getCmp('dataelementgroup_cb').hideField();
 							Ext.getCmp('dataelement_cb').hideField();
-							VALUETYPE.polygon = map_value_type_indicator;
+							this.valueType = map_value_type_indicator;
 						}
 						else if (Ext.getCmp('mapvaluetype_cb').getValue() == map_value_type_dataelement) {
 							Ext.getCmp('indicatorgroup_cb').hideField();
 							Ext.getCmp('indicator_cb').hideField();
 							Ext.getCmp('dataelementgroup_cb').showField();
 							Ext.getCmp('dataelement_cb').showField();
-							VALUETYPE.polygon = map_value_type_dataelement;
+							this.valueType = map_value_type_dataelement;
 						}
                         
                         this.classify(false, true);
@@ -1461,7 +1463,7 @@
     },
     
     getIndicatorOrDataElementId: function() {
-        return VALUETYPE.polygon == map_value_type_indicator ?
+        return this.valueType == map_value_type_indicator ?
             Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
     },
     
@@ -1518,9 +1520,9 @@
 
             FEATURE[thematicMap] = this.layer.features;
             
-            var indicatorOrDataElementId = VALUETYPE.polygon == map_value_type_indicator ?
+            var indicatorOrDataElementId = this.valueType == map_value_type_indicator ?
                 Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
-            var dataUrl = VALUETYPE.polygon == map_value_type_indicator ?
+            var dataUrl = this.valueType == map_value_type_indicator ?
                 'getIndicatorMapValuesByParentOrganisationUnit' : 'getDataMapValuesByParentOrganisationUnit';
             var params = {};
             if (MAPDATETYPE == map_date_type_fixed) {
@@ -1606,9 +1608,9 @@
             
                     FEATURE[thematicMap] = this.layer.features;
             
-                    var indicatorOrDataElementId = VALUETYPE.polygon == map_value_type_indicator ?
+                    var indicatorOrDataElementId = this.valueType == map_value_type_indicator ?
                         Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
-                    var dataUrl = VALUETYPE.polygon == map_value_type_indicator ?
+                    var dataUrl = this.valueType == map_value_type_indicator ?
                         'getIndicatorMapValuesByMap' : 'getDataMapValuesByMap';
                     var periodId = Ext.getCmp('period_cb').getValue();
                     var mapLayerPath = this.newUrl;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js	2010-09-30 11:57:08 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js	2010-09-30 14:35:12 +0000
@@ -51,23 +51,6 @@
     loadMask: false,
 
     labelGenerator: null,
-
-    getGridPanelHeight: function() {
-        var h = screen.height;
-        
-        if (h <= 800) {
-            return 180;
-        }
-        else if (h <= 1050) {
-            return 480;
-        }
-        else if (h <= 1200) {
-            return 600;
-        }
-        else {
-            return 900;
-        }
-    },
      
     newUrl: false,
 	
@@ -175,7 +158,7 @@
 				autoExpandColumn: 'organisationUnitId',
 				enableHdMenu: true,
                 width: gridpanel_width,
-                height: this.getGridPanelHeight(),
+                height: GLOBALS.util.getGridPanelHeight(),
                 view: gridView,
                 style: 'left:0px',
                 bbar: new Ext.StatusBar({
@@ -405,8 +388,9 @@
     applyValues: function(color, noCls) {
         var options = {};
         
-        mapping.indicator = options.indicator = 'value';
-        options.method = 1;
+        mapping.indicator = 'value';
+        options.indicator = mapping.indicator;
+        options.method = 2;
         options.numClasses = noCls;
         
         var colorA = new mapfish.ColorRgb();
@@ -431,16 +415,17 @@
         Ext.Ajax.request({
             url: path_mapping + 'getOrganisationUnitsAtLevel' + type,
             method: 'POST',
-            params: { level: level },
+            params: {level: level},
+            scope: this,
             success: function(r) {
-                FEATURE[thematicMap] = MAP.getLayersByName('Polygon layer')[0].features;
+                FEATURE[thematicMap] = this.layer.features;
                 var organisationUnits = Ext.util.JSON.decode(r.responseText).organisationUnits;
                 var nameColumn = this.mapData.nameColumn;
                 var mlp = this.mapData.mapLayerPath;
                 var count_match = 0;
                 var relations = '';
                 
-                for ( var i = 0; i < FEATURE[thematicMap].length; i++ ) {
+                for (var i = 0; i < FEATURE[thematicMap].length; i++) {
                     FEATURE[thematicMap][i].attributes.compareName = FEATURE[thematicMap][i].attributes[nameColumn].split(' ').join('').toLowerCase();
                 }
         
@@ -487,7 +472,6 @@
 
     classify: function(exception, position) {
         if (mapping.validateForm(exception)) {
-        
             MASK.msg = i18n_creating_map;
             MASK.show();
             
@@ -507,12 +491,8 @@
                     if (!position) {
                         MAP.zoomToExtent(this.layer.getDataExtent());
                     }
-            
+
                     FEATURE[thematicMap] = this.layer.features;
-                    
-                    if (LABELS[thematicMap]) {
-                        toggleFeatureLabelsPolygons(false, this.layer);
-                    }
         
                     var mlp = this.mapData.mapLayerPath;
                     var relations =	Ext.getCmp('grid_gp').getStore();
@@ -522,11 +502,13 @@
         
                     for (var i = 0; i < FEATURE[thematicMap].length; i++) {
                         FEATURE[thematicMap][i].attributes.value = 0;
+                        FEATURE[thematicMap][i].attributes.labelString = '';
 
                         for (var j = 0; j < relations.getTotalCount(); j++) {
-                            if (relations.getAt(j).data.featureId == FEATURE[thematicMap][i].attributes[nameColumn]) {
+                            var name = FEATURE[thematicMap][i].attributes[nameColumn];
+                            if (relations.getAt(j).data.featureId == name) {
                                 FEATURE[thematicMap][i].attributes.value = 1;
-                                FEATURE[thematicMap][i].attributes.labelString = FEATURE[thematicMap][i].attributes[nameColumn];
+                                FEATURE[thematicMap][i].attributes.labelString = name;
                                 noAssigned++;
                                 noCls = noCls < 2 ? 2 : noCls;
                                 break;

=== 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-30 11:57:08 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js	2010-09-30 14:35:12 +0000
@@ -69,6 +69,10 @@
     mapData: false,
     
     labels: false,
+    
+    valueType: false,
+    
+    stores: false,
 
     initComponent: function() {
         this.legend = {};
@@ -78,7 +82,7 @@
         
         this.mapData = {};
     
-        mapViewStore2 = new Ext.data.JsonStore({
+        mapViewStore = new Ext.data.JsonStore({
             url: path_mapping + 'getAllMapViews' + type,
             root: 'mapViews',
             fields: ['id', 'name'],
@@ -86,7 +90,7 @@
             autoLoad: true
         });
     
-        indicatorGroupStore2 = new Ext.data.JsonStore({
+        indicatorGroupStore = new Ext.data.JsonStore({
             url: path_mapping + 'getAllIndicatorGroups' + type,
             root: 'indicatorGroups',
             fields: ['id', 'name'],
@@ -95,7 +99,7 @@
             autoLoad: true
         });
         
-        indicatorStore2 = new Ext.data.JsonStore({
+        indicatorStore = new Ext.data.JsonStore({
             url: path_mapping + 'getIndicatorsByIndicatorGroup' + type,
             root: 'indicators',
             fields: ['id', 'name', 'shortName'],
@@ -106,7 +110,7 @@
                 'load': {
                     scope: this,
                     fn: function() {
-                        indicatorStore2.each(
+                        indicatorStore.each(
                             function fn(record) {
                                 var name = record.get('name');
                                 name = name.replace('&lt;', '<').replace('&gt;', '>');
@@ -126,8 +130,8 @@
                                 Ext.getCmp('enddate_df2').hideField();
                                 
                                 Ext.getCmp('periodtype_cb2').setValue(this.mapView.periodTypeId);
-                                periodStore2.setBaseParam('name', this.mapView.periodTypeId);
-                                periodStore2.load();
+                                periodStore.setBaseParam('name', this.mapView.periodTypeId);
+                                periodStore.load();
                             }
                             else if (this.mapView.mapDateType == map_date_type_start_end) {
                                 Ext.getCmp('periodtype_cb2').hideField();
@@ -166,7 +170,7 @@
             }
         });
 		
-		dataElementGroupStore2 = new Ext.data.JsonStore({
+		dataElementGroupStore = new Ext.data.JsonStore({
 			url: path_mapping + 'getAllDataElementGroups' + type,
             root: 'dataElementGroups',
             fields: ['id', 'name'],
@@ -174,7 +178,7 @@
             autoLoad: true
         });
 		
-		dataElementStore2 = new Ext.data.JsonStore({
+		dataElementStore = new Ext.data.JsonStore({
             url: path_mapping + 'getDataElementsByDataElementGroup' + type,
             root: 'dataElements',
             fields: ['id', 'name', 'shortName'],
@@ -184,7 +188,7 @@
                 'load': {
                     scope: this,
                     fn: function() {
-                        dataElementStore2.each(
+                        dataElementStore.each(
                             function fn(record) {
                                 var name = record.get('name');
                                 name = name.replace('&lt;', '<').replace('&gt;', '>');
@@ -204,8 +208,8 @@
                                 Ext.getCmp('enddate_df2').hideField();
                                 
                                 Ext.getCmp('periodtype_cb2').setValue(this.mapView.periodTypeId);
-                                periodStore2.setBaseParam('name', this.mapView.periodTypeId);
-                                periodStore2.load();
+                                periodStore.setBaseParam('name', this.mapView.periodTypeId);
+                                periodStore.load();
                             }
                             else if (this.mapView.mapDateType == map_date_type_start_end) {
                                 Ext.getCmp('periodtype_cb2').hideField();
@@ -244,14 +248,14 @@
             }
         });
         
-        periodTypeStore2 = new Ext.data.JsonStore({
+        periodTypeStore = new Ext.data.JsonStore({
             url: path_mapping + 'getAllPeriodTypes' + type,
             root: 'periodTypes',
             fields: ['name'],
             autoLoad: true
         });
             
-        periodStore2 = new Ext.data.JsonStore({
+        periodStore = new Ext.data.JsonStore({
             url: path_mapping + 'getPeriodsByPeriodType' + type,
             root: 'periods',
             fields: ['id', 'name'],
@@ -282,7 +286,7 @@
             }
         });
             
-        mapStore2 = new Ext.data.JsonStore({
+        mapStore = new Ext.data.JsonStore({
             url: path_mapping + 'getAllMaps' + type,
             baseParams: { format: 'jsonmin' },
             root: 'maps',
@@ -321,7 +325,7 @@
             }
         });
 		
-		predefinedMapLegendSetStore2 = new Ext.data.JsonStore({
+		predefinedMapLegendSetStore = new Ext.data.JsonStore({
             url: path_mapping + 'getMapLegendSetsByType' + type,
             baseParams: {type: map_legend_type_predefined},
             root: 'mapLegendSets',
@@ -352,6 +356,18 @@
             }
         });
         
+        this.stores = {
+            mapViewStore: mapViewStore,
+            indicatorGroupStore: indicatorGroupStore,
+            indicatorStore: indicatorStore,
+            dataElementGroupStore: dataElementGroupStore,
+            dataElementStore: dataElementStore,
+            periodTypeStore: periodTypeStore,
+            periodStore: periodStore,
+            mapStore: mapStore,
+            predefinedMapLegendSetStore: predefinedMapLegendSetStore
+        }
+        
         this.items = [
          
         {
@@ -369,7 +385,7 @@
             selectOnFocus: true,
 			labelSeparator: labelseparator,
             width: combo_width,
-            store: mapViewStore2,
+            store: choropleth.stores.mapViewStore,
             listeners: {
                 'select': {
                     scope: this,
@@ -388,7 +404,7 @@
                                 Ext.getCmp('mapdatetype_cb').setValue(MAPDATETYPE);
                                 
                                 Ext.getCmp('mapvaluetype_cb2').setValue(this.mapView.mapValueType);
-								VALUETYPE.point = this.mapView.mapValueType;
+								this.valueType = this.mapView.mapValueType;
                                 
                                 if (this.mapView.mapValueType == map_value_type_indicator) {
                                     Ext.getCmp('indicatorgroup_cb2').showField();
@@ -397,8 +413,8 @@
                                     Ext.getCmp('dataelement_cb2').hideField();
                                     
                                     Ext.getCmp('indicatorgroup_cb2').setValue(this.mapView.indicatorGroupId);
-                                    indicatorStore2.setBaseParam('indicatorGroupId', this.mapView.indicatorGroupId);
-                                    indicatorStore2.load();
+                                    indicatorStore.setBaseParam('indicatorGroupId', this.mapView.indicatorGroupId);
+                                    indicatorStore.load();
                                 }
                                 else if (this.mapView.mapValueType == map_value_type_dataelement) {
                                     Ext.getCmp('indicatorgroup_cb2').hideField();
@@ -407,8 +423,8 @@
                                     Ext.getCmp('dataelement_cb2').showField();
                                     
                                     Ext.getCmp('dataelementgroup_cb2').setValue(this.mapView.dataElementGroupId);
-                                    dataElementStore2.setBaseParam('dataElementGroupId', this.mapView.dataElementGroupId);
-                                    dataElementStore2.load();
+                                    dataElementStore.setBaseParam('dataElementGroupId', this.mapView.dataElementGroupId);
+                                    dataElementStore.load();
                                 }                                        
 								
 								if (this.mapView.mapLegendType == map_legend_type_automatic) {
@@ -483,14 +499,14 @@
 							Ext.getCmp('indicator_cb2').showField();
 							Ext.getCmp('dataelementgroup_cb2').hideField();
 							Ext.getCmp('dataelement_cb2').hideField();
-							VALUETYPE.point = map_value_type_indicator;
+							this.valueType = map_value_type_indicator;
 						}
 						else if (Ext.getCmp('mapvaluetype_cb2').getValue() == map_value_type_dataelement) {
 							Ext.getCmp('indicatorgroup_cb2').hideField();
 							Ext.getCmp('indicator_cb2').hideField();
 							Ext.getCmp('dataelementgroup_cb2').showField();
 							Ext.getCmp('dataelement_cb2').showField();
-							VALUETYPE.point = map_value_type_dataelement;
+							this.valueType = map_value_type_dataelement;
 						}
                         
                         this.classify(false, true);
@@ -514,7 +530,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: indicatorGroupStore2,
+            store: indicatorGroupStore,
             listeners: {
                 'select': {
                     fn: function() {
@@ -523,8 +539,8 @@
                         }
 						
 						Ext.getCmp('indicator_cb2').clearValue();
-						indicatorStore2.setBaseParam('indicatorGroupId', this.getValue());
-                        indicatorStore2.load();
+						indicatorStore.setBaseParam('indicatorGroupId', this.getValue());
+                        indicatorStore.load();
                     }
                 }
             }
@@ -545,7 +561,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: indicatorStore2,
+            store: indicatorStore,
             listeners: {
                 'select': {
                     scope: this,
@@ -619,7 +635,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: dataElementGroupStore2,
+            store: dataElementGroupStore,
             listeners: {
                 'select': {
                     fn: function() {
@@ -627,8 +643,8 @@
                             Ext.getCmp('mapview_cb2').clearValue();
                         }
                         Ext.getCmp('dataelement_cb2').clearValue();
-						dataElementStore2.setBaseParam('dataElementGroupId', this.getValue());
-                        dataElementStore2.load();
+						dataElementStore.setBaseParam('dataElementGroupId', this.getValue());
+                        dataElementStore.load();
                     }
                 }
             }
@@ -649,7 +665,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: dataElementStore2,
+            store: dataElementStore,
             listeners: {
                 'select': {
                     scope: this,
@@ -723,7 +739,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: periodTypeStore2,
+            store: periodTypeStore,
             listeners: {
                 'select': {
                     fn: function() {
@@ -754,7 +770,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: periodStore2,
+            store: periodStore,
             listeners: {
                 'select': {
                     scope: this,
@@ -823,7 +839,7 @@
 			labelSeparator: labelseparator,
             selectOnFocus: true,
             width: combo_width,
-            store: mapStore2,
+            store: mapStore,
             listeners: {
                 'select': {
                     scope: this,
@@ -1045,7 +1061,7 @@
             triggerAction: 'all',
             width: combo_width,
 			hidden: true,
-            store: predefinedMapLegendSetStore2,
+            store: predefinedMapLegendSetStore,
             listeners: {
                 'select': {
                     scope: this,
@@ -1347,7 +1363,7 @@
     },
     
     getIndicatorOrDataElementId: function() {
-        return VALUETYPE.point == map_value_type_indicator ?
+        return this.valueType == map_value_type_indicator ?
             Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue();
     },
     
@@ -1404,9 +1420,9 @@
             
             FEATURE[thematicMap2] = this.layer.features;
             
-            var indicatorOrDataElementId = VALUETYPE.point == map_value_type_indicator ?
+            var indicatorOrDataElementId = this.valueType == map_value_type_indicator ?
                 Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue();
-            var dataUrl = VALUETYPE.point == map_value_type_indicator ?
+            var dataUrl = this.valueType == map_value_type_indicator ?
                 'getIndicatorMapValuesByParentOrganisationUnit' : 'getDataMapValuesByParentOrganisationUnit';
             var params = {};
             if (MAPDATETYPE == map_date_type_fixed) {
@@ -1492,9 +1508,9 @@
             
                     FEATURE[thematicMap2] = this.layer.features;
                     
-                    var indicatorOrDataElementId = VALUETYPE.point == map_value_type_indicator ?
+                    var indicatorOrDataElementId = this.valueType == map_value_type_indicator ?
                         Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue();
-                    var dataUrl = VALUETYPE.point == map_value_type_indicator ?
+                    var dataUrl = this.valueType == map_value_type_indicator ?
                         'getIndicatorMapValuesByMap' : 'getDataMapValuesByMap';
                     var periodId = Ext.getCmp('period_cb2').getValue();
                     var mapLayerPath = this.newUrl;