Koha/catalogue/showmarc.pl
Owen Leonard 142e6098a9 Bug 13151 - staff marc preview not wrapping
The MARC preview available on the staff client detail page doesn't wrap
long lines of text because it uses a huge block of whitespace-formatted
text in a <pre> tag. The OPAC doesn't have this problem because the MARC
preview is formated in a table.

This patch copies the OPAC's "plainMARC.xsl" file for use in the staff
client. The preview modal has been converted to use Bootstrap following
the method used in Bug 12755

To test, apply the patch and clear your browser cache. View the
detail page for a bibliographic record in the staff client. Click the
link to show the MARC preview. Confirm that the modal looks correct,
works correctly, and adapts gracefully to different browser widths.

Confirm that the MARC preview and Card links still work from Z39.50
searches.

Note: This patch assumes that UNIMARC records display correctly using
xslt/plainMARC.xsl. Please let me know if that is wrong.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

I confirm it works: nice modal dialog box; display aligned on opac display;
works also with Unimarc biblios.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-21 15:04:00 -03:00

86 lines
2.5 KiB
Perl
Executable file

#!/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, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
# standard or CPAN modules used
use CGI qw(:standard);
use DBI;
use Encode;
# Koha modules used
use C4::Context;
use C4::Output;
use C4::Auth;
use C4::Biblio;
use C4::ImportBatch;
use C4::XSLT ();
my $input= new CGI;
my $biblionumber= $input->param('id');
my $importid= $input->param('importid');
my $view= $input->param('viewas')||'';
my $record;
if ($importid) {
my ($marc) = GetImportRecordMarc($importid);
$record = MARC::Record->new_from_usmarc($marc);
}
else {
$record =GetMarcBiblio($biblionumber);
}
if(!ref $record) {
print $input->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
if($view eq 'card' || $view eq 'html') {
my $xml = $importid ? $record->as_xml(): GetXmlBiblio($biblionumber);
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 {
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "catalogue/showmarc.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { catalogue => 1 },
debug => 1,
}
);
$template->param( MARC_FORMATTED => $record->as_formatted );
output_html_with_http_headers $input, $cookie, $template->output;
}