mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 12:51:52 +02: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
|
// Still loading, don't fire loading finished
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
et2_loadXMLFromURL(path, function(_xmldoc) {
|
et2_loadXMLFromURL(path, function(_xmldoc) {
|
||||||
var templates = {};
|
var templates = this.getInstanceManager().templates || {};
|
||||||
// Scan for templates and store them
|
// Scan for templates and store them
|
||||||
for(var i = 0; i < _xmldoc.childNodes.length; i++) {
|
for(var i = 0; i < _xmldoc.childNodes.length; i++) {
|
||||||
var template = _xmldoc.childNodes[i];
|
var template = _xmldoc.childNodes[i];
|
||||||
@ -125,13 +125,11 @@ var et2_template = et2_DOMWidget.extend(
|
|||||||
// Update flag
|
// Update flag
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
||||||
// If the parent is already attached, it has already
|
// Fire the load event (after)
|
||||||
// finished loading. This template and its children
|
var self = this;
|
||||||
// were left out, so they need processing
|
window.setTimeout(function() {
|
||||||
if(!this.isAttached() && this._parent.isAttached())
|
$j(self.getDOMNode()).trigger('load');
|
||||||
{
|
},0);
|
||||||
this.loadingFinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
@ -144,6 +142,11 @@ var et2_template = et2_DOMWidget.extend(
|
|||||||
this.loadFromXML(xml);
|
this.loadFromXML(xml);
|
||||||
// Don't call this here - premature
|
// Don't call this here - premature
|
||||||
//this.loadingFinished();
|
//this.loadingFinished();
|
||||||
|
// Fire the load event (after)
|
||||||
|
var self = this;
|
||||||
|
window.setTimeout(function() {
|
||||||
|
$j(self.getDOMNode()).trigger('load');
|
||||||
|
},0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -178,10 +181,6 @@ var et2_template = et2_DOMWidget.extend(
|
|||||||
doLoadingFinished: function() {
|
doLoadingFinished: function() {
|
||||||
if(this.loading) return false;
|
if(this.loading) return false;
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
var self = this;
|
|
||||||
window.setTimeout(function() {
|
|
||||||
$j(self.getDOMNode()).trigger('load');
|
|
||||||
},0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user