mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
- More consistent firing of load event, so templates can be handled the same if the template has to be fetched or it's already there
- Caching of fetched templates in the instance manager
This commit is contained in:
parent
603fb8e782
commit
1e8e86fe23
@ -111,7 +111,7 @@ var et2_template = et2_DOMWidget.extend(
|
||||
// Still loading, don't fire loading finished
|
||||
this.loading = true;
|
||||
et2_loadXMLFromURL(path, function(_xmldoc) {
|
||||
var templates = {};
|
||||
var templates = this.getInstanceManager().templates || {};
|
||||
// Scan for templates and store them
|
||||
for(var i = 0; i < _xmldoc.childNodes.length; i++) {
|
||||
var template = _xmldoc.childNodes[i];
|
||||
@ -125,13 +125,11 @@ var et2_template = et2_DOMWidget.extend(
|
||||
// Update flag
|
||||
this.loading = false;
|
||||
|
||||
// If the parent is already attached, it has already
|
||||
// finished loading. This template and its children
|
||||
// were left out, so they need processing
|
||||
if(!this.isAttached() && this._parent.isAttached())
|
||||
{
|
||||
this.loadingFinished();
|
||||
}
|
||||
// Fire the load event (after)
|
||||
var self = this;
|
||||
window.setTimeout(function() {
|
||||
$j(self.getDOMNode()).trigger('load');
|
||||
},0);
|
||||
|
||||
}, this);
|
||||
}
|
||||
@ -144,6 +142,11 @@ var et2_template = et2_DOMWidget.extend(
|
||||
this.loadFromXML(xml);
|
||||
// Don't call this here - premature
|
||||
//this.loadingFinished();
|
||||
// Fire the load event (after)
|
||||
var self = this;
|
||||
window.setTimeout(function() {
|
||||
$j(self.getDOMNode()).trigger('load');
|
||||
},0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -178,10 +181,6 @@ var et2_template = et2_DOMWidget.extend(
|
||||
doLoadingFinished: function() {
|
||||
if(this.loading) return false;
|
||||
this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
window.setTimeout(function() {
|
||||
$j(self.getDOMNode()).trigger('load');
|
||||
},0);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user