dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #39511
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20005: PT plugin fixes.
------------------------------------------------------------
revno: 20005
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-09-06 23:38:21 +0200
message:
PT plugin fixes.
modified:
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/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-09-06 14:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2015-09-06 21:38:21 +0000
@@ -877,6 +877,17 @@
} : null;
};
+ // connection
+ support.connection = {};
+
+ support.connection.ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
}());
// service
=== 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-06 14:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/table.js 2015-09-06 21:38:21 +0000
@@ -879,6 +879,17 @@
} : null;
};
+ // connection
+ support.connection = {};
+
+ support.connection.ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
}());
// service
@@ -3086,9 +3097,9 @@
var isInit = false,
requests = [],
callbackCount = 0,
- type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
- fn,
- ajax;
+ type = 'json',
+ ajax,
+ fn;
init.contextPath = config.url;
@@ -3104,10 +3115,10 @@
}
};
- 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);
+ ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
}
Ext.Ajax.request(requestConfig);
@@ -3196,7 +3207,7 @@
//init.legendSets = [];
for (var i = 0; i < requests.length; i++) {
- ajax(requests[i]);
+ ajax(requests[i], config);
}
};
@@ -3284,7 +3295,7 @@
support = ns.core.support,
service = ns.core.service,
web = ns.core.web,
- type = appConfig.plugin && appConfig.crossDomain ? 'jsonp' : 'json',
+ type = 'json',
headerMap = {
json: 'application/json',
jsonp: 'application/javascript'
@@ -3295,6 +3306,19 @@
},
el = Ext.get(init.el);
+ init.el = config.el;
+
+ // ns
+ ns.plugin = appConfig.plugin;
+ ns.dashboard = appConfig.dashboard;
+ ns.crossDomain = appConfig.crossDomain;
+ ns.skipMask = appConfig.skipMask;
+ ns.skipFade = appConfig.skipFade;
+ ns.el = appConfig.el;
+ ns.username = appConfig.username;
+ ns.password = appConfig.password;
+ ns.ajax = support.connection.ajax;
+
// message
web.message = web.message || {};
@@ -3399,12 +3423,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.pivot.getData = function(layout, isUpdateGui) {
@@ -3460,12 +3479,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.pivot.createTable = function(layout, response, xResponse, isUpdateGui) {
@@ -3584,16 +3598,6 @@
//web.pivot.createTable(layout, null, response, false);
//};
- // ns
- 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;
-
//if (!ns.skipFade && el) {
//el.setStyle('opacity', 0);
//}
@@ -3619,7 +3623,9 @@
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
+ el: Ext.isString(config.el) ? config.el : null,
+ username: Ext.isString(config.username) ? config.username : null,
+ password: Ext.isString(config.password) ? config.password : null
};
// css
=== 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-06 14:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/table.js 2015-09-06 21:38:21 +0000
@@ -879,6 +879,17 @@
} : null;
};
+ // connection
+ support.connection = {};
+
+ support.connection.ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
}());
// service
@@ -3086,9 +3097,9 @@
var isInit = false,
requests = [],
callbackCount = 0,
- type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
- fn,
- ajax;
+ type = 'json',
+ ajax,
+ fn;
init.contextPath = config.url;
@@ -3104,10 +3115,10 @@
}
};
- 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);
+ ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
}
Ext.Ajax.request(requestConfig);
@@ -3196,7 +3207,7 @@
//init.legendSets = [];
for (var i = 0; i < requests.length; i++) {
- ajax(requests[i]);
+ ajax(requests[i], config);
}
};
@@ -3284,7 +3295,7 @@
support = ns.core.support,
service = ns.core.service,
web = ns.core.web,
- type = appConfig.plugin && appConfig.crossDomain ? 'jsonp' : 'json',
+ type = 'json',
headerMap = {
json: 'application/json',
jsonp: 'application/javascript'
@@ -3295,6 +3306,19 @@
},
el = Ext.get(init.el);
+ init.el = config.el;
+
+ // ns
+ ns.plugin = appConfig.plugin;
+ ns.dashboard = appConfig.dashboard;
+ ns.crossDomain = appConfig.crossDomain;
+ ns.skipMask = appConfig.skipMask;
+ ns.skipFade = appConfig.skipFade;
+ ns.el = appConfig.el;
+ ns.username = appConfig.username;
+ ns.password = appConfig.password;
+ ns.ajax = support.connection.ajax;
+
// message
web.message = web.message || {};
@@ -3399,12 +3423,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.pivot.getData = function(layout, isUpdateGui) {
@@ -3460,12 +3479,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.pivot.createTable = function(layout, response, xResponse, isUpdateGui) {
@@ -3584,16 +3598,6 @@
//web.pivot.createTable(layout, null, response, false);
//};
- // ns
- 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;
-
//if (!ns.skipFade && el) {
//el.setStyle('opacity', 0);
//}
@@ -3619,7 +3623,9 @@
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
+ el: Ext.isString(config.el) ? config.el : null,
+ username: Ext.isString(config.username) ? config.username : null,
+ password: Ext.isString(config.password) ? config.password : null
};
// css
=== 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-06 14:46:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js 2015-09-06 21:38:21 +0000
@@ -879,6 +879,17 @@
} : null;
};
+ // connection
+ support.connection = {};
+
+ support.connection.ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
+ }
+
+ Ext.Ajax.request(requestConfig);
+ };
}());
// service
@@ -3086,9 +3097,9 @@
var isInit = false,
requests = [],
callbackCount = 0,
- type = config.plugin && config.crossDomain ? 'jsonp' : 'json',
- fn,
- ajax;
+ type = 'json',
+ ajax,
+ fn;
init.contextPath = config.url;
@@ -3104,10 +3115,10 @@
}
};
- 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);
+ ajax = function(requestConfig, authConfig) {
+ if (authConfig.crossDomain && Ext.isString(authConfig.username) && Ext.isString(authConfig.password)) {
+ requestConfig.headers = Ext.isObject(authConfig.headers) ? authConfig.headers : {};
+ requestConfig.headers['Authorization'] = 'Basic ' + btoa(authConfig.username + ':' + authConfig.password);
}
Ext.Ajax.request(requestConfig);
@@ -3196,7 +3207,7 @@
//init.legendSets = [];
for (var i = 0; i < requests.length; i++) {
- ajax(requests[i]);
+ ajax(requests[i], config);
}
};
@@ -3284,7 +3295,7 @@
support = ns.core.support,
service = ns.core.service,
web = ns.core.web,
- type = appConfig.plugin && appConfig.crossDomain ? 'jsonp' : 'json',
+ type = 'json',
headerMap = {
json: 'application/json',
jsonp: 'application/javascript'
@@ -3295,6 +3306,19 @@
},
el = Ext.get(init.el);
+ init.el = config.el;
+
+ // ns
+ ns.plugin = appConfig.plugin;
+ ns.dashboard = appConfig.dashboard;
+ ns.crossDomain = appConfig.crossDomain;
+ ns.skipMask = appConfig.skipMask;
+ ns.skipFade = appConfig.skipFade;
+ ns.el = appConfig.el;
+ ns.username = appConfig.username;
+ ns.password = appConfig.password;
+ ns.ajax = support.connection.ajax;
+
// message
web.message = web.message || {};
@@ -3399,12 +3423,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.pivot.getData = function(layout, isUpdateGui) {
@@ -3460,12 +3479,7 @@
config.success = success;
config.failure = failure;
- if (type === 'jsonp') {
- Ext.data.JsonP.request(config);
- }
- else {
- Ext.Ajax.request(config);
- }
+ ns.ajax(config, ns);
};
web.pivot.createTable = function(layout, response, xResponse, isUpdateGui) {
@@ -3584,16 +3598,6 @@
//web.pivot.createTable(layout, null, response, false);
//};
- // ns
- 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;
-
//if (!ns.skipFade && el) {
//el.setStyle('opacity', 0);
//}
@@ -3619,7 +3623,9 @@
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
+ el: Ext.isString(config.el) ? config.el : null,
+ username: Ext.isString(config.username) ? config.username : null,
+ password: Ext.isString(config.password) ? config.password : null
};
// css