← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3050: Improved code.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3050 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-03-16 14:44:00 +0100
message:
  Improved code.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.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/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js	2011-03-16 12:23:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js	2011-03-16 13:20:24 +0000
@@ -195,27 +195,26 @@
                     'cursor': 'pointer'
                 })
             });
-        }
-    },
-
-    toggleFeatureLabels: function(widget) {
-        function activateLabels(scope) {
-            widget.layer.styleMap = scope.labels.getActivatedOpenLayersStyleMap();
-            widget.labels = true;
-        }
-        function deactivateLabels(scope) {
-            widget.layer.styleMap = scope.labels.getDeactivatedOpenLayersStyleMap();
-            widget.labels = false;
-        }
-        
-        if (widget.labels) {
-            deactivateLabels(this);
-        }
-        else {
-            activateLabels(this);
-        }
-        
-        widget.applyValues();
+        },
+        toggleFeatureLabels: function(widget) {
+            function activateLabels() {
+                widget.layer.styleMap = this.getActivatedOpenLayersStyleMap();
+                widget.labels = true;
+            }
+            function deactivateLabels(scope) {
+                widget.layer.styleMap = this.getDeactivatedOpenLayersStyleMap();
+                widget.labels = false;
+            }
+            
+            if (widget.labels) {
+                deactivateLabels.call(this);
+            }
+            else {
+                activateLabels.call(this);
+            }
+        
+            widget.applyValues();
+        }
     },
 
     sortByValue: function(a,b) {

=== 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	2011-03-16 11:49:41 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2011-03-16 13:42:50 +0000
@@ -2178,10 +2178,10 @@
                         
                         if (layer.features.length) {
                             if (layer.name == 'Polygon layer') {
-                                G.util.toggleFeatureLabels(choropleth);
+                                G.util.labels.toggleFeatureLabels(layer.widget);
                             }
                             else if (layer.name == 'Point layer') {
-                                G.util.toggleFeatureLabels(symbol);
+                                G.util.labels.toggleFeatureLabels(layer.widget);
                             }
                         }
                         else {
@@ -2260,6 +2260,9 @@
         listeners: {
             'expand': function() {
                 G.vars.activePanel.setPolygon();
+            },
+            'afterrender': function() {
+                this.layer.widget = this;
             }
         }
     });
@@ -2281,6 +2284,9 @@
 						G.stores.organisationUnitLevel.load();
 					}
 				}
+            },
+            'afterrender': function() {
+                this.layer.widget = this;
             }
         }
     });