mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 15:48:55 +01:00
share loaded eTemplates with iframes and popups, this way they dont need to load templates in same EGroupware session again (unless main window get reloaded), also adding now a cache-buster by default, if server dont supply one
This commit is contained in:
parent
d100187584
commit
48fa4c1857
@ -88,7 +88,7 @@ var et2_template = et2_DOMWidget.extend(
|
|||||||
|
|
||||||
// Check to see if XML is known
|
// Check to see if XML is known
|
||||||
var xml = null;
|
var xml = null;
|
||||||
var templates = etemplate2.prototype.templates || this.getRoot().getInstanceManager().templates;
|
var templates = etemplate2.prototype.templates; // use global eTemplate cache
|
||||||
if(!(xml = templates[template_name]))
|
if(!(xml = templates[template_name]))
|
||||||
{
|
{
|
||||||
// Check to see if ID is short form --> prepend parent/top-level name
|
// Check to see if ID is short form --> prepend parent/top-level name
|
||||||
@ -105,12 +105,13 @@ var et2_template = et2_DOMWidget.extend(
|
|||||||
var splitted = template_name.split('.');
|
var splitted = template_name.split('.');
|
||||||
// use template base url from initial template, to continue using webdav, if that was loaded via webdav
|
// use template base url from initial template, to continue using webdav, if that was loaded via webdav
|
||||||
var path = this.getRoot()._inst.template_base_url + splitted.shift() + "/templates/default/" +
|
var path = this.getRoot()._inst.template_base_url + splitted.shift() + "/templates/default/" +
|
||||||
splitted.join('.')+ ".xet" + (cache_buster ? '?'+cache_buster : '');
|
splitted.join('.')+ ".xet" + (cache_buster ? '?'+cache_buster :
|
||||||
|
// if server did not give a cache-buster, fall back to current time
|
||||||
|
'?download='+(new Date).valueOf());
|
||||||
|
|
||||||
if(splitted.length)
|
if(splitted.length)
|
||||||
{
|
{
|
||||||
et2_loadXMLFromURL(path, function(_xmldoc) {
|
et2_loadXMLFromURL(path, function(_xmldoc) {
|
||||||
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];
|
||||||
|
@ -101,11 +101,26 @@ function etemplate2(_container, _menuaction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List of templates (XML) that are known, not always used. Indexed by id.
|
// List of templates (XML) that are known, not always used. Indexed by id.
|
||||||
etemplate2.prototype.templates = {};
|
// We share list of templates with iframes and popups
|
||||||
|
try {
|
||||||
|
if (opener && opener.etemplate2)
|
||||||
|
{
|
||||||
|
etemplate2.prototype.templates = opener.etemplate2.prototype.templates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
// catch security exception if opener is from a different domain
|
||||||
|
}
|
||||||
|
if (typeof etemplate2.prototype.templates == "undefined")
|
||||||
|
{
|
||||||
|
etemplate2.prototype.templates = top.etemplate2.prototype.templates || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the resize event of all widgets
|
* Calls the resize event of all widgets
|
||||||
|
*
|
||||||
|
* @param {jQuery.event} e
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype.resize = function(e)
|
etemplate2.prototype.resize = function(e)
|
||||||
{
|
{
|
||||||
@ -181,19 +196,6 @@ etemplate2.prototype.clear = function()
|
|||||||
this.widgetContainer = null;
|
this.widgetContainer = null;
|
||||||
}
|
}
|
||||||
$j(this.DOMContainer).empty();
|
$j(this.DOMContainer).empty();
|
||||||
|
|
||||||
// Remove self from the index
|
|
||||||
for(name in this.templates)
|
|
||||||
{
|
|
||||||
if(typeof etemplate2._byTemplate[name] == "undefined") continue;
|
|
||||||
for(var i = 0; i < etemplate2._byTemplate[name].length; i++)
|
|
||||||
{
|
|
||||||
if(etemplate2._byTemplate[name][i] == this)
|
|
||||||
{
|
|
||||||
etemplate2._byTemplate[name].splice(i,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user