← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18892: GIS support function bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18892 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-04-13 01:06:55 +0200
message:
  GIS support function bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.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-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-03-30 14:50:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-04-12 23:06:14 +0000
@@ -546,13 +546,13 @@
 			}
 
 			// sort organisation unit levels
-			gis.util.array.sort(init.organisationUnitLevels, 'ASC', 'level');
+			util.array.sort(init.organisationUnitLevels, 'ASC', 'level');
 
 			// sort indicator groups
-			gis.util.array.sort(init.indicatorGroups);
+			util.array.sort(init.indicatorGroups);
 
 			// sort data element groups
-			gis.util.array.sort(init.dataElementGroups);
+			util.array.sort(init.dataElementGroups);
 		}());
 
 		// store

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-04-12 18:31:24 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-04-12 23:06:14 +0000
@@ -2979,7 +2979,7 @@
                 levelOrder = levelOrder || 'ASC';
 
                 // sort
-                organisationUnits = util.array.sort(organisationUnits, levelOrder, 'le');
+                util.array.sort(organisationUnits, levelOrder, 'le');
 
 				for (var i = 0, ou, gpid = '', gppg = ''; i < organisationUnits.length; i++) {
                     ou = organisationUnits[i];
@@ -3048,10 +3048,22 @@
 
 			util.array = {};
 
+			util.array.getLength = function(array, suppressWarning) {
+				if (!Ext.isArray(array)) {
+					if (!suppressWarning) {
+						console.log('support.prototype.array.getLength: not an array');
+					}
+
+					return null;
+				}
+
+				return array.length;
+			};
+
 			util.array.sort = function(array, direction, key, emptyFirst) {
 				// supports [number], [string], [{key: number}], [{key: string}], [[string]], [[number]]
 
-				if (!support.prototype.array.getLength(array)) {
+				if (!util.array.getLength(array, true)) {
 					return;
 				}
 
@@ -3083,7 +3095,6 @@
 							return a < b ? -1 : (a > b ? 1 : 0);
 						}
 					}
-
 					// number
 					else if (Ext.isNumber(a) && Ext.isNumber(b)) {
 						return direction === 'DESC' ? b - a : a - b;
@@ -3594,10 +3605,6 @@
 		gis.layer = GIS.core.getLayers(gis);
 		gis.thematicLayers = [gis.layer.thematic1, gis.layer.thematic2, gis.layer.thematic3, gis.layer.thematic4];
 
-		//if (window.google) {
-			//layers.push(gis.layer.googleStreets, gis.layer.googleHybrid);
-		//}
-
 		layers.push(
 			gis.layer.openStreetMap,
 			gis.layer.thematic4,