====== 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 ==== https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/server-print-templates 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 returned as-is (i.e. a text/html page) avoiding the unnecessary opensrf packaging. ==== 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.