mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
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);
|
||||
|
||||
// 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
|
||||
$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;
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user