mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
Fixed bug with etemplate2 not working properly especially in idots: JS files only get included if they really have not already been included; egw object gets included before 'lang' in idots
This commit is contained in:
parent
1575434535
commit
36314a077e
@ -27,37 +27,35 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
*/
|
||||
var files = {};
|
||||
|
||||
function addFile(src)
|
||||
{
|
||||
if (src)
|
||||
{
|
||||
// Remove everything after the "?"
|
||||
src = src.split('?').shift();
|
||||
files[src] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather all already loaded JavaScript and CSS files on document load.
|
||||
*
|
||||
* TODO: Currently this can only contain the JS files present in the main
|
||||
* window.
|
||||
*/
|
||||
this.module('ready', _wnd).ready(function() {
|
||||
// Iterate over the script tags
|
||||
var scripts = _wnd.document.getElementsByTagName('script');
|
||||
for (var i = 0; i < scripts.length; i++)
|
||||
{
|
||||
var src = scripts[i].getAttribute('src');
|
||||
|
||||
if (src)
|
||||
{
|
||||
files[src] = true;
|
||||
}
|
||||
addFile(scripts[i].getAttribute('src'));
|
||||
}
|
||||
|
||||
// Iterate over the link tags
|
||||
var links = _wnd.document.getElementsByTagName('link');
|
||||
for (var i = 0; i < links.length; i++)
|
||||
{
|
||||
var src = links[i].getAttribute('href');
|
||||
|
||||
if (src)
|
||||
{
|
||||
files[src] = true;
|
||||
addFile(links[i].getAttribute('href'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function includeJSFile(_jsFile, _callback, _context)
|
||||
{
|
||||
@ -105,6 +103,10 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
// Request the given javascript file
|
||||
egw.debug('info', 'Requested JS file "%s" from server', _jsFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
alreadyLoaded = true;
|
||||
}
|
||||
|
||||
// If the file is already loaded, call the callback
|
||||
if (alreadyLoaded)
|
||||
|
@ -90,6 +90,8 @@ class idots_framework extends egw_framework
|
||||
self::$header_done = true;
|
||||
|
||||
// load translations
|
||||
self::validate_file('jsapi', 'egw', 'phpgwapi');
|
||||
|
||||
translation::add_app('etemplate');
|
||||
foreach(translation::$loaded_apps as $app => $lang)
|
||||
{
|
||||
@ -99,7 +101,6 @@ class idots_framework extends egw_framework
|
||||
));
|
||||
}
|
||||
|
||||
self::validate_file('jsapi', 'egw', 'phpgwapi');
|
||||
if ($this->isTop(false))
|
||||
{
|
||||
self::validate_file('.', 'etemplate2', 'etemplate');
|
||||
|
Loading…
Reference in New Issue
Block a user