Bug 23076 - Include OpacUserJS on OPAC maintenance page
Summary: Include OpacUserJS on OPAC maintenance page
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-07 12:00 UTC by Katrin Fischer
Modified: 2020-06-04 20:32 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fix allows the OPAC maintenance page to use JavaScript included in the OPACUserJS system preference.
Version(s) released in:
19.11.00,19.05.01


Attachments
Bug 23076: Include OpacUserJS on OPAC maintenance page (1.61 KB, patch)
2019-06-07 12:16 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 23076: Include OpacUserJS on OPAC maintenance page (1.67 KB, patch)
2019-06-07 18:55 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 23076: Include OpacUserJS on OPAC maintenance page (1.73 KB, patch)
2019-06-07 19:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 23076: Include OpacUserJS on OPAC maintenance page (1.78 KB, patch)
2019-06-09 20:12 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2019-06-07 12:00:33 UTC
At the moment it's not possible to use OpacUserJS with the OPAC maintenance page. It would be nice to have that.
Comment 1 Owen Leonard 2019-06-07 12:16:14 UTC
Created attachment 90414 [details] [review]
Bug 23076: Include OpacUserJS on OPAC maintenance page

This patch coverts the syntax for embedding OpacUserJS in the global
include file so that it uses 'Koha.Preference' syntax. This makes the
data available in templates, like the OPAC maintenance page, to which
the preference data has not been explicitly provided.

To reproduce: Add some JavaScript to the OPACUserJS system preference
which will let you know it's working. For instance:

alert("OPACUserJS!");

Turn on the OPAC maintenance message using the OpacMaintenance system
preference. Navigate to the OPAC. You should see the system maintenance
page but you should not see an alert.

To test, apply the patch and reload the OPAC page. Your alert should
show.
Comment 2 Maryse Simard 2019-06-07 18:55:52 UTC Comment hidden (obsolete)
Comment 3 David Nind 2019-06-07 19:07:38 UTC Comment hidden (obsolete)
Comment 4 David Nind 2019-06-07 19:37:30 UTC
Should the title now be 'Include OpacUserJS in templates'? Not understanding the nuts and bolts of this, my limited understanding as that the OPAC maintenance page is just one place it can be used.
Comment 5 David Nind 2019-06-07 19:38:02 UTC
Also, have I got the text for the release notes right?
Comment 6 Owen Leonard 2019-06-07 19:48:10 UTC
(In reply to David Nind from comment #4)
> Should the title now be 'Include OpacUserJS in templates'? 

OpacUserJS was available to almost all templates before this patch. I'm not sure if the maintenance page was the only one which lacked it. My patch ensures that the bug affecting the maintenance page won't affect other pages for the same reason.

It would be safer to keep the title as-is. The release notes should be indicate that this is a bug fix affecting the OPAC maintenance page.
Comment 7 David Nind 2019-06-07 20:36:49 UTC
Thnaks Owen! I've updated the text for the release notes.
Comment 8 Katrin Fischer 2019-06-09 20:12:36 UTC
Created attachment 90445 [details] [review]
Bug 23076: Include OpacUserJS on OPAC maintenance page

This patch coverts the syntax for embedding OpacUserJS in the global
include file so that it uses 'Koha.Preference' syntax. This makes the
data available in templates, like the OPAC maintenance page, to which
the preference data has not been explicitly provided.

To reproduce: Add some JavaScript to the OPACUserJS system preference
which will let you know it's working. For instance:

alert("OPACUserJS!");

Turn on the OPAC maintenance message using the OpacMaintenance system
preference. Navigate to the OPAC. You should see the system maintenance
page but you should not see an alert.

To test, apply the patch and reload the OPAC page. Your alert should
show.

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

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2019-06-09 20:12:49 UTC
Thank you for the quick fix!
Comment 10 Martin Renvoize 2019-06-11 07:38:10 UTC
Nice work!

Pushed to master for 19.11.00
Comment 11 Martin Renvoize 2019-06-11 09:24:18 UTC
Nice work!

Pushed to master for 19.11.00
Comment 12 Fridolin Somers 2019-06-11 15:25:24 UTC
Pushed to 19.05.x for 19.05.01
Comment 13 Lucas Gass 2019-06-14 20:53:44 UTC
backported to 18.11.x for 18.11.07