Bug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack
commit9077d5a172149c92485bb3b89778c6493a7d8f44
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 20 Dec 2016 15:11:36 +0000 (20 16:11 +0100)
committerMason James <mtj@kohaaloha.com>
Tue, 24 Jan 2017 23:49:16 +0000 (25 12:49 +1300)
tree851ebe7562d2ba95e2e9c913cf3e9ff61de55e85
parent1c0abdf23eca26ecadfd09af33b831867a8b983d
Bug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack

Look at e.g. the URL for Show More at the end of the output of Records or
Identifiers. If you use Plack, you will see that it refers to
yourserver:/opac/oai.pl, which is not correct.

This is caused by using CGI's self_url in combination with script alias,
mounting point, etc. Note that we cannot solve this problem in the code of
Koha only. Since HTTP::OAI modules also call self_url, we still end up
with some wrong url's.

Instead of a larger architectural operation on Apache and Plack config files,
this patch adjusts the final xslt transformation on the OAI response.
It hardcodes the correct path only once, in a xslt variable. And replaces
all oai:OAI-PMH/oai:request/text() calls, containing wrong URLs, by this
variable.

Test plan:
Run oai.pl. Try the various verbs.
Verify that the URLs point to /cgi-bin/koha/oai.pl.

Edit: changed commit subject

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Works as expected. Good workaround until a definitive solution is implemented.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Mason James <mtj@kohaaloha.com>
koha-tmpl/opac-tmpl/xslt/OAI.xslt