X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Funapi;h=a07434500a7f6fba561b2bc23b831e01c002ff99;hb=92d021f989227fa798b13f63abae4ebf53744d17;hp=fef5f91da585c1b26ad3cb6c6565016c428d0bc8;hpb=ce5e2429db712951724156c8c7bc7a417bd4d42d;p=koha_fer diff --git a/opac/unapi b/opac/unapi index fef5f91da5..a07434500a 100755 --- a/opac/unapi +++ b/opac/unapi @@ -44,7 +44,7 @@ use XML::LibXML; use XML::LibXSLT; my $cgi = CGI->new(); -binmode(STDOUT, "utf8"); #output as utf8 +binmode(STDOUT, ":encoding(UTF-8)"); #output as utf8 =head1 VARIABLES @@ -75,6 +75,19 @@ my $format_to_stylesheet_map = { 'rss2-full' => 'MARC21slim2RSS2.xsl', 'srw_dc' => 'MARC21slim2SRWDC.xsl', }, + 'NORMARC' => { + 'marcxml' => 'identity.xsl', + 'marcxml-full' => 'identity.xsl', + 'mods' => 'MARC21slim2MODS.xsl', + 'mods-full' => 'MARC21slim2MODS.xsl', + 'mods3' => 'MARC21slim2MODS3-1.xsl', + 'mods3-full' => 'MARC21slim2MODS3-1.xsl', + 'oai_dc' => 'MARC21slim2OAIDC.xsl', + 'rdfdc', => 'MARC21slim2RDFDC.xsl', + 'rss2' => 'MARC21slim2RSS2.xsl', + 'rss2-full' => 'MARC21slim2RSS2.xsl', + 'srw_dc' => 'MARC21slim2SRWDC.xsl', + }, 'UNIMARC' => { 'marcxml' => 'identity.xsl', 'marcxml-full' => 'identity.xsl', @@ -107,7 +120,7 @@ my $id = $cgi->param('id'); my $format = $cgi->param('format'); if (not defined $format) { - emit_formats($id); + emit_formats($id, $format_to_stylesheet_map, $format_info, $cgi); } elsif ($id) { # koha:biblionumber:0152018484 @@ -123,7 +136,7 @@ if (not defined $format) { exit 0; } - my $transformer = get_transformer($format); + my $transformer = get_transformer($format, $format_to_stylesheet_map, $format_info); unless (defined $transformer) { print $cgi->header( -status => '406 invalid format requested' ); exit 0; @@ -154,7 +167,7 @@ if (not defined $format) { exit 0; sub emit_formats { - my $id = shift; + my ($id, $format_to_stylesheet_map, $format_info, $cgi) = @_; if (defined $id) { print $cgi->header( -type =>'application/xml', -status => '300 multiple choices' ); @@ -179,7 +192,8 @@ sub emit_formats { sub get_transformer { - my $format = lc shift; + my ($format, $format_to_stylesheet_map, $format_info) = @_; + $format = lc $format; my $marcflavour = uc(C4::Context->preference('marcflavour')); return unless $format_to_stylesheet_map->{$marcflavour}->{$format};