This commit is contained in:
2020-09-14 19:30:55 +00:00
parent 0f00713a9e
commit 3d7aca6ac9
2 changed files with 9 additions and 2 deletions

View File

@@ -395,9 +395,15 @@ namespace AyaNova.Biz
//add report pre-render, helpers and style
//TODO: Add code to vet / evaluate these scripts and see if they are safe and contain valid methods expected
if(string.IsNullOrWhiteSpace(report.JsPrerender)){
report.JsPrerender="async function ayPrepareData(reportData){return reportData;}";
}
await page.AddScriptTagAsync(new AddTagOptions() { Content = report.JsPrerender });
await page.AddScriptTagAsync(new AddTagOptions() { Content = report.JsHelpers });
await page.AddStyleTagAsync(new AddTagOptions() { Content = report.Style });
if (!string.IsNullOrWhiteSpace(report.JsHelpers))
await page.AddScriptTagAsync(new AddTagOptions() { Content = report.JsHelpers });
if (!string.IsNullOrWhiteSpace(report.Style))
await page.AddStyleTagAsync(new AddTagOptions() { Content = report.Style });
log.LogDebug($"Preparing page: adding Client meta data");

View File

@@ -0,0 +1 @@
{"Name":"EXAMPLE WIKI helper","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"<html>\n\n<body>\n\t{{#each ayReportData}}\n\t<h1>Object name:</h1> \n\t{{ Name }}\n\t<h1>Object WIKI:</h1>\n\t{{ ayWiki Wiki }}\n\t{{/each}}\n</body>\n\n</html>","Style":"","JsPrerender":"async function ayPrepareData(reportData){ \n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders\n //see the help documentation for details\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\n","RenderType":0}