Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Should be XSLT::Base now.
Removes old XSLT_Handler stub too (from bug 23290).
Result of a git grep | sed statement.
Test plan:
Run qa tools (so modules compile).
Run t/db_dependent/Breeding.t
Run t/db_dependent/Koha/XSLT/Base.t (This test fails when only this patch
has been applied; see subsequent patch.)
Enable XSLT use on results and details display. Check search results and
detail view on OPAC and staff.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Speaks for itself. No test plan.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The script contains some error responses that get lost when using them
in an eval statement. (Since exit should not be used within an eval
construction.) The eval is removed now.
Test plan:
[1] Before applying this patch, you could look at the current responses
from unapi for the calls in the next steps. Apply the patch now.
[2] Call http(s)://[your-server]/cgi-bin/koha/unapi with only a format
parameter.
Check if you have a 400 status response. (In Firefox, look at Network
tab of Developer Tools.)
Note: Have to admit (reluctantly) that MS Edge shows the status code in
the browser rightaway in contrast with Firefox.
[3] Call unapi with a format=marcxml&id=999
The wrong id parameter should trigger a 404 response.
[4] Call unapi with format=marcxml&id=koha:biblionumber:[notexist]
where notexist is a biblionumber that not exists.
This should trigger again a 404 response.
[5] Call unapi with format=marcxmlx&id=koha:biblionumber:[exist]
where exist should be a good biblionumber.
The wrong format should trigger a 406 response.
[6] Bonus: The 500 response can be tested by manipulating a XSLT file.
Create invalid xml in the file for marcxml (identity.xsl in intranet
xslt folder).
Call unapi with format=marcxml&id=koha:biblionumber:[exist].
You should get a 500 response and have warnings in your logfile.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Replaces some code by a call to existing module.
Removes the $@->code and $@->message calls.
Test plan
[1] Run /cgi-bin/koha/unapi?id=koha:biblionumber:[number]&format=marcxml
[2] Try some variations.
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Fix also, marginaly, OAI-DC XSL file which were using 090$a as biblionumber
rather than 001.
To test with an Unimarc Catalog:
- Open this URL
/cgi-bin/koha/unapi?id=koha:biblionumber:41201&format=marcxml
And play with id & format parameters
Test format=rdfdc and format=srw_dc
- Or try with bug 13642
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Both XML formats generated successfully. Also fix
problem with OPACBaseURL in UNIMARC environment. Tested with Sandbox too.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Fix bad utf8 decoding, also fix status code 200 for no parameters passed to
script
To reproduce the issue in OPAC
1) Copy from LOC (Z39.50) ISBN 8467020113 or test it with whichever record with
special characters
2) Open URL in OPAC cgi-bin/koha/unapi?id=koha:biblionumber:4&format=oai_dc
play with oai_dc, srw_dc, mods, mods-full, mods3, mods3-full, rdfdc.
Note: marcxml does not fail
3) Enter the new biblionumber for ISBN 8467020113 or the record of your choise
4) An oai_dc record will display, notice about the bad utf8
decoding characters
5) Search the record in OPAC
6) To reproduce code 200 Ok and 300 Multiple choices play with:
cgi-bin/koha/unapi
cgi-bin/koha/unapi?id=koha:biblionumber:4
7) If possible test in NORMARC (UNIMARC will launch an error because bug 15162)
Test plan
-Apply patch
-Follow steps 2 to 6
-You will see no errors in utf8
Followed test plan, works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
http://bugs.koha-community.org/show_bug.cgi?id=9987
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
The Unapi path to XSLTs is wrong in the OPAC.
Unfortunately, it's coded to work just for Git installs, which makes it
tough to test.
_TEST PLAN_
Before applying:
1) Go to
http://GIT-INSTALL/cgi-bin/koha/unapi?id=koha:biblionumber:1&format=oai_dc
2) If the biblionumber exists, it should show you the record in OAI_DC format.
3) Go to
http://REGULAR-INSTALL/cgi-bin/koha/unapi?id=koha:biblionumber:1&format=oai_dc
4) You should get a software error
Apply the patch.
After applying:
1) Refresh the page for
http://yourgitinstall/cgi-bin/koha/unapi?id=koha:biblionumber:1&format=oai_dc
2) It should work exactly the same as before.
Thorough testers:
1) Push the code to that regular test install
2) Try the link again. It will properly show the converted record now.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Verified that single install
intrahtdocs==/usr/share/koha/clone1712/intranet/htdocs/intranet-tmpl plus
"/prog/en/xslt/" is the location for the required xslt files.
Script unapi in git install is still fine.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
The following errors appear when trying to use unapi under Plack (among
others):
Variable "$cgi" is not available at /home/jcamins/kohaclone/opac/unapi line 160.
Variable "$format_to_stylesheet_map" is not available at /home/jcamins/kohaclone/opac/unapi line 173.
Variable "$format_info" is not available at /home/jcamins/kohaclone/opac/unapi line 174.
Variable "$format_to_stylesheet_map" is not available at /home/jcamins/kohaclone/opac/unapi line 185.
To test:
1) Try to view /cgi-bin/koha/unapi under Plack
2) There is no step 2. Plack crashes.
3) Apply patch.
4) Try to view /cgi-bin/koha/unapi again, and note that it doesn't crash
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
I'm puzzled how this ever worked anyway, accidentally i'm guessing,
this tidies up some lazy coding
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This patch uses a lot of MARC21 XSLT to transform NORMARC records
to desired formats. Since NORMARC is mostly a subset of MARC21, I
think this should give passable results. And better results than
no unapi-support at all for NORMARC!
To reproduce:
- Make sure you have marcflavour = NORMARC
- Visit /cgi-bin/koha/unapi in a browser
- Observe the empty <formats></formats> element
To test:
- Apply the patch
- Visit /cgi-bin/koha/unapi in a browser
- Observe the the list of formats in the <formats></formats> element
- Import the provided sample NORMARC record and make a note of its
biblionumber
- View the record at /cgi-bin/koha/unapi?id=koha:biblionumber:x&format=y
where x = the biblionumber of the sample record and y = one of the
formats marcxml, marcxml-full, mods, mods-full, mods3, mods3-full,
oai_dc, rdfdc, rss2, rss2-full and srw_dc
- Check that the transformed records make some kind of superficial
sense
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Improves Koha's unAPI support as follows:
* The implementation no longer depends on there being
an accessible Zebra or SRW server. Instead, responses
are created by running the bib MARCXML through local
stylesheets.
* unAPI now works for all bibs, not just ones that have
an ISBN. The ID format is changed from koha:isbn:ISBN
to koha:biblionumber:BIBNUM.
* unAPI now correctly advertises the formats it supports.
* This implementation now passes validation testing at
http://validator.unapi.info/ .
* MODS3 support now works correctly. As a consequence, this
patch fixes bug 2432 (Zotero support when using the XSLT
OPAC stylesheets).
TODO: as additonal XSLT stylesheets are created to convert
UNIMARC bibs to additional formats, the stylesheet map
in opac/unapi should be updated.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Calculate OPACBaseURL from the
CGI environment variables instead of using the
system preference. As a result of this patch,
it should be possible to change the hostname,
protocol, or port of the OPAC without having to
reset a system preference.
Also added a FIXME to opac/unapi - the URL of
the SRU/W server has no necessary relationship
to the URL of the OPAC.
Once this patch is confirmed, the syspref can
be removed.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Needed to restore OpenSearch capabilities, and did the following while
I was at it:
* add support for unAPI: http://unapi.info/
* add basic support for COinS and OpenURL:
http://ocoins.info;
http://www.niso.org/committees/committee_ax.html
* ^^ Gives us Zotero Support!
* adding some XSLT stylesheets for handling additional transformations
NOTE: English and MARC21 specific unfortunately
* adding back opensearch/rss feed <link>s for autodiscovery
TODO: after the installation, to get the Zebra system running on an external
port it's necessary to hand-edit the configs. I'm looking into Virtual Hosts
which could solve that problem (run on both the socket and a port).
Need to add better error handling to the unapi and opensearch scripts
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>