nsedit icon indicating copy to clipboard operation
nsedit copied to clipboard

Add support to load templates from json files

Open bartvanhalder opened this issue 1 year ago • 2 comments

Our config.inc.php was getting a bit long and unreadable, so i added support for loading templates from .json files.

For existing installs this changes nothing as templates loaded from files are appended to the existing $templates before the "is this user allowed to use this template" check.

If an error is encountered loading a template a message is logged and the template is skipped.

bartvanhalder avatar Jul 25 '24 13:07 bartvanhalder

Cool, thanks. How do 'we' feel about including json-files that are not checked on sanity at all?

tuxis-ie avatar Aug 19 '24 12:08 tuxis-ie

I can see two ways of reasoning here myself.

The first one would be that this is already slightly more sanity checked than templates in config.inc.php. Because a failed file_get_contents or json_decode will only result in an error in the log and a correctly functioning nsedit (but without the template that failed to load).

The second way of thinking would be that if someone touches this anyway they should do full sanity checking on the content of the template as well. I obviously did not do that as i wasn't sure the functionality would be welcome in nsedit at all, but if you want i can try to find the time to add full sanity checking to the loaded templates.

bartvanhalder avatar Aug 20 '24 09:08 bartvanhalder

@tuxis-ie Is it possible to merge this, or are there still unresolved objections?

ekoster avatar Jan 14 '25 12:01 ekoster