adding 'gettext' as this is requred by the translation utility
[koha.git] / catalogue / cardview.pl
1 #!/usr/bin/perl
2 use strict;
3 require Exporter;
4 use CGI;
5 use XML::LibXSLT;
6 use XML::LibXML;
7 use C4::Koha;
8 use C4::Auth;
9 use C4::Biblio;
10 use C4::Languages qw(getTranslatedLanguages);
11
12 my $query=new CGI;
13 my ($template, $borrowernumber, $cookie) 
14     = get_template_and_user({template_name => "opac-detail.tmpl",
15                              query => $query,
16                              type => "opac",
17                              authnotrequired => 1,
18                              flagsrequired => {borrow => 1},
19                              });
20
21 # load the languages
22 my @languages_options = getTranslatedLanguages($query);
23 my $languages_count = @languages_options;
24 if($languages_count > 1){
25         $template->param(languages => \@languages_options);
26 }
27 my $biblionumber=$query->param('biblionumber');
28 $template->param(biblionumber => $biblionumber);
29
30 # grab the XML, run it through our stylesheet, push it out to the browser
31 my $xmlrecord = GetXmlBiblio($biblionumber);
32 #my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2HTML.xsl";
33 #my $xslfile = "/home/kohacat/etc/xslt/MARC21slim2English.xsl";
34 my $xslfile = C4::Context->config('intranetdir')."/koha-tmpl/intranet-tmpl/prog/en/xslt/compact.xsl";
35 my $parser = XML::LibXML->new();
36 my $xslt = XML::LibXSLT->new();
37 my $source = $parser->parse_string($xmlrecord);
38 my $style_doc = $parser->parse_file($xslfile);
39 my $stylesheet = $xslt->parse_stylesheet($style_doc);
40 my $results = $stylesheet->transform($source);
41 my $newxmlrecord = $stylesheet->output_string($results);
42 print "Content-type: text/html\n\n";
43 print $newxmlrecord;