Bug 23237 - Plugin allow [% INCLUDE %] from template
Summary: Plugin allow [% INCLUDE %] from template
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Frédéric Demians
QA Contact: Nick Clemens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-29 06:54 UTC by Frédéric Demians
Modified: 2019-09-20 22:02 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.03


Attachments
Bug 23237 Plugin allow [% INCLUDE %] from template (3.33 KB, patch)
2019-06-29 07:10 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 23237 Plugin allow [% INCLUDE %] from template (3.39 KB, patch)
2019-07-05 20:11 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 23237: Plugin allow [% INCLUDE %] from template (3.45 KB, patch)
2019-07-30 13:52 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 23237: Fix POD and typos (1.29 KB, patch)
2019-07-30 13:52 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Demians 2019-06-29 06:54:58 UTC
From a plugin template it is useful to be able to include other templates with [% INCLUDE %] directives. But TT module is used by Koha with absolute paths. Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %] allow plugin templates to know where to find plugin home directory.
Comment 1 Frédéric Demians 2019-06-29 07:10:31 UTC
Created attachment 91128 [details] [review]
Bug 23237 Plugin allow [% INCLUDE %] from template

From a plugin template it is useful to be able to include other templates with
[% INCLUDE %] directives. But TT module is used by Koha with absolute paths.
Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %]
allow plugin templates to know where to find plugin home directory.

How to test:

1. Install kitchen-sink plugin.

2. Find tool-step1.tt file, and add this at the begining of the file:
   [% INCLUDE "$PLUGIN_DIR/header.tt" %]
   It ask to include a template header.tt which doesn't exit.

3. Run kitchen-sink plugin tool. You must have this error message:

   Template process failed: file error - _path to plugin
   directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found

   quod erat demonstrandum
Comment 2 Maryse Simard 2019-07-05 20:11:24 UTC
Created attachment 91374 [details] [review]
Bug 23237 Plugin allow [% INCLUDE %] from template

From a plugin template it is useful to be able to include other templates with
[% INCLUDE %] directives. But TT module is used by Koha with absolute paths.
Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %]
allow plugin templates to know where to find plugin home directory.

How to test:

1. Install kitchen-sink plugin.

2. Find tool-step1.tt file, and add this at the begining of the file:
   [% INCLUDE "$PLUGIN_DIR/header.tt" %]
   It ask to include a template header.tt which doesn't exit.

3. Run kitchen-sink plugin tool. You must have this error message:

   Template process failed: file error - _path to plugin
   directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found

   quod erat demonstrandum

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Comment 3 Nick Clemens 2019-07-30 13:52:44 UTC
Created attachment 91875 [details] [review]
Bug 23237: Plugin allow [% INCLUDE %] from template

From a plugin template it is useful to be able to include other templates with
[% INCLUDE %] directives. But TT module is used by Koha with absolute paths.
Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %]
allow plugin templates to know where to find plugin home directory.

How to test:

1. Install kitchen-sink plugin.

2. Find tool-step1.tt file, and add this at the begining of the file:
   [% INCLUDE "$PLUGIN_DIR/header.tt" %]
   It ask to include a template header.tt which doesn't exit.

3. Run kitchen-sink plugin tool. You must have this error message:

   Template process failed: file error - _path to plugin
   directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found

   quod erat demonstrandum

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens 2019-07-30 13:52:47 UTC
Created attachment 91876 [details] [review]
Bug 23237: Fix POD and typos

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Martin Renvoize 2019-08-05 14:47:55 UTC
Nice work!

Pushed to master for 19.11.00
Comment 6 Martin Renvoize 2019-08-05 14:51:19 UTC
Nice work!

Pushed to master for 19.11.00
Comment 7 Fridolin SOMERS 2019-08-09 13:45:56 UTC
Nice enhancement.
I choose to backport so than Koha Plugins can already be developed/updated with this.

Pushed to 19.05.x for 19.05.03
Comment 8 Lucas Gass 2019-09-17 19:25:49 UTC
following Fridolin's lead and backporting this enhancement to 18.11.x for 18.11.10
Comment 9 Lucas Gass 2019-09-20 22:02:20 UTC
this patchset made me unable to prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t in 18.11.x, since this is an enhancement i am choosing to revert the patch set in 18.11.x