===== Notification templates =====
{{tag> notification template configuration}}
==== System templates ====
If you tick a template as a system one (either in the form of FE or in XML), for this template it will not be allowed to change the attributes of FE forms: system template indication, parameters, and code. System templates are closely tied with BE; currently it isn't allowed to change any of their attributes.
==== Templates and FE ====
We can edit templates (html, text, subject) using a simple WYSIWYG editor.
{{:navrh:sni_mek_obrazovky_2017-03-10_v_10.44.38.png|}}
This WYSIWYG editor allows simplified filling template parameters with putting character **$**. After we put this character into editor, we are offered a current list of parameters:
{{:navrh:sni_mek_obrazovky_2017-03-10_v_10.47.18.png|}}
We can use any available style from WYSIWYG editor for parameters and their combinations.
Style MUST be applied on all parameters including character **$**. The style can't be applied for merely one part of parameters. See examples
**Well applied style to parameter:**
{{:navrh:sni_mek_obrazovky_2017-03-10_v_10.50.53.png|}}
**Poorly applied style to parameter:**
{{:navrh:sni_mek_obrazovky_2017-03-10_v_10.51.46.png|}}
==== Deploy of templates from an external source ====
For setting up an external folder with templates, you can use the property '**idm.sec.core.notification.template.folder**' and value `classpath*:/eu/bcvsolutions/idm/templates/, file:/home/some_user/templates/`.
=== XML template structure ===
A template saved in resources as an XML file has the following structure:
Template name
//code//Unique template code///code//
Notification subject
Notification body, html can be used (if using html, don't forget the CDATA! block)
Notification body without html.
Notification parameters, separated by a comma
Indication whether it is a system template, see system templates for more
Module identifier for which the template is created, informative indication on the FE
Schema for an XML file can be found in the XSD file: [[https://github.com/bcvsolutions/CzechIdMng/blob/develop/Realization/backend/core/core-impl/src/main/resources/eu/bcvsolutions/idm/templates/IdmNotificationTemplate.xsd|IdmNotificationTemplate.xsd]]
All template elements are required. It is **desirable** to place only one template within one file, i.e. one root element template.
Loading of templates is currently done at the start of the application only if there isn't **any other** system template.
==== Redeploy and backup ====
In the notification template agenda, it is possible to restore/redeploy/refresh templates that are in the resources. For templates that cannot be found there, it isn't possible to apply restore/reload/refresh process.
It is possible to back up all templates regardless of their origin.
For backup and redeploy, you must enable this configured property:
idm.sec.core.backups.default.folder.path=
If configuration property is set and no folder exists, the folder will be created.