dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35520
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18180: Dashboard, alert issues fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18180 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-05 15:56:19 +0100
message:
Dashboard, alert issues fixed.
modified:
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js
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/table.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-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-02-05 12:55:33 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-02-05 14:55:06 +0000
@@ -794,12 +794,12 @@
return function() {
if (!Ext.isObject(config)) {
- console.log('Record: config is not an object: ' + config);
+ ns.alert('Record: config is not an object: ' + config, true);
return;
}
if (!Ext.isString(config.id)) {
- alert('Record: id is not text: ' + config);
+ ns.alert('Record: id is not text: ' + config, true);
return;
}
@@ -1008,19 +1008,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- web.message.alert(DV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ ns.alert(DV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter', true);
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- web.message.alert(DV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ ns.alert(DV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter', true);
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- web.message.alert(DV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ ns.alert(DV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter', true);
return;
}
}
@@ -1028,25 +1028,25 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- web.message.alert('Indicators and detailed data elements cannot be specified together');
+ ns.alert('Indicators and detailed data elements cannot be specified together', true);
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- web.message.alert('Detailed data elements and totals cannot be specified together');
+ ns.alert('Detailed data elements and totals cannot be specified together', true);
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- web.message.alert('Data sets and detailed data elements cannot be specified together');
+ ns.alert('Data sets and detailed data elements cannot be specified together', true);
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- web.message.alert('Categories and detailed data elements cannot be specified together');
+ ns.alert('Categories and detailed data elements cannot be specified together', true);
return;
}
@@ -1059,7 +1059,7 @@
// config must be an object
if (!(config && Ext.isObject(config))) {
- alert('Layout: config is not an object (' + init.el + ')');
+ ns.alert('Layout: config is not an object (' + init.el + ')', true);
return;
}
@@ -1069,12 +1069,12 @@
// at least one dimension specified as column and row
if (!config.columns) {
- alert('No series items selected');
+ ns.alert('No series items selected');
return;
}
if (!config.rows) {
- alert('No category items selected');
+ ns.alert('No category items selected');
return;
}
@@ -1089,7 +1089,7 @@
// at least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- alert('At least one period must be specified as series, category or filter');
+ ns.alert('At least one period must be specified as series, category or filter');
return;
}
@@ -2183,13 +2183,6 @@
}
};
- // message
- web.message = {};
-
- web.message.alert = function(message) {
- console.log(message);
- };
-
// analytics
web.analytics = {};
@@ -2262,7 +2255,7 @@
msg += '\n\n' + 'Hint: A good way to reduce the number of items is to use relative periods and level/group organisation unit selection modes.';
- alert(msg);
+ ns.alert(msg);
};
// chart
@@ -3866,7 +3859,7 @@
}
}
else {
- alert('User is not assigned to any organisation units');
+ ns.alert('User is not assigned to any organisation units');
}
fn();
@@ -4197,7 +4190,18 @@
init.skipMask = Ext.isBoolean(config.skipMask) ? config.skipMask : false;
init.skipFade = Ext.isBoolean(config.skipFade) ? config.skipFade : false;
- // alert
+ // alerts
+ ns.alert = function(text, isLog) {
+ if (isLog) {
+ console.log(text);
+ }
+ else {
+ if (text) {
+ alert(text);
+ }
+ }
+ };
+
init.alert = function(text) {
var div = Ext.get(config.el);
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js 2015-02-05 12:55:33 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js 2015-02-05 14:55:06 +0000
@@ -773,12 +773,12 @@
return function() {
if (!Ext.isObject(config)) {
- console.log('Record: config is not an object: ' + config);
+ ns.alert('Record: config is not an object: ' + config, true);
return;
}
if (!Ext.isString(config.id)) {
- alert('Record: id is not text: ' + config);
+ ns.alert('Record: id is not text: ' + config, true);
return;
}
@@ -952,19 +952,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- web.message.alert(EV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ ns.alert(EV.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter', true);
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- web.message.alert(EV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ ns.alert(EV.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter', true);
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- web.message.alert(EV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ ns.alert(EV.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter', true);
return;
}
}
@@ -972,25 +972,25 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- web.message.alert('Indicators and detailed data elements cannot be specified together');
+ ns.alert('Indicators and detailed data elements cannot be specified together', true);
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- web.message.alert('Detailed data elements and totals cannot be specified together');
+ ns.alert('Detailed data elements and totals cannot be specified together', true);
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- web.message.alert('Data sets and detailed data elements cannot be specified together');
+ ns.alert('Data sets and detailed data elements cannot be specified together', true);
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- web.message.alert('Categories and detailed data elements cannot be specified together');
+ ns.alert('Categories and detailed data elements cannot be specified together', true);
return;
}
@@ -1018,7 +1018,7 @@
// period
if (!Ext.Array.contains(objectNames, 'pe') && !(config.startDate && config.endDate)) {
- alert('At least one fixed period, one relative period or start/end dates must be specified');
+ ns.alert('At least one fixed period, one relative period or start/end dates must be specified');
return;
}
@@ -1028,7 +1028,7 @@
// column
if (!config.columns) {
- alert('No series items selected');
+ ns.alert('No series items selected');
return;
}
@@ -1040,7 +1040,7 @@
// row
if (!config.rows) {
- alert('No category items selected');
+ ns.alert('No category items selected');
return;
}
@@ -2489,13 +2489,6 @@
}
};
- // message
- web.message = {};
-
- web.message.alert = function(message) {
- console.log(message);
- };
-
// analytics
web.analytics = {};
@@ -2581,7 +2574,7 @@
msg += '\n\n' + 'Hint: A good way to reduce the number of items is to use relative periods and level/group organisation unit selection modes.';
- alert(msg);
+ ns.alert(msg);
};
// report
@@ -4433,7 +4426,7 @@
init.user.ouc = ouc;
}
else {
- alert('User is not assigned to any organisation units');
+ ns.alert('User is not assigned to any organisation units');
}
fn();
@@ -4817,7 +4810,18 @@
init.skipMask = Ext.isBoolean(config.skipMask) ? config.skipMask : false;
init.skipFade = Ext.isBoolean(config.skipFade) ? config.skipFade : false;
- // alert
+ // alerts
+ ns.alert = function(text, isLog) {
+ if (isLog) {
+ console.log(text);
+ }
+ else {
+ if (text) {
+ alert(text);
+ }
+ }
+ };
+
init.alert = function(text) {
var div = Ext.get(config.el);
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-02-05 12:34:16 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-02-05 14:55:06 +0000
@@ -237,12 +237,12 @@
return function() {
if (!Ext.isObject(config)) {
- console.log('Record: config is not an object: ' + config);
+ ns.alert('Record: config is not an object: ' + config, true);
return;
}
if (!Ext.isString(config.id)) {
- alert('Record: id is not text: ' + config);
+ ns.alert('Record: id is not text: ' + config, true);
return;
}
@@ -384,21 +384,21 @@
if (layout.filters && layout.filters.length) {
for (var i = 0; i < layout.filters.length; i++) {
- // Indicators as filter
+ // indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- web.message.alert(ER.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ ns.alert(ER.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter', true);
return;
}
- // Categories as filter
+ // categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- web.message.alert(ER.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ ns.alert(ER.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter', true);
return;
}
- // Data sets as filter
+ // data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- web.message.alert(ER.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ ns.alert(ER.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter', true);
return;
}
}
@@ -406,25 +406,25 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- web.message.alert('Indicators and detailed data elements cannot be specified together');
+ ns.alert('Indicators and detailed data elements cannot be specified together', true);
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- web.message.alert('Detailed data elements and totals cannot be specified together');
+ ns.alert('Detailed data elements and totals cannot be specified together', true);
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- web.message.alert('Data sets and detailed data elements cannot be specified together');
+ ns.alert('Data sets and detailed data elements cannot be specified together', true);
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- web.message.alert('Categories and detailed data elements cannot be specified together');
+ ns.alert('Categories and detailed data elements cannot be specified together', true);
return;
}
@@ -437,7 +437,7 @@
// config must be an object
if (!(config && Ext.isObject(config))) {
- alert('Layout: config is not an object (' + init.el + ')');
+ ns.alert('Layout: config is not an object (' + init.el + ')', true);
return;
}
@@ -447,7 +447,7 @@
// at least one dimension specified as column or row
if (!(config.columns || config.rows)) {
- alert(ER.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
+ ns.alert(ER.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
return;
}
@@ -462,7 +462,7 @@
// at least one period
//if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- //alert(ER.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
+ //ns.alert(ER.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
//return;
//}
@@ -1979,13 +1979,6 @@
}
};
- // message
- web.message = {};
-
- web.message.alert = function(message) {
- console.log(message);
- };
-
// analytics
web.analytics = {};
@@ -2105,7 +2098,7 @@
msg += '\n\n' + 'Hint: A good way to reduce the number of items is to use relative periods and level/group organisation unit selection modes.';
- alert(msg);
+ ns.alert(msg);
};
// report
@@ -3297,7 +3290,7 @@
init.user.ouc = ouc;
}
else {
- alert('User is not assigned to any organisation units');
+ ns.alert('User is not assigned to any organisation units');
}
fn();
@@ -3685,7 +3678,7 @@
table = getHtml(xLayout, xResponse);
if (table.tdCount > 20000 || (layout.hideEmptyRows && table.tdCount > 10000)) {
- alert('Table has too many cells. Please reduce the table and try again.');
+ ns.alert('Table has too many cells. Please reduce the table and try again.');
if (!ns.skipMask) {
web.mask.hide(ns.app.centerRegion);
@@ -3874,7 +3867,18 @@
init.skipMask = Ext.isBoolean(config.skipMask) ? config.skipMask : false;
init.skipFade = Ext.isBoolean(config.skipFade) ? config.skipFade : false;
- // alert
+ // alerts
+ ns.alert = function(text, isLog) {
+ if (isLog) {
+ console.log(text);
+ }
+ else {
+ if (text) {
+ alert(text);
+ }
+ }
+ };
+
init.alert = function(text) {
var div = Ext.get(config.el);
=== 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-01-30 13:13:31 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js 2015-02-05 14:55:06 +0000
@@ -2495,10 +2495,12 @@
}
if (Ext.Array.contains([403], r.status)) {
- alert(GIS.i18n.you_do_not_have_access_to_all_items_in_this_favorite);
+ gis.alert(GIS.i18n.you_do_not_have_access_to_all_items_in_this_favorite);
}
else {
- alert(r.status + '\n' + r.statusText + '\n' + r.responseText);
+ if (r.status && r.statusText && r.responseText) {
+ gis.alert(r.status + '\n' + r.statusText + '\n' + r.responseText);
+ }
}
};
@@ -2522,7 +2524,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.favorite_outdated_create_new);
+ gis.alert(GIS.i18n.favorite_outdated_create_new);
return;
}
@@ -2705,7 +2707,7 @@
}
if (!rows.length) {
- alert('No event coordinates found');
+ gis.alert('No event coordinates found');
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
@@ -2756,7 +2758,9 @@
url: gis.init.contextPath + '/api/analytics/events/query/' + view.program.id + '.json' + paramString,
disableCaching: false,
failure: function(r) {
- alert(r.status + '\n' + r.statusText + '\n' + r.responseText);
+ if (r.status && r.statusText && r.responseText) {
+ gis.alert(r.status + '\n' + r.statusText + '\n' + r.responseText);
+ }
},
success: function(r) {
success(Ext.decode(r.responseText));
@@ -2960,7 +2964,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.invalid_coordinates);
+ gis.alert(GIS.i18n.invalid_coordinates);
return;
}
@@ -2968,7 +2972,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.no_valid_coordinates_found);
+ gis.alert(GIS.i18n.no_valid_coordinates_found);
return;
}
@@ -2981,7 +2985,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.coordinates_could_not_be_loaded);
+ gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
if (isJsonp) {
@@ -3246,7 +3250,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.invalid_coordinates);
+ gis.alert(GIS.i18n.invalid_coordinates);
return;
}
@@ -3254,7 +3258,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.no_valid_coordinates_found);
+ gis.alert(GIS.i18n.no_valid_coordinates_found);
return;
}
@@ -3296,7 +3300,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.coordinates_could_not_be_loaded);
+ gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
if (isJsonp) {
@@ -3474,7 +3478,8 @@
}
return gis.conf.finals.widget.loadtype_organisationunit;
}
- } else {
+ }
+ else {
if (doExecute) {
loadOrganisationUnits(view);
}
@@ -3504,7 +3509,8 @@
}
return gis.conf.finals.widget.loadtype_organisationunit;
}
- } else {
+ }
+ else {
if (doExecute) {
loadData(view);
}
@@ -3532,7 +3538,8 @@
}
return gis.conf.finals.widget.loadtype_organisationunit;
}
- } else {
+ }
+ else {
if (doExecute) {
loadData(view);
}
@@ -3595,7 +3602,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.invalid_coordinates);
+ gis.alert(GIS.i18n.invalid_coordinates);
return;
}
@@ -3603,7 +3610,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.no_valid_coordinates_found);
+ gis.alert(GIS.i18n.no_valid_coordinates_found);
return;
}
@@ -3616,7 +3623,7 @@
if (gis.olmap.mask && !gis.skipMask) {
gis.olmap.mask.hide();
}
- alert(GIS.i18n.coordinates_could_not_be_loaded);
+ gis.alert(GIS.i18n.coordinates_could_not_be_loaded);
};
if (isJsonp) {
@@ -3754,12 +3761,15 @@
success(r);
}
});
- } else {
+ }
+ else {
Ext.Ajax.request({
url: gis.init.contextPath + '/api/analytics.json' + paramString,
disableCaching: false,
failure: function(r) {
- alert(r.status + '\n' + r.statusText + '\n' + r.responseText);
+ if (r.status && r.statusText && r.responseText) {
+ gis.alert(r.status + '\n' + r.statusText + '\n' + r.responseText);
+ }
},
success: function(r) {
success(Ext.decode(r.responseText));
@@ -4823,7 +4833,7 @@
}
if (!ouDim) {
- alert('No organisation units specified');
+ gis.alert('No organisation units specified');
return;
}
@@ -4985,12 +4995,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;
}
@@ -5005,7 +5015,7 @@
config.headers = headers;
if (!config.headers.length) {
- alert('No valid response headers', config);
+ gis.alert('No valid response headers', config);
return;
}
@@ -5015,7 +5025,7 @@
}
if (config.headers.length !== config.rows[0].length) {
- alert('Data invalid', config);
+ gis.alert('Data invalid', config);
return false;
}
@@ -6782,7 +6792,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();
@@ -6997,11 +7007,14 @@
createViewport,
afterRender,
initialize,
- gis;
+ gis = {
+ core: {},
+ app: {}
+ };
validateConfig = function() {
if (!Ext.isString(config.url)) {
- alert('Invalid url (' + config.el + ')');
+ gis.alert('Invalid url (' + config.el + ')');
return;
}
@@ -7010,14 +7023,14 @@
}
if (!Ext.isString(config.el)) {
- alert('Invalid html element id (' + config.el + ')');
+ gis.alert('Invalid html element id (' + config.el + ')');
return;
}
config.id = config.id || config.uid;
if (config.id && !Ext.isString(config.id)) {
- alert('Invalid map id (' + config.el + ')');
+ gis.alert('Invalid map id (' + config.el + ')');
return;
}
@@ -7183,15 +7196,18 @@
viewport.eastRegion = eastRegion;
viewport.centerRegion.trash = trash;
- viewport.centerRegion.getEl().on('mouseleave', function() {
- for (var i = 0, cmp; i < trash.length; i++) {
- cmp = viewport.centerRegion.trash[i];
-
- if (cmp && cmp.destroy) {
- cmp.destroy();
+
+ if (viewport.centerRegion.getEl()) {
+ viewport.centerRegion.getEl().on('mouseleave', function() {
+ for (var i = 0, cmp; i < trash.length; i++) {
+ cmp = viewport.centerRegion.trash[i];
+
+ if (cmp && cmp.destroy) {
+ cmp.destroy();
+ }
}
- }
- });
+ });
+ }
return viewport;
};
@@ -7253,13 +7269,22 @@
init.skipMask = Ext.isBoolean(config.skipMask) ? config.skipMask : false;
init.skipFade = Ext.isBoolean(config.skipFade) ? config.skipFade : false;
- // alert
- //init.alert = function(text) {
- //Ext.get(config.el).setStyle('opacity', 1);
- //Ext.get(config.el).update('<div class="ns-plugin-alert">' + text + '</div>');
- //};
-
+ // instance
gis = GIS.core.getInstance(init);
+
+ // alerts
+ gis.alert = function(text, isLog) {
+ if (isLog) {
+ console.log(text);
+ }
+ else {
+ if (text) {
+ alert(text);
+ }
+ }
+ };
+
+ // extend instance
extendInstance(gis);
// google maps
@@ -7337,9 +7362,11 @@
};
}
- gis.olmap.mask = Ext.create('Ext.LoadMask', gis.viewport.centerRegion.getEl(), {
- msg: 'Loading'
- });
+ if (gis.viewport.centerRegion.getEl()) {
+ gis.olmap.mask = Ext.create('Ext.LoadMask', gis.viewport.centerRegion.getEl(), {
+ msg: 'Loading'
+ });
+ }
GIS.core.MapLoader(gis).load();
}();
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-02-05 12:34:16 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-02-05 14:55:06 +0000
@@ -247,12 +247,12 @@
return function() {
if (!Ext.isObject(config)) {
- console.log('Record: config is not an object: ' + config);
+ ns.alert('Record: config is not an object: ' + config, true);
return;
}
if (!Ext.isString(config.id)) {
- alert('Record: id is not text: ' + config);
+ ns.alert('Record: id is not text: ' + config, true);
return;
}
@@ -393,19 +393,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- web.message.alert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ ns.alert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter', true);
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- web.message.alert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ ns.alert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter', true);
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- web.message.alert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ ns.alert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter', true);
return;
}
}
@@ -413,25 +413,25 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- web.message.alert('Indicators and detailed data elements cannot be specified together');
+ ns.alert('Indicators and detailed data elements cannot be specified together', true);
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- web.message.alert('Detailed data elements and totals cannot be specified together');
+ ns.alert('Detailed data elements and totals cannot be specified together', true);
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- web.message.alert('Data sets and detailed data elements cannot be specified together');
+ ns.alert('Data sets and detailed data elements cannot be specified together', true);
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- web.message.alert('Assigned categories and detailed data elements cannot be specified together');
+ ns.alert('Assigned categories and detailed data elements cannot be specified together', true);
return;
}
@@ -444,7 +444,7 @@
// config must be an object
if (!(config && Ext.isObject(config))) {
- alert('Layout: config is not an object (' + init.el + ')');
+ ns.alert('Layout: config is not an object (' + init.el + ')', true);
return;
}
@@ -454,7 +454,7 @@
// at least one dimension specified as column or row
if (!(config.columns || config.rows)) {
- alert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
+ ns.alert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
return;
}
@@ -469,7 +469,7 @@
// at least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- alert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
+ ns.alert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
return;
}
@@ -1900,13 +1900,6 @@
}
};
- // message
- web.message = {};
-
- web.message.alert = function(message) {
- console.log(message);
- };
-
// analytics
web.analytics = {};
@@ -1996,7 +1989,7 @@
msg += '\n\n' + 'Hint: A good way to reduce the number of items is to use relative periods and level/group organisation unit selection modes.';
- alert(msg);
+ ns.alert(msg);
};
// pivot
@@ -2994,7 +2987,7 @@
init.user.ouc = ouc;
}
else {
- alert('User is not assigned to any organisation units');
+ ns.alert('User is not assigned to any organisation units');
}
fn();
@@ -3442,7 +3435,18 @@
init.skipMask = Ext.isBoolean(config.skipMask) ? config.skipMask : false;
init.skipFade = Ext.isBoolean(config.skipFade) ? config.skipFade : false;
- // alert
+ // alerts
+ ns.alert = function(text, isLog) {
+ if (isLog) {
+ console.log(text);
+ }
+ else {
+ if (text) {
+ alert(text);
+ }
+ }
+ };
+
init.alert = function(text) {
var div = Ext.get(config.el);