← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19038: GIS legend bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 19038 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-04-28 12:34:25 +0200
message:
  GIS legend bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/mapfish/core/GeoStat/all.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.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-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-04-27 15:38:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-04-28 10:02:12 +0000
@@ -1700,7 +1700,7 @@
                 }
             }
 
-            onCollapseDataDimensionsChange(collapseDataDimensions.getValue());
+            //onCollapseDataDimensionsChange(collapseDataDimensions.getValue()); // not supported in EV yet
         };
 
         removeDimension = function(id, excludedStores) {
@@ -1789,6 +1789,7 @@
             var stores = [colStore, rowStore, filterStore, fixedFilterStore],
                 collapse = Ext.isObject(param) && Ext.isDefined(param.collapseDataItems) ? param.collapseDataItems : param,
                 keys = ['ou', 'pe', 'dates'],
+                dimensionKeys = Ext.Array.pluck(ns.core.init.dimensions || [], 'id'),
                 dy = ['dy'],
                 keys;
 
@@ -1807,7 +1808,7 @@
 
             // keys
             if (collapse) { // included keys
-                keys = ['ou', 'pe', 'dates', 'dy'];
+                keys = ['ou', 'pe', 'dates', 'dy'].concat(dimensionKeys);
             }
             else { // excluded keys
                 keys = ['dy'];
@@ -3462,7 +3463,7 @@
                                 }
                             }
                         }
-					});					
+					});
 				}
 			}
 		});
@@ -5880,7 +5881,7 @@
 			if (!updateGui) {
 				return;
 			}
-            
+
 			ns.app.viewport.chartType.setChartType(layout.type);
 
             setLayout(layout);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js	2015-04-16 23:47:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js	2015-04-28 10:02:12 +0000
@@ -1886,7 +1886,7 @@
 
                 // collapse data dimensions?
                 (function() {
-                    var keys = xLayout.collapseDataDimensions ? ['dy', 'pe', 'ou'] : ['dy'],
+                    var keys = xLayout.collapseDataDimensions ? ['dy', 'pe', 'ou'].concat(Ext.Array.pluck(init.dimensions, 'id')) : ['dy'],
                         dimensionsToRemove = [];
 
                     // find dimensions to remove
@@ -3667,7 +3667,7 @@
                             height: ns.dashboard ? height : height - 40,
                             theme: 'dv1'
                         };
-                        
+
                     // legend
                     if (!xLayout.hideLegend) {
                         defaultConfig.legend = getDefaultLegend(store, config);
@@ -3990,7 +3990,7 @@
                         label.renderer = function(value) {
                             var record = store.getAt(store.findExact(conf.finals.data.domain, value)),
                                 v = record.data[store.rangeFields[0]];
-                                
+
                             return support.prototype.number.prettyPrint(v);
                         };
                     }
@@ -4017,7 +4017,7 @@
                             renderer: function(item) {
                                 var value = support.prototype.number.prettyPrint(item.data[store.rangeFields[0]]),
                                     data = item.data[conf.finals.data.domain];
-                                    
+
                                 this.update('<div style="text-align:center"><div style="font-size:17px; font-weight:bold">' + value + '</div><div style="font-size:10px">' + data + '</div></div>');
                             }
                         },

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-03-23 12:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-04-28 10:31:23 +0000
@@ -1470,7 +1470,7 @@
             styleEl = document.createElement("style");
 
         styleEl.setAttribute("type", "text/css");
-        
+
         if (id) {
            styleEl.setAttribute("id", id);
         }
@@ -1583,12 +1583,14 @@
                     else if (!window) {
                         var layers = gis.util.map.getRenderedVectorLayers().reverse(),
                             html = '<div id="legendWrapper">';
-                            
-                        for (var i = 0, layer; i < layers.length; i++) {
+
+                        for (var i = 0, layer, innerHTML; i < layers.length; i++) {
                             layer = layers[i];
+                            innerHTML = layer.core.updateLegend().innerHTML;
 
-                            html += '<div style="font-size:10px; font-weight:bold">' + layer.name + '</div>' + layer.core.updateLegend().innerHTML + (i < layers.length - 1 ? '<div style="padding:5px"></div>' : '');
-                        }
+                            if (innerHTML) {
+                                html += '<div style="font-size:10px; font-weight:bold">' + layer.name + '</div>' + innerHTML + (i < layers.length - 1 ? '<div style="padding:5px"></div>' : '');
+                            }
 
                         html += '</div>';
 
@@ -1605,10 +1607,10 @@
                                 show: function() {
                                     var el = this.getEl(),
                                         legendEl = el.first().first(),
-                                        xy = Ext.get(olmap.buttonControls[0].div).getAnchorXY();                                        
+                                        xy = Ext.get(olmap.buttonControls[0].div).getAnchorXY();
 
                                     el.setStyle('opacity', 0.92);
-                                    
+
                                     this.setHeight(legendEl.getHeight() + 8 + 9);
 
                                     this.setPosition(xy[0] - this.getWidth(), xy[1] - 1);
@@ -6087,7 +6089,7 @@
             },
 
             updateLegend: function() {
-
+                return {};
             },
 
             CLASS_NAME: "mapfish.GeoStat.Event"
@@ -6291,7 +6293,7 @@
             },
 
             updateLegend: function() {
-
+                return {};
             },
 
             CLASS_NAME: "mapfish.GeoStat.Boundary"

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/mapfish/core/GeoStat/all.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/mapfish/core/GeoStat/all.js	2014-12-16 11:49:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/mapfish/core/GeoStat/all.js	2015-04-28 10:32:12 +0000
@@ -325,7 +325,7 @@
     },
 
     updateLegend: function() {
-
+        return {};
     },
 
     CLASS_NAME: "mapfish.GeoStat.Event"
@@ -523,7 +523,7 @@
     },
 
     updateLegend: function() {
-
+        return {};
     },
 
     CLASS_NAME: "mapfish.GeoStat.Boundary"

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-03-23 12:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-04-28 10:31:23 +0000
@@ -1583,12 +1583,14 @@
                     else if (!window) {
                         var layers = gis.util.map.getRenderedVectorLayers().reverse(),
                             html = '<div id="legendWrapper">';
-                            
-                        for (var i = 0, layer; i < layers.length; i++) {
+
+                        for (var i = 0, layer, innerHTML; i < layers.length; i++) {
                             layer = layers[i];
+                            innerHTML = layer.core.updateLegend().innerHTML;
 
-                            html += '<div style="font-size:10px; font-weight:bold">' + layer.name + '</div>' + layer.core.updateLegend().innerHTML + (i < layers.length - 1 ? '<div style="padding:5px"></div>' : '');
-                        }
+                            if (innerHTML) {
+                                html += '<div style="font-size:10px; font-weight:bold">' + layer.name + '</div>' + innerHTML + (i < layers.length - 1 ? '<div style="padding:5px"></div>' : '');
+                            }
 
                         html += '</div>';
 
@@ -6087,7 +6089,7 @@
             },
 
             updateLegend: function() {
-
+                return {};
             },
 
             CLASS_NAME: "mapfish.GeoStat.Event"
@@ -6291,7 +6293,7 @@
             },
 
             updateLegend: function() {
-
+                return {};
             },
 
             CLASS_NAME: "mapfish.GeoStat.Boundary"

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-03-30 14:18:36 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-04-28 10:16:12 +0000
@@ -1589,10 +1589,13 @@
                         var layers = gis.util.map.getRenderedVectorLayers().reverse(),
                             html = '<div id="legendWrapper">';
 
-                        for (var i = 0, layer; i < layers.length; i++) {
+                        for (var i = 0, layer, innerHTML; i < layers.length; i++) {
                             layer = layers[i];
+                            innerHTML = layer.core.updateLegend().innerHTML;
 
-                            html += '<div style="font-size:10px; font-weight:bold">' + layer.name + '</div>' + layer.core.updateLegend().innerHTML + (i < layers.length - 1 ? '<div style="padding:5px"></div>' : '');
+                            if (innerHTML) {
+                                html += '<div style="font-size:10px; font-weight:bold">' + layer.name + '</div>' + innerHTML + (i < layers.length - 1 ? '<div style="padding:5px"></div>' : '');
+                            }
                         }
 
                         html += '</div>';
@@ -6102,7 +6105,7 @@
             },
 
             updateLegend: function() {
-
+                return {};
             },
 
             CLASS_NAME: "mapfish.GeoStat.Event"
@@ -6306,7 +6309,7 @@
             },
 
             updateLegend: function() {
-
+                return {};
             },
 
             CLASS_NAME: "mapfish.GeoStat.Boundary"