View | Details | Raw Unified | Return to bug 8872
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showmarc.tt (-3 / +5 lines)
Lines 1-8 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]MARC view
1
[% INCLUDE 'doc-head-open.inc' %]
2
MARC view</title>
2
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3
</head>
4
</head>
4
<body id="opac-showmarc">
5
<body id="opac-showmarc">
5
<div id="main">
6
<div id="main">
6
<pre>[% MARC_FORMATTED %]</pre>
7
<pre>[% MARC_FORMATTED %]</pre>
7
<!-- div gets closed by opac-bottom.inc -->
8
</div>
8
[% INCLUDE 'opac-bottom.inc' %]
9
</body>
10
</html>
(-)a/opac/opac-showmarc.pl (-26 / +19 lines)
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-73 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
$biblionumber   = int($biblionumber);
45
my $importid= $input->param('importid');
48
my $importid	= $input->param('importid');
46
my $view= $input->param('viewas') || 'marc';
49
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
47
59
$template->param( SCRIPT_NAME => $ENV{'SCRIPT_NAME'}, );
48
my $record;
60
my ($record, $xmlrecord);
61
if ($importid) {
49
if ($importid) {
62
	my ($marc,$encoding) = GetImportRecordMarc($importid);
50
    my ($marc) = GetImportRecordMarc($importid);
63
	$record = MARC::Record->new_from_usmarc($marc) ;
51
    $record = MARC::Record->new_from_usmarc($marc);
64
 	if($view eq 'card') {
52
}
65
		$xmlrecord = $record->as_xml();
53
else {
66
	}
54
    $record =GetMarcBiblio($biblionumber);
67
}
55
}
68
56
69
if ($view eq 'card' || $view eq 'html') {
57
if ($view eq 'card' || $view eq 'html') {
70
    $xmlrecord = GetXmlBiblio($biblionumber) unless $xmlrecord;
58
    my $xmlrecord= $importid? $record->as_xml(): GetXmlBiblio($biblionumber);
71
    my $xslfile;
59
    my $xslfile;
72
    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
60
    my $themelang = '/' . C4::Context->preference("opacthemes") .  '/' . C4::Templates::_current_language();
73
61
Lines 84-93 if ($view eq 'card' || $view eq 'html') { Link Here
84
    my $stylesheet = $xslt->parse_stylesheet($style_doc);
72
    my $stylesheet = $xslt->parse_stylesheet($style_doc);
85
    my $results = $stylesheet->transform($source);
73
    my $results = $stylesheet->transform($source);
86
    my $newxmlrecord = $stylesheet->output_string($results);
74
    my $newxmlrecord = $stylesheet->output_string($results);
87
    $newxmlrecord = Encode::decode_utf8($newxmlrecord) unless utf8::is_utf8($newxmlrecord);
75
    print $input->header(-charset => 'UTF-8'), Encode::encode_utf8($newxmlrecord);
88
    print $input->header(-charset => 'UTF-8'), $newxmlrecord;
76
}
89
} else {
77
else { #view eq marc
90
    $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
    });
91
    $template->param( MARC_FORMATTED => $record->as_formatted );
85
    $template->param( MARC_FORMATTED => $record->as_formatted );
92
    output_html_with_http_headers $input, $cookie, $template->output;
86
    output_html_with_http_headers $input, $cookie, $template->output;
93
}
87
}
94
- 

Return to bug 8872