14 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
({
15 template_name
=> "tools/export.tt",
19 flagsrequired
=> { catalogue
=> 1 },
23 my $op=$query->param("op");
24 my $format=$query->param("format");
26 if ($op eq "export") {
27 my $biblionumber = $query->param("bib");
30 my $marc = GetMarcBiblio
({
31 biblionumber
=> $biblionumber,
34 if ($format =~ /endnote/) {
35 $marc = marc2endnote
($marc);
38 elsif ($format =~ /marcxml/) {
39 $marc = marc2marcxml
($marc);
42 elsif ($format=~ /mods/) {
43 $marc = marc2modsxml
($marc);
46 elsif ($format =~ /ris/) {
47 $marc = marc2ris
($marc);
50 elsif ($format =~ /bibtex/) {
51 $marc = marc2bibtex
($marc);
54 elsif ($format =~ /dc$/) {
55 $marc = marc2dcxml
(undef, undef, $biblionumber, $format);
56 $format = "dublin-core.xml";
58 elsif ($format =~ /marc8/) {
59 $marc = changeEncoding
($marc,"MARC","MARC21","MARC-8");
60 $marc = $marc->as_usmarc();
63 elsif ($format =~ /utf8/) {
64 C4
::Charset
::SetUTF8Flag
($marc, 1);
65 $marc = $marc->as_usmarc();
68 elsif ($format =~ /marcstd/) {
69 C4
::Charset
::SetUTF8Flag
($marc,1);
70 ($error, $marc) = marc2marc
($marc, 'marcstd', C4
::Context
->preference('marcflavour'));
73 if ( $format =~ /utf8/ or $format =~ /marcstd/ ) {
74 binmode STDOUT
, ':encoding(UTF-8)';
77 -type
=> 'application/octet-stream',
78 -attachment
=>"bib-$biblionumber.$format");