fix indention making debugging wired otherwise

This commit is contained in:
ralf 2022-03-09 09:43:39 +02:00
parent f7f4053d1a
commit 5fd4423775

View File

@ -140,58 +140,58 @@ export class et2_template extends et2_DOMWidget
splitted.join('.') + ".xet" + (cache_buster ? '?download=' + cache_buster : ''); splitted.join('.') + ".xet" + (cache_buster ? '?download=' + cache_buster : '');
} }
// if server did not give a cache-buster, fall back to current time // if server did not give a cache-buster, fall back to current time
if (url.indexOf('?') == -1) url += '?download='+(new Date).valueOf(); if (url.indexOf('?') == -1) url += '?download='+(new Date).valueOf();
if(this.options.url || splitted.length) if(this.options.url || splitted.length)
{
var fetch_url_callback = function(_xmldoc)
{ {
// Scan for templates and store them var fetch_url_callback = function(_xmldoc)
for(var i = 0; i < _xmldoc.childNodes.length; i++)
{ {
var template = _xmldoc.childNodes[i]; // Scan for templates and store them
if(template.nodeName.toLowerCase() != "template") for(var i = 0; i < _xmldoc.childNodes.length; i++)
{ {
continue; var template = _xmldoc.childNodes[i];
if(template.nodeName.toLowerCase() != "template")
{
continue;
}
templates[template.getAttribute("id")] = template;
} }
templates[template.getAttribute("id")] = template;
}
// Read the XML structure of the requested template // Read the XML structure of the requested template
if(typeof templates[template_name] != 'undefined') if(typeof templates[template_name] != 'undefined')
{ {
this.loadFromXML(templates[template_name]); this.loadFromXML(templates[template_name]);
} }
// Update flag // Update flag
resolve(); resolve();
}.bind(this); }.bind(this);
et2_loadXMLFromURL(url, fetch_url_callback, this, function( error) { et2_loadXMLFromURL(url, fetch_url_callback, this, function( error) {
url = egw.link('/'+ app + "/templates/default/" + url = egw.link('/'+ app + "/templates/default/" +
splitted.join('.')+ ".xet", {download:cache_buster? cache_buster :(new Date).valueOf()}); splitted.join('.')+ ".xet", {download:cache_buster? cache_buster :(new Date).valueOf()});
et2_loadXMLFromURL(url, fetch_url_callback, this); et2_loadXMLFromURL(url, fetch_url_callback, this);
}); });
}
return;
} }
return;
} }
} if(xml !== null && typeof xml !== "undefined")
if(xml !== null && typeof xml !== "undefined") {
{ this.egw().debug("log", "Loading template from XML: ", template_name);
this.egw().debug("log", "Loading template from XML: ", template_name); this.loadFromXML(xml);
this.loadFromXML(xml); // Don't call this here - done by caller, or on whole widget tree
// Don't call this here - done by caller, or on whole widget tree //this.loadingFinished();
//this.loadingFinished();
// But resolve the promise // But resolve the promise
resolve(); resolve();
} }
else else
{ {
this.egw().debug("warn", "Unable to find XML for ", template_name); this.egw().debug("warn", "Unable to find XML for ", template_name);
reject() reject()
} }
} }
else else
{ {
@ -272,4 +272,3 @@ export class et2_template extends et2_DOMWidget
} }
} }
et2_register_widget(et2_template, ["template"]); et2_register_widget(et2_template, ["template"]);