Start to build data conservation policy settings

This commit is contained in:
2021-02-16 18:00:26 +01:00
parent 562293a2e0
commit bb81512f2c
9 changed files with 13888 additions and 19 deletions

View File

@ -0,0 +1,22 @@
/**
* Server configuration
*
* @author Pierre Hubert
*/
let _serverConfigCache = null;
class ServerConfig {
static async ensureLoaded() {
if (!_serverConfigCache)
_serverConfigCache = await api("server/config");
}
/**
* @returns {StaticServerConfig}
*/
static get conf() {
return _serverConfigCache;
}
}

View File

@ -4,7 +4,7 @@
* @author Pierre HUBERT
*/
ComunicWeb.common.page = {
const Page = {
/**
* Save the current page url
@ -542,5 +542,26 @@ ComunicWeb.common.page = {
if(!ComunicWeb.common.network.getRequest(templateURL, true, afterTemplateDownload))
//An error occured
return false;
},
/**
* Load an HTML template
*
* @param {String} name The name of the template to load
*/
loadHTMLTemplate: async function(name) {
let tpl = await (await fetch(ComunicWeb.__config.templatesURL + name)).text();
for(let entry of [...tpl.matchAll("tr\\(\"[^\"]+\"\\)")])
{
entry = entry[0]
const start = entry.indexOf("\"") + 1
const end = entry.lastIndexOf("\"");
tpl = tpl.replace(entry, tr(entry.substring(start, end)))
}
return tpl;
}
};
};
ComunicWeb.common.page = Page;