← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20811: GIS dashboard fix.

 

------------------------------------------------------------
revno: 20811
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-10-20 17:42:15 +0200
message:
  GIS dashboard fix.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js
  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/map.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-reports/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2015-09-18 19:32:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2015-10-20 15:42:15 +0000
@@ -214,7 +214,7 @@
                 ],
                 idNameMap: {}
             };
-            
+
             conf.valueType = {
             	numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
             	textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
@@ -2586,7 +2586,7 @@
 				if (view.completedOnly) {
 					paramString += '&completedOnly=true';
 				}
-                
+
                 // sorting
                 if (view.dataType === conf.finals.dataType.individual_cases && view.sorting) {
                     if (view.sorting.id && view.sorting.direction) {
@@ -2607,7 +2607,7 @@
                 if (view.collapseDataDimensions) {
                     paramString += '&collapseDataDimensions=true';
                 }
-                
+
                 // relative period date
                 if (view.relativePeriodDate) {
                     paramString += '&relativePeriodDate=' + view.relativePeriodDate;
@@ -3576,8 +3576,9 @@
 
 					for (var j = 0, str, header, name; j < dimensionHeaders.length; j++) {
 						header = dimensionHeaders[j];
+                        isBoolean = header.type === 'java.lang.Boolean';
 						str = row[header.index];
-                        str = optionNames[header.name + str] || optionNames[str] || booleanNames[str] || names[str] || str;
+                        str = optionNames[header.name + str] || optionNames[str] || (isBoolean ? booleanNames[str] : null) || names[str] || str;
 						name = web.report.query.format(str);
 
 						//if (header.name === 'ouname' && layout.showHierarchy) {

=== 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-09-28 11:25:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2015-10-20 15:42:15 +0000
@@ -1131,9 +1131,14 @@
 			var views = gis.map.mapViews,
 				loader;
 
+            // title
+            if (gis.dashboard && gis.viewport.northRegion && gis.map && gis.map.name) {
+                gis.viewport.northRegion.update(gis.map.name);
+            }
+
 			if (!(Ext.isArray(views) && views.length)) {
 				gis.olmap.mask.hide();
-				alert(GIS.i18n.favorite_outdated_create_new);
+				gis.alert(GIS.i18n.favorite_outdated_create_new);
 				return;
 			}
 
@@ -1385,7 +1390,7 @@
                 }
 
                 if (!rows.length) {
-                    alert('No event coordinates found');
+                    gis.alert('No event coordinates found');
                     olmap.mask.hide();
                     return;
                 }
@@ -1611,13 +1616,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -1628,7 +1633,7 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
             if (GIS.plugin && !GIS.app) {
@@ -1899,13 +1904,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -1945,7 +1950,7 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
             if (isPlugin) {
@@ -2259,13 +2264,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -2276,7 +2281,7 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
             if (isPlugin) {
@@ -3410,6 +3415,12 @@
                     };
                 }
 
+                // dashboard
+                if (gis.dashboard) {
+                    gis.viewport.centerRegion.update('<div class="ns-plugin-alert">' + obj.message + '</div>');
+                    return;
+                }
+
                 // web message
                 type = (obj.status || 'INFO').toLowerCase();
 
@@ -3640,7 +3651,7 @@
                     }
 
                     if (!ouDim) {
-                        alert('No organisation units specified');
+                        gis.alert('No organisation units specified');
                         return;
                     }
 
@@ -3825,12 +3836,12 @@
 					var headers = [];
 
 					if (!(config && Ext.isObject(config))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
 					if (!(config.headers && Ext.isArray(config.headers))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
@@ -3845,17 +3856,17 @@
 					config.headers = headers;
 
 					if (!config.headers.length) {
-						alert('No valid response headers', config);
+						gis.alert('No valid response headers', config);
 						return;
 					}
-
+                    
 					if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
-						alert('No values found', config);
+						gis.alert('No values found', config);
 						return false;
 					}
 
 					if (config.headers.length !== config.rows[0].length) {
-						alert('Data invalid', config);
+						gis.alert('Data invalid', config);
 						return false;
 					}
 
@@ -3896,5 +3907,4 @@
 
 		return gis;
 	};
-
 });

=== 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-09-11 23:57:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/map.js	2015-10-20 15:42:15 +0000
@@ -2518,9 +2518,14 @@
 			var views = gis.map.mapViews,
 				loader;
 
+            // title
+            if (gis.dashboard && gis.viewport.northRegion && gis.map && gis.map.name) {
+                gis.viewport.northRegion.update(gis.map.name);
+            }
+
 			if (!(Ext.isArray(views) && views.length)) {
 				gis.olmap.mask.hide();
-				alert(GIS.i18n.favorite_outdated_create_new);
+				gis.alert(GIS.i18n.favorite_outdated_create_new);
 				return;
 			}
 
@@ -2772,7 +2777,7 @@
                 }
 
                 if (!rows.length) {
-                    alert('No event coordinates found');
+                    gis.alert('No event coordinates found');
                     olmap.mask.hide();
                     return;
                 }
@@ -2781,16 +2786,28 @@
                 getOptionSets();
             };
 
-            gis.ajax({
-                url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
-                disableCaching: false,
-                failure: function(r) {
-                    gis.alert(r);
-                },
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+			if (Ext.isObject(GIS.app)) {
+				Ext.Ajax.request({
+					url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
+					disableCaching: false,
+					failure: function(r) {
+                        gis.alert(r);
+					},
+					success: function(r) {
+						success(Ext.decode(r.responseText));
+					}
+				});
+			}
+			else if (Ext.isObject(GIS.plugin)) {
+				Ext.data.JsonP.request({
+					url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.jsonp' + paramString,
+					disableCaching: false,
+					scope: this,
+					success: function(r) {
+						success(r);
+					}
+				});
+			}
 		};
 
 		loadLegend = function(view) {
@@ -2955,7 +2972,7 @@
 
 		loadOrganisationUnits = function(view) {
             var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -2974,7 +2991,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params + '&includeGroupSets=true';
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params + '&includeGroupSets=true';
                 }(),
                 success,
                 failure;
@@ -2986,13 +3003,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3003,16 +3020,27 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+            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) {
@@ -3030,7 +3058,8 @@
 		};
 
 		loadLegend = function(view) {
-            var type = 'json',
+            var isPlugin = GIS.plugin && !GIS.app,
+                type = isPlugin ? 'jsonp' : 'json',
                 url = gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.' + type + '?fields=organisationUnitGroups[id,name,symbol]',
                 success;
 
@@ -3063,12 +3092,22 @@
                 afterLoad(view);
             };
 
-            gis.ajax({
-                url: url,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+            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) {
@@ -3218,7 +3257,7 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3237,7 +3276,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params;
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
                 }(),
                 success,
                 failure;
@@ -3252,13 +3291,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3298,19 +3337,30 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                },
-                failure: function() {
-                    failure();
-                }
-            });
+            if (isPlugin) {
+                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));
+                    },
+                    failure: function() {
+                        failure();
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -3570,7 +3620,7 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3589,7 +3639,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params;
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
                 }(),
                 success,
                 failure;
@@ -3601,13 +3651,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3618,19 +3668,30 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                },
-                failure: function() {
-                    failure();
-                }
-            });
+            if (isPlugin) {
+                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));
+                    },
+                    failure: function() {
+                        failure();
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -3644,8 +3705,7 @@
 				dxItems = view.columns[0].items,
 				isOperand = view.columns[0].dimension === dimConf.operand.objectName,
 				peItems = view.filters[0].items,
-				ouItems = view.rows[0].items,
-                type = 'json';
+				ouItems = view.rows[0].items;
 
 			// ou
 			paramString += 'dimension=ou:';
@@ -3663,6 +3723,11 @@
 				paramString += i < dxItems.length - 1 ? ';' : '';
 			}
 
+            // program
+            if (view.program) {
+                paramString += '&program=' + view.program.id;
+            }
+
 			paramString += isOperand ? '&dimension=co' : '';
 
 			// pe
@@ -3749,16 +3814,28 @@
 				loadLegend(view);
 			};
 
-            gis.ajax({
-                url: gis.init.contextPath + '/api/analytics.json' + paramString,
-                disableCaching: false,
-                failure: function(r) {
-                    gis.alert(r);
-                },
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+			if (Ext.isObject(GIS.app)) {
+				Ext.Ajax.request({
+					url: gis.init.contextPath + '/api/analytics.json' + paramString,
+					disableCaching: false,
+					failure: function(r) {
+                        gis.alert(r);
+					},
+					success: function(r) {
+						success(Ext.decode(r.responseText));
+					}
+				});
+			}
+			else if (Ext.isObject(GIS.plugin)) {
+				Ext.data.JsonP.request({
+					url: gis.init.contextPath + '/api/analytics.jsonp' + paramString,
+					disableCaching: false,
+					scope: this,
+					success: function(r) {
+						success(r);
+					}
+				});
+			}
 		};
 
 		loadLegend = function(view) {
@@ -3829,7 +3906,7 @@
             };
 
             loadLegendSet = function(view) {
-                gis.ajax({
+                Ext.Ajax.request({
 					url: gis.init.contextPath + '/api/legendSets/' + view.legendSet.id + '.json?fields=' + gis.conf.url.legendSetFields.join(','),
 					scope: this,
                     disableCaching: false,
@@ -3881,7 +3958,7 @@
                     return;
                 }
 
-                gis.ajax({
+                Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
                         var elements = Ext.decode(r.responseText)[elementUrl],
@@ -4036,7 +4113,9 @@
 			gis = {};
 
         // tmp
-        gis.alert = function() {};
+        gis.alert = function() {
+            console.log(".");
+        };
 
 		// conf
 		(function() {
@@ -4661,6 +4740,12 @@
                         message: obj
                     };
                 }
+                
+                // dashboard
+                if (gis.dashboard) {
+                    gis.viewport.centerRegion.update('<div class="ns-plugin-alert">' + obj.message + '</div>');
+                    return;
+                }
 
                 // web message
                 type = (obj.status || 'INFO').toLowerCase();
@@ -4812,6 +4897,8 @@
 
                 // filters: [Dimension]
 
+                // program: object
+
                 // classes: integer (5) - 1-7
 
                 // method: integer (2) - 2, 3 // 2=equal intervals, 3=equal counts
@@ -4874,7 +4961,7 @@
                     }
 
                     if (!ouDim) {
-                        alert('No organisation units specified');
+                        gis.alert('No organisation units specified');
                         return;
                     }
 
@@ -4961,6 +5048,11 @@
                     layout.columns = config.columns;
                     layout.rows = config.rows;
                     layout.filters = config.filters;
+                    
+                    // program
+                    if (Ext.isObject(config.program) && config.program.id) {
+                        layout.program = config.program;
+                    }
 
                     // Properties
                     layout.layer = Ext.isString(config.layer) && !Ext.isEmpty(config.layer) ? config.layer : 'thematic1';
@@ -5052,12 +5144,12 @@
 					var headers = [];
 
 					if (!(config && Ext.isObject(config))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
 					if (!(config.headers && Ext.isArray(config.headers))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
@@ -5072,17 +5164,17 @@
 					config.headers = headers;
 
 					if (!config.headers.length) {
-						alert('No valid response headers', config);
+						gis.alert('No valid response headers', config);
 						return;
 					}
 
 					if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
-						alert('No values found', config);
+						gis.alert('No values found', config);
 						return false;
 					}
 
 					if (config.headers.length !== config.rows[0].length) {
-						alert('Data invalid', config);
+						gis.alert('Data invalid', config);
 						return false;
 					}
 
@@ -6652,7 +6744,10 @@
         boundary_layer: 'Boundary layer',
         facility_layer: 'Facility layer',
         thematic_layer: 'Thematic layer',
-        measure_distance: 'Measure distance'
+        measure_distance: 'Measure distance',
+        coordinates_could_not_be_loaded: 'Coordinates could not be loaded',
+        invalid_coordinates: 'Invalid coordinates',
+        no_valid_coordinates_found: 'No valid coordinates found'
     };
 
     GIS.plugin = {};
@@ -6853,7 +6948,7 @@
                     init.user.ou = ou;
                     init.user.ouc = ouc;
                 } else {
-                    alert('User is not assigned to any organisation units');
+                    gis.alert('User is not assigned to any organisation units');
                 }
 
                 fn();

=== 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-09-11 23:57:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js	2015-10-20 15:42:15 +0000
@@ -2518,9 +2518,14 @@
 			var views = gis.map.mapViews,
 				loader;
 
+            // title
+            if (gis.dashboard && gis.viewport.northRegion && gis.map && gis.map.name) {
+                gis.viewport.northRegion.update(gis.map.name);
+            }
+
 			if (!(Ext.isArray(views) && views.length)) {
 				gis.olmap.mask.hide();
-				alert(GIS.i18n.favorite_outdated_create_new);
+				gis.alert(GIS.i18n.favorite_outdated_create_new);
 				return;
 			}
 
@@ -2772,7 +2777,7 @@
                 }
 
                 if (!rows.length) {
-                    alert('No event coordinates found');
+                    gis.alert('No event coordinates found');
                     olmap.mask.hide();
                     return;
                 }
@@ -2781,16 +2786,28 @@
                 getOptionSets();
             };
 
-            gis.ajax({
-                url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
-                disableCaching: false,
-                failure: function(r) {
-                    gis.alert(r);
-                },
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+			if (Ext.isObject(GIS.app)) {
+				Ext.Ajax.request({
+					url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
+					disableCaching: false,
+					failure: function(r) {
+                        gis.alert(r);
+					},
+					success: function(r) {
+						success(Ext.decode(r.responseText));
+					}
+				});
+			}
+			else if (Ext.isObject(GIS.plugin)) {
+				Ext.data.JsonP.request({
+					url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.jsonp' + paramString,
+					disableCaching: false,
+					scope: this,
+					success: function(r) {
+						success(r);
+					}
+				});
+			}
 		};
 
 		loadLegend = function(view) {
@@ -2955,7 +2972,7 @@
 
 		loadOrganisationUnits = function(view) {
             var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -2974,7 +2991,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params + '&includeGroupSets=true';
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params + '&includeGroupSets=true';
                 }(),
                 success,
                 failure;
@@ -2986,13 +3003,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3003,16 +3020,27 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+            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) {
@@ -3030,7 +3058,8 @@
 		};
 
 		loadLegend = function(view) {
-            var type = 'json',
+            var isPlugin = GIS.plugin && !GIS.app,
+                type = isPlugin ? 'jsonp' : 'json',
                 url = gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.' + type + '?fields=organisationUnitGroups[id,name,symbol]',
                 success;
 
@@ -3063,12 +3092,22 @@
                 afterLoad(view);
             };
 
-            gis.ajax({
-                url: url,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+            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) {
@@ -3218,7 +3257,7 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3237,7 +3276,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params;
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
                 }(),
                 success,
                 failure;
@@ -3252,13 +3291,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3298,19 +3337,30 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                },
-                failure: function() {
-                    failure();
-                }
-            });
+            if (isPlugin) {
+                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));
+                    },
+                    failure: function() {
+                        failure();
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -3570,7 +3620,7 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3589,7 +3639,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params;
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
                 }(),
                 success,
                 failure;
@@ -3601,13 +3651,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3618,19 +3668,30 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                },
-                failure: function() {
-                    failure();
-                }
-            });
+            if (isPlugin) {
+                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));
+                    },
+                    failure: function() {
+                        failure();
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -3644,8 +3705,7 @@
 				dxItems = view.columns[0].items,
 				isOperand = view.columns[0].dimension === dimConf.operand.objectName,
 				peItems = view.filters[0].items,
-				ouItems = view.rows[0].items,
-                type = 'json';
+				ouItems = view.rows[0].items;
 
 			// ou
 			paramString += 'dimension=ou:';
@@ -3663,6 +3723,11 @@
 				paramString += i < dxItems.length - 1 ? ';' : '';
 			}
 
+            // program
+            if (view.program) {
+                paramString += '&program=' + view.program.id;
+            }
+
 			paramString += isOperand ? '&dimension=co' : '';
 
 			// pe
@@ -3749,16 +3814,28 @@
 				loadLegend(view);
 			};
 
-            gis.ajax({
-                url: gis.init.contextPath + '/api/analytics.json' + paramString,
-                disableCaching: false,
-                failure: function(r) {
-                    gis.alert(r);
-                },
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+			if (Ext.isObject(GIS.app)) {
+				Ext.Ajax.request({
+					url: gis.init.contextPath + '/api/analytics.json' + paramString,
+					disableCaching: false,
+					failure: function(r) {
+                        gis.alert(r);
+					},
+					success: function(r) {
+						success(Ext.decode(r.responseText));
+					}
+				});
+			}
+			else if (Ext.isObject(GIS.plugin)) {
+				Ext.data.JsonP.request({
+					url: gis.init.contextPath + '/api/analytics.jsonp' + paramString,
+					disableCaching: false,
+					scope: this,
+					success: function(r) {
+						success(r);
+					}
+				});
+			}
 		};
 
 		loadLegend = function(view) {
@@ -3829,7 +3906,7 @@
             };
 
             loadLegendSet = function(view) {
-                gis.ajax({
+                Ext.Ajax.request({
 					url: gis.init.contextPath + '/api/legendSets/' + view.legendSet.id + '.json?fields=' + gis.conf.url.legendSetFields.join(','),
 					scope: this,
                     disableCaching: false,
@@ -3881,7 +3958,7 @@
                     return;
                 }
 
-                gis.ajax({
+                Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
                         var elements = Ext.decode(r.responseText)[elementUrl],
@@ -4036,7 +4113,9 @@
 			gis = {};
 
         // tmp
-        gis.alert = function() {};
+        gis.alert = function() {
+            console.log(".");
+        };
 
 		// conf
 		(function() {
@@ -4661,6 +4740,12 @@
                         message: obj
                     };
                 }
+                
+                // dashboard
+                if (gis.dashboard) {
+                    gis.viewport.centerRegion.update('<div class="ns-plugin-alert">' + obj.message + '</div>');
+                    return;
+                }
 
                 // web message
                 type = (obj.status || 'INFO').toLowerCase();
@@ -4812,6 +4897,8 @@
 
                 // filters: [Dimension]
 
+                // program: object
+
                 // classes: integer (5) - 1-7
 
                 // method: integer (2) - 2, 3 // 2=equal intervals, 3=equal counts
@@ -4874,7 +4961,7 @@
                     }
 
                     if (!ouDim) {
-                        alert('No organisation units specified');
+                        gis.alert('No organisation units specified');
                         return;
                     }
 
@@ -4961,6 +5048,11 @@
                     layout.columns = config.columns;
                     layout.rows = config.rows;
                     layout.filters = config.filters;
+                    
+                    // program
+                    if (Ext.isObject(config.program) && config.program.id) {
+                        layout.program = config.program;
+                    }
 
                     // Properties
                     layout.layer = Ext.isString(config.layer) && !Ext.isEmpty(config.layer) ? config.layer : 'thematic1';
@@ -5052,12 +5144,12 @@
 					var headers = [];
 
 					if (!(config && Ext.isObject(config))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
 					if (!(config.headers && Ext.isArray(config.headers))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
@@ -5072,17 +5164,17 @@
 					config.headers = headers;
 
 					if (!config.headers.length) {
-						alert('No valid response headers', config);
+						gis.alert('No valid response headers', config);
 						return;
 					}
 
 					if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
-						alert('No values found', config);
+						gis.alert('No values found', config);
 						return false;
 					}
 
 					if (config.headers.length !== config.rows[0].length) {
-						alert('Data invalid', config);
+						gis.alert('Data invalid', config);
 						return false;
 					}
 
@@ -6652,7 +6744,10 @@
         boundary_layer: 'Boundary layer',
         facility_layer: 'Facility layer',
         thematic_layer: 'Thematic layer',
-        measure_distance: 'Measure distance'
+        measure_distance: 'Measure distance',
+        coordinates_could_not_be_loaded: 'Coordinates could not be loaded',
+        invalid_coordinates: 'Invalid coordinates',
+        no_valid_coordinates_found: 'No valid coordinates found'
     };
 
     GIS.plugin = {};
@@ -6853,7 +6948,7 @@
                     init.user.ou = ou;
                     init.user.ouc = ouc;
                 } else {
-                    alert('User is not assigned to any organisation units');
+                    gis.alert('User is not assigned to any organisation units');
                 }
 
                 fn();

=== 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-09-11 23:57:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-10-20 15:42:15 +0000
@@ -2518,9 +2518,14 @@
 			var views = gis.map.mapViews,
 				loader;
 
+            // title
+            if (gis.dashboard && gis.viewport.northRegion && gis.map && gis.map.name) {
+                gis.viewport.northRegion.update(gis.map.name);
+            }
+
 			if (!(Ext.isArray(views) && views.length)) {
 				gis.olmap.mask.hide();
-				alert(GIS.i18n.favorite_outdated_create_new);
+				gis.alert(GIS.i18n.favorite_outdated_create_new);
 				return;
 			}
 
@@ -2772,7 +2777,7 @@
                 }
 
                 if (!rows.length) {
-                    alert('No event coordinates found');
+                    gis.alert('No event coordinates found');
                     olmap.mask.hide();
                     return;
                 }
@@ -2781,16 +2786,28 @@
                 getOptionSets();
             };
 
-            gis.ajax({
-                url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
-                disableCaching: false,
-                failure: function(r) {
-                    gis.alert(r);
-                },
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+			if (Ext.isObject(GIS.app)) {
+				Ext.Ajax.request({
+					url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
+					disableCaching: false,
+					failure: function(r) {
+                        gis.alert(r);
+					},
+					success: function(r) {
+						success(Ext.decode(r.responseText));
+					}
+				});
+			}
+			else if (Ext.isObject(GIS.plugin)) {
+				Ext.data.JsonP.request({
+					url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.jsonp' + paramString,
+					disableCaching: false,
+					scope: this,
+					success: function(r) {
+						success(r);
+					}
+				});
+			}
 		};
 
 		loadLegend = function(view) {
@@ -2955,7 +2972,7 @@
 
 		loadOrganisationUnits = function(view) {
             var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -2974,7 +2991,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params + '&includeGroupSets=true';
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params + '&includeGroupSets=true';
                 }(),
                 success,
                 failure;
@@ -2986,13 +3003,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3003,16 +3020,27 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+            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) {
@@ -3030,7 +3058,8 @@
 		};
 
 		loadLegend = function(view) {
-            var type = 'json',
+            var isPlugin = GIS.plugin && !GIS.app,
+                type = isPlugin ? 'jsonp' : 'json',
                 url = gis.init.contextPath + '/api/organisationUnitGroupSets/' + view.organisationUnitGroupSet.id + '.' + type + '?fields=organisationUnitGroups[id,name,symbol]',
                 success;
 
@@ -3063,12 +3092,22 @@
                 afterLoad(view);
             };
 
-            gis.ajax({
-                url: url,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+            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) {
@@ -3218,7 +3257,7 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3237,7 +3276,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params;
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
                 }(),
                 success,
                 failure;
@@ -3252,13 +3291,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3298,19 +3337,30 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                },
-                failure: function() {
-                    failure();
-                }
-            });
+            if (isPlugin) {
+                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));
+                    },
+                    failure: function() {
+                        failure();
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -3570,7 +3620,7 @@
 
 		loadOrganisationUnits = function(view) {
 			var items = view.rows[0].items,
-                type = 'json',
+                isPlugin = GIS.plugin && !GIS.app,
                 url = function() {
                     var params = '?ou=ou:';
 
@@ -3589,7 +3639,7 @@
                         }
                     }
 
-                    return gis.init.contextPath + '/api/geoFeatures.' + type + params;
+                    return gis.init.contextPath + '/api/geoFeatures.' + (isPlugin ? 'jsonp' : 'json') + params;
                 }(),
                 success,
                 failure;
@@ -3601,13 +3651,13 @@
 
                 if (!Ext.isArray(features)) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.invalid_coordinates);
+                    gis.alert(GIS.i18n.invalid_coordinates);
                     return;
                 }
 
                 if (!features.length) {
                     olmap.mask.hide();
-                    alert(GIS.i18n.no_valid_coordinates_found);
+                    gis.alert(GIS.i18n.no_valid_coordinates_found);
                     return;
                 }
 
@@ -3618,19 +3668,30 @@
 
             failure = function() {
                 olmap.mask.hide();
-                alert(GIS.i18n.coordinates_could_not_be_loaded);
+                gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
             };
 
-            gis.ajax({
-                url: url,
-                disableCaching: false,
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                },
-                failure: function() {
-                    failure();
-                }
-            });
+            if (isPlugin) {
+                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));
+                    },
+                    failure: function() {
+                        failure();
+                    }
+                });
+            }
 		};
 
 		loadData = function(view, features) {
@@ -3644,8 +3705,7 @@
 				dxItems = view.columns[0].items,
 				isOperand = view.columns[0].dimension === dimConf.operand.objectName,
 				peItems = view.filters[0].items,
-				ouItems = view.rows[0].items,
-                type = 'json';
+				ouItems = view.rows[0].items;
 
 			// ou
 			paramString += 'dimension=ou:';
@@ -3663,6 +3723,11 @@
 				paramString += i < dxItems.length - 1 ? ';' : '';
 			}
 
+            // program
+            if (view.program) {
+                paramString += '&program=' + view.program.id;
+            }
+
 			paramString += isOperand ? '&dimension=co' : '';
 
 			// pe
@@ -3749,16 +3814,28 @@
 				loadLegend(view);
 			};
 
-            gis.ajax({
-                url: gis.init.contextPath + '/api/analytics.json' + paramString,
-                disableCaching: false,
-                failure: function(r) {
-                    gis.alert(r);
-                },
-                success: function(r) {
-                    success(Ext.decode(r.responseText));
-                }
-            });
+			if (Ext.isObject(GIS.app)) {
+				Ext.Ajax.request({
+					url: gis.init.contextPath + '/api/analytics.json' + paramString,
+					disableCaching: false,
+					failure: function(r) {
+                        gis.alert(r);
+					},
+					success: function(r) {
+						success(Ext.decode(r.responseText));
+					}
+				});
+			}
+			else if (Ext.isObject(GIS.plugin)) {
+				Ext.data.JsonP.request({
+					url: gis.init.contextPath + '/api/analytics.jsonp' + paramString,
+					disableCaching: false,
+					scope: this,
+					success: function(r) {
+						success(r);
+					}
+				});
+			}
 		};
 
 		loadLegend = function(view) {
@@ -3829,7 +3906,7 @@
             };
 
             loadLegendSet = function(view) {
-                gis.ajax({
+                Ext.Ajax.request({
 					url: gis.init.contextPath + '/api/legendSets/' + view.legendSet.id + '.json?fields=' + gis.conf.url.legendSetFields.join(','),
 					scope: this,
                     disableCaching: false,
@@ -3881,7 +3958,7 @@
                     return;
                 }
 
-                gis.ajax({
+                Ext.Ajax.request({
                     url: gis.init.contextPath + '/api/' + elementUrl + '.json?fields=legendSet[id,name]&paging=false&filter=id:eq:' + id,
                     success: function(r) {
                         var elements = Ext.decode(r.responseText)[elementUrl],
@@ -4036,7 +4113,9 @@
 			gis = {};
 
         // tmp
-        gis.alert = function() {};
+        gis.alert = function() {
+            console.log(".");
+        };
 
 		// conf
 		(function() {
@@ -4661,6 +4740,12 @@
                         message: obj
                     };
                 }
+                
+                // dashboard
+                if (gis.dashboard) {
+                    gis.viewport.centerRegion.update('<div class="ns-plugin-alert">' + obj.message + '</div>');
+                    return;
+                }
 
                 // web message
                 type = (obj.status || 'INFO').toLowerCase();
@@ -4812,6 +4897,8 @@
 
                 // filters: [Dimension]
 
+                // program: object
+
                 // classes: integer (5) - 1-7
 
                 // method: integer (2) - 2, 3 // 2=equal intervals, 3=equal counts
@@ -4874,7 +4961,7 @@
                     }
 
                     if (!ouDim) {
-                        alert('No organisation units specified');
+                        gis.alert('No organisation units specified');
                         return;
                     }
 
@@ -4961,6 +5048,11 @@
                     layout.columns = config.columns;
                     layout.rows = config.rows;
                     layout.filters = config.filters;
+                    
+                    // program
+                    if (Ext.isObject(config.program) && config.program.id) {
+                        layout.program = config.program;
+                    }
 
                     // Properties
                     layout.layer = Ext.isString(config.layer) && !Ext.isEmpty(config.layer) ? config.layer : 'thematic1';
@@ -5052,12 +5144,12 @@
 					var headers = [];
 
 					if (!(config && Ext.isObject(config))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
 					if (!(config.headers && Ext.isArray(config.headers))) {
-						alert('Data response invalid', config);
+						gis.alert('Data response invalid', config);
 						return false;
 					}
 
@@ -5072,17 +5164,17 @@
 					config.headers = headers;
 
 					if (!config.headers.length) {
-						alert('No valid response headers', config);
+						gis.alert('No valid response headers', config);
 						return;
 					}
 
 					if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
-						alert('No values found', config);
+						gis.alert('No values found', config);
 						return false;
 					}
 
 					if (config.headers.length !== config.rows[0].length) {
-						alert('Data invalid', config);
+						gis.alert('Data invalid', config);
 						return false;
 					}
 
@@ -6652,7 +6744,10 @@
         boundary_layer: 'Boundary layer',
         facility_layer: 'Facility layer',
         thematic_layer: 'Thematic layer',
-        measure_distance: 'Measure distance'
+        measure_distance: 'Measure distance',
+        coordinates_could_not_be_loaded: 'Coordinates could not be loaded',
+        invalid_coordinates: 'Invalid coordinates',
+        no_valid_coordinates_found: 'No valid coordinates found'
     };
 
     GIS.plugin = {};
@@ -6853,7 +6948,7 @@
                     init.user.ou = ou;
                     init.user.ouc = ouc;
                 } else {
-                    alert('User is not assigned to any organisation units');
+                    gis.alert('User is not assigned to any organisation units');
                 }
 
                 fn();