← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15791: GIS api sync, json/jsonp fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15791 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-06-20 16:59:57 +0200
message:
  GIS api sync, json/jsonp fixes.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.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/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-06-20 10:41:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-06-20 14:58:16 +0000
@@ -2665,8 +2665,6 @@
 
 							gis.store.maps.loadStore();
 
-							gis.viewport.shareButton.enable();
-
 							window.destroy();
 						}
 					});
@@ -2680,7 +2678,7 @@
                         map;
 
                     Ext.Ajax.request({
-                        url: gis.init.contextPath + '/api/maps/' + id + '.json?viewClass=dimensional&links=false',
+                        url: gis.init.contextPath + '/api/maps/' + id + '.json?fields=' + gis.conf.url.mapFields.join(','),
                         success: function(r) {
                             map = Ext.decode(r.responseText);
 
@@ -2759,7 +2757,7 @@
 							this.currentValue = this.getValue();
 
 							var value = this.getValue(),
-								url = value ? gis.init.contextPath + '/api/maps.json?viewClass=sharing&fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
+								url = value ? gis.init.contextPath + '/api/maps.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
 								store = gis.store.maps;
 
 							store.page = 1;
@@ -2775,7 +2773,7 @@
 			text: GIS.i18n.prev,
 			handler: function() {
 				var value = searchTextfield.getValue(),
-					url = value ? gis.init.contextPath + '/api/maps.json?viewClass=sharing&fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
+					url = value ? gis.init.contextPath + '/api/maps.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
 					store = gis.store.maps;
 
 				store.page = store.page <= 1 ? 1 : store.page - 1;
@@ -2787,7 +2785,7 @@
 			text: GIS.i18n.next,
 			handler: function() {
 				var value = searchTextfield.getValue(),
-					url = value ? gis.init.contextPath + '/api/maps.json?viewClass=sharing&fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
+					url = value ? gis.init.contextPath + '/api/maps.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
 					store = gis.store.maps;
 
 				store.page = store.page + 1;
@@ -2902,7 +2900,6 @@
 												params: Ext.encode(map),
 												success: function() {
 													gis.map = map;
-													gis.viewport.shareButton.enable();
 													gis.store.maps.loadStore();
 												}
 											});

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-06-19 11:37:49 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-06-20 14:57:15 +0000
@@ -621,18 +621,13 @@
             }
 
 			menu = new Ext.menu.Menu({
-				baseCls: 'gis-plugin',
+				baseCls: 'gis-plugin gis-popupmenu',
 				shadow: false,
 				showSeparator: false,
 				defaults: {
 					bodyStyle: 'padding-right:6px'
 				},
-				items: menuItems,
-				listeners: {
-					afterrender: function() {
-						this.getEl().addCls('gis-toolbar-btn-menu');
-					}
-				}
+				items: menuItems
 			});
 
 			menu.showAt([gis.olmap.mouseMove.x, gis.olmap.mouseMove.y]);
@@ -705,11 +700,13 @@
 	};
 
 	GIS.core.OrganisationUnitLevelStore = function(gis) {
+        var isPlugin = GIS.plugin && !GIS.app;
+
 		return Ext.create('Ext.data.Store', {
 			fields: ['id', 'name', 'level'],
 			proxy: {
-				type: 'jsonp',
-				url: gis.init.contextPath + gis.conf.finals.url.path_api + 'organisationUnitLevels.jsonp?viewClass=detailed&links=false&paging=false',
+				type: isPlugin ? 'jsonp' : 'ajax',
+				url: gis.init.contextPath + gis.conf.finals.url.path_api + 'organisationUnitLevels.' + (isPlugin ? 'jsonp' : 'json') + '?fields=id,name,level&paging=false',
 				reader: {
 					type: 'json',
 					root: 'organisationUnitLevels'
@@ -877,42 +874,63 @@
 			loader;
 
 		getMap = function() {
-			Ext.data.JsonP.request({
-				url: gis.init.contextPath + gis.conf.finals.url.path_api + 'maps/' + gis.map.id + '.jsonp?viewClass=dimensional&links=false',
-				success: function(r) {
-
-					// Operand
-					if (Ext.isArray(r.mapViews)) {
-						for (var i = 0, view; i < r.mapViews.length; i++) {
-							view = r.mapViews[i];
-
-							if (view) {
-								if (Ext.isArray(view.columns) && view.columns.length) {
-									for (var j = 0, dim; j < view.columns.length; j++) {
-										dim = view.columns[j];
-
-										if (Ext.isArray(dim.items) && dim.items.length) {
-											for (var k = 0, item; k < dim.items.length; k++) {
-												item = dim.items[k];
-
-												item.id = item.id.replace('#', '.');
-											}
-										}
-									}
-								}
-							}
-						}
-					}
-
-					gis.map = r;
-					setMap();
-				},
-				failure: function() {
-					gis.olmap.mask.hide();
-					alert('Map id not recognized' + (gis.el ? ' (' + gis.el + ')' : ''));
-					return;
-				}
-			});
+            var isPlugin = GIS.plugin && !GIS.app,
+                type = isPlugin ? 'jsonp' : 'json',
+                url = gis.init.contextPath + '/api/maps/' + gis.map.id + '.' + type + '?fields=' + gis.conf.url.mapFields.join(','),
+                success,
+                failure;
+
+            success = function(r) {
+
+                // operand
+                if (Ext.isArray(r.mapViews)) {
+                    for (var i = 0, view; i < r.mapViews.length; i++) {
+                        view = r.mapViews[i];
+
+                        if (view) {
+                            if (Ext.isArray(view.columns) && view.columns.length) {
+                                for (var j = 0, dim; j < view.columns.length; j++) {
+                                    dim = view.columns[j];
+
+                                    if (Ext.isArray(dim.items) && dim.items.length) {
+                                        for (var k = 0, item; k < dim.items.length; k++) {
+                                            item = dim.items[k];
+
+                                            item.id = item.id.replace('#', '.');
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+
+                gis.map = r;
+                setMap();
+            };
+
+            failure = function() {
+                gis.olmap.mask.hide();
+                alert('Map id not recognized' + (gis.el ? ' (' + gis.el + ')' : ''));
+                return;
+            };
+
+            if (isPlugin) {
+                Ext.data.JsonP.request({
+                    url: url,
+                    success: function(r) {
+                        success(r);
+                    }
+                });
+            }
+            else {
+                Ext.Ajax.request({
+                    url: url,
+                    success: function(r) {
+                        success(Ext.decode(r.responseText));
+                    }
+                });
+            }
 		};
 
 		setMap = function() {
@@ -975,7 +993,7 @@
 			}
 
 			// interpretation button
-			if (gis.map.id && gis.viewport.shareButton) {
+			if (gis.viewport.shareButton) {
 				gis.viewport.shareButton.enable();
 			}
 
@@ -1302,45 +1320,64 @@
 		};
 
 		loadOrganisationUnits = function(view) {
-			var items = view.rows[0].items,
-				idParamString = '';
-
-			for (var i = 0; i < items.length; i++) {
-				idParamString += 'ids=' + items[i].id;
-				idParamString += i !== items.length - 1 ? '&' : '';
-			}
-
-			Ext.data.JsonP.request({
-				url: gis.init.contextPath + gis.conf.finals.url.path_module + 'getGeoJsonFacilities.action?' + idParamString,
-				scope: this,
-				disableCaching: false,
-				success: function(r) {
-					var geojson = layer.core.decode(r),
-						format = new OpenLayers.Format.GeoJSON(),
-						features = gis.util.map.getTransformedFeatureArray(format.read(geojson));
-
-					if (!Ext.isArray(features)) {
-						olmap.mask.hide();
-						alert(GIS.i18n.invalid_coordinates);
-						return;
-					}
-
-					if (!features.length) {
-						olmap.mask.hide();
-						alert(GIS.i18n.no_valid_coordinates_found);
-						return;
-					}
-
-					layer.core.featureStore.loadFeatures(features.slice(0));
-
-					loadData(view, features);
-				},
-				failure: function(r) {
-					olmap.mask.hide();
-					alert(GIS.i18n.coordinates_could_not_be_loaded);
-				}
-			});
-		};
+            var items = view.rows[0].items,
+                url = function() {
+                    var params = '';
+                    for (var i = 0; i < items.length; i++) {
+                        params += 'ids=' + items[i].id;
+                        params += i !== items.length - 1 ? '&' : '';
+                    }
+                    return gis.init.contextPath + gis.conf.finals.url.path_module + 'getGeoJsonFacilities.action?' + params;
+                }(),
+                success,
+                failure;
+
+            success = function(r) {
+                var geojson = layer.core.decode(r),
+                    format = new OpenLayers.Format.GeoJSON(),
+                    features = gis.util.map.getTransformedFeatureArray(format.read(geojson));
+
+                if (!Ext.isArray(features)) {
+                    olmap.mask.hide();
+                    alert(GIS.i18n.invalid_coordinates);
+                    return;
+                }
+
+                if (!features.length) {
+                    olmap.mask.hide();
+                    alert(GIS.i18n.no_valid_coordinates_found);
+                    return;
+                }
+
+                layer.core.featureStore.loadFeatures(features.slice(0));
+
+                loadData(view, features);
+            };
+
+            failure = function() {
+                olmap.mask.hide();
+                alert(GIS.i18n.coordinates_could_not_be_loaded);
+            };
+
+            if (GIS.plugin && !GIS.app) {
+                Ext.data.JsonP.request({
+                    url: url,
+                    disableCaching: false,
+                    success: function(r) {
+                        success(r);
+                    }
+                });
+            }
+            else {
+                Ext.Ajax.request({
+                    url: url,
+                    disableCaching: false,
+                    success: function(r) {
+                        success(Ext.decode(r.responseText));
+                    }
+                });
+            }
+        };
 
 		loadData = function(view, features) {
 			view = view || layer.core.view;
@@ -1357,27 +1394,48 @@
 		};
 
 		loadLegend = function(view) {
+            var isPlugin = GIS.plugin && !GIS.app,
+                type = isPlugin ? 'jsonp' : 'json',
+                url = gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.' + type + '?fields=organisationUnitGroups[id,name]',
+                success;
+
 			view = view || layer.core.view;
 
-            Ext.data.JsonP.request({
-                url: gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.jsonp?links=false',
-                success: function(r) {
-                    var data = r.organisationUnitGroups,
-                        options = {
-                            indicator: view.organisationUnitGroupSet.id
-                        };
-
-                    gis.store.groupsByGroupSet.loadData(data);
-
-					layer.core.view = view;
-
-					layer.core.applyClassification(options);
-
-					addCircles(view);
-
-					afterLoad(view);
-				}
-			});
+            success = function(r) {
+                var data = r.organisationUnitGroups,
+                    options = {
+                        indicator: view.organisationUnitGroupSet.id
+                    };
+
+                gis.store.groupsByGroupSet.loadData(data);
+
+                layer.core.view = view;
+
+                layer.core.applyClassification({
+                    indicator: view.organisationUnitGroupSet.id
+                });
+
+                addCircles(view);
+
+                afterLoad(view);
+            };
+
+            if (isPlugin) {
+                Ext.data.JsonP.request({
+                    url: url,
+                    success: function(r) {
+                        success(r);
+                    }
+                });
+            }
+            else {
+                Ext.Ajax.request({
+                    url: url,
+                    success: function(r) {
+                        success(Ext.decode(r.responseText));
+                    }
+                });
+            }
 		};
 
 		addCircles = function(view) {
@@ -1832,43 +1890,62 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-				idParamString = '';
-
-			for (var i = 0; i < items.length; i++) {
-				idParamString += 'ids=' + items[i].id;
-				idParamString += i !== items.length - 1 ? '&' : '';
-			}
-
-			Ext.data.JsonP.request({
-				url: gis.init.contextPath + gis.conf.finals.url.path_module + 'getGeoJson.action?' + idParamString,
-				scope: this,
-				disableCaching: false,
-				success: function(r) {
-					var geojson = gis.util.geojson.decode(r),
-						format = new OpenLayers.Format.GeoJSON(),
-						features = gis.util.map.getTransformedFeatureArray(format.read(geojson));
-
-					if (!Ext.isArray(features)) {
-						olmap.mask.hide();
-						alert(GIS.i18n.invalid_coordinates);
-						return;
-					}
-
-					if (!features.length) {
-						olmap.mask.hide();
-						alert(GIS.i18n.no_valid_coordinates_found);
-						return;
-					}
-
-					layer.core.featureStore.loadFeatures(features.slice(0));
-
-					loadData(view, features);
-				},
-				failure: function(r) {
-					olmap.mask.hide();
-					alert(GIS.i18n.coordinates_could_not_be_loaded);
-				}
-			});
+				url = function() {
+                    var params = '';
+                    for (var i = 0; i < items.length; i++) {
+                        params += 'ids=' + items[i].id;
+                        params += i !== items.length - 1 ? '&' : '';
+                    }
+                    return gis.init.contextPath + gis.conf.finals.url.path_module + 'getGeoJson.action?' + params;
+                }(),
+                success,
+                failure;
+
+            success = function(r) {
+                var geojson = gis.util.geojson.decode(r),
+                    format = new OpenLayers.Format.GeoJSON(),
+                    features = gis.util.map.getTransformedFeatureArray(format.read(geojson));
+
+                if (!Ext.isArray(features)) {
+                    olmap.mask.hide();
+                    alert(GIS.i18n.invalid_coordinates);
+                    return;
+                }
+
+                if (!features.length) {
+                    olmap.mask.hide();
+                    alert(GIS.i18n.no_valid_coordinates_found);
+                    return;
+                }
+
+                layer.core.featureStore.loadFeatures(features.slice(0));
+
+                loadData(view, features);
+            };
+
+            failure = function() {
+                olmap.mask.hide();
+                alert(GIS.i18n.coordinates_could_not_be_loaded);
+            };
+
+            if (GIS.plugin && !GIS.app) {
+                Ext.data.JsonP.request({
+                    url: url,
+                    disableCaching: false,
+                    success: function(r) {
+                        success(r);
+                    }
+                });
+            }
+            else {
+                Ext.Ajax.request({
+                    url: url,
+                    disableCaching: false,
+                    success: function(r) {
+                        success(Ext.decode(r.responseText));
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -2056,7 +2133,7 @@
 					legends = [];
 
 				Ext.Ajax.request({
-					url: gis.init.contextPath + gis.conf.finals.url.path_api + 'mapLegendSets/' + view.legendSet.id + '.json?links=false&paging=false',
+					url: gis.init.contextPath + gis.conf.finals.url.path_api + 'mapLegendSets/' + view.legendSet.id + '.json?fields=' + gis.conf.url.mapLegendSetFields.join(','),
 					scope: this,
 					success: function(r) {
 						legends = Ext.decode(r.responseText).mapLegends;
@@ -2344,7 +2421,64 @@
 					'LAST_5_YEARS': 'LAST_YEAR'
 				}
 			};
-		}());
+
+            conf.url = {};
+
+            conf.url.analysisFields = [
+                '*',
+                'columns[dimension,filter,items[id,name]]',
+                'rows[dimension,filter,items[id,name]]',
+                'filters[dimension,filter,items[id,name]]',
+                '!lastUpdated',
+                '!href',
+                '!created',
+                '!publicAccess',
+                '!rewindRelativePeriods',
+                '!userOrganisationUnit',
+                '!userOrganisationUnitChildren',
+                '!userOrganisationUnitGrandChildren',
+                '!externalAccess',
+                '!access',
+                '!relativePeriods',
+                '!columnDimensions',
+                '!rowDimensions',
+                '!filterDimensions',
+                '!user',
+                '!organisationUnitGroups',
+                '!itemOrganisationUnitGroups',
+                '!userGroupAccesses',
+                '!indicators',
+                '!dataElements',
+                '!dataElementOperands',
+                '!dataElementGroups',
+                '!dataSets',
+                '!periods',
+                '!organisationUnitLevels',
+                '!organisationUnits',
+
+                '!sortOrder',
+                '!topLimit'
+            ];
+
+            conf.url.mapFields = [
+                conf.url.analysisFields.join(','),
+                'mapViews[' + conf.url.analysisFields.join(',') + ']'
+            ];
+
+            conf.url.mapLegendFields = [
+                '*',
+                '!created',
+                '!lastUpdated',
+                '!displayName',
+                '!externalAccess',
+                '!access',
+                '!userGroupAccesses'
+            ];
+
+            conf.url.mapLegendSetFields = [
+                'id,name,mapLegends[' + conf.url.mapLegendFields.join(',') + ']'
+            ];
+        }());
 
 		// util
 		(function() {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js	2014-06-12 11:37:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/plugin.js	2014-06-20 14:57:15 +0000
@@ -1029,7 +1029,7 @@
 			fields: ['id', 'name', 'level'],
 			proxy: {
 				type: 'jsonp',
-				url: gis.init.contextPath + gis.conf.finals.url.path_api + 'organisationUnitLevels.jsonp?viewClass=detailed&links=false&paging=false',
+				url: gis.init.contextPath + '/api/organisationUnitLevels.jsonp?fields=id,name,level&paging=false',
 				reader: {
 					type: 'json',
 					root: 'organisationUnitLevels'
@@ -1203,7 +1203,7 @@
 
 		getMap = function() {
 			Ext.data.JsonP.request({
-				url: gis.init.contextPath + gis.conf.finals.url.path_api + 'maps/' + gis.map.id + '.jsonp?viewClass=dimensional&links=false',
+				url: gis.init.contextPath + '/api/maps/' + gis.map.id + '.jsonp?fields=' + gis.conf.url.mapFields.join(','),
 				success: function(r) {
 
 					// Operand
@@ -1396,7 +1396,7 @@
                         map = Ext.clone(r.metaData.names);
 
                     // name-column map, lonIndex, latIndex
-                    for (var i = 0; i < r.headers.length; i++) {
+                    for (var i = 0; i < r.headers.length; i++) {
                         map[r.headers[i].name] = r.headers[i].column;
 
                         if (r.headers[i].name === 'longitude') {
@@ -1428,7 +1428,7 @@
                     // name-column map
                     map = Ext.clone(r.metaData.names);
 
-                    for (var i = 0; i < r.headers.length; i++) {
+                    for (var i = 0; i < r.headers.length; i++) {
                         map[r.headers[i].name] = r.headers[i].column;
                     }
 
@@ -2301,7 +2301,7 @@
 					peIds = metaData[dimConf.period.objectName];
 
 				for (var i = 0, dimension; i < dimensions.length; i++) {
-					dimension = dimensions[i];
+					dimension = dimensions[i];
 
 					for (var j = 0, item; j < dimension.items.length; j++) {
 						item = dimension.items[j];
@@ -2650,7 +2650,65 @@
 					'LAST_5_YEARS': 'LAST_YEAR'
 				}
 			};
-		}());
+
+            conf.url = {};
+
+            conf.url.analysisFields = [
+                '*',
+                'columns[dimension,filter,items[id,name]]',
+                'rows[dimension,filter,items[id,name]]',
+                'filters[dimension,filter,items[id,name]]',
+                '!lastUpdated',
+                '!href',
+                '!created',
+                '!publicAccess',
+                '!rewindRelativePeriods',
+                '!userOrganisationUnit',
+                '!userOrganisationUnitChildren',
+                '!userOrganisationUnitGrandChildren',
+                '!externalAccess',
+                '!access',
+                '!relativePeriods',
+                '!columnDimensions',
+                '!rowDimensions',
+                '!filterDimensions',
+                '!user',
+                '!organisationUnitGroups',
+                '!itemOrganisationUnitGroups',
+                '!userGroupAccesses',
+                '!indicators',
+                '!dataElements',
+                '!dataElementOperands',
+                '!dataElementGroups',
+                '!dataSets',
+                '!periods',
+                '!organisationUnitLevels',
+                '!organisationUnits',
+
+                '!sortOrder',
+                '!topLimit'
+            ];
+
+            conf.url.mapFields = [
+                conf.url.analysisFields.join(','),
+                'mapViews[' + conf.url.analysisFields.join(',') + ']'
+            ];
+
+            conf.url.mapLegendFields = [
+                '*',
+                '!created',
+                '!lastUpdated',
+                '!displayName',
+                '!externalAccess',
+                '!access',
+                '!userGroupAccesses'
+            ];
+
+            conf.url.mapLegendSetFields = [
+                'id,name,mapLegends[' + conf.url.mapLegendFields.join(',') + ']'
+            ];
+
+        }());
 
 		// util
 		(function() {
@@ -2763,7 +2821,7 @@
 				return array;
 			};
 
-			util.object.getLength = function(object) {
+			util.object.getLength = function(object) {
 				var size = 0;
 
 				for (var key in object) {
@@ -2959,7 +3017,7 @@
 
 				return function() {
 					var a = [],
-						objectNames = [],
+						objectNames = [],
 						dimConf = conf.finals.dimension,
 						isOu = false,
 						isOuc = false,
@@ -4663,7 +4721,7 @@
 		});
 
 		requests.push({
-			url: url + '/api/organisationUnits.jsonp?userOnly=true&viewClass=detailed&paging=false&links=false',
+			url: url + '/api/organisationUnits.jsonp?userOnly=true&fields=id,name,children[id,name]&paging=false',
 			success: function(r) {
 				var organisationUnits = r.organisationUnits || [],
                     ou = [],
@@ -4680,10 +4738,9 @@
                         }
                     }
 
-                    init.user = {
-                        ou: ou,
-                        ouc: ouc
-                    }
+                    init.user = init.user || {};
+                    init.user.ou = ou;
+                    init.user.ouc = ouc;
                 }
                 else {
                     alert('User is not assigned to any organisation units');
@@ -4694,14 +4751,6 @@
 		});
 
 		requests.push({
-			url: url + '/api/mapLegendSets.jsonp?viewClass=detailed&links=false&paging=false',
-			success: function(r) {
-				init.legendSets = r.mapLegendSets;
-				fn();
-			}
-		});
-
-		requests.push({
 			url: url + '/api/dimensions.jsonp?links=false&paging=false',
 			success: function(r) {
 				init.dimensions = r.dimensions;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css	2014-05-13 21:53:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css	2014-06-20 13:25:49 +0000
@@ -564,20 +564,26 @@
  *--------------------------------------------------------------------------*/
 
 .x-menu-body {
-    border: 1px solid #aaa;
+    border-color: #bbb;
     border-radius: 2px;
-	padding: 0;
-	background-color: #fff !important;
 }
-
 .x-menu-item-active .x-menu-item-link {
 	border-radius: 0;
 	border-color: #e1e1e1;
 	background-color: #e1e1e1;
 	background-image: none;
 }
+.x-menu-body {
+	padding: 0;
+}
+.x-menu-body .x-box-inner {
+	background-color: #fafafa;
+}
 
 	/* Menu item */
+.x-menu-item {
+	background-color: #fafafa;
+}
 
 .x-menu-item-link {
     padding: 4px 5px 4px 26px;
@@ -677,6 +683,12 @@
 	margin-top: 2px;
 }
 
+	/* Popup menu */
+.gis-popupmenu {
+    border: 1px solid #aaa;
+    border-radius: 2px;
+}
+
 
 /*----------------------------------------------------------------------------
  * Treepanel

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js	2014-06-18 11:06:05 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js	2014-06-20 14:24:06 +0000
@@ -2761,10 +2761,9 @@
                         }
                     }
 
-                    init.user = {
-                        ou: ou,
-                        ouc: ouc
-                    }
+                    init.user = init.user || {};
+                    init.user.ou = ou;
+                    init.user.ouc = ouc;
                 }
                 else {
                     alert('User is not assigned to any organisation units');