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