dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35086
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18008: Dashboard, agg/ind event reports implemented, 'no value' notifications, style fixes.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18008 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-01-15 23:37:17 +0100
message:
Dashboard, agg/ind event reports implemented, 'no value' notifications, style fixes.
modified:
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js
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/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-01-15 14:28:32 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-01-15 22:09:04 +0000
@@ -130,7 +130,7 @@
"<li id='li-${itemId}' class='liItem'><div class='item' id='${itemId}' style='${style}'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>${i18n_remove}</a>" +
"<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"reportTable\", \"${name}\" )'>${i18n_share}</a>" +
"<a href='javascript:dhis2.db.exploreEventReport( \"${id}\" )'>${i18n_explore}</a>" +
- "<a href='javascript:dhis2.db.resizeItem( \"${itemId}\" )'>${i18n_resize}</a>" +
+ "<a href='javascript:dhis2.db.resizeItem( \"${itemId}\", true )'>${i18n_resize}</a>" +
"<i class=\"fa fa-arrows dragIcon\" title=\"${i18n_click_and_drag_to_new_position}\"></i></div>" +
"<div id='plugin-${itemId}'></div>" +
"</div></li>"
@@ -610,8 +610,6 @@
url: '..',
el: 'plugin-' + dashboardItem.id,
id: dashboardItem.map.id,
- width: width,
- height: 290,
hideLegend: true,
dashboard: true,
crossDomain: false,
@@ -627,8 +625,6 @@
url: '..',
el: 'plugin-' + dashboardItem.id,
id: dashboardItem.reportTable.id,
- width: width,
- height: 290,
dashboard: true,
crossDomain: false,
skipMask: true,
@@ -645,8 +641,6 @@
url: '..',
el: 'plugin-' + dashboardItem.id,
id: dashboardItem.eventReport.id,
- width: width - scrollbarWidth,
- height: 290,
dashboard: true,
crossDomain: false,
skipMask: true,
=== 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-01-14 12:56:58 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js 2015-01-15 16:49:39 +0000
@@ -1089,12 +1089,10 @@
console.log('Response: no valid headers');
return;
}
-
+
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- if (!DV.plugin) {
- alert('No values found');
- }
- return;
+ init.alert('No values found');
+ return;
}
if (config.headers.length !== config.rows[0].length) {
@@ -3699,6 +3697,9 @@
css += '.x-mask-msg .x-mask-loading { border: 0 none; \n background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';
css += '.x-mask { opacity: 0; } \n';
+ // alert
+ css += '.ns-plugin-alert { width: 90%; padding: 5%; color: #777 } \n';
+
Ext.util.CSS.createStyleSheet(css);
};
@@ -3941,14 +3942,23 @@
return;
}
+ // css
applyCss();
+ // config
init.plugin = true;
init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
init.crossDomain = Ext.isBoolean(config.crossDomain) ? config.crossDomain : true;
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>');
+ };
+
+ // init
ns.core = DV.getCore(Ext.clone(init));
extendInstance(ns);
=== 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-01-14 14:56:08 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js 2015-01-15 22:34:01 +0000
@@ -407,7 +407,6 @@
EV.isDebug = false;
EV.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- // core
EV.getCore = function(init) {
var conf = {},
api = {},
@@ -1056,9 +1055,9 @@
console.log('Response: no valid headers');
return;
}
-
+
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- alert('No values found');
+ init.alert('No values found');
return;
}
@@ -3932,7 +3931,12 @@
// PLUGIN
- // chart tips css
+ // i18n
+ EV.i18n = {
+ target: 'Target',
+ base: 'Base',
+ trend: 'Trend'
+ };
EV.plugin = {};
@@ -3950,14 +3954,14 @@
getInit = function(config) {
var isInit = false,
requests = [],
- callbacks = 0,
+ callbackCount = 0,
type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
fn;
init.contextPath = config.url;
fn = function() {
- if (++callbacks === requests.length) {
+ if (++callbackCount === requests.length) {
isInitComplete = true;
for (var i = 0; i < configs.length; i++) {
@@ -4181,6 +4185,9 @@
css += '.x-mask-msg .x-mask-loading { border: 0 none; \n background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';
css += '.x-mask { opacity: 0; } \n';
+ // alert
+ css += '.ns-plugin-alert { width: 90%; padding: 5%; color: #777 } \n';
+
Ext.util.CSS.createStyleSheet(css);
};
@@ -4491,14 +4498,23 @@
return;
}
+ // css
applyCss();
+ // config
init.plugin = true;
init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
init.crossDomain = Ext.isBoolean(config.crossDomain) ? config.crossDomain : true;
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>');
+ };
+
+ // init
ns.core = EV.getCore(Ext.clone(init));
extendInstance(ns);
=== 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-01-14 16:57:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js 2015-01-15 22:34:01 +0000
@@ -173,14 +173,18 @@
'space': ' '
},
displayDensity: {
- 'compact': '3px',
- 'normal': '5px',
- 'comfortable': '10px',
+ 'xcompact': '2px',
+ 'compact': '4px',
+ 'normal': '6px',
+ 'comfortable': '8px',
+ 'xcomfortable': '10px'
},
fontSize: {
+ 'xsmall': '9px',
'small': '10px',
'normal': '11px',
- 'large': '13px'
+ 'large': '12px',
+ 'xlarge': '14px'
}
};
@@ -290,7 +294,7 @@
}();
};
- api.layout.Layout = function(config) {
+ api.layout.Layout = function(config, applyConfig) {
var config = Ext.clone(config),
layout = {},
getValidatedDimensionArray,
@@ -520,7 +524,7 @@
return;
}
- return Ext.apply(layout, applyConfig);
+ return Ext.apply(layout, applyConfig);
}();
};
@@ -581,7 +585,7 @@
}
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- alert('No values found');
+ init.alert('No values found');
return;
}
@@ -2972,9 +2976,14 @@
rows = xResponse.rows,
names = xResponse.metaData.names,
optionNames = xResponse.metaData.optionNames,
- pager = xResponse.metaData.pager,
+ pager = xResponse.metaData.pager || {
+ page: 1,
+ pageSize: 50
+ },
count = pager.page * pager.pageSize - pager.pageSize
tableCls = 'pivot',
+ fontSize = conf.report.fontSize[layout.fontSize],
+ displayDensity = conf.report.displayDensity[layout.displayDensity],
html = '';
xResponse.sortableIdObjects = [];
@@ -2983,14 +2992,14 @@
tableCls += layout.fontSize ? ' ' + layout.fontSize : '';
html += '<table class="' + tableCls + '"><tr>';
- html += '<td class="pivot-dim pivot-dim-subtotal">' + '#' + '</td>';
+ html += '<td class="pivot-dim pivot-dim-subtotal" style="font-size:' + fontSize + '; padding:' + displayDensity + '">' + '#' + '</td>';
// get header indexes
for (var i = 0, header, uuid; i < dimensionHeaders.length; i++) {
header = dimensionHeaders[i];
uuid = Ext.data.IdGenerator.get('uuid').generate();
- html += '<td id="' + uuid + '" class="pivot-dim td-sortable">' + header.column + '</td>';
+ html += '<td id="' + uuid + '" class="pivot-dim td-sortable" style="font-size:' + fontSize + '; padding:' + displayDensity + '">' + header.column + '</td>';
xResponse.sortableIdObjects.push({
id: header.name,
@@ -3004,7 +3013,7 @@
for (var i = 0, row; i < rows.length; i++) {
row = rows[i];
html += '<tr>';
- html += '<td class="pivot-value align-right">' + (count + (i + 1)) + '</td>';
+ html += '<td class="pivot-value align-right" style="font-size:' + fontSize + '; padding:' + displayDensity + '">' + (count + (i + 1)) + '</td>';
for (var j = 0, str, header, name; j < dimensionHeaders.length; j++) {
header = dimensionHeaders[j];
@@ -3024,7 +3033,7 @@
//}
//}
- html += '<td class="pivot-value align-left">' + name + '</td>';
+ html += '<td class="pivot-value align-left" style="font-size:' + fontSize + '; padding:' + displayDensity + '">' + name + '</td>';
}
html += '</tr>';
@@ -3094,13 +3103,14 @@
applyCss,
execute;
- getInit = function(contextPath) {
+ getInit = function(config) {
var isInit = false,
requests = [],
callbackCount = 0,
+ type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
fn;
- init.contextPath = contextPath;
+ init.contextPath = config.url;
fn = function() {
if (++callbackCount === requests.length) {
@@ -3154,9 +3164,9 @@
init.namePropertyUrl = namePropertyUrl;
// dhis2
- dhis2.util.namespace('dhis2.ev');
+ dhis2.util.namespace('dhis2.er');
- dhis2.ev.store = dhis2.ev.store || new dhis2.storage.Store({
+ dhis2.er.store = dhis2.er.store || new dhis2.storage.Store({
name: 'dhis2',
adapters: [dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter],
objectStores: ['optionSets']
@@ -3167,7 +3177,7 @@
disableCashing: false,
success: function(r) {
var optionSets = (r.responseText ? Ext.decode(r.responseText).optionSets : r.optionSets) || [],
- store = dhis2.ev.store,
+ store = dhis2.er.store,
ids = [],
url = '',
callbacks = 0,
@@ -3325,9 +3335,9 @@
css += '.td-hidden { display: none; } \n';
css += '.td-collapsed { display: none; } \n';
css += 'table.pivot { border-collapse: collapse; border-spacing: 0px; border: 0 none; } \n';
- css += '.pivot td { padding: 5px; border: \n 1px solid #b2b2b2; } \n';
+ css += '.pivot td { font-family: arial, sans-serif, helvetica neue, helvetica !important; padding: 5px; border: 1px solid #b2b2b2; } \n';
css += '.pivot-dim { background-color: #dae6f8; text-align: center; } \n';
- css += '.pivot-dim.highlighted { background-color: #c5d8f6; } \n';
+ css += '.pivot-dim.highlighted { background-color: #c5d8f6; } \n';
css += '.pivot-dim-subtotal { background-color: #cad6e8; text-align: center; } \n';
css += '.pivot-dim-total { background-color: #bac6d8; text-align: center; } \n';
css += '.pivot-dim-total.highlighted { background-color: #adb8c9; } \n';
@@ -3343,9 +3353,9 @@
css += '.pivot-transparent-column { background-color: #fff; border-top-color: #fff !important; border-right-color: #fff !important; } \n';
css += '.pivot-transparent-row { background-color: #fff; border-bottom-color: #fff !important; border-left-color: #fff !important; } \n';
- css += '.x-mask-msg { padding: 0; border: 0 none; background-image: none; background-color: transparent; } \n';
+ css += '.x-mask-msg { padding: 0; border: 0 none; background-image: none; background-color: transparent; } \n';
css += '.x-mask-msg div { background-position: 11px center; } \n';
- css += '.x-mask-msg .x-mask-loading { border: 0 none; background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';
+ css += '.x-mask-msg .x-mask-loading { border: 0 none; background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';
css += '.x-mask { opacity: 0 } \n';
css += '.pivot td.legend { padding: 0; } \n';
@@ -3358,6 +3368,9 @@
css += '.pointer { cursor: pointer; } \n';
css += '.td-sortable { background-image: url("' + arrowUrl + '"); background-repeat: no-repeat; background-position: right center; padding-right: 15px !important; } \n';
+ // alert
+ css += '.ns-plugin-alert { width: 90%; padding: 5%; color: #777 } \n';
+
Ext.util.CSS.createStyleSheet(css);
};
@@ -3484,6 +3497,12 @@
success = function(r) {
var layout = api.layout.Layout((r.responseText ? Ext.decode(r.responseText) : r), obj);
+ // paging
+ layout.paging = {
+ page: 1,
+ pageSize: 50
+ };
+
if (layout) {
web.report.getData(layout, true);
}
@@ -3507,7 +3526,7 @@
}
};
- web.report.getData = function(view, isUpdateGui) {
+ web.report.getData = function(layout, isUpdateGui) {
var xLayout,
paramString,
success,
@@ -3546,7 +3565,7 @@
ns.app.paramString = paramString;
- web.report.createReport(view, response, isUpdateGui);
+ web.report.createReport(layout, response, isUpdateGui);
};
failure = function(r) {
@@ -3729,7 +3748,9 @@
//table = web.report.query.getHtml(layout, xResponse);
//}
- ns.app.centerRegion.removeAll(true);
+ if (ns.app.centerRegion.removeAll) {
+ ns.app.centerRegion.removeAll(true);
+ }
ns.app.centerRegion.update(table.html);
Ext.defer( function() {
@@ -3807,13 +3828,26 @@
return;
}
+ // css
applyCss(config);
+ // config
+ init.plugin = true;
+ init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
+ init.crossDomain = Ext.isBoolean(config.crossDomain) ? config.crossDomain : true;
+ 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>');
+ };
+
+ // init
ns.core = ER.getCore(Ext.clone(init));
- ns.core.init.el = config.el;
- Ext.get(ns.core.init.el).setStyle('opacity', 0);
extendInstance(ns);
-
+
ns.app.viewport = createViewport();
ns.app.centerRegion = ns.app.viewport.centerRegion;
@@ -3821,8 +3855,8 @@
ns.app.centerRegion.setWidth(width);
};
- if (config.id) {
- ns.core.web.report.loadReport(config.id);
+ if (config && config.id) {
+ ns.core.web.report.loadReport(config);
}
else {
layout = ns.core.api.layout.Layout(config);
@@ -3849,7 +3883,7 @@
if (!isInitStarted) {
isInitStarted = true;
- getInit(config.url);
+ getInit(config);
}
}
};
=== 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-14 16:55:31 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js 2015-01-15 22:34:01 +0000
@@ -4926,7 +4926,7 @@
}
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- alert('No values found', config);
+ console.log('No values found');
return false;
}
@@ -6715,11 +6715,15 @@
};
applyCss = function () {
+ var css = '';
+
+ // needs parent class to avoid conflict
+ css += '.x-border-box .gis-plugin * {box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;-webkit-box-sizing:border-box} \n';
- var css = '.gis-plugin, .gis-plugin * { font-family: arial, sans-serif, liberation sans, consolas; } \n';
+ // plugin
+ css += '.gis-plugin, .gis-plugin * { font-family: arial, sans-serif, liberation sans, consolas; } \n';
// ext gray
- //css += 'html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0} \n';
css += 'table{border-collapse:collapse;border-spacing:0} \n';
css += 'fieldset,img{border:0} \n';
css += 'h1,h2,h3,h4,h5,h6{font-size:100%} \n';
@@ -6824,11 +6828,6 @@
css += '.x-panel-header-vertical,.x-panel-header-vertical .x-panel-header-body,.x-btn-group-header-vertical,.x-btn-group-header-vertical .x-btn-group-header-body,.x-window-header-vertical,.x-window-header-vertical .x-window-header-body,.x-html button,.x-html textarea,.x-html input,.x-html select { display:inline-block; } \n';
css += '.x-window-header-text { user-select:none; -o-user-select:none; -ms-user-select:none; -moz-user-select:0; -webkit-user-select:none; cursor:default; white-space:nowrap; display:block; } \n';
-
-
- // needs parent class to avoid conflict
- css += '.x-border-box .gis-plugin *{box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;-webkit-box-sizing:border-box} \n';
-
// gis
css += '.x-box-inner { zoom: 1; } \n';
css += '.x-panel-default { border-color: #d0d0d0; } \n';
@@ -6844,7 +6843,6 @@
css += '.x-unselectable { -webkit-user-select: none; cursor: default; } \n';
css += '.x-docked { position: absolute; z-index: 1; } \n';
css += '.x-docked-top { border-bottom-width: 0 !important; } \n';
-
css += '.gis-container-default .x-window-body { padding: 5px; background: #fff; } \n';
css += '.olControlPanel { position: absolute; top: 0; right: 0; border: 0 none; } \n';
css += '.olControlButtonItemActive { background: #556; color: #fff; width: 24px; height: 24px; opacity: 0.75; filter: alpha(opacity=75); -ms-filter: "alpha(opacity=75)"; cursor: pointer; cursor: hand; text-align: center; font-size: 21px !important; text-shadow: 0 0 1px #ddd; } \n';
@@ -6896,6 +6894,9 @@
css += '.gis-panel-legend .x-panel-header { height: 23px; background: #f1f1f1; padding: 4px 4px 0 5px} \n';
css += '.gis-panel-legend .x-panel-header .x-panel-header-text { font-size: 10px; } \n';
+ // alert
+ css += '.ns-plugin-alert { width: 90%; padding: 5%; color: #777 } \n';
+
Ext.util.CSS.createStyleSheet(css);
};
@@ -7100,8 +7101,10 @@
return;
}
+ // css
applyCss();
+ // config
init.plugin = true;
init.el = config.el;
init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
@@ -7109,6 +7112,12 @@
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>');
+ //};
+
gis = GIS.core.getInstance(init);
// google maps
@@ -7164,6 +7173,7 @@
}
}
+ // extend
gis.el = config.el;
gis.plugin = init.plugin;
gis.dashboard = init.dashboard;
@@ -7179,9 +7189,9 @@
GIS.core.createSelectHandlers(gis, gis.layer.facility);
gis.map = config;
-
gis.viewport = createViewport();
+ // dashboard element
Ext.get(config.el).setViewportWidth = function(width) {
gis.viewport.setWidth(width);
gis.viewport.centerRegion.setWidth(width);
=== 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-01-14 16:50:54 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-01-15 22:09:04 +0000
@@ -579,9 +579,9 @@
console.log('Response: no valid headers');
return;
}
-
+
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- alert('No values found');
+ init.alert('No values found');
return;
}
@@ -2922,14 +2922,14 @@
getInit = function(config) {
var isInit = false,
requests = [],
- callbacks = 0,
+ callbackCount = 0,
type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
fn;
init.contextPath = config.url;
fn = function() {
- if (++callbacks === requests.length) {
+ if (++callbackCount === requests.length) {
isInitComplete = true;
for (var i = 0; i < configs.length; i++) {
@@ -3033,7 +3033,7 @@
css += 'table.pivot { border-collapse: collapse; border-spacing: 0px; border: 0 none; } \n';
css += '.pivot td { font-family: arial, sans-serif, helvetica neue, helvetica !important; padding: 5px; border: 1px solid #b2b2b2; } \n';
css += '.pivot-dim { background-color: #dae6f8; text-align: center; } \n';
- css += '.pivot-dim.highlighted { \n background-color: #c5d8f6; } \n';
+ css += '.pivot-dim.highlighted { background-color: #c5d8f6; } \n';
css += '.pivot-dim-subtotal { background-color: #cad6e8; text-align: center; } \n';
css += '.pivot-dim-total { background-color: #bac6d8; text-align: center; } \n';
css += '.pivot-dim-total.highlighted { background-color: #adb8c9; } \n';
@@ -3049,9 +3049,9 @@
css += '.pivot-transparent-column { background-color: #fff; border-top-color: #fff !important; border-right-color: #fff !important; } \n';
css += '.pivot-transparent-row { background-color: #fff; border-bottom-color: #fff !important; border-left-color: #fff !important; } \n';
- css += '.x-mask-msg { padding: 0; \n border: 0 none; background-image: none; background-color: transparent; } \n';
+ css += '.x-mask-msg { padding: 0; border: 0 none; background-image: none; background-color: transparent; } \n';
css += '.x-mask-msg div { background-position: 11px center; } \n';
- css += '.x-mask-msg .x-mask-loading { border: 0 none; \n background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';
+ css += '.x-mask-msg .x-mask-loading { border: 0 none; background-color: #000; color: #fff; border-radius: 2px; padding: 12px 14px 12px 30px; opacity: 0.65; } \n';
css += '.x-mask { opacity: 0 } \n';
css += '.pivot td.legend { padding: 0; } \n';
@@ -3064,6 +3064,9 @@
css += '.pointer { cursor: pointer; } \n';
css += '.td-sortable { background-image: url("' + arrowUrl + '"); background-repeat: no-repeat; background-position: right center; padding-right: 15px !important; } \n';
+ // alert
+ css += '.ns-plugin-alert { width: 90%; padding: 5%; color: #777 } \n';
+
Ext.util.CSS.createStyleSheet(css);
};
@@ -3394,14 +3397,23 @@
return;
}
+ // css
applyCss(config);
+ // config
init.plugin = true;
init.dashboard = Ext.isBoolean(config.dashboard) ? config.dashboard : false;
init.crossDomain = Ext.isBoolean(config.crossDomain) ? config.crossDomain : true;
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>');
+ };
+
+ // init
ns.core = PT.getCore(Ext.clone(init));
extendInstance(ns);