dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39508
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20003: PT plugin cross domain issues resolved.
------------------------------------------------------------
revno: 20003
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-09-06 16:46:34 +0200
message:
PT plugin cross domain issues resolved.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.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-apps/src/main/webapp/dhis-web-pivot/plugin.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-08-05 12:57:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/plugin.html 2015-09-06 14:46:34 +0000
@@ -1,48 +1,55 @@
<!DOCTYPE html>
<html>
<head>
-
-<!-- <link rel="stylesheet" type="text/css" href="//localhost:8080/dhis-web-commons/javascripts/ext/resources/css/ext-plugin-gray.css" /> -->
<script src="//localhost:8080/dhis-web-commons/javascripts/ext/ext-all.js"></script>
<script src="scripts/table.js"></script>
<style type="text/css">
- body {font-family:sans-serif; margin:0 0 0 60px;}
-
+ body {font-family:sans-serif; margin:0 60px;}
h1 {font-size:20px; margin:20px 0;}
-
#table1, #table2 {margin-bottom:40px;}
</style>
<script>
Ext.onReady(function() {
- var url = 'http://localhost:8080';
-
- //DHIS.getTable({
- //url: url,
- //el: 'table1',
- //uid: 'VkJmOoCE4xu',
- //showDimensionLabels: true,
- //displayDensity: 'compact'
- //});
+ //var url = 'http://localhost:8080',
+ var url = 'https://apps.dhis2.org/demo',
+ username = 'admin',
+ password = 'district';
DHIS.getTable({
url: url,
- el: 'table2',
- columns: [
- {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]}
- ],
- rows: [
- {dimension: 'ou', items: [{id: 'USER_ORGUNIT_CHILDREN'}]}
- ],
- hideEmptyRows: true,
+ crossDomain: true,
+ username: username,
+ password: password,
+ el: 'table1',
+ uid: 'tWg9OiyV7mu',
+ showDimensionLabels: true,
+ displayDensity: 'compact'
+ });
+
+ DHIS.getTable({
+ url: url,
+ el: 'table2',
+ crossDomain: true,
+ username: username,
+ password: password,
+ columns: [
+ {dimension: 'pe', items: [{id: 'LAST_12_MONTHS'}]}
+ ],
+ rows: [
+ {dimension: 'ou', items: [{id: 'USER_ORGUNIT_CHILDREN'}]}
+ ],
+ hideEmptyRows: true,
userOrgUnit: ['fdc6uOvgoji', 'e1eIKM1GIF3']
- });
+ });
});
</script>
</head>
<body>
+ <h1>TABLE BY ID</h1>
+ <div id="table1"></div>
<h1>TABLE BY CONFIG</h1>
<div id="table2"></div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-09-04 14:37:08 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2015-09-06 14:46:34 +0000
@@ -2003,12 +2003,12 @@
// core
extendCore = function(core) {
- var conf = core.conf,
+ var init = core.init,
+ conf = core.conf,
api = core.api,
support = core.support,
service = core.service,
- web = core.web,
- init = core.init;
+ web = core.web;
// init
(function() {
@@ -7634,6 +7634,8 @@
period: period,
treePanel: treePanel,
setGui: setGui,
+ westRegion: westRegion,
+ centerRegion: centerRegion,
items: [
westRegion,
centerRegion
@@ -7740,14 +7742,19 @@
fn = function() {
if (++callbacks === requests.length) {
- NS.instances.push(ns);
-
- ns.init = init;
- ns.core = NS.getCore(ns);
+ ns.core = NS.getCore(init);
+ ns.alert = ns.core.webAlert;
extendCore(ns.core);
dimConf = ns.core.conf.finals.dimension;
ns.app.viewport = createViewport();
+
+ ns.core.app.getViewportWidth = function() { return ns.app.viewport.getWidth(); };
+ ns.core.app.getViewportHeight = function() { return ns.app.viewport.getHeight(); };
+ ns.core.app.getCenterRegionWidth = function() { return ns.app.viewport.centerRegion.getWidth(); };
+ ns.core.app.getCenterRegionHeight = function() { return ns.app.viewport.centerRegion.getHeight(); };
+
+ NS.instances.push(ns);
}
};
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-09-04 14:37:08 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-09-06 14:46:34 +0000
@@ -46,17 +46,26 @@
NS.isDebug = false;
NS.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- NS.getCore = function(ns) {
- var init = ns.init,
- conf = {},
+ NS.getCore = function(init, appConfig) {
+ var conf = {},
api = {},
support = {},
service = {},
web = {},
+ app = {},
+ webAlert,
dimConf;
- // tmp
- ns.alert = function() {};
+ appConfig = appConfig || {};
+
+ // alert
+ webAlert = function() {};
+
+ // app
+ app.getViewportWidth = function() {};
+ app.getViewportHeight = function() {};
+ app.getCenterRegionWidth = function() {};
+ app.getCenterRegionHeight = function() {};
// conf
(function() {
@@ -153,10 +162,6 @@
dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
- dimConf.objectNameMap['ou1'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou2'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou3'] = dimConf.organisationUnit;
-
conf.period = {
periodTypes: [
{id: 'Daily', name: NS.i18n.daily},
@@ -449,19 +454,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(NS.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ webAlert(NS.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(NS.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ webAlert(NS.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(NS.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ webAlert(NS.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
return;
}
}
@@ -469,31 +474,31 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- ns.alert('Indicators and detailed data elements cannot be specified together');
+ webAlert('Indicators and detailed data elements cannot be specified together');
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- ns.alert('Detailed data elements and totals cannot be specified together');
+ webAlert('Detailed data elements and totals cannot be specified together');
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- ns.alert('Data sets and detailed data elements cannot be specified together');
+ webAlert('Data sets and detailed data elements cannot be specified together');
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- ns.alert('Assigned categories and detailed data elements cannot be specified together');
+ webAlert('Assigned categories and detailed data elements cannot be specified together');
return;
}
// in and aggregation type
if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
- ns.alert('Indicators and aggregation types cannot be specified together', true);
+ webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -516,7 +521,7 @@
// at least one dimension specified as column or row
if (!(config.columns || config.rows)) {
- ns.alert(NS.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
+ webAlert(NS.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
return;
}
@@ -531,7 +536,7 @@
// at least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- ns.alert(NS.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
+ webAlert(NS.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
return;
}
@@ -1948,7 +1953,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2024,7 +2029,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2145,7 +2150,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.';
- ns.alert(msg, 'warning');
+ webAlert(msg, 'warning');
};
// pivot
@@ -3015,7 +3020,6 @@
};
}();
};
-
}());
// extend init
@@ -3048,14 +3052,17 @@
}());
// alert
- ns.alert = web.message.alert;
-
- ns.conf = conf;
- ns.api = api;
- ns.support = support;
- ns.service = service;
- ns.web = web;
-
- return ns;
+ webAlert = web.message.alert;
+
+ return {
+ init: init,
+ conf: conf,
+ api: api,
+ support: support,
+ service: service,
+ web: web,
+ app: app,
+ webAlert: webAlert
+ };
};
});
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-09-02 18:25:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-09-06 14:46:34 +0000
@@ -48,17 +48,26 @@
PT.isDebug = false;
PT.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- PT.getCore = function(ns) {
- var init = ns.init,
- conf = {},
+ PT.getCore = function(init, appConfig) {
+ var conf = {},
api = {},
support = {},
service = {},
web = {},
+ app = {},
+ webAlert,
dimConf;
- // tmp
- ns.alert = function() {};
+ appConfig = appConfig || {};
+
+ // alert
+ webAlert = function() {};
+
+ // app
+ app.getViewportWidth = function() {};
+ app.getViewportHeight = function() {};
+ app.getCenterRegionWidth = function() {};
+ app.getCenterRegionHeight = function() {};
// conf
(function() {
@@ -155,10 +164,6 @@
dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
- dimConf.objectNameMap['ou1'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou2'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou3'] = dimConf.organisationUnit;
-
conf.period = {
periodTypes: [
{id: 'Daily', name: PT.i18n.daily},
@@ -176,6 +181,14 @@
relativePeriods: []
};
+ conf.valueType = {
+ numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
+ textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
+ booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+ dateTypes: ['DATE','DATETIME'],
+ aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ };
+
conf.layout = {
west_width: 424,
west_fieldset_width: 418,
@@ -443,19 +456,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ webAlert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ webAlert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ webAlert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
return;
}
}
@@ -463,31 +476,31 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- ns.alert('Indicators and detailed data elements cannot be specified together');
+ webAlert('Indicators and detailed data elements cannot be specified together');
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- ns.alert('Detailed data elements and totals cannot be specified together');
+ webAlert('Detailed data elements and totals cannot be specified together');
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- ns.alert('Data sets and detailed data elements cannot be specified together');
+ webAlert('Data sets and detailed data elements cannot be specified together');
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- ns.alert('Assigned categories and detailed data elements cannot be specified together');
+ webAlert('Assigned categories and detailed data elements cannot be specified together');
return;
}
// in and aggregation type
if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
- ns.alert('Indicators and aggregation types cannot be specified together', true);
+ webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -510,7 +523,7 @@
// at least one dimension specified as column or row
if (!(config.columns || config.rows)) {
- ns.alert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
+ webAlert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
return;
}
@@ -525,7 +538,7 @@
// at least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- ns.alert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
+ webAlert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
return;
}
@@ -1942,7 +1955,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2018,7 +2031,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2139,7 +2152,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.';
- ns.alert(msg, 'warning');
+ webAlert(msg, 'warning');
};
// pivot
@@ -3009,7 +3022,6 @@
};
}();
};
-
}());
// extend init
@@ -3042,15 +3054,18 @@
}());
// alert
- ns.alert = web.message.alert;
-
- ns.conf = conf;
- ns.api = api;
- ns.support = support;
- ns.service = service;
- ns.web = web;
-
- return ns;
+ webAlert = web.message.alert;
+
+ return {
+ init: init,
+ conf: conf,
+ api: api,
+ support: support,
+ service: service,
+ web: web,
+ app: app,
+ webAlert: webAlert
+ };
};
// PLUGIN
@@ -3072,7 +3087,8 @@
requests = [],
callbackCount = 0,
type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
- fn;
+ fn,
+ ajax;
init.contextPath = config.url;
@@ -3088,6 +3104,15 @@
}
};
+ ajax = function(requestConfig) {
+ if (config.crossDomain && Ext.isString(config.username) && Ext.isString(config.password)) {
+ requestConfig.headers = Ext.isObject(config.headers) ? config.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(config.username + ':' + config.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
+
// user-account
requests.push({
url: init.contextPath + '/api/me/user-account.' + type,
@@ -3171,12 +3196,7 @@
//init.legendSets = [];
for (var i = 0; i < requests.length; i++) {
- if (type === 'jsonp') {
- Ext.data.JsonP.request(requests[i]);
- }
- else {
- Ext.Ajax.request(requests[i]);
- }
+ ajax(requests[i]);
}
};
@@ -3257,14 +3277,14 @@
return true;
};
- extendInstance = function(ns) {
+ extendInstance = function(ns, appConfig) {
var init = ns.core.init,
api = ns.core.api,
conf = ns.core.conf,
support = ns.core.support,
service = ns.core.service,
web = ns.core.web,
- type = ns.plugin && ns.crossDomain ? 'jsonp' : 'json',
+ type = appConfig.plugin && appConfig.crossDomain ? 'jsonp' : 'json',
headerMap = {
json: 'application/json',
jsonp: 'application/javascript'
@@ -3402,7 +3422,7 @@
paramString = web.analytics.getParamString(xLayout, true);
// mask
- if (!ns.skipMask) {
+ if (!appConfig.skipMask) {
web.mask.show(ns.app.centerRegion);
}
@@ -3428,7 +3448,7 @@
};
failure = function(r) {
- if (!ns.skipMask) {
+ if (!appConfig.skipMask) {
web.mask.hide(ns.app.centerRegion);
}
};
@@ -3459,7 +3479,7 @@
getXResponse = service.response.getExtendedResponse,
getXAxis = service.layout.getExtendedAxis,
getTitleHtml = function(title) {
- return ns.dashboard && title ? '<div style="height: 19px; line-height: 14px; width: 100%; font: bold 12px LiberationSans; color: #333; text-align: center; letter-spacing: -0.1px"">' + title + '</div>' : '';
+ return appConfig.dashboard && title ? '<div style="height: 19px; line-height: 14px; width: 100%; font: bold 12px LiberationSans; color: #333; text-align: center; letter-spacing: -0.1px"">' + title + '</div>' : '';
};
getHtml = function(xLayout, xResponse) {
@@ -3565,13 +3585,12 @@
//};
// ns
- ns.plugin = init.plugin;
- ns.dashboard = init.dashboard;
- ns.crossDomain = init.crossDomain;
- ns.skipMask = init.skipMask;
- ns.skipFade = init.skipFade;
-
- ns.alert = web.message.alert;
+ ns.plugin = appConfig.plugin;
+ ns.dashboard = appConfig.dashboard;
+ ns.crossDomain = appConfig.crossDomain;
+ ns.skipMask = appConfig.skipMask;
+ ns.skipFade = appConfig.skipFade;
+ ns.el = appConfig.el;
init.el = config.el;
@@ -3587,31 +3606,34 @@
};
initialize = function() {
- var el = Ext.get(config.el);
+ var el = Ext.get(config.el),
+ appConfig;
if (!validateConfig(config)) {
return;
}
+ appConfig = {
+ plugin: true,
+ dashboard: Ext.isBoolean(config.dashboard) ? config.dashboard : false,
+ crossDomain: Ext.isBoolean(config.crossDomain) ? config.crossDomain : true,
+ skipMask: Ext.isBoolean(config.skipMask) ? config.skipMask : false,
+ skipFade: Ext.isBoolean(config.skipFade) ? config.skipFade : false,
+ el: Ext.isString(config.el) ? config.el : null
+ };
+
// 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;
-
- // init
- ns.init = init;
- PT.instances.push(ns);
- ns.core = PT.getCore(ns);
- extendInstance(ns);
+ // core
+ ns.core = PT.getCore(init, appConfig);
+ extendInstance(ns, appConfig);
ns.app.viewport = createViewport();
ns.app.centerRegion = ns.app.viewport.centerRegion;
+ PT.instances.push(ns);
+
if (el) {
el.setViewportWidth = function(width) {
ns.app.centerRegion.setWidth(width);
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-09-02 18:25:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-09-06 14:46:34 +0000
@@ -48,17 +48,26 @@
PT.isDebug = false;
PT.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- PT.getCore = function(ns) {
- var init = ns.init,
- conf = {},
+ PT.getCore = function(init, appConfig) {
+ var conf = {},
api = {},
support = {},
service = {},
web = {},
+ app = {},
+ webAlert,
dimConf;
- // tmp
- ns.alert = function() {};
+ appConfig = appConfig || {};
+
+ // alert
+ webAlert = function() {};
+
+ // app
+ app.getViewportWidth = function() {};
+ app.getViewportHeight = function() {};
+ app.getCenterRegionWidth = function() {};
+ app.getCenterRegionHeight = function() {};
// conf
(function() {
@@ -155,10 +164,6 @@
dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
- dimConf.objectNameMap['ou1'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou2'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou3'] = dimConf.organisationUnit;
-
conf.period = {
periodTypes: [
{id: 'Daily', name: PT.i18n.daily},
@@ -176,6 +181,14 @@
relativePeriods: []
};
+ conf.valueType = {
+ numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
+ textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
+ booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+ dateTypes: ['DATE','DATETIME'],
+ aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ };
+
conf.layout = {
west_width: 424,
west_fieldset_width: 418,
@@ -443,19 +456,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ webAlert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ webAlert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ webAlert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
return;
}
}
@@ -463,31 +476,31 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- ns.alert('Indicators and detailed data elements cannot be specified together');
+ webAlert('Indicators and detailed data elements cannot be specified together');
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- ns.alert('Detailed data elements and totals cannot be specified together');
+ webAlert('Detailed data elements and totals cannot be specified together');
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- ns.alert('Data sets and detailed data elements cannot be specified together');
+ webAlert('Data sets and detailed data elements cannot be specified together');
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- ns.alert('Assigned categories and detailed data elements cannot be specified together');
+ webAlert('Assigned categories and detailed data elements cannot be specified together');
return;
}
// in and aggregation type
if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
- ns.alert('Indicators and aggregation types cannot be specified together', true);
+ webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -510,7 +523,7 @@
// at least one dimension specified as column or row
if (!(config.columns || config.rows)) {
- ns.alert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
+ webAlert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
return;
}
@@ -525,7 +538,7 @@
// at least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- ns.alert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
+ webAlert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
return;
}
@@ -1942,7 +1955,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2018,7 +2031,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2139,7 +2152,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.';
- ns.alert(msg, 'warning');
+ webAlert(msg, 'warning');
};
// pivot
@@ -3009,7 +3022,6 @@
};
}();
};
-
}());
// extend init
@@ -3042,15 +3054,18 @@
}());
// alert
- ns.alert = web.message.alert;
-
- ns.conf = conf;
- ns.api = api;
- ns.support = support;
- ns.service = service;
- ns.web = web;
-
- return ns;
+ webAlert = web.message.alert;
+
+ return {
+ init: init,
+ conf: conf,
+ api: api,
+ support: support,
+ service: service,
+ web: web,
+ app: app,
+ webAlert: webAlert
+ };
};
// PLUGIN
@@ -3072,7 +3087,8 @@
requests = [],
callbackCount = 0,
type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
- fn;
+ fn,
+ ajax;
init.contextPath = config.url;
@@ -3088,6 +3104,15 @@
}
};
+ ajax = function(requestConfig) {
+ if (config.crossDomain && Ext.isString(config.username) && Ext.isString(config.password)) {
+ requestConfig.headers = Ext.isObject(config.headers) ? config.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(config.username + ':' + config.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
+
// user-account
requests.push({
url: init.contextPath + '/api/me/user-account.' + type,
@@ -3171,12 +3196,7 @@
//init.legendSets = [];
for (var i = 0; i < requests.length; i++) {
- if (type === 'jsonp') {
- Ext.data.JsonP.request(requests[i]);
- }
- else {
- Ext.Ajax.request(requests[i]);
- }
+ ajax(requests[i]);
}
};
@@ -3257,14 +3277,14 @@
return true;
};
- extendInstance = function(ns) {
+ extendInstance = function(ns, appConfig) {
var init = ns.core.init,
api = ns.core.api,
conf = ns.core.conf,
support = ns.core.support,
service = ns.core.service,
web = ns.core.web,
- type = ns.plugin && ns.crossDomain ? 'jsonp' : 'json',
+ type = appConfig.plugin && appConfig.crossDomain ? 'jsonp' : 'json',
headerMap = {
json: 'application/json',
jsonp: 'application/javascript'
@@ -3402,7 +3422,7 @@
paramString = web.analytics.getParamString(xLayout, true);
// mask
- if (!ns.skipMask) {
+ if (!appConfig.skipMask) {
web.mask.show(ns.app.centerRegion);
}
@@ -3428,7 +3448,7 @@
};
failure = function(r) {
- if (!ns.skipMask) {
+ if (!appConfig.skipMask) {
web.mask.hide(ns.app.centerRegion);
}
};
@@ -3459,7 +3479,7 @@
getXResponse = service.response.getExtendedResponse,
getXAxis = service.layout.getExtendedAxis,
getTitleHtml = function(title) {
- return ns.dashboard && title ? '<div style="height: 19px; line-height: 14px; width: 100%; font: bold 12px LiberationSans; color: #333; text-align: center; letter-spacing: -0.1px"">' + title + '</div>' : '';
+ return appConfig.dashboard && title ? '<div style="height: 19px; line-height: 14px; width: 100%; font: bold 12px LiberationSans; color: #333; text-align: center; letter-spacing: -0.1px"">' + title + '</div>' : '';
};
getHtml = function(xLayout, xResponse) {
@@ -3565,13 +3585,12 @@
//};
// ns
- ns.plugin = init.plugin;
- ns.dashboard = init.dashboard;
- ns.crossDomain = init.crossDomain;
- ns.skipMask = init.skipMask;
- ns.skipFade = init.skipFade;
-
- ns.alert = web.message.alert;
+ ns.plugin = appConfig.plugin;
+ ns.dashboard = appConfig.dashboard;
+ ns.crossDomain = appConfig.crossDomain;
+ ns.skipMask = appConfig.skipMask;
+ ns.skipFade = appConfig.skipFade;
+ ns.el = appConfig.el;
init.el = config.el;
@@ -3587,31 +3606,34 @@
};
initialize = function() {
- var el = Ext.get(config.el);
+ var el = Ext.get(config.el),
+ appConfig;
if (!validateConfig(config)) {
return;
}
+ appConfig = {
+ plugin: true,
+ dashboard: Ext.isBoolean(config.dashboard) ? config.dashboard : false,
+ crossDomain: Ext.isBoolean(config.crossDomain) ? config.crossDomain : true,
+ skipMask: Ext.isBoolean(config.skipMask) ? config.skipMask : false,
+ skipFade: Ext.isBoolean(config.skipFade) ? config.skipFade : false,
+ el: Ext.isString(config.el) ? config.el : null
+ };
+
// 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;
-
- // init
- ns.init = init;
- PT.instances.push(ns);
- ns.core = PT.getCore(ns);
- extendInstance(ns);
+ // core
+ ns.core = PT.getCore(init, appConfig);
+ extendInstance(ns, appConfig);
ns.app.viewport = createViewport();
ns.app.centerRegion = ns.app.viewport.centerRegion;
+ PT.instances.push(ns);
+
if (el) {
el.setViewportWidth = function(width) {
ns.app.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-09-02 18:25:31 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-09-06 14:46:34 +0000
@@ -48,17 +48,26 @@
PT.isDebug = false;
PT.isSessionStorage = ('sessionStorage' in window && window['sessionStorage'] !== null);
- PT.getCore = function(ns) {
- var init = ns.init,
- conf = {},
+ PT.getCore = function(init, appConfig) {
+ var conf = {},
api = {},
support = {},
service = {},
web = {},
+ app = {},
+ webAlert,
dimConf;
- // tmp
- ns.alert = function() {};
+ appConfig = appConfig || {};
+
+ // alert
+ webAlert = function() {};
+
+ // app
+ app.getViewportWidth = function() {};
+ app.getViewportHeight = function() {};
+ app.getCenterRegionWidth = function() {};
+ app.getCenterRegionHeight = function() {};
// conf
(function() {
@@ -155,10 +164,6 @@
dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
- dimConf.objectNameMap['ou1'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou2'] = dimConf.organisationUnit;
- dimConf.objectNameMap['ou3'] = dimConf.organisationUnit;
-
conf.period = {
periodTypes: [
{id: 'Daily', name: PT.i18n.daily},
@@ -176,6 +181,14 @@
relativePeriods: []
};
+ conf.valueType = {
+ numericTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
+ textTypes: ['TEXT','LONG_TEXT','LETTER','PHONE_NUMBER','EMAIL'],
+ booleanTypes: ['BOOLEAN','TRUE_ONLY'],
+ dateTypes: ['DATE','DATETIME'],
+ aggregateTypes: ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE','BOOLEAN','TRUE_ONLY']
+ };
+
conf.layout = {
west_width: 424,
west_fieldset_width: 418,
@@ -443,19 +456,19 @@
// Indicators as filter
if (layout.filters[i].dimension === dimConf.indicator.objectName) {
- ns.alert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
+ webAlert(PT.i18n.indicators_cannot_be_specified_as_filter || 'Indicators cannot be specified as filter');
return;
}
// Categories as filter
if (layout.filters[i].dimension === dimConf.category.objectName) {
- ns.alert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
+ webAlert(PT.i18n.categories_cannot_be_specified_as_filter || 'Categories cannot be specified as filter');
return;
}
// Data sets as filter
if (layout.filters[i].dimension === dimConf.dataSet.objectName) {
- ns.alert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
+ webAlert(PT.i18n.data_sets_cannot_be_specified_as_filter || 'Data sets cannot be specified as filter');
return;
}
}
@@ -463,31 +476,31 @@
// dc and in
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
- ns.alert('Indicators and detailed data elements cannot be specified together');
+ webAlert('Indicators and detailed data elements cannot be specified together');
return;
}
// dc and de
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
- ns.alert('Detailed data elements and totals cannot be specified together');
+ webAlert('Detailed data elements and totals cannot be specified together');
return;
}
// dc and ds
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) {
- ns.alert('Data sets and detailed data elements cannot be specified together');
+ webAlert('Data sets and detailed data elements cannot be specified together');
return;
}
// dc and co
if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.category.objectName]) {
- ns.alert('Assigned categories and detailed data elements cannot be specified together');
+ webAlert('Assigned categories and detailed data elements cannot be specified together');
return;
}
// in and aggregation type
if (objectNameDimensionMap[dimConf.indicator.objectName] && config.aggregationType !== 'DEFAULT') {
- ns.alert('Indicators and aggregation types cannot be specified together', true);
+ webAlert('Indicators and aggregation types cannot be specified together', true);
return;
}
@@ -510,7 +523,7 @@
// at least one dimension specified as column or row
if (!(config.columns || config.rows)) {
- ns.alert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
+ webAlert(PT.i18n.at_least_one_dimension_must_be_specified_as_row_or_column);
return;
}
@@ -525,7 +538,7 @@
// at least one period
if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
- ns.alert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
+ webAlert(PT.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
return;
}
@@ -1942,7 +1955,7 @@
web.window = web.window || {};
web.window.setAnchorPosition = function(w, target) {
- var vpw = ns.app.viewport.getWidth(),
+ var vpw = app.getViewportWidth(),
targetx = target ? target.getPosition()[0] : 4,
winw = w.getWidth(),
y = target ? target.getPosition()[1] + target.getHeight() + 4 : 33;
@@ -2018,7 +2031,7 @@
config.html += obj.message + (obj.message.substr(obj.message.length - 1) === '.' ? '' : '.');
// bodyStyle
- config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + ns.app.centerRegion.getHeight() / 2 + 'px';
+ config.bodyStyle = 'padding: 12px; background: #fff; max-width: 600px; max-height: ' + app.getCenterRegionHeight() / 2 + 'px';
// destroy handler
config.modal = true;
@@ -2139,7 +2152,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.';
- ns.alert(msg, 'warning');
+ webAlert(msg, 'warning');
};
// pivot
@@ -3009,7 +3022,6 @@
};
}();
};
-
}());
// extend init
@@ -3042,15 +3054,18 @@
}());
// alert
- ns.alert = web.message.alert;
-
- ns.conf = conf;
- ns.api = api;
- ns.support = support;
- ns.service = service;
- ns.web = web;
-
- return ns;
+ webAlert = web.message.alert;
+
+ return {
+ init: init,
+ conf: conf,
+ api: api,
+ support: support,
+ service: service,
+ web: web,
+ app: app,
+ webAlert: webAlert
+ };
};
// PLUGIN
@@ -3072,7 +3087,8 @@
requests = [],
callbackCount = 0,
type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
- fn;
+ fn,
+ ajax;
init.contextPath = config.url;
@@ -3088,6 +3104,15 @@
}
};
+ ajax = function(requestConfig) {
+ if (config.crossDomain && Ext.isString(config.username) && Ext.isString(config.password)) {
+ requestConfig.headers = Ext.isObject(config.headers) ? config.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(config.username + ':' + config.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
+
// user-account
requests.push({
url: init.contextPath + '/api/me/user-account.' + type,
@@ -3171,12 +3196,7 @@
//init.legendSets = [];
for (var i = 0; i < requests.length; i++) {
- if (type === 'jsonp') {
- Ext.data.JsonP.request(requests[i]);
- }
- else {
- Ext.Ajax.request(requests[i]);
- }
+ ajax(requests[i]);
}
};
@@ -3257,14 +3277,14 @@
return true;
};
- extendInstance = function(ns) {
+ extendInstance = function(ns, appConfig) {
var init = ns.core.init,
api = ns.core.api,
conf = ns.core.conf,
support = ns.core.support,
service = ns.core.service,
web = ns.core.web,
- type = ns.plugin && ns.crossDomain ? 'jsonp' : 'json',
+ type = appConfig.plugin && appConfig.crossDomain ? 'jsonp' : 'json',
headerMap = {
json: 'application/json',
jsonp: 'application/javascript'
@@ -3402,7 +3422,7 @@
paramString = web.analytics.getParamString(xLayout, true);
// mask
- if (!ns.skipMask) {
+ if (!appConfig.skipMask) {
web.mask.show(ns.app.centerRegion);
}
@@ -3428,7 +3448,7 @@
};
failure = function(r) {
- if (!ns.skipMask) {
+ if (!appConfig.skipMask) {
web.mask.hide(ns.app.centerRegion);
}
};
@@ -3459,7 +3479,7 @@
getXResponse = service.response.getExtendedResponse,
getXAxis = service.layout.getExtendedAxis,
getTitleHtml = function(title) {
- return ns.dashboard && title ? '<div style="height: 19px; line-height: 14px; width: 100%; font: bold 12px LiberationSans; color: #333; text-align: center; letter-spacing: -0.1px"">' + title + '</div>' : '';
+ return appConfig.dashboard && title ? '<div style="height: 19px; line-height: 14px; width: 100%; font: bold 12px LiberationSans; color: #333; text-align: center; letter-spacing: -0.1px"">' + title + '</div>' : '';
};
getHtml = function(xLayout, xResponse) {
@@ -3565,13 +3585,12 @@
//};
// ns
- ns.plugin = init.plugin;
- ns.dashboard = init.dashboard;
- ns.crossDomain = init.crossDomain;
- ns.skipMask = init.skipMask;
- ns.skipFade = init.skipFade;
-
- ns.alert = web.message.alert;
+ ns.plugin = appConfig.plugin;
+ ns.dashboard = appConfig.dashboard;
+ ns.crossDomain = appConfig.crossDomain;
+ ns.skipMask = appConfig.skipMask;
+ ns.skipFade = appConfig.skipFade;
+ ns.el = appConfig.el;
init.el = config.el;
@@ -3587,31 +3606,34 @@
};
initialize = function() {
- var el = Ext.get(config.el);
+ var el = Ext.get(config.el),
+ appConfig;
if (!validateConfig(config)) {
return;
}
+ appConfig = {
+ plugin: true,
+ dashboard: Ext.isBoolean(config.dashboard) ? config.dashboard : false,
+ crossDomain: Ext.isBoolean(config.crossDomain) ? config.crossDomain : true,
+ skipMask: Ext.isBoolean(config.skipMask) ? config.skipMask : false,
+ skipFade: Ext.isBoolean(config.skipFade) ? config.skipFade : false,
+ el: Ext.isString(config.el) ? config.el : null
+ };
+
// 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;
-
- // init
- ns.init = init;
- PT.instances.push(ns);
- ns.core = PT.getCore(ns);
- extendInstance(ns);
+ // core
+ ns.core = PT.getCore(init, appConfig);
+ extendInstance(ns, appConfig);
ns.app.viewport = createViewport();
ns.app.centerRegion = ns.app.viewport.centerRegion;
+ PT.instances.push(ns);
+
if (el) {
el.setViewportWidth = function(width) {
ns.app.centerRegion.setWidth(width);