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

(-)a/C4/XSLT.pm (-2 / +63 lines)
Lines 34-39 use Koha::ItemTypes; Link Here
34
use Koha::XSLT::Base;
34
use Koha::XSLT::Base;
35
use Koha::Libraries;
35
use Koha::Libraries;
36
36
37
use XML::LibXML;
38
37
use Encode;
39
use Encode;
38
40
39
use vars qw(@ISA @EXPORT);
41
use vars qw(@ISA @EXPORT);
Lines 48-53 BEGIN { Link Here
48
    @ISA = qw(Exporter);
50
    @ISA = qw(Exporter);
49
    @EXPORT = qw(
51
    @EXPORT = qw(
50
        &XSLTParse4Display
52
        &XSLTParse4Display
53
        &CustomXSLTExportList
51
    );
54
    );
52
    $engine=Koha::XSLT::Base->new( { do_not_return_source => 1 } );
55
    $engine=Koha::XSLT::Base->new( { do_not_return_source => 1 } );
53
}
56
}
Lines 190-202 sub get_xslt_sysprefs { Link Here
190
}
193
}
191
194
192
sub XSLTParse4Display {
195
sub XSLTParse4Display {
193
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_;
196
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang , $opac) = @_;
194
197
195
    $sysxml ||= C4::Context->preference($xslsyspref);
198
    $sysxml ||= C4::Context->preference($xslsyspref);
196
    $xslfilename ||= C4::Context->preference($xslsyspref);
199
    $xslfilename ||= C4::Context->preference($xslsyspref);
197
    $lang ||= C4::Languages::getlanguage();
200
    $lang ||= C4::Languages::getlanguage();
198
201
199
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
202
    if ($xslsyspref eq "XSLTCustomExport") {
203
        my $dir;
204
        if ($opac) {
205
            $dir = C4::Context->config('opachtdocs') .
206
                '/' . C4::Context->preference("opacthemes") .
207
                '/' . C4::Languages::getlanguage() .
208
                '/xslt/biblioexport';
209
        } else {
210
            $dir = C4::Context->config('intrahtdocs') .
211
                '/' . C4::Context->preference("template") .
212
                '/' . C4::Languages::getlanguage() .
213
                '/xslt/biblioexport';
214
        }
215
        $xslfilename = $dir . "/" . $xslfilename;
216
    } elsif( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
200
        my $htdocs;
217
        my $htdocs;
201
        my $theme;
218
        my $theme;
202
        my $xslfile;
219
        my $xslfile;
Lines 387-392 sub engine { Link Here
387
    return $engine;
404
    return $engine;
388
}
405
}
389
406
407
=head2 CustomXSLTExportList
408
409
 Returns list of file for custom xslt conversion
410
411
=cut
412
413
sub CustomXSLTExportList {
414
    my $opac = shift; # opac (1) vs intranet (0)
415
    my @tabFiles;
416
417
    my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') .
418
                      '/' . C4::Context->preference( $opac ? "opacthemes" : "template") .
419
                      '/' . C4::Languages::getlanguage() .
420
                      '/xslt/biblioexport';
421
    my @files = <$dir/*.xsl>;
422
    foreach my $file (@files) {
423
        if ( -f "$file" ) {
424
            (my $text = $file) =~ s/.*\///g;
425
426
            ## Get title of the option
427
            my $dom = XML::LibXML->load_xml( location => $file );
428
            my $node = $dom->documentElement();
429
            my $title = $node->{"title"};
430
            ($title = $text) =~ s/\.xsl// unless defined $title;
431
432
            # Get output format
433
            # There should only be one xsl:output node, so taking the first one only is OK
434
            $node = @{$node->findnodes("xsl:output")}[0];
435
            my $outputformat = $node->{"method"} if $node;
436
            $outputformat = "txt" if ($outputformat eq "" || $outputformat eq "text");
437
438
            my %row = (
439
                value       => $text,
440
                filename    => $title,
441
                format      => $outputformat,
442
            );
443
444
            push @tabFiles, \%row;
445
        }
446
    }
447
    return \@tabFiles;
448
}
449
450
390
1;
451
1;
391
452
392
__END__
453
__END__
(-)a/basket/basket.pl (+2 lines)
Lines 23-28 use C4::Biblio; Link Here
23
use C4::Items;
23
use C4::Items;
24
use C4::Auth;
24
use C4::Auth;
25
use C4::Output;
25
use C4::Output;
26
use C4::XSLT;
26
27
27
use Koha::AuthorisedValues;
28
use Koha::AuthorisedValues;
28
use Koha::CsvProfiles;
29
use Koha::CsvProfiles;
Lines 121-126 my $resultsarray = \@results; Link Here
121
$template->param(
122
$template->param(
122
    BIBLIO_RESULTS => $resultsarray,
123
    BIBLIO_RESULTS => $resultsarray,
123
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
124
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
125
    xsl_exports => CustomXSLTExportList(),
124
    bib_list => $bib_list,
126
    bib_list => $bib_list,
125
);
127
);
126
128
(-)a/basket/downloadcart.pl (-1 / +6 lines)
Lines 28-34 use C4::Items; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Record;
29
use C4::Record;
30
use C4::Ris;
30
use C4::Ris;
31
31
use C4::XSLT;
32
use Koha::CsvProfiles;
32
use Koha::CsvProfiles;
33
33
34
use utf8;
34
use utf8;
Lines 80-90 if ($bib_list && $format) { Link Here
80
            elsif ($format eq 'bibtex') {
80
            elsif ($format eq 'bibtex') {
81
                $output .= marc2bibtex($record, $biblio);
81
                $output .= marc2bibtex($record, $biblio);
82
            }
82
            }
83
            elsif ($format =~ /^xsl\.(.*)$/) {
84
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, '');
85
            }
83
        }
86
        }
84
    }
87
    }
85
88
86
    # If it was a CSV export we change the format after the export so the file extension is fine
89
    # If it was a CSV export we change the format after the export so the file extension is fine
87
    $format = "csv" if ($format =~ m/^\d+$/);
90
    $format = "csv" if ($format =~ m/^\d+$/);
91
    $format = "html" if ($format =~ /^xsl\./);
88
92
89
    print $query->header(
93
    print $query->header(
90
	-type => 'application/octet-stream',
94
	-type => 'application/octet-stream',
Lines 94-99 if ($bib_list && $format) { Link Here
94
98
95
} else { 
99
} else { 
96
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
100
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
101
    $template->param(xsl_exports => CustomXSLTExportList());
97
    $template->param(bib_list => $bib_list); 
102
    $template->param(bib_list => $bib_list); 
98
    output_html_with_http_headers $query, $cookie, $template->output;
103
    output_html_with_http_headers $query, $cookie, $template->output;
99
}
104
}
(-)a/catalogue/detail.pl (+3 lines)
Lines 98-103 if ( C4::Context->config('enable_plugins') ) { Link Here
98
    );
98
    );
99
}
99
}
100
100
101
##### ADD CUSTOM XSLT
102
$template->param(filesOptions => CustomXSLTExportList(0));
103
101
my $biblionumber = $query->param('biblionumber');
104
my $biblionumber = $query->param('biblionumber');
102
$biblionumber = HTML::Entities::encode($biblionumber);
105
$biblionumber = HTML::Entities::encode($biblionumber);
103
my $record       = GetMarcBiblio({ biblionumber => $biblionumber });
106
my $record       = GetMarcBiblio({ biblionumber => $biblionumber });
(-)a/catalogue/export.pl (+15 lines)
Lines 7-12 use C4::Output; Link Here
7
use C4::Biblio;
7
use C4::Biblio;
8
use CGI qw ( -utf8 );
8
use CGI qw ( -utf8 );
9
use C4::Ris;
9
use C4::Ris;
10
use C4::XSLT;
10
11
11
12
12
13
Lines 77-80 if ($op eq "export") { Link Here
77
                -attachment=>"bib-$biblionumber.$format");
78
                -attachment=>"bib-$biblionumber.$format");
78
            print $marc;
79
            print $marc;
79
        }
80
        }
81
}elsif ($op eq "exportxsl"){
82
    my $biblionumber = $query->param("bib");
83
    if ($biblionumber){
84
        my $xslFile = $query->param("file");
85
        my $marc = GetMarcBiblio( { biblionumber => $biblionumber, embed_items => 1 } );
86
        my $format=$query->param("format")||'txt';
87
        my @hiddenitems;
88
89
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,'');
90
        print $query->header(
91
            -type => 'application/octet-stream',
92
            -attachment=>"bib-$biblionumber.$format");
93
        print $marc;
94
    }
80
}
95
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+3 lines)
Lines 97-102 CAN_user_serials_create_subscription ) %] Link Here
97
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=marcstd&amp;op=export&amp;bib=[% biblionumber | uri %]">MARC (Unicode/UTF-8, Standard)</a></li>
97
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=marcstd&amp;op=export&amp;bib=[% biblionumber | uri %]">MARC (Unicode/UTF-8, Standard)</a></li>
98
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
98
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
99
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
99
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
100
        [% FOREACH filesOption IN filesOptions %]
101
            <li><a href="/cgi-bin/koha/catalogue/export.pl?format=[% filesOption.format %]&amp;op=exportxsl&amp;file=[% filesOption.value %]&amp;bib=[% biblionumber | html %]">[% filesOption.filename %]</a></li>
102
        [% END %]
100
    </ul>
103
    </ul>
101
    </div>
104
    </div>
102
105
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (+3 lines)
Lines 31-36 Link Here
31
                    [% FOREACH csv_profile IN csv_profiles %]
31
                    [% FOREACH csv_profile IN csv_profiles %]
32
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=[% csv_profile.export_format_id | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
32
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=[% csv_profile.export_format_id | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
33
                    [% END %]
33
                    [% END %]
34
                    [% FOREACH xsl_export IN xsl_exports %]
35
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=xsl.[% xsl_export.value %]&amp;shelfid=[% shelf.shelfnumber %]">XSL - [% xsl_export.filename %]</a></li>
36
                    [% END %]
34
                </ul>
37
                </ul>
35
        </div>
38
        </div>
36
        <div class="btn-group"><a class="btn btn-default" href="#" id="sendlist"><i class="fa fa-envelope"></i> Send list</a></div>
39
        <div class="btn-group"><a class="btn btn-default" href="#" id="sendlist"><i class="fa fa-envelope"></i> Send list</a></div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt (+3 lines)
Lines 56-61 Link Here
56
                            [% FOREACH csv_profile IN csv_profiles %]
56
                            [% FOREACH csv_profile IN csv_profiles %]
57
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=[% csv_profile.export_format_id | uri %]&amp;bib_list=[% bib_list | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
57
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=[% csv_profile.export_format_id | uri %]&amp;bib_list=[% bib_list | uri %]">CSV - [% csv_profile.profile | html %]</a></li>
58
                            [% END %]
58
                            [% END %]
59
                            [% FOREACH xsl_export IN xsl_exports %]
60
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=xsl.[% xsl_export.value %]&amp;bib_list=[% bib_list %]">XSL - [% xsl_export.filename %]</a></li>
61
                            [% END %]
59
                            </ul>
62
                            </ul>
60
                        </div>
63
                        </div>
61
                        <a class="btn btn-default" href="basket.pl" id="print_cart"><i class="fa fa-print"></i> Print</a>
64
                        <a class="btn btn-default" href="basket.pl" id="print_cart"><i class="fa fa-print"></i> Print</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +5 lines)
Lines 947-954 Note that permanent location is a code, and location may be an authval. Link Here
947
        <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
947
        <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
948
        <option value="marcxml">MARCXML</option>
948
        <option value="marcxml">MARCXML</option>
949
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
949
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
950
        <option value="utf8">MARC (Unicode/UTF-8)</option>    </select>
950
        <option value="utf8">MARC (Unicode/UTF-8)</option>
951
        <input type="submit" name="save" value="Download record" /></td>
951
        [% FOREACH filesOption IN filesOptions %]
952
            <option value="[% filesOption.value %]">[% filesOption.filename %]</option>
953
        [% END %]</select>
954
        <input type="submit" name="save" value="Download Record" /></td>
952
  </tr>
955
  </tr>
953
  <tr><td>
956
  <tr><td>
954
    <input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="[% biblionumber | html %]" />
957
    <input type="hidden" name="op" value="export" /><input type="hidden" name="bib" value="[% biblionumber | html %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/downloadshelf.tt (+3 lines)
Lines 36-41 Link Here
36
	    [% FOREACH csv_profile IN csv_profiles %]
36
	    [% FOREACH csv_profile IN csv_profiles %]
37
	    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
37
	    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
38
	    [% END %]
38
	    [% END %]
39
        [% FOREACH xsl_export IN xsl_exports %]
40
            <option value="xsl.[% xsl_export.value %]">XSL - [% xsl_export.filename %]</option>
41
        [% END %]
39
	</select>
42
	</select>
40
	</li></ol>
43
	</li></ol>
41
	</fieldset>
44
	</fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/biblioexport/MARC21_simple_export.xsl (+62 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
   xmlns:marc="http://www.loc.gov/MARC21/slim"
5
   title="Simple Export">
6
<xsl:output method="html" encoding="UTF-8"/>
7
8
    <xsl:template match="/">
9
      <xsl:apply-templates/>
10
    </xsl:template>
11
12
    <xsl:template match="marc:record">
13
      <p>
14
        <xsl:if test="marc:datafield[@tag=245]">
15
        <xsl:for-each select="marc:datafield[@tag=245]">
16
            <xsl:value-of select="marc:subfield[@code='a']"/>
17
            <xsl:if test="marc:subfield[@code='b']">
18
                 <xsl:text> </xsl:text>
19
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
20
            </xsl:if>
21
            <xsl:if test="marc:subfield[@code='c']">
22
                  <xsl:text> </xsl:text>
23
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
24
            </xsl:if>
25
        </xsl:for-each>
26
        </xsl:if>
27
        <xsl:if test="marc:datafield[@tag=260]">
28
        <br/>
29
        <xsl:for-each select="marc:datafield[@tag=260]">
30
            <xsl:if test="marc:subfield[@code='a']">
31
                 <xsl:value-of select="marc:subfield[@code='a']"/>
32
            </xsl:if>
33
            <xsl:if test="marc:subfield[@code='b']">
34
                 <xsl:text> </xsl:text>
35
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
36
            </xsl:if>
37
            <xsl:if test="marc:subfield[@code='c']">
38
                  <xsl:text> </xsl:text>
39
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
40
            </xsl:if>
41
        </xsl:for-each>
42
        </xsl:if>
43
        <xsl:if test="marc:datafield[@tag=264]">
44
        <br/>
45
        <xsl:for-each select="marc:datafield[@tag=264]">
46
            <xsl:if test="marc:subfield[@code='a']">
47
                 <xsl:value-of select="marc:subfield[@code='a']"/>
48
            </xsl:if>
49
            <xsl:if test="marc:subfield[@code='b']">
50
                 <xsl:text> </xsl:text>
51
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
52
            </xsl:if>
53
            <xsl:if test="marc:subfield[@code='c']">
54
                  <xsl:text> </xsl:text>
55
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
56
            </xsl:if>
57
        </xsl:for-each>
58
        </xsl:if>
59
      </p>
60
    </xsl:template>
61
62
</xsl:stylesheet>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (+3 lines)
Lines 77-82 Link Here
77
                                    [% END %]
77
                                    [% END %]
78
                                </a>
78
                                </a>
79
                            [% END %]
79
                            [% END %]
80
                            [% FOREACH filesOption IN filesOptions %]
81
                                <li><a role="menuitem" href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format %]&amp;op=exportxsl&amp;file=[% filesOption.value %]&amp;bib=[% biblionumber %]">[% filesOption.filename %]</a></li>
82
                            [% END %]
80
                        [% END %]
83
                        [% END %]
81
                    </div> <!-- /.dropdown-menu -->
84
                    </div> <!-- /.dropdown-menu -->
82
                </div> <!-- /.dropdown -->
85
                </div> <!-- /.dropdown -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt (+3 lines)
Lines 20-25 Link Here
20
                                [% FOREACH csv_profile IN csv_profiles %]
20
                                [% FOREACH csv_profile IN csv_profiles %]
21
                                    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
21
                                    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
22
                                [% END %]
22
                                [% END %]
23
                                [% FOREACH xsl_export IN xsl_exports %]
24
                                    <option value="xsl.[% xsl_export.value %]">XSL - [% xsl_export.filename %]</option>
25
                                [% END %]
23
                            </select>
26
                            </select>
24
                            <fieldset class="action">
27
                            <fieldset class="action">
25
                                <input type="hidden" name="bib_list" value="[% bib_list | html %]" />
28
                                <input type="hidden" name="bib_list" value="[% bib_list | html %]" />
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt (+3 lines)
Lines 65-70 Link Here
65
                                            [% FOREACH csv_profile IN csv_profiles %]
65
                                            [% FOREACH csv_profile IN csv_profiles %]
66
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
66
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
67
                                            [% END %]
67
                                            [% END %]
68
                                            [% FOREACH xsl_export IN xsl_exports %]
69
                                                <option value="xsl.[% xsl_export.value %]">XSL - [% xsl_export.filename %]</option>
70
                                            [% END %]
68
                                        </select>
71
                                        </select>
69
                                        <span class="required">Required</span>
72
                                        <span class="required">Required</span>
70
                                    </fieldset>
73
                                    </fieldset>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/biblioexport/MARC21_simple_export.xsl (+62 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0"
3
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
   xmlns:marc="http://www.loc.gov/MARC21/slim"
5
   title="Simple Export">
6
<xsl:output method="html" encoding="UTF-8"/>
7
8
    <xsl:template match="/">
9
      <xsl:apply-templates/>
10
    </xsl:template>
11
12
    <xsl:template match="marc:record">
13
      <p>
14
        <xsl:if test="marc:datafield[@tag=245]">
15
        <xsl:for-each select="marc:datafield[@tag=245]">
16
            <xsl:value-of select="marc:subfield[@code='a']"/>
17
            <xsl:if test="marc:subfield[@code='b']">
18
                 <xsl:text> </xsl:text>
19
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
20
            </xsl:if>
21
            <xsl:if test="marc:subfield[@code='c']">
22
                  <xsl:text> </xsl:text>
23
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
24
            </xsl:if>
25
        </xsl:for-each>
26
        </xsl:if>
27
        <xsl:if test="marc:datafield[@tag=260]">
28
        <br/>
29
        <xsl:for-each select="marc:datafield[@tag=260]">
30
            <xsl:if test="marc:subfield[@code='a']">
31
                 <xsl:value-of select="marc:subfield[@code='a']"/>
32
            </xsl:if>
33
            <xsl:if test="marc:subfield[@code='b']">
34
                 <xsl:text> </xsl:text>
35
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
36
            </xsl:if>
37
            <xsl:if test="marc:subfield[@code='c']">
38
                  <xsl:text> </xsl:text>
39
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
40
            </xsl:if>
41
        </xsl:for-each>
42
        </xsl:if>
43
        <xsl:if test="marc:datafield[@tag=264]">
44
        <br/>
45
        <xsl:for-each select="marc:datafield[@tag=264]">
46
            <xsl:if test="marc:subfield[@code='a']">
47
                 <xsl:value-of select="marc:subfield[@code='a']"/>
48
            </xsl:if>
49
            <xsl:if test="marc:subfield[@code='b']">
50
                 <xsl:text> </xsl:text>
51
                 <xsl:value-of select="marc:subfield[@code='b']"></xsl:value-of>
52
            </xsl:if>
53
            <xsl:if test="marc:subfield[@code='c']">
54
                  <xsl:text> </xsl:text>
55
                  <xsl:value-of select="marc:subfield[@code='c']"></xsl:value-of>
56
            </xsl:if>
57
        </xsl:for-each>
58
        </xsl:if>
59
      </p>
60
    </xsl:template>
61
62
</xsl:stylesheet>
(-)a/opac/opac-detail.pl (+3 lines)
Lines 82-87 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
82
    }
82
    }
83
);
83
);
84
84
85
#### ADD CUSTOM XSLT
86
$template->param(filesOptions => CustomXSLTExportList(1));
87
85
my @all_items = GetItemsInfo($biblionumber);
88
my @all_items = GetItemsInfo($biblionumber);
86
if( $specific_item ) {
89
if( $specific_item ) {
87
    @all_items = grep { $_->{itemnumber} == $query->param('itemnumber') } @all_items;
90
    @all_items = grep { $_->{itemnumber} == $query->param('itemnumber') } @all_items;
(-)a/opac/opac-downloadcart.pl (+6 lines)
Lines 28-33 use C4::Items; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Record;
29
use C4::Record;
30
use C4::Ris;
30
use C4::Ris;
31
use C4::XSLT;
31
use Koha::CsvProfiles;
32
use Koha::CsvProfiles;
32
use Koha::RecordProcessor;
33
use Koha::RecordProcessor;
33
34
Lines 116-126 if ($bib_list && $format) { Link Here
116
                $extension = "txt";
117
                $extension = "txt";
117
                $type      = "text/plain";
118
                $type      = "text/plain";
118
            }
119
            }
120
            elsif ($format =~ /^xsl\.(.*)$/) {
121
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1);
122
            }
119
        }
123
        }
120
    }
124
    }
121
125
122
    # If it was a CSV export we change the format after the export so the file extension is fine
126
    # If it was a CSV export we change the format after the export so the file extension is fine
123
    $format = "csv" if ($format =~ m/^\d+$/);
127
    $format = "csv" if ($format =~ m/^\d+$/);
128
    $format = "html" if ($format =~ /^xsl\./);
124
129
125
    print $query->header(
130
    print $query->header(
126
                               -type => ($type) ? $type : 'application/octet-stream',
131
                               -type => ($type) ? $type : 'application/octet-stream',
Lines 142-146 if ($bib_list && $format) { Link Here
142
        ]
147
        ]
143
    );
148
    );
144
    $template->param(bib_list => $bib_list); 
149
    $template->param(bib_list => $bib_list); 
150
    $template->param(xsl_exports => CustomXSLTExportList());
145
    output_html_with_http_headers $query, $cookie, $template->output;
151
    output_html_with_http_headers $query, $cookie, $template->output;
146
}
152
}
(-)a/opac/opac-export.pl (+10 lines)
Lines 26-31 use C4::Biblio; Link Here
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use C4::Auth;
27
use C4::Auth;
28
use C4::Ris;
28
use C4::Ris;
29
use C4::XSLT;
29
use Koha::RecordProcessor;
30
use Koha::RecordProcessor;
30
31
31
my $query = CGI->new;
32
my $query = CGI->new;
Lines 120-125 elsif ( $format =~ /isbd/ ) { Link Here
120
    });
121
    });
121
    $format = 'isbd';
122
    $format = 'isbd';
122
}
123
}
124
elsif ($format =~ /html/ ) {
125
    if ($biblionumber){
126
        my $xslFile = $query->param("file");
127
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
128
        my @hiddenitems;
129
130
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef, 1);
131
    }
132
}
123
else {
133
else {
124
    $error= "Format $format is not supported.";
134
    $error= "Format $format is not supported.";
125
}
135
}
(-)a/virtualshelves/downloadshelf.pl (-1 / +5 lines)
Lines 28-33 use C4::Items; Link Here
28
use C4::Output;
28
use C4::Output;
29
use C4::Record;
29
use C4::Record;
30
use C4::Ris;
30
use C4::Ris;
31
use C4::XSLT;
31
32
32
use Koha::CsvProfiles;
33
use Koha::CsvProfiles;
33
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
Lines 82-93 if ($shelfid && $format) { Link Here
82
                    elsif ($format eq 'bibtex') {
83
                    elsif ($format eq 'bibtex') {
83
                        $output .= marc2bibtex($record, $biblionumber);
84
                        $output .= marc2bibtex($record, $biblionumber);
84
                    }
85
                    }
86
                    elsif ($format =~ /^xsl\.(.*)$/){
87
                        $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,'');
88
                    }
85
                }
89
                }
86
            }
90
            }
87
91
88
            # If it was a CSV export we change the format after the export so the file extension is fine
92
            # If it was a CSV export we change the format after the export so the file extension is fine
89
            $format = "csv" if ($format =~ m/^\d+$/);
93
            $format = "csv" if ($format =~ m/^\d+$/);
90
94
            $format = "html" if ($format =~ /^xsl\./);
91
            print $query->header(
95
            print $query->header(
92
            -type => 'application/octet-stream',
96
            -type => 'application/octet-stream',
93
            -'Content-Transfer-Encoding' => 'binary',
97
            -'Content-Transfer-Encoding' => 'binary',
(-)a/virtualshelves/shelves.pl (-1 / +1 lines)
Lines 354-359 $template->param( Link Here
354
    category => $category,
354
    category => $category,
355
    print    => scalar $query->param('print') || 0,
355
    print    => scalar $query->param('print') || 0,
356
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
356
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
357
    xsl_exports => CustomXSLTExportList()
357
);
358
);
358
359
359
output_html_with_http_headers $query, $cookie, $template->output;
360
output_html_with_http_headers $query, $cookie, $template->output;
360
- 

Return to bug 17385