Bugzilla – Attachment 58338 Details for
Bug 17785
oai.pl returns wrong URLs under Plack
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack
Bug-17785-Fix-OAI-PMHs-XSLT-generated-URLs-under-P.patch (text/plain), 10.01 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-12-21 13:01:54 UTC
(
hide
)
Description:
Bug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-12-21 13:01:54 UTC
Size:
10.01 KB
patch
obsolete
>From c55a63b5dab6de89147191c2f7d787da22ff529e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 20 Dec 2016 16:11:36 +0100 >Subject: [PATCH] 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. >--- > koha-tmpl/opac-tmpl/xslt/OAI.xslt | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/xslt/OAI.xslt b/koha-tmpl/opac-tmpl/xslt/OAI.xslt >index 976f0c2..d9faccc 100644 >--- a/koha-tmpl/opac-tmpl/xslt/OAI.xslt >+++ b/koha-tmpl/opac-tmpl/xslt/OAI.xslt >@@ -18,6 +18,8 @@ > > <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> > >+ <xsl:variable name="oai_script_name">/cgi-bin/koha/oai.pl</xsl:variable> >+ > <xsl:template match="/"> > <html> > <head> >@@ -44,7 +46,7 @@ > </xsl:if> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=Identify')"></xsl:value-of> >+ select="concat($oai_script_name,'?verb=Identify')"></xsl:value-of> > </xsl:attribute> > Identify > </a> >@@ -56,7 +58,7 @@ > </xsl:if> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListSets')"></xsl:value-of> >+ select="concat($oai_script_name, '?verb=ListSets')"></xsl:value-of> > </xsl:attribute> > Sets > </a> >@@ -68,7 +70,7 @@ > </xsl:if> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc')"></xsl:value-of> >+ select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc')"></xsl:value-of> > </xsl:attribute> > Records > </a> >@@ -80,7 +82,7 @@ > </xsl:if> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListIdentifiers&metadataPrefix=oai_dc')"></xsl:value-of> >+ select="concat($oai_script_name, '?verb=ListIdentifiers&metadataPrefix=oai_dc')"></xsl:value-of> > </xsl:attribute> > Identifiers > </a> >@@ -93,7 +95,7 @@ > </xsl:if> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListMetadataFormats')"></xsl:value-of> >+ select="concat($oai_script_name, '?verb=ListMetadataFormats')"></xsl:value-of> > </xsl:attribute> > Metadata Formats > </a> >@@ -238,14 +240,14 @@ > <a> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', oai:setSpec/text())" /> >+ select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', oai:setSpec/text())" /> > </xsl:attribute> > Records > </a> > <a> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListIdentifiers&metadataPrefix=oai_dc&set=', oai:setSpec/text())" /> >+ select="concat($oai_script_name, '?verb=ListIdentifiers&metadataPrefix=oai_dc&set=', oai:setSpec/text())" /> > </xsl:attribute> > Identifiers > </a> >@@ -303,7 +305,7 @@ > <a> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> >+ select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> > </xsl:attribute> > <xsl:value-of select="text()" /> > </a> >@@ -367,7 +369,7 @@ > <a> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> >+ select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> > </xsl:attribute> > <xsl:value-of select="text()" /> > </a> >@@ -415,7 +417,7 @@ > <div class="col-lg-4"> > <a class="btn btn-default pull-right"> > <xsl:attribute name="href"> >- <xsl:value-of select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=GetRecord&metadataPrefix=oai_dc&identifier=', oai:identifier/text())" /> >+ <xsl:value-of select="concat($oai_script_name, '?verb=GetRecord&metadataPrefix=oai_dc&identifier=', oai:identifier/text())" /> > </xsl:attribute> > View Details > </a> >@@ -444,7 +446,7 @@ > <a> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> >+ select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> > </xsl:attribute> > <xsl:value-of select="text()" /> > </a> >@@ -481,7 +483,7 @@ > <a class="btn btn-default pull-right"> > <xsl:attribute name="href"> > <xsl:value-of >- select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=', oai:metadataPrefix/text())" /> >+ select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=', oai:metadataPrefix/text())" /> > </xsl:attribute> > List Records > </a> >@@ -505,7 +507,7 @@ > <div class="text-center"> > <a class="btn btn-primary"> > <xsl:attribute name="href"> >- <xsl:value-of select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=',/oai:OAI-PMH/oai:request/@verb,'&resumptionToken=', text())"></xsl:value-of> >+ <xsl:value-of select="concat($oai_script_name, '?verb=',/oai:OAI-PMH/oai:request/@verb,'&resumptionToken=', text())"></xsl:value-of> > </xsl:attribute> > Show More > </a> >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17785
:
58303
|
58338
|
58435