← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5293: Aggregated value response minimised.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5293 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-12-05 18:38:41 +0100
message:
  Aggregated value response minimised.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js
  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/jsonminAggregatedMapValues.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm	2011-12-01 15:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminAggregatedMapValues.vm	2011-12-05 17:37:00 +0000
@@ -1,1 +1,1 @@
-#set( $size = $object.size() ){"mapValues":[#foreach( $value in $object ){"oi":"$!{value.organisationUnitId}","v":"$!{value.value}"}#if( $velocityCount < $size ),#end#end]}
\ No newline at end of file
+#set( $size = $object.size() )[#foreach( $value in $object )["$!{value.organisationUnitId}","$!{value.value}"]#if( $velocityCount < $size ),#end#end]
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-12-05 16:06:25 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-12-05 17:37:00 +0000
@@ -607,6 +607,18 @@
         return geojson;
     },
     
+    mapValueDecode: function(r) {
+        var r = Ext.util.JSON.decode(r.responseText),
+            mapvalues = [];
+        for (var i = 0; i < r.length; i++) {
+            mapvalues.push({
+                oi: r[i][0],
+                v: r[i][1]
+            });
+        }
+        return mapvalues;        
+    },
+    
     mapView: {
         layer: function(id) {
             var w = new Ext.Window({

=== 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-12-01 17:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js	2011-12-05 17:37:00 +0000
@@ -457,6 +457,8 @@
                     scope: this,
                     fn: function(cb) {
                         this.updateValues = true;
+                        this.classify(false, cb.lockPosition);
+                        G.util.setLockPosition(cb);
                     }
                 }
             }
@@ -504,35 +506,8 @@
                     scope: this,
                     fn: function(cb) {
                         this.updateValues = true;
-                        
-                        Ext.Ajax.request({
-                            url: G.conf.path_mapping + 'getMapLegendSetByDataElement' + G.conf.type,
-                            method: 'POST',
-                            params: {dataElementId: 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);
-                            }
-                        });
+                        this.classify(false, cb.lockPosition);
+                        G.util.setLockPosition(cb);
                     }
                 }
             }
@@ -580,8 +555,7 @@
                     scope: this,
                     fn: function(cb) {
                         this.updateValues = true;
-                        
-                        this.classify(false, cb.lockPosition);                        
+                        this.classify(false, cb.lockPosition);
                         G.util.setLockPosition(cb);
                     }
                 }
@@ -1086,7 +1060,8 @@
                     params: params,
                     scope: this,
                     success: function(r) {
-                        var mapvalues = Ext.util.JSON.decode(r.responseText).mapValues;
+alert(r);                        
+                        var mapvalues = G.util.mapValueDecode(r);
                         
                         if (!this.layer.features.length) {
                             Ext.message.msg(false, 'No coordinates found');

=== 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-12-05 13:49:31 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js	2011-12-05 17:37:00 +0000
@@ -1692,7 +1692,7 @@
                     params: params,
                     scope: this,
                     success: function(r) {
-                        var mapvalues = Ext.util.JSON.decode(r.responseText).mapValues;
+                        var mapvalues = G.util.mapValueDecode(r);
                         
                         if (!this.layer.features.length) {
                             Ext.message.msg(false, 'No coordinates found');

=== 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-12-05 16:06:25 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js	2011-12-05 17:37:00 +0000
@@ -1692,7 +1692,7 @@
                     params: params,
                     scope: this,
                     success: function(r) {
-                        var mapvalues = Ext.util.JSON.decode(r.responseText).mapValues;
+                        var mapvalues = G.util.mapValueDecode(r);
                         
                         if (!this.layer.features.length) {
                             Ext.message.msg(false, 'No coordinates found');