|
Lines 1-60
Link Here
|
| 1 |
#!/usr/bin/perl |
|
|
| 2 |
use strict; |
| 3 |
# parts copyright 2010 BibLibre |
| 4 |
# This file is part of Koha |
| 5 |
# |
| 6 |
# Koha is free software; you can redistribute it and/or modify it under the |
| 7 |
# terms of the GNU General Public License as published by the Free Software |
| 8 |
# Foundation; either version 2 of the License, or (at your option) any later |
| 9 |
# version. |
| 10 |
# |
| 11 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
| 13 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License along |
| 16 |
# with Koha; if not, write to the Free Software Foundation, Inc., |
| 17 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
|
| 19 |
#use warnings; FIXME - Bug 2505 |
| 20 |
|
| 21 |
use CGI; |
| 22 |
use XML::LibXSLT; |
| 23 |
use XML::LibXML; |
| 24 |
use C4::Koha; |
| 25 |
use C4::Auth; |
| 26 |
use C4::Biblio; |
| 27 |
use C4::Languages qw(getTranslatedLanguages); |
| 28 |
|
| 29 |
my $query=new CGI; |
| 30 |
my ($template, $borrowernumber, $cookie) |
| 31 |
= get_template_and_user({template_name => "opac-detail.tmpl", |
| 32 |
query => $query, |
| 33 |
type => "opac", |
| 34 |
authnotrequired => 1, |
| 35 |
flagsrequired => {borrow => 1}, |
| 36 |
}); |
| 37 |
|
| 38 |
# load the languages |
| 39 |
my @languages_options = getTranslatedLanguages($query); |
| 40 |
my $languages_count = @languages_options; |
| 41 |
if($languages_count > 1){ |
| 42 |
$template->param(languages => \@languages_options); |
| 43 |
} |
| 44 |
my $biblionumber=$query->param('biblionumber'); |
| 45 |
$template->param(biblionumber => $biblionumber); |
| 46 |
|
| 47 |
# grab the XML, run it through our stylesheet, push it out to the browser |
| 48 |
my $xmlrecord = GetXmlBiblio($biblionumber); |
| 49 |
#my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2HTML.xsl"; |
| 50 |
#my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2English.xsl"; |
| 51 |
my $xslfile = C4::Context->config('intranetdir')."/koha-tmpl/intranet-tmpl/prog/en/xslt/compact.xsl"; |
| 52 |
my $parser = XML::LibXML->new(); |
| 53 |
my $xslt = XML::LibXSLT->new(); |
| 54 |
my $source = $parser->parse_string($xmlrecord); |
| 55 |
my $style_doc = $parser->parse_file($xslfile); |
| 56 |
my $stylesheet = $xslt->parse_stylesheet($style_doc); |
| 57 |
my $results = $stylesheet->transform($source); |
| 58 |
my $newxmlrecord = $stylesheet->output_string($results); |
| 59 |
print "Content-type: text/html\n\n"; |
| 60 |
print $newxmlrecord; |