3 # Koha library project www.koha-community.org
5 # Copyright 2007 Liblime
6 # Parts copyright 2010 BibLibre
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #use warnings; FIXME - Bug 2505
26 use open OUT
=>":encoding(UTF-8)", ':std';
28 # standard or CPAN modules used
29 use CGI
qw(:standard);
43 my $biblionumber = $input->param('id');
44 my $importid = $input->param('importid');
45 my $view = $input->param('viewas');
47 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
49 template_name
=> "catalogue/showmarc.tmpl",
53 flagsrequired
=> { catalogue
=> 1 },
58 $template->param( SCRIPT_NAME
=> $ENV{'SCRIPT_NAME'}, );
59 my ($record, $xmlrecord);
61 my ($marc,$encoding) = GetImportRecordMarc
($importid);
62 $record = MARC
::Record
->new_from_usmarc($marc) ;
64 $xmlrecord = $record->as_xml();
69 my $themelang = '/' . C4
::Context
->preference("opacthemes") . '/' . C4
::Templates
::_current_language
();
70 $xmlrecord = GetXmlBiblio
($biblionumber) unless $xmlrecord;
72 C4
::Context
->config('intrahtdocs') . $themelang . "/xslt/compact.xsl";
73 my $parser = XML
::LibXML
->new();
74 my $xslt = XML
::LibXSLT
->new();
75 my $source = $parser->parse_string($xmlrecord);
76 my $style_doc = $parser->parse_file($xslfile);
77 my $stylesheet = $xslt->parse_stylesheet($style_doc);
78 my $results = $stylesheet->transform($source);
79 my $newxmlrecord = $stylesheet->output_string($results);
80 $newxmlrecord = Encode
::decode_utf8
($newxmlrecord)
81 unless utf8
::is_utf8
($newxmlrecord)
82 ; #decode only if not in perl internal format
83 print $input->header( -charset
=> 'UTF-8' ), $newxmlrecord;
86 $record =GetMarcBiblio
($biblionumber) unless $record;
88 my $formatted = $record->as_formatted;
89 $template->param( MARC_FORMATTED
=> $formatted );
91 my $output= $template->output;
92 $output=Encode
::decode_utf8
($output) unless utf8
::is_utf8
($output);
93 output_html_with_http_headers
$input, $cookie, $output;