Lines 27-34
Link Here
|
27 |
use strict; |
27 |
use strict; |
28 |
use warnings; |
28 |
use warnings; |
29 |
|
29 |
|
30 |
use open OUT=> ":encoding(UTF-8)", ':std'; |
|
|
31 |
|
32 |
# standard or CPAN modules used |
30 |
# standard or CPAN modules used |
33 |
use CGI; |
31 |
use CGI; |
34 |
use Encode; |
32 |
use Encode; |
Lines 44-72
use XML::LibXML;
Link Here
|
44 |
|
42 |
|
45 |
my $input = new CGI; |
43 |
my $input = new CGI; |
46 |
my $biblionumber = $input->param('id'); |
44 |
my $biblionumber = $input->param('id'); |
47 |
my $importid = $input->param('importid'); |
45 |
my $importid= $input->param('importid'); |
48 |
my $view = $input->param('viewas') || 'marc'; |
46 |
my $view= $input->param('viewas') || 'marc'; |
49 |
|
|
|
50 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ |
51 |
template_name => "opac-showmarc.tmpl", |
52 |
query => $input, |
53 |
type => "opac", |
54 |
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), |
55 |
debug => 1, |
56 |
}); |
57 |
|
47 |
|
58 |
$template->param( SCRIPT_NAME => $ENV{'SCRIPT_NAME'}, ); |
48 |
my $record; |
59 |
my ($record, $xmlrecord); |
|
|
60 |
if ($importid) { |
49 |
if ($importid) { |
61 |
my ($marc,$encoding) = GetImportRecordMarc($importid); |
50 |
my ($marc) = GetImportRecordMarc($importid); |
62 |
$record = MARC::Record->new_from_usmarc($marc) ; |
51 |
$record = MARC::Record->new_from_usmarc($marc); |
63 |
if($view eq 'card') { |
52 |
} |
64 |
$xmlrecord = $record->as_xml(); |
53 |
else { |
65 |
} |
54 |
$record =GetMarcBiblio($biblionumber); |
66 |
} |
55 |
} |
67 |
|
56 |
|
68 |
if ($view eq 'card' || $view eq 'html') { |
57 |
if ($view eq 'card' || $view eq 'html') { |
69 |
$xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord; |
58 |
my $xmlrecord= $importid? $record->as_xml(): GetXmlBiblio($biblionumber); |
70 |
my $xslfile; |
59 |
my $xslfile; |
71 |
my $themelang = '/' . C4::Context->preference("opacthemes") . '/' . C4::Templates::_current_language(); |
60 |
my $themelang = '/' . C4::Context->preference("opacthemes") . '/' . C4::Templates::_current_language(); |
72 |
|
61 |
|
Lines 83-92
if ($view eq 'card' || $view eq 'html') {
Link Here
|
83 |
my $stylesheet = $xslt->parse_stylesheet($style_doc); |
72 |
my $stylesheet = $xslt->parse_stylesheet($style_doc); |
84 |
my $results = $stylesheet->transform($source); |
73 |
my $results = $stylesheet->transform($source); |
85 |
my $newxmlrecord = $stylesheet->output_string($results); |
74 |
my $newxmlrecord = $stylesheet->output_string($results); |
86 |
$newxmlrecord = Encode::decode_utf8($newxmlrecord) unless utf8::is_utf8($newxmlrecord); |
75 |
print $input->header(-charset => 'UTF-8'), Encode::encode_utf8($newxmlrecord); |
87 |
print $input->header(-charset => 'UTF-8'), $newxmlrecord; |
76 |
} |
88 |
} else { |
77 |
else { #view eq marc |
89 |
$record =GetMarcBiblio($biblionumber) unless $record; |
78 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ |
|
|
79 |
template_name => "opac-showmarc.tmpl", |
80 |
query => $input, |
81 |
type => "opac", |
82 |
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), |
83 |
debug => 1, |
84 |
}); |
90 |
$template->param( MARC_FORMATTED => $record->as_formatted ); |
85 |
$template->param( MARC_FORMATTED => $record->as_formatted ); |
91 |
output_html_with_http_headers $input, $cookie, $template->output; |
86 |
output_html_with_http_headers $input, $cookie, $template->output; |
92 |
} |
87 |
} |
93 |
- |
|
|