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; import('../etemplate/etemplate2.js').then((module) => {
if(popup || window.opener && !egwIsMobile()) 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) }
{ const et2 = new module.etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content");
CKEDITOR.once('instanceReady',function() { et2.load(data.name, data.url, data.data);
// Trigger a resize again once CKEDITOR is ready if (typeof data.response !== 'undefined') {
window.resizeTo(egw_getWindowOuterWidth(), egw_getWindowOuterHeight() ); const json_request = egw(window).json("");
}); json_request.handleResponse({response: data.response});
} }
else }).catch((e) => alert(e.message+"\n\n"+e.stack));
{
window.setTimeout(resize_popup, 50);
}
});
}
const et2 = new module.etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content");
et2.load(data.name,data.url,data.data);
if (typeof data.response != 'undefined')
{
var json_request = egw(window).json("");
json_request.handleResponse({response: data.response});
}
}); });
// 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;