Bug 21016

Summary: Plugins: Expand usage of opac_js method, or create intranet_js
Product: Koha Reporter: Andrew Isherwood <bugzilla>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: julian.maurice, kyle
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Andrew Isherwood 2018-06-29 09:54:48 UTC
There is an opac_js method which gives the opportunity for a plugin to return some Javascript to be embedded in the OPAC. I propose that we either make this method more generic, perhaps, plugin_js, so it can reasonably be used for JS for either the OPAC or intranet, or we add an intranet_js method for embedding JS in plugins that touch the staff client.

I suspect there's a use case for a plugin wanting to return different JS for the OPAC and staff client, so the latter idea might be preferable.

The inspiration for this proposal is the CLA Check Permissions plugin (Bug 20968), the current workflow is a bit clunky with the button on the Bib toolbar taking the user to a page generated by the plugin, on which the main Javascript is run, opening a modal. The plugin has no use for the additional page, but is necessary to run the Javascript. The proposal would allow us to run the Javascript directly in the Bib view, which would make for a better UX.
Comment 1 Kyle M Hall 2018-06-29 12:51:24 UTC
I would *definitely* say we would want separate intranet_js *AND* intranet_head methods to keep parity with the opac feature. It also makes sense to have separate methods instead of re-using the opac ones.
Comment 2 Julian Maurice 2019-01-09 14:14:05 UTC
Duplicate of bug 21352 ?
Comment 3 Kyle M Hall 2019-01-09 14:21:59 UTC
Definitely a duplicate!

*** This bug has been marked as a duplicate of bug 21352 ***