dev:server_print_templates
This is an old revision of the document!
Table of Contents
Server Print Templates
What's the Problem?
- Templates whose syntax depends on the UI framework creates inconsistency and is not sustainable.
- Angular templates must be pre-compiled.
- Template modification requires local install and use of 'ng build'.
- Current template editing could be more secure (scrubbing scripts, etc.)
Proposal: Server Templates
- Templates are configured and stored in the database, similar to Action/Trigger templates, using Template Toolkit.
- Modifying templates requires permissions.
- Print templates can be saved per-org (and potentially per workstation if needed).
- Print templates are managed via admin UI.
- Support per-locale templates.
- Templates can produce different content types
- Templates are compiled for printing on the server
- At print time, the caller passes template data, template name, etc. to the server and receives a compiled (text, html, etc.) response.
- Template content can be scrubbed on the server for added security.
- We could use something like https://metacpan.org/pod/HTML::Restrict to remove all but an anointed set of HTML tags and attributes (for text/html templates)
- Note we are already using server-managed templates for self-checkout receipts, some ACQ interfaces, and various others, so the general concept is not new.
Proof of Concept
This creates a purpose-built template processor instead of using Action/Trigger for several reasons:
- A/T has a lot of moving parts which are not needed
- Printing needs to be as streamlined as possible to avoid slowing staff work flow.
- There is no environment building, etc.
- Provides an opportunity to add locale, content type, etc. support.
- Uses a mod_perl front-end so template content can be treated like a web page where desired and so the cross-walk to packaging the response as an opensrf message is bypassed.
Offline Caveat
The staff client offline interface will still require a small set of pre-compiled templates that live within the application, since it will not be able to call out for template compilation.
dev/server_print_templates.1555432614.txt.gz · Last modified: 2022/02/10 13:34 (external edit)