remove egw_app dependency and only import et2, if there is an eTemplate on the page

stops login-page from loading eT2 stuff
This commit is contained in:
Ralf Becker 2021-06-09 10:13:51 +02:00
parent 488f01aea9
commit 027c087a06

View File

@ -26,14 +26,12 @@
egw_tooltip; egw_tooltip;
egw_css; egw_css;
egw_calendar; egw_calendar;
egw_ready;
egw_data; egw_data;
egw_tail; egw_tail;
egw_inheritance; egw_inheritance;
egw_message; egw_message;
egw_notification; egw_notification;
app_base; app_base;
egw_app;
*/ */
(function() (function()
@ -344,35 +342,24 @@
}; };
// rest needs DOM to be ready // rest needs DOM to be ready
jQuery(function() {import('../etemplate/etemplate2.js').then(function(module){ jQuery(function()
{
// load etemplate2 template(s) // load etemplate2 template(s)
jQuery('form.et2_container[data-etemplate]').each( function(index, node){ jQuery('form.et2_container[data-etemplate]').each( function(index, node)
var data = JSON.parse(node.getAttribute('data-etemplate')) || {};
var currentapp = data.data.currentapp || window.egw_appName;
if(popup || window.opener && !egwIsMobile())
{ {
import('../etemplate/etemplate2.js').then((module) => {
const data = JSON.parse(node.getAttribute('data-etemplate')) || {};
if (popup || window.opener && !egwIsMobile()) {
// Resize popup when et2 load is done // Resize popup when et2 load is done
jQuery(node).on('load', function() { jQuery(node).on('load', () => window.setTimeout(resize_popup, 50));
if(typeof CKEDITOR !== 'undefined' && Object.keys(CKEDITOR.instances).length)
{
CKEDITOR.once('instanceReady',function() {
// Trigger a resize again once CKEDITOR is ready
window.resizeTo(egw_getWindowOuterWidth(), egw_getWindowOuterHeight() );
});
}
else
{
window.setTimeout(resize_popup, 50);
}
});
} }
const et2 = new module.etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content"); const et2 = new module.etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content");
et2.load(data.name,data.url,data.data); et2.load(data.name, data.url, data.data);
if (typeof data.response != 'undefined') if (typeof data.response !== 'undefined') {
{ const json_request = egw(window).json("");
var json_request = egw(window).json("");
json_request.handleResponse({response: data.response}); json_request.handleResponse({response: data.response});
} }
}).catch((e) => alert(e.message+"\n\n"+e.stack));
}); });
// Offline/Online checking part // Offline/Online checking part
@ -474,8 +461,8 @@
catch(e) { catch(e) {
// ignore SecurityError exception if top is different security context / cross-origin // ignore SecurityError exception if top is different security context / cross-origin
} }
})}); });
}, (e) => alert(e.message+"\n\n"+e.stack)); });
// //
window.egw_LAB.wait = window.egw_ready.then; window.egw_LAB.wait = window.egw_ready.then;