forked from extern/egroupware
inject preprocessor and (daily) cache-buster for templates in dialog widget
also allow for a xml comment inside the deprecated menulist tag fixes Admin ACL popup
This commit is contained in:
parent
77b475b5e6
commit
38721229b0
@ -71,7 +71,7 @@ function send_template()
|
|||||||
}, $str);
|
}, $str);
|
||||||
|
|
||||||
// fix <menulist...><menupopup type="select-*"/></menulist> --> <select type="select-*" .../>
|
// fix <menulist...><menupopup type="select-*"/></menulist> --> <select type="select-*" .../>
|
||||||
$str = preg_replace('#<menulist([^>]*)>[\r\n\s]*<menupopup([^>]+>)[\r\n\s]*</menulist>#', '<select$1$2', $str);
|
$str = preg_replace('#<menulist([^>]*)>[\r\n\s]*(<!--[^>]+-->[\r\n\s]*)?<menupopup([^>]+>)[\r\n\s]*</menulist>#', '$2<select$1$3', $str);
|
||||||
|
|
||||||
// fix legacy options, so new client-side has not to deal with them
|
// fix legacy options, so new client-side has not to deal with them
|
||||||
$str = preg_replace_callback('#<([^- />]+)(-[^ ]+)?[^>]* (options="([^"]+)")[ />]#', static function ($matches) {
|
$str = preg_replace_callback('#<([^- />]+)(-[^ ]+)?[^>]* (options="([^"]+)")[ />]#', static function ($matches) {
|
||||||
|
@ -524,6 +524,17 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
|
|||||||
{
|
{
|
||||||
let old_template = this.__template;
|
let old_template = this.__template;
|
||||||
this.__template = new_template_name;
|
this.__template = new_template_name;
|
||||||
|
// inject preprocessor, if not already in template-url
|
||||||
|
const webserverUrl = this.egw().webserverUrl;
|
||||||
|
if (!new_template_name.match(new RegExp(webserverUrl+'/api/etemplate.php')))
|
||||||
|
{
|
||||||
|
this.__template = new_template_name.replace(new RegExp(webserverUrl), webserverUrl+'/api/etemplate.php');
|
||||||
|
}
|
||||||
|
// if we have no cache-buster, reload daily
|
||||||
|
if (this.__template.indexOf('?') === -1)
|
||||||
|
{
|
||||||
|
this.__template += '?'+((new Date).valueOf()/86400|0).toString();
|
||||||
|
}
|
||||||
this.requestUpdate("template", old_template);
|
this.requestUpdate("template", old_template);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1169,4 +1180,4 @@ customElements.define("et2-dialog", Et2Dialog);
|
|||||||
{
|
{
|
||||||
window['et2_dialog'] = Et2Dialog;
|
window['et2_dialog'] = Et2Dialog;
|
||||||
window['Et2Dialog'] = Et2Dialog;
|
window['Et2Dialog'] = Et2Dialog;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user