When an ajax response includes a directive to load a javascript file, try to load it using the API - allows cache to skip known files

This commit is contained in:
Nathan Gray 2013-04-01 18:39:03 +00:00
parent bdb148d167
commit 792152497c

View File

@ -368,6 +368,32 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
if (data && data.response)
{
var hasResponse = false;
// Try to load files using API
if(egw && egw().includeJS)
{
var js_files = [];
var css_files = [];
for (var i = data.response.length - 1; i > 0; --i)
{
var res = data.response[i];
if(res.type == 'js' && typeof res.data == 'string')
{
js_files.unshift(res.data);
this.loadedJSFiles[res.data] = false;
data.response.splice(i,1);
}
}
if(js_files.length > 0)
{
egw().includeJS(js_files, function() {
for(var i = 0; i < js_files.length; i++)
{
this.loadedJSFiles[js_files[i]] = true;
}
this.checkLoadFinish();
},this);
}
}
for (var i = 0; i < data.response.length; i++)
{
try