Bugzilla – Attachment 161517 Details for
Bug 30554
Use XSLT in authority search cataloguing plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30554: Use XSLT (if enabled) in authority search cataloguing plugin
Bug-30554-Use-XSLT-if-enabled-in-authority-search-.patch (text/plain), 4.00 KB, created by
Martin Renvoize (ashimema)
on 2024-01-26 12:45:32 UTC
(
hide
)
Description:
Bug 30554: Use XSLT (if enabled) in authority search cataloguing plugin
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-01-26 12:45:32 UTC
Size:
4.00 KB
patch
obsolete
>From dc6be1be93849d21ef77b65054e2e1e5015fc708 Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Fri, 15 Apr 2022 16:51:14 +0200 >Subject: [PATCH] Bug 30554: Use XSLT (if enabled) in authority search > cataloguing plugin >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: >1. Set AuthorityXSLTResultsDisplay to a valid XSL file (see bug 30554 > attachments, there is an example XSL file) >2. Go to the bibliographic record editor (edit an existing one or create > a new one) >3. Find a field linked to authorities and open the plugin >4. Start a search and verify that the results are displayed using the > XSLT output (if using the example file it should be a link saying > "Authority #<authid>") > >Sponsored-by: Ãcoles nationales supérieure d'architecture (ENSA) >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > authorities/auth_finder.pl | 26 +++++++++++++++++++ > .../authorities/searchresultlist-auth.tt | 8 +++++- > 2 files changed, 33 insertions(+), 1 deletion(-) > >diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl >index c4e3a746642..1603fbbc31f 100755 >--- a/authorities/auth_finder.pl >+++ b/authorities/auth_finder.pl >@@ -23,10 +23,13 @@ use CGI qw ( -utf8 ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Auth qw( get_template_and_user ); > use C4::Context; >+use C4::Languages; > use Koha::SearchEngine::Search; > use Koha::SearchEngine::QueryBuilder; > > use Koha::Authority::Types; >+use Koha::Authorities; >+use Koha::XSLT::Base; > > my $query = CGI->new; > my $op = $query->param('op') || ''; >@@ -132,6 +135,29 @@ if ( $op eq "do_search" ) { > $to = ( ( $startfrom + 1 ) * $resultsperpage ); > } > >+ my $AuthorityXSLTResultsDisplay = C4::Context->preference('AuthorityXSLTResultsDisplay'); >+ if ( $results && $AuthorityXSLTResultsDisplay ) { >+ my $lang = C4::Languages::getlanguage(); >+ foreach my $result (@$results) { >+ my $authority = Koha::Authorities->find( $result->{authid} ); >+ next unless $authority; >+ >+ my $authtypecode = $authority->authtypecode; >+ my $xsl = $AuthorityXSLTResultsDisplay; >+ $xsl =~ s/\{langcode\}/$lang/g; >+ $xsl =~ s/\{authtypecode\}/$authtypecode/g; >+ >+ my $xslt_engine = Koha::XSLT::Base->new; >+ my $output = $xslt_engine->transform( { xml => $authority->marcxml, file => $xsl } ); >+ if ( $xslt_engine->err ) { >+ warn "XSL transformation failed ($xsl): " . $xslt_engine->err; >+ next; >+ } >+ >+ $result->{html} = $output; >+ } >+ } >+ > $template->param( result => $results ) if $results; > $template->param( > orderby => $orderby, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt >index c063817a0f0..478cd79ef69 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt >@@ -76,7 +76,13 @@ > </tr> > [% FOREACH resul IN result %] > <tr> >- <td>[% PROCESS authresult summary=resul.summary authid=resul.authid auth_preview=1 %]</td> >+ <td> >+ [% IF resul.html %] >+ [% resul.html | $raw %] >+ [% ELSE %] >+ [% PROCESS authresult summary=resul.summary authid=resul.authid auth_preview=1 %] >+ [% END %] >+ </td> > <td>[% resul.summary.label | html %]</td> > <td>[% resul.used | html %] times</td> > [% IF Koha.Preference('ShowHeadingUse') %] >-- >2.43.0
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 30554
:
133359
|
156824
|
156825
|
156826
|
157293
|
157294
|
157295
| 161517 |
161518
|
161545