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_Handler;
34
use Koha::XSLT_Handler;
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_Handler->new( { do_not_return_source => 1 } );
55
    $engine=Koha::XSLT_Handler->new( { do_not_return_source => 1 } );
53
}
56
}
Lines 188-200 sub get_xslt_sysprefs { Link Here
188
}
191
}
189
192
190
sub XSLTParse4Display {
193
sub XSLTParse4Display {
191
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang ) = @_;
194
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang , $opac) = @_;
192
195
193
    $sysxml ||= C4::Context->preference($xslsyspref);
196
    $sysxml ||= C4::Context->preference($xslsyspref);
194
    $xslfilename ||= C4::Context->preference($xslsyspref);
197
    $xslfilename ||= C4::Context->preference($xslsyspref);
195
    $lang ||= C4::Languages::getlanguage();
198
    $lang ||= C4::Languages::getlanguage();
196
199
197
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
200
    if ($xslsyspref eq "XSLTCustomExport") {
201
        my $dir;
202
        if ($opac) {
203
            $dir = C4::Context->config('opachtdocs') .
204
                '/' . C4::Context->preference("opacthemes") .
205
                '/' . C4::Languages::getlanguage() .
206
                '/xslt/biblioexport';
207
        } else {
208
            $dir = C4::Context->config('intrahtdocs') .
209
                '/' . C4::Context->preference("template") .
210
                '/' . C4::Languages::getlanguage() .
211
                '/xslt/biblioexport';
212
        }
213
        $xslfilename = $dir . "/" . $xslfilename;
214
    } elsif( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
198
        my $htdocs;
215
        my $htdocs;
199
        my $theme;
216
        my $theme;
200
        my $xslfile;
217
        my $xslfile;
Lines 352-357 sub engine { Link Here
352
    return $engine;
369
    return $engine;
353
}
370
}
354
371
372
=head2 CustomXSLTExportList
373
374
 Returns list of file for custom xslt conversion
375
376
=cut
377
378
sub CustomXSLTExportList {
379
    my $opac = shift; # opac (1) vs intranet (0)
380
    my @tabFiles;
381
382
    my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') .
383
                      '/' . C4::Context->preference( $opac ? "opacthemes" : "template") .
384
                      '/' . C4::Languages::getlanguage() .
385
                      '/xslt/biblioexport';
386
    my @files = <$dir/*.xsl>;
387
    foreach my $file (@files) {
388
        if ( -f "$file" ) {
389
            (my $text = $file) =~ s/.*\///g;
390
391
            ## Get title of the option
392
            my $dom = XML::LibXML->load_xml( location => $file );
393
            my $node = $dom->documentElement();
394
            my $title = $node->{"title"};
395
            ($title = $text) =~ s/\.xsl// unless defined $title;
396
397
            # Get output format
398
            # There should only be one xsl:output node, so taking the first one only is OK
399
            $node = @{$node->findnodes("xsl:output")}[0];
400
            my $outputformat = $node->{"method"} if $node;
401
            $outputformat = "txt" if ($outputformat eq "" || $outputformat eq "text");
402
403
            my %row = (
404
                value       => $text,
405
                filename    => $title,
406
                format      => $outputformat,
407
            );
408
409
            push @tabFiles, \%row;
410
        }
411
    }
412
    return \@tabFiles;
413
}
414
415
355
1;
416
1;
356
417
357
__END__
418
__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 124-129 my $resultsarray = \@results; Link Here
124
$template->param(
125
$template->param(
125
    BIBLIO_RESULTS => $resultsarray,
126
    BIBLIO_RESULTS => $resultsarray,
126
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
127
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
128
    xsl_exports => CustomXSLTExportList(),
127
    bib_list => $bib_list,
129
    bib_list => $bib_list,
128
);
130
);
129
131
(-)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 79-89 if ($bib_list && $format) { Link Here
79
            elsif ($format eq 'bibtex') {
79
            elsif ($format eq 'bibtex') {
80
                $output .= marc2bibtex($record, $biblio);
80
                $output .= marc2bibtex($record, $biblio);
81
            }
81
            }
82
            elsif ($format =~ /^xsl\.(.*)$/) {
83
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, '');
84
            }
82
        }
85
        }
83
    }
86
    }
84
87
85
    # If it was a CSV export we change the format after the export so the file extension is fine
88
    # If it was a CSV export we change the format after the export so the file extension is fine
86
    $format = "csv" if ($format =~ m/^\d+$/);
89
    $format = "csv" if ($format =~ m/^\d+$/);
90
    $format = "html" if ($format =~ /^xsl\./);
87
91
88
    print $query->header(
92
    print $query->header(
89
	-type => 'application/octet-stream',
93
	-type => 'application/octet-stream',
Lines 93-98 if ($bib_list && $format) { Link Here
93
97
94
} else { 
98
} else { 
95
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
99
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
100
    $template->param(xsl_exports => CustomXSLTExportList());
96
    $template->param(bib_list => $bib_list); 
101
    $template->param(bib_list => $bib_list); 
97
    output_html_with_http_headers $query, $cookie, $template->output;
102
    output_html_with_http_headers $query, $cookie, $template->output;
98
}
103
}
(-)a/catalogue/detail.pl (+3 lines)
Lines 60-65 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( Link Here
60
    }
60
    }
61
);
61
);
62
62
63
##### ADD CUSTOM XSLT
64
$template->param(filesOptions => CustomXSLTExportList(0));
65
63
my $biblionumber = $query->param('biblionumber');
66
my $biblionumber = $query->param('biblionumber');
64
$biblionumber = HTML::Entities::encode($biblionumber);
67
$biblionumber = HTML::Entities::encode($biblionumber);
65
my $record       = GetMarcBiblio({ biblionumber => $biblionumber });
68
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 78-81 if ($op eq "export") { Link Here
78
                -attachment=>"bib-$biblionumber.$format");
79
                -attachment=>"bib-$biblionumber.$format");
79
            print $marc;
80
            print $marc;
80
        }
81
        }
82
}elsif ($op eq "exportxsl"){
83
    my $biblionumber = $query->param("bib");
84
    if ($biblionumber){
85
        my $xslFile = $query->param("file");
86
        my $marc = GetMarcBiblio( { biblionumber => $biblionumber, embed_items => 1 } );
87
        my $format=$query->param("format")||'txt';
88
        my @hiddenitems;
89
90
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,'');
91
        print $query->header(
92
            -type => 'application/octet-stream',
93
            -attachment=>"bib-$biblionumber.$format");
94
        print $marc;
95
    }
81
}
96
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+3 lines)
Lines 96-101 CAN_user_serials_create_subscription ) %] Link Here
96
        <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>
96
        <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=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
97
        <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=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
98
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
99
        [% FOREACH filesOption IN filesOptions %]
100
            <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>
101
        [% END %]
99
    </ul>
102
    </ul>
100
    </div>
103
    </div>
101
104
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (+3 lines)
Lines 23-28 Link Here
23
                    [% FOREACH csv_profile IN csv_profiles %]
23
                    [% FOREACH csv_profile IN csv_profiles %]
24
                        <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>
24
                        <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>
25
                    [% END %]
25
                    [% END %]
26
                    [% FOREACH xsl_export IN xsl_exports %]
27
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=xsl.[% xsl_export.value %]&amp;shelfid=[% shelf.shelfnumber %]">XSL - [% xsl_export.filename %]</a></li>
28
                    [% END %]
26
                </ul>
29
                </ul>
27
        </div>
30
        </div>
28
        <div class="btn-group"><a class="btn btn-default btn-sm" href="#" id="sendlist"><i class="fa fa-envelope"></i> Send list</a></div>
31
        <div class="btn-group"><a class="btn btn-default btn-sm" 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 btn-sm" href="basket.pl" id="print_cart"><i class="fa fa-print"></i> Print</a>
64
                        <a class="btn btn-default btn-sm" 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 (-1 / +4 lines)
Lines 855-861 Link Here
855
        <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
855
        <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
856
        <option value="marcxml">MARCXML</option>
856
        <option value="marcxml">MARCXML</option>
857
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
857
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
858
        <option value="utf8">MARC (Unicode/UTF-8)</option>    </select>
858
        <option value="utf8">MARC (Unicode/UTF-8)</option>
859
        [% FOREACH filesOption IN filesOptions %]
860
            <option value="[% filesOption.value %]">[% filesOption.filename %]</option>
861
        [% END %]</select>
859
        <input type="submit" name="save" value="Download Record" /></td>
862
        <input type="submit" name="save" value="Download Record" /></td>
860
  </tr>
863
  </tr>
861
  <tr><td>
864
  <tr><td>
(-)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 68-73 Link Here
68
                                </li>
68
                                </li>
69
                                [% END %]
69
                                [% END %]
70
                            [% END %]
70
                            [% END %]
71
                            [% FOREACH filesOption IN filesOptions %]
72
                                <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>
73
                            [% END %]
71
                        </ul>
74
                        </ul>
72
                </div>
75
                </div>
73
            </div>
76
            </div>
(-)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 59-64 Link Here
59
                                            [% FOREACH csv_profile IN csv_profiles %]
59
                                            [% FOREACH csv_profile IN csv_profiles %]
60
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
60
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
61
                                            [% END %]
61
                                            [% END %]
62
                                            [% FOREACH xsl_export IN xsl_exports %]
63
                                                <option value="xsl.[% xsl_export.value %]">XSL - [% xsl_export.filename %]</option>
64
                                            [% END %]
62
                                        </select>
65
                                        </select>
63
                                        <span class="required">Required</span>
66
                                        <span class="required">Required</span>
64
                                    </fieldset>
67
                                    </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 78-83 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
78
    }
78
    }
79
);
79
);
80
80
81
##### ADD CUSTOM XSLT
82
$template->param(filesOptions => CustomXSLTExportList(1));
83
81
my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
84
my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
82
$biblionumber = int($biblionumber);
85
$biblionumber = int($biblionumber);
83
86
(-)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 99-109 if ($bib_list && $format) { Link Here
99
                $extension = "txt";
100
                $extension = "txt";
100
                $type      = "text/plain";
101
                $type      = "text/plain";
101
            }
102
            }
103
            elsif ($format =~ /^xsl\.(.*)$/) {
104
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1);
105
            }
102
        }
106
        }
103
    }
107
    }
104
108
105
    # If it was a CSV export we change the format after the export so the file extension is fine
109
    # If it was a CSV export we change the format after the export so the file extension is fine
106
    $format = "csv" if ($format =~ m/^\d+$/);
110
    $format = "csv" if ($format =~ m/^\d+$/);
111
    $format = "html" if ($format =~ /^xsl\./);
107
112
108
    print $query->header(
113
    print $query->header(
109
                               -type => ($type) ? $type : 'application/octet-stream',
114
                               -type => ($type) ? $type : 'application/octet-stream',
Lines 114-119 if ($bib_list && $format) { Link Here
114
119
115
} else { 
120
} else { 
116
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
121
    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
122
    $template->param(xsl_exports => CustomXSLTExportList());
117
    $template->param(bib_list => $bib_list); 
123
    $template->param(bib_list => $bib_list); 
118
    output_html_with_http_headers $query, $cookie, $template->output;
124
    output_html_with_http_headers $query, $cookie, $template->output;
119
}
125
}
(-)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 106-111 elsif ( $format =~ /isbd/ ) { Link Here
106
    });
107
    });
107
    $format = 'isbd';
108
    $format = 'isbd';
108
}
109
}
110
elsif ($format =~ /html/ ) {
111
    if ($biblionumber){
112
        my $xslFile = $query->param("file");
113
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
114
        my @hiddenitems;
115
116
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef, 1);
117
    }
118
}
109
else {
119
else {
110
    $error= "Format $format is not supported.";
120
    $error= "Format $format is not supported.";
111
}
121
}
(-)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 83-94 if ($shelfid && $format) { Link Here
83
                    elsif ($format eq 'bibtex') {
84
                    elsif ($format eq 'bibtex') {
84
                        $output .= marc2bibtex($record, $biblionumber);
85
                        $output .= marc2bibtex($record, $biblionumber);
85
                    }
86
                    }
87
                    elsif ($format =~ /^xsl\.(.*)$/){
88
                        $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,'');
89
                    }
86
                }
90
                }
87
            }
91
            }
88
92
89
            # If it was a CSV export we change the format after the export so the file extension is fine
93
            # If it was a CSV export we change the format after the export so the file extension is fine
90
            $format = "csv" if ($format =~ m/^\d+$/);
94
            $format = "csv" if ($format =~ m/^\d+$/);
91
95
            $format = "html" if ($format =~ /^xsl\./);
92
            print $query->header(
96
            print $query->header(
93
            -type => 'application/octet-stream',
97
            -type => 'application/octet-stream',
94
            -'Content-Transfer-Encoding' => 'binary',
98
            -'Content-Transfer-Encoding' => 'binary',
(-)a/virtualshelves/shelves.pl (-1 / +1 lines)
Lines 351-356 $template->param( Link Here
351
    category => $category,
351
    category => $category,
352
    print    => scalar $query->param('print') || 0,
352
    print    => scalar $query->param('print') || 0,
353
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
353
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
354
    xsl_exports => CustomXSLTExportList()
354
);
355
);
355
356
356
output_html_with_http_headers $query, $cookie, $template->output;
357
output_html_with_http_headers $query, $cookie, $template->output;
357
- 

Return to bug 17385