Bugzilla – Attachment 120261 Details for
Bug 28247
Add a MARC preview column to to Authority search results table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28247: Add a MARC preview column to to Authority search results table
Bug-28247-Add-a-MARC-preview-column-to-to-Authorit.patch (text/plain), 6.27 KB, created by
Timothy Alexis Vass
on 2021-04-28 10:11:19 UTC
(
hide
)
Description:
Bug 28247: Add a MARC preview column to to Authority search results table
Filename:
MIME Type:
Creator:
Timothy Alexis Vass
Created:
2021-04-28 10:11:19 UTC
Size:
6.27 KB
patch
obsolete
>From fafa6ecaa0049fa3564493190684c9f7c11f5789 Mon Sep 17 00:00:00 2001 >From: Timothy Alexis Vass <timothy_alexis.vass@ub.lu.se> >Date: Wed, 28 Apr 2021 11:21:27 +0200 >Subject: [PATCH] Bug 28247: Add a MARC preview column to to Authority search > results table > >To test: >1) Do an authority search >2) Notice the MARC preview column >3) Click "Show" for some of the results. >4) Confirm that the correct details are shown. >5) Sign off. >--- > authorities/showmarc.pl | 77 +++++++++++++++++++ > .../modules/authorities/searchresultlist.tt | 31 ++++++++ > .../prog/en/modules/authorities/showmarc.tt | 10 +++ > 3 files changed, 118 insertions(+) > create mode 100755 authorities/showmarc.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt > >diff --git a/authorities/showmarc.pl b/authorities/showmarc.pl >new file mode 100755 >index 0000000000..4d6f722928 >--- /dev/null >+++ b/authorities/showmarc.pl >@@ -0,0 +1,77 @@ >+#!/usr/bin/perl >+ >+# Koha library project www.koha-community.org >+ >+# Copyright 2007 Liblime >+# Parts copyright 2010 BibLibre >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+# standard or CPAN modules used >+use CGI qw(:standard -utf8); >+use DBI; >+use Encode; >+ >+# Koha modules used >+use C4::Context; >+use C4::Output; >+use C4::Auth; >+use C4::AuthoritiesMarc; >+use C4::XSLT (); >+ >+my $input= CGI->new; >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "authorities/showmarc.tt", >+ query => $input, >+ type => "intranet", >+ flagsrequired => { authorities => 1 }, >+ debug => 1, >+ } >+); >+ >+my $authid = $input->param('id'); >+my $view = $input->param('viewas')||''; >+ >+my $record = GetAuthority($authid); >+ >+if(!ref $record) { >+ print $input->redirect("/cgi-bin/koha/errors/404.pl"); >+ exit; >+} >+ >+if($view eq 'card' || $view eq 'html') { >+ my $xml = GetAuthorityXML($authid); >+ my $xsl; >+ if ( $view eq 'card' ){ >+ $xsl = C4::Context->preference('marcflavour') eq 'UNIMARC' >+ ? 'UNIMARC_compact.xsl' : 'compact.xsl'; >+ } >+ else { >+ $xsl = 'plainMARC.xsl'; >+ } >+ my $htdocs = C4::Context->config('intrahtdocs'); >+ my ($theme, $lang) = C4::Templates::themelanguage($htdocs, $xsl, 'intranet', $input); >+ $xsl = "$htdocs/$theme/$lang/xslt/$xsl"; >+ print $input->header(-charset => 'UTF-8'), >+ Encode::encode_utf8(C4::XSLT::engine->transform($xml, $xsl)); >+} >+else { >+ $template->param( MARC_FORMATTED => $record->as_formatted ); >+ output_html_with_http_headers $input, $cookie, $template->output; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >index 3baec6db23..8fcc9d2988 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >@@ -45,6 +45,7 @@ > <table> > <tr> > <th>Summary</th> >+ <th>MARC preview</th> > <th>Heading type</th> > [% UNLESS ( isEDITORS ) %] > <th>Used in</th> >@@ -57,6 +58,7 @@ > <tr data-authid="[% resul.authid | html %]"> > <td>[% PROCESS authresult summary=resul.summary authid=resul.authid %]</td> > <td>[% resul.authtype | html %]</td> >+ <td><a class="previewMARC btn btn-default btn-xs" href="showmarc.pl?id=[% resul.authid | uri %]&viewas=html" title="MARC">Show</a></td> > [% UNLESS ( resul.isEDITORS ) %] > <td> > [% IF resul.used > 0 %] >@@ -94,8 +96,37 @@ > </div> > </div> > >+<div id="marcPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true"> >+ <div class="modal-dialog modal-lg"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ <h3 id="marcPreviewLabel">MARC preview</h3> >+ </div> >+ <div class="modal-body"> >+ <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> >+ </div> >+ </div> >+ </div> >+</div> >+ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'authorities_js.inc' %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >+ >+<script> >+ $("body").on("click",".previewMARC", function(e){ >+ e.preventDefault(); >+ var page = $(this).attr("href"); >+ $("#marcPreview .modal-body").load(page + " table"); >+ $('#marcPreview').modal({show:true}); >+ }); >+ $("#marcPreview").on("hidden.bs.modal", function(){ >+ $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >+ }); >+</script> >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt >new file mode 100644 >index 0000000000..47ce4ff6d9 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/showmarc.tt >@@ -0,0 +1,10 @@ >+ [% INCLUDE 'doc-head-open.inc' %] >+ <title>Koha › Authorities › MARC preview</title> >+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >+ </head> >+ <body id="authorities_showmarc" class="authority"> >+ <div id="main" style="direction: ltr;"> >+ <pre>[% MARC_FORMATTED | html %]</pre> >+ </div> >+ </body> >+</html> >-- >2.25.1
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 28247
:
120260
|
120261
|
121795
|
129206
|
129236
|
131212