=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-05-11 18:21:51 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-05-13 02:27:31 +0000 @@ -7306,7 +7306,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: NS.i18n.no_values_found_for_current_selection + '.' }); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-05-11 19:30:52 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-05-13 02:27:31 +0000 @@ -6891,7 +6891,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: NS.i18n.no_values_found_for_current_selection + '.' }); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js 2015-05-13 02:00:49 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/eventchart.js 2015-05-13 02:27:31 +0000 @@ -5204,7 +5204,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: 'No values found for the current selection.' }); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2015-05-13 02:00:49 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/app.js 2015-05-13 02:27:31 +0000 @@ -2538,7 +2538,7 @@ ns.app.centerRegion.update(); ns.app.centerRegion.removeAll(); ns.app.centerRegion.add(response.rows.length ? ns.app.chart : { - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: NS.i18n.no_values_found_for_current_selection + '.' }); === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-05-13 02:19:56 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/scripts/chart.js 2015-05-13 02:27:31 +0000 @@ -4358,7 +4358,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: 'No values found for the current selection.' }); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2015-05-13 02:19:56 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/chart.js 2015-05-13 02:28:47 +0000 @@ -4306,7 +4306,7 @@ chart; success = function() { - + ns.app.layout = layout; ns.app.xLayout = xLayout; ns.app.response = response; @@ -4358,7 +4358,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: 'No values found for the current selection.' }); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js 2015-05-13 02:00:49 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventchart.js 2015-05-13 02:28:47 +0000 @@ -3672,7 +3672,7 @@ return getFormatedSeriesTitle(a); }; - + getPieSeriesTitle = function(store) { var a = [], md = xResponse.metaData, @@ -5156,7 +5156,7 @@ console.log("app", ns.app); } }; - + getReport = function() { if (!xLayout && !ns.skipMask) { web.mask.hide(ns.app.centerRegion); @@ -5204,7 +5204,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: 'No values found for the current selection.' }); === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js 2015-05-11 18:26:23 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/eventreport.js 2015-05-13 02:28:47 +0000 @@ -4208,7 +4208,7 @@ }; if (!response.rows.length) { - ns.app.centerRegion.update('
No values found for the current selection.
'); + ns.app.centerRegion.update('
No values found for the current selection.
'); web.mask.hide(ns.app.centerRegion); === 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-04-29 18:07:15 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/map.js 2015-05-13 02:28:47 +0000 @@ -1470,7 +1470,12 @@ styleEl = document.createElement("style"); styleEl.setAttribute("type", "text/css"); - + var ss, + head = document.getElementsByTagName("head")[0], + styleEl = document.createElement("style"); + + styleEl.setAttribute("type", "text/css"); + if (id) { styleEl.setAttribute("id", id); } @@ -1608,10 +1613,10 @@ show: function() { var el = this.getEl(), legendEl = el.first().first(), - xy = Ext.get(olmap.buttonControls[0].div).getAnchorXY(); + xy = Ext.get(olmap.buttonControls[0].div).getAnchorXY(); el.setStyle('opacity', 0.92); - + this.setHeight(legendEl.getHeight() + 8 + 9); this.setPosition(xy[0] - this.getWidth(), xy[1] - 1); @@ -2528,10 +2533,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); + } } }; @@ -2555,7 +2562,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; } @@ -2738,7 +2745,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(); } @@ -2789,7 +2796,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)); @@ -2993,7 +3002,7 @@ if (gis.olmap.mask && !gis.skipMask) { gis.olmap.mask.hide(); } - alert(GIS.i18n.invalid_coordinates); + gis.alert(GIS.i18n.invalid_coordinates); return; } @@ -3001,7 +3010,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; } @@ -3014,7 +3023,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) { @@ -3279,7 +3288,7 @@ if (gis.olmap.mask && !gis.skipMask) { gis.olmap.mask.hide(); } - alert(GIS.i18n.invalid_coordinates); + gis.alert(GIS.i18n.invalid_coordinates); return; } @@ -3287,7 +3296,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; } @@ -3329,7 +3338,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) { @@ -3507,7 +3516,8 @@ } return gis.conf.finals.widget.loadtype_organisationunit; } - } else { + } + else { if (doExecute) { loadOrganisationUnits(view); } @@ -3537,7 +3547,8 @@ } return gis.conf.finals.widget.loadtype_organisationunit; } - } else { + } + else { if (doExecute) { loadData(view); } @@ -3565,7 +3576,8 @@ } return gis.conf.finals.widget.loadtype_organisationunit; } - } else { + } + else { if (doExecute) { loadData(view); } @@ -3628,7 +3640,7 @@ if (gis.olmap.mask && !gis.skipMask) { gis.olmap.mask.hide(); } - alert(GIS.i18n.invalid_coordinates); + gis.alert(GIS.i18n.invalid_coordinates); return; } @@ -3636,7 +3648,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; } @@ -3649,7 +3661,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) { @@ -3787,12 +3799,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)); @@ -4856,7 +4871,7 @@ } if (!ouDim) { - alert('No organisation units specified'); + gis.alert('No organisation units specified'); return; } @@ -5018,12 +5033,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; } @@ -5038,7 +5053,7 @@ config.headers = headers; if (!config.headers.length) { - alert('No valid response headers', config); + gis.alert('No valid response headers', config); return; } @@ -5048,7 +5063,7 @@ } if (config.headers.length !== config.rows[0].length) { - alert('Data invalid', config); + gis.alert('Data invalid', config); return false; } @@ -6820,7 +6835,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(); @@ -7035,11 +7050,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; } @@ -7048,14 +7066,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; } @@ -7102,6 +7120,8 @@ centerRegion, eastRegion, el = Ext.get(gis.el), + elWidth = el ? el.getWidth() : 0, + elHeight = el ? el.getHeight() : 0, eastWidth = gis.map.hideLegend ? 0 : (gis.plugin ? 120 : 200), trash = []; @@ -7109,7 +7129,7 @@ if (gis.dashboard) { items.push(northRegion = Ext.create('Ext.panel.Panel', { region: 'north', - width: el.getWidth(), + width: elWidth, height: 19, bodyStyle: 'background-color: #fff; border: 0 none; font: bold 12px LiberationSans, arial, sans-serif; color: #333; text-align: center; line-height: 14px; letter-spacing: -0.1px', html: '' @@ -7121,7 +7141,7 @@ region: 'center', map: gis.olmap, bodyStyle: 'border: 1px solid #d0d0d0', - width: el.getWidth() - eastWidth + width: elWidth - eastWidth })); // east @@ -7201,8 +7221,8 @@ viewport = Ext.create('Ext.panel.Panel', { renderTo: el, - width: el.getWidth(), - height: el.getHeight(), + width: elWidth, + height: elHeight, cls: 'gis-plugin', layout: 'border', bodyStyle: 'border: 0 none', @@ -7219,15 +7239,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; }; @@ -7263,9 +7286,11 @@ if (!base || base === 'none' || base === 'off') { gis.layer.googleStreets.setVisibility(false); - } else if (base === 'gh' || base === 'googlehybrid') { + } + else if (base === 'gh' || base === 'googlehybrid') { gis.olmap.setBaseLayer(gis.layer.googleHybrid); - } else if (base === 'osm' || base === 'openstreetmap') { + } + else if (base === 'osm' || base === 'openstreetmap') { gis.olmap.setBaseLayer(gis.layer.openStreetMap); } } @@ -7289,13 +7314,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('
' + text + '
'); - //}; - + // 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 @@ -7373,9 +7407,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/chart.js' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-05-13 02:19:56 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-05-13 02:27:31 +0000 @@ -4306,7 +4306,7 @@ chart; success = function() { - + ns.app.layout = layout; ns.app.xLayout = xLayout; ns.app.response = response; @@ -4358,7 +4358,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: 'No values found for the current selection.' }); === 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-05-13 02:00:49 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js 2015-05-13 02:27:31 +0000 @@ -3672,7 +3672,7 @@ return getFormatedSeriesTitle(a); }; - + getPieSeriesTitle = function(store) { var a = [], md = xResponse.metaData, @@ -5156,7 +5156,7 @@ console.log("app", ns.app); } }; - + getReport = function() { if (!xLayout && !ns.skipMask) { web.mask.hide(ns.app.centerRegion); @@ -5204,7 +5204,7 @@ ns.app.centerRegion.removeAll(true); ns.app.centerRegion.update(''); ns.app.centerRegion.add({ - bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555', + bodyStyle: 'padding:20px; border:0 none; background:transparent; color: #555; font-size:11px', html: 'No values found for the current selection.' }); === 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-05-11 18:26:23 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-05-13 02:27:31 +0000 @@ -4208,7 +4208,7 @@ }; if (!response.rows.length) { - ns.app.centerRegion.update('
No values found for the current selection.
'); + ns.app.centerRegion.update('
No values found for the current selection.
'); web.mask.hide(ns.app.centerRegion);