← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4430: Layer form bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4430 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-08-24 18:24:00 +0200
message:
  Layer form bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.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/resources/mapfish/widgets/geostat/Centroid.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2011-08-24 15:42:02 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2011-08-24 16:23:07 +0000
@@ -332,35 +332,6 @@
                     scope: this,
                     fn: function(cb) {
                         this.updateValues = true;
-                        
-                        Ext.Ajax.request({
-                            url: G.conf.path_mapping + 'getMapLegendSetByIndicator' + G.conf.type,
-                            method: 'POST',
-                            params: {indicatorId: cb.getValue()},
-                            scope: this,
-                            success: function(r) {
-                                var mapLegendSet = Ext.util.JSON.decode(r.responseText).mapLegendSet[0];
-                                if (mapLegendSet.id) {
-                                    
-                                    function load() {
-                                        this.cmp.mapLegendSet.setValue(mapLegendSet.id);
-                                        this.applyPredefinedLegend();
-                                    }
-                                    
-                                    if (!G.stores.predefinedMapLegendSet.isLoaded) {
-                                        G.stores.predefinedMapLegendSet.load({scope: this, callback: function() {
-                                            load.call(this);
-                                        }});
-                                    }
-                                    else {
-                                        load.call(this);
-                                    }
-                                }
-                                
-                                this.classify(false, cb.lockPosition);
-                                G.util.setLockPosition(cb);
-                            }
-                        });
                     }
                 }
             }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-08-24 15:42:02 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-08-24 16:23:07 +0000
@@ -349,9 +349,13 @@
             triggerAction: 'all',
             selectOnFocus: true,
             width: G.conf.combo_width,
+            currentValue: null,
+            lockPosition: false,
+            reloadStore: function(id) {
+                this.cmp.mapLegendSet.setValue(id);
+                this.applyPredefinedLegend();
+            },
             store: this.stores.indicatorsByGroup,
-            currentValue: null,
-            lockPosition: false,
             listeners: {
                 'select': {
                     scope: this,
@@ -372,18 +376,13 @@
                                     this.legend.value = G.conf.map_legendset_type_predefined;
                                     this.prepareMapViewLegend();
                                     
-                                    function load() {
-                                        this.cmp.mapLegendSet.setValue(mapLegendSet.id);
-                                        this.applyPredefinedLegend();
-                                    }
-                                    
-                                    if (!G.stores.predefinedMapLegendSet.isLoaded) {
-                                        G.stores.predefinedMapLegendSet.load({scope: this, callback: function() {
-                                            load.call(this);
+                                    if (!G.stores.predefinedColorMapLegendSet.isLoaded) {
+                                        G.stores.predefinedColorMapLegendSet.load({scope: this, callback: function() {
+                                            cb.reloadStore.call(this, mapLegendSet.id);
                                         }});
                                     }
                                     else {
-                                        load.call(this);
+                                        cb.reloadStore.call(this, mapLegendSet.id);
                                     }
                                 }
                                 else {
@@ -1404,18 +1403,12 @@
         validateForm: function() {
             if (this.cmp.mapValueType.getValue() == G.conf.map_value_type_indicator) {
                 if (!this.cmp.indicator.getValue()) {
-                    if (exception) {
-                        Ext.message.msg(false, G.i18n.form_is_not_complete);
-                    }
                     this.window.cmp.apply.disable();
                     return false;
                 }
             }
             else if (this.cmp.mapValueType.getValue() == G.conf.map_value_type_dataelement) {
                 if (!this.cmp.dataElement.getValue()) {
-                    if (exception) {
-                        Ext.message.msg(false, G.i18n.form_is_not_complete);
-                    }
                     this.window.cmp.apply.disable();
                     return false;
                 }
@@ -1423,35 +1416,23 @@
 
             if (G.system.mapDateType.isFixed()) {
                 if (!this.cmp.period.getValue()) {
-                    if (exception) {
-                        Ext.message.msg(false, G.i18n.form_is_not_complete);
-                    }
                     this.window.cmp.apply.disable();
                     return false;
                 }
             }
             else {
                 if (!this.cmp.startDate.getValue() || !this.cmp.endDate.getValue()) {
-                    if (exception) {
-                        Ext.message.msg(false, G.i18n.form_is_not_complete);
-                    }
                     this.window.cmp.apply.disable();
                     return false;
                 }
             }
 
             if (!this.cmp.parent.selectedNode || !this.cmp.level.getValue()) {
-                if (exception) {
-                    Ext.message.msg(false, G.i18n.form_is_not_complete);
-                }
                 this.window.cmp.apply.disable();
                 return false;
             }
             
             if (this.cmp.parent.selectedNode.attributes.level > this.cmp.level.getValue()) {
-                if (exception) {
-                    Ext.message.msg(false, 'Invalid parent organisation unit');
-                }
                 this.window.cmp.apply.disable();
                 return false;
             }
@@ -1459,9 +1440,6 @@
             if (this.cmp.mapLegendType.getValue() == G.conf.map_legendset_type_automatic) {
                 if (this.cmp.method.getValue() == G.conf.classify_with_bounds) {
                     if (!this.cmp.bounds.getValue()) {
-                        if (exception) {
-                            Ext.message.msg(false, G.i18n.form_is_not_complete);
-                        }
                         this.window.cmp.apply.disable();
                         return false;
                     }
@@ -1469,18 +1447,12 @@
             }
             else if (this.cmp.mapLegendType.getValue() == G.conf.map_legendset_type_predefined) {
                 if (!this.cmp.mapLegendSet.getValue()) {
-                    if (exception) {
-                        Ext.message.msg(false, G.i18n.form_is_not_complete);
-                    }
                     this.window.cmp.apply.disable();
                     return false;
                 }
             }
             
             if (!this.cmp.radiusLow.getValue() || !this.cmp.radiusHigh.getValue()) {
-                if (exception) {
-                    Ext.message.msg(false, G.i18n.form_is_not_complete);
-                }
                 this.window.cmp.apply.disable();
                 return false;
             }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-08-24 15:42:02 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-08-24 16:23:07 +0000
@@ -349,9 +349,13 @@
             triggerAction: 'all',
             selectOnFocus: true,
             width: G.conf.combo_width,
+            currentValue: null,
+            lockPosition: false,
+            reloadStore: function(id) {
+                this.cmp.mapLegendSet.setValue(id);
+                this.applyPredefinedLegend();
+            },
             store: this.stores.indicatorsByGroup,
-            currentValue: null,
-            lockPosition: false,
             listeners: {
                 'select': {
                     scope: this,
@@ -372,18 +376,13 @@
                                     this.legend.value = G.conf.map_legendset_type_predefined;
                                     this.prepareMapViewLegend();
                                     
-                                    function load() {
-                                        this.cmp.mapLegendSet.setValue(mapLegendSet.id);
-                                        this.applyPredefinedLegend();
-                                    }
-                                    
-                                    if (!G.stores.predefinedMapLegendSet.isLoaded) {
-                                        G.stores.predefinedMapLegendSet.load({scope: this, callback: function() {
-                                            load.call(this);
+                                    if (!G.stores.predefinedColorMapLegendSet.isLoaded) {
+                                        G.stores.predefinedColorMapLegendSet.load({scope: this, callback: function() {
+                                            cb.reloadStore.call(this, mapLegendSet.id);
                                         }});
                                     }
                                     else {
-                                        load.call(this);
+                                        cb.reloadStore.call(this, mapLegendSet.id);
                                     }
                                 }
                                 else {