14 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
({
15 template_name
=> "tools/export.tt",
18 flagsrequired
=> { catalogue
=> 1 },
22 my $op=$query->param("op");
23 my $format=$query->param("format");
25 if ($op eq "export") {
26 my $biblionumber = $query->param("bib");
29 my $marc = GetMarcBiblio
({
30 biblionumber
=> $biblionumber,
33 if ($format =~ /endnote/) {
34 $marc = marc2endnote
($marc);
37 elsif ($format =~ /marcxml/) {
38 $marc = marc2marcxml
($marc);
41 elsif ($format=~ /mods/) {
42 $marc = marc2modsxml
($marc);
45 elsif ($format =~ /ris/) {
46 $marc = marc2ris
($marc);
49 elsif ($format =~ /bibtex/) {
50 $marc = marc2bibtex
($marc);
53 elsif ($format =~ /dc$/) {
54 $marc = marc2dcxml
(undef, undef, $biblionumber, $format);
55 $format = "dublin-core.xml";
57 elsif ($format =~ /marc8/) {
58 $marc = changeEncoding
($marc,"MARC","MARC21","MARC-8");
59 $marc = $marc->as_usmarc();
62 elsif ($format =~ /utf8/) {
63 C4
::Charset
::SetUTF8Flag
($marc, 1);
64 $marc = $marc->as_usmarc();
67 elsif ($format =~ /marcstd/) {
68 C4
::Charset
::SetUTF8Flag
($marc,1);
69 ($error, $marc) = marc2marc
($marc, 'marcstd', C4
::Context
->preference('marcflavour'));
72 if ( $format =~ /utf8/ or $format =~ /marcstd/ ) {
73 binmode STDOUT
, ':encoding(UTF-8)';
76 -type
=> 'application/octet-stream',
77 -attachment
=>"bib-$biblionumber.$format");