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

(-)a/C4/XSLT.pm (-1 / +26 lines)
Lines 32-37 use Koha::RecordProcessor; Link Here
32
use Koha::XSLT::Base;
32
use Koha::XSLT::Base;
33
use Koha::Libraries;
33
use Koha::Libraries;
34
use Koha::Recalls;
34
use Koha::Recalls;
35
use XML::LibXML;
36
use Encode;
37
use vars qw(@ISA @EXPORT);
38
35
39
36
my $engine; #XSLT Handler object
40
my $engine; #XSLT Handler object
37
41
Lines 42-47 BEGIN { Link Here
42
    @EXPORT_OK = qw(
46
    @EXPORT_OK = qw(
43
        buildKohaItemsNamespace
47
        buildKohaItemsNamespace
44
        XSLTParse4Display
48
        XSLTParse4Display
49
        &CustomXSLTExportList
45
    );
50
    );
46
    $engine=Koha::XSLT::Base->new( { do_not_return_source => 1 } );
51
    $engine=Koha::XSLT::Base->new( { do_not_return_source => 1 } );
47
}
52
}
Lines 84-89 sub _get_best_default_xslt_filename { Link Here
84
    return $xslfilename;
89
    return $xslfilename;
85
}
90
}
86
91
92
=head2 get_xslt_sysprefs
93
94
    returns XML xslt sysprefs.
95
96
=cut
97
87
sub get_xslt_sysprefs {
98
sub get_xslt_sysprefs {
88
    my $sysxml = "<sysprefs>\n";
99
    my $sysxml = "<sysprefs>\n";
89
    foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
100
    foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
Lines 121-127 sub get_xsl_filename { Link Here
121
132
122
    my $xslfilename = C4::Context->preference($xslsyspref) || "default";
133
    my $xslfilename = C4::Context->preference($xslsyspref) || "default";
123
134
124
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
135
    if ($xslsyspref eq "XSLTCustomExport") {
136
        my $dir;
137
        $dir = C4::Context->config('intrahtdocs') .
138
            '/' . C4::Context->preference("template") .
139
            '/' . C4::Languages::getlanguage() .
140
            '/xslt/biblioexport';
141
        $xslfilename = $dir . "/" . $xslfilename;
142
    } elsif ($xslsyspref eq "OPACXSLTCustomExport") {
143
        my $dir;
144
        $dir = C4::Context->config('opachtdocs') .
145
            '/' . C4::Context->preference("opacthemes") .
146
            '/' . C4::Languages::getlanguage() .
147
            '/xslt/biblioexport';
148
        $xslfilename = $dir . "/" . $xslfilename;
149
    } elsif ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
125
150
126
        my ( $htdocs, $theme, $xslfile );
151
        my ( $htdocs, $theme, $xslfile );
127
152
(-)a/basket/basket.pl (+4 lines)
Lines 19-24 Link Here
19
use Modern::Perl;
19
use Modern::Perl;
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use C4::Koha;
21
use C4::Koha;
22
22
use C4::Biblio qw(
23
use C4::Biblio qw(
23
    GetMarcSeries
24
    GetMarcSeries
24
    GetMarcSubjects
25
    GetMarcSubjects
Lines 26-31 use C4::Biblio qw( Link Here
26
);
27
);
27
use C4::Auth qw( get_template_and_user );
28
use C4::Auth qw( get_template_and_user );
28
use C4::Output qw( output_html_with_http_headers );
29
use C4::Output qw( output_html_with_http_headers );
30
use C4::XSLT;
31
29
32
30
use Koha::AuthorisedValues;
33
use Koha::AuthorisedValues;
31
use Koha::Biblios;
34
use Koha::Biblios;
Lines 111-116 my $resultsarray = \@results; Link Here
111
$template->param(
114
$template->param(
112
    BIBLIO_RESULTS => $resultsarray,
115
    BIBLIO_RESULTS => $resultsarray,
113
    csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }),
116
    csv_profiles => Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }),
117
    xsl_exports => CustomXSLTExportList(),
114
    bib_list => $bib_list,
118
    bib_list => $bib_list,
115
);
119
);
116
120
(-)a/basket/downloadcart.pl (+6 lines)
Lines 26-31 use C4::Auth qw( get_template_and_user ); Link Here
26
use C4::Output qw( output_html_with_http_headers );
26
use C4::Output qw( output_html_with_http_headers );
27
use C4::Record;
27
use C4::Record;
28
use C4::Ris qw( marc2ris );
28
use C4::Ris qw( marc2ris );
29
use C4::XSLT;
29
30
30
use Koha::CsvProfiles;
31
use Koha::CsvProfiles;
31
use Koha::Biblios;
32
use Koha::Biblios;
Lines 78-88 if ($bib_list && $format) { Link Here
78
            elsif ($format eq 'bibtex') {
79
            elsif ($format eq 'bibtex') {
79
                $output .= marc2bibtex($record, $biblionumber);
80
                $output .= marc2bibtex($record, $biblionumber);
80
            }
81
            }
82
            elsif ($format =~ /^xsl\.(.*)$/) {
83
                $output .= XSLTParse4Display($biblio, $record, 'XSLTCustomExport', 1, undef, , '', $1, '');
84
            }
81
        }
85
        }
82
    }
86
    }
83
87
84
    # 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
85
    $format = "csv" if ($format =~ m/^\d+$/);
89
    $format = "csv" if ($format =~ m/^\d+$/);
90
    $format = "html" if ($format =~ /^xsl\./);
86
91
87
    print $query->header(
92
    print $query->header(
88
	-type => 'application/octet-stream',
93
	-type => 'application/octet-stream',
Lines 92-97 if ($bib_list && $format) { Link Here
92
97
93
} else { 
98
} else { 
94
    $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());
95
    $template->param(bib_list => $bib_list); 
101
    $template->param(bib_list => $bib_list); 
96
    output_html_with_http_headers $query, $cookie, $template->output;
102
    output_html_with_http_headers $query, $cookie, $template->output;
97
}
103
}
(-)a/catalogue/detail.pl (+3 lines)
Lines 85-90 if ( C4::Context->config('enable_plugins') ) { Link Here
85
    );
85
    );
86
}
86
}
87
87
88
##### ADD CUSTOM XSLT
89
$template->param(filesOptions => CustomXSLTExportList(0));
90
88
my $biblionumber = $query->param('biblionumber');
91
my $biblionumber = $query->param('biblionumber');
89
$biblionumber = HTML::Entities::encode($biblionumber);
92
$biblionumber = HTML::Entities::encode($biblionumber);
90
my $biblio = Koha::Biblios->find( $biblionumber );
93
my $biblio = Koha::Biblios->find( $biblionumber );
(-)a/catalogue/export.pl (+16 lines)
Lines 7-12 use C4::Output; Link Here
7
use C4::Biblio qw( GetMarcControlnumber );
7
use C4::Biblio qw( GetMarcControlnumber );
8
use CGI qw ( -utf8 );
8
use CGI qw ( -utf8 );
9
use C4::Ris qw( marc2ris );
9
use C4::Ris qw( marc2ris );
10
use C4::XSLT;
11
10
12
11
13
12
14
Lines 86-89 if ($op eq "export") { Link Here
86
                -attachment=>"$file_pre$file_id.$format");
88
                -attachment=>"$file_pre$file_id.$format");
87
            print $marc;
89
            print $marc;
88
        }
90
        }
91
}elsif ($op eq "exportxsl"){
92
    my $biblionumber = $query->param("bib");
93
    if ($biblionumber){
94
        my $xslFile = $query->param("file");
95
        my $marc = GetMarcBiblio( { biblionumber => $biblionumber, embed_items => 1 } );
96
        my $format=$query->param("format")||'txt';
97
        my @hiddenitems;
98
99
        $marc = XSLTParse4Display($biblionumber, $marc, 'XSLTCustomExport', 1, \@hiddenitems, '', $xslFile,'');
100
        print $query->header(
101
            -type => 'application/octet-stream',
102
            -attachment=>"bib-$biblionumber.$format");
103
        print $marc;
104
    }
89
}
105
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (+3 lines)
Lines 105-110 Link Here
105
        <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>
105
        <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>
106
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
106
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=mods&amp;op=export&amp;bib=[% biblionumber | uri %]">MODS (XML)</a></li>
107
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
107
        <li><a href="/cgi-bin/koha/catalogue/export.pl?format=ris&amp;op=export&amp;bib=[% biblionumber | uri %]">RIS</a></li>
108
        [% FOREACH filesOption IN filesOptions %]
109
            <li><a href="/cgi-bin/koha/catalogue/export.pl?format=[% filesOption.format | uri %]&amp;op=exportxsl&amp;file=[% filesOption.value | uri %]&amp;bib=[% biblionumber | uri %]">XSL - [% filesOption.filename | html %]</a></li>
110
        [% END %]
108
    </ul>
111
    </ul>
109
    </div>
112
    </div>
110
113
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (+3 lines)
Lines 38-43 Link Here
38
                    [% FOREACH csv_profile IN csv_profiles %]
38
                    [% FOREACH csv_profile IN csv_profiles %]
39
                        <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>
39
                        <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>
40
                    [% END %]
40
                    [% END %]
41
                    [% FOREACH xsl_export IN xsl_exports %]
42
                        <li><a href="/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=xsl.[% xsl_export.value | uri %]&amp;shelfid=[% shelf.shelfnumber | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
43
                    [% END %]
41
                </ul>
44
                </ul>
42
        </div>
45
        </div>
43
        <div class="btn-group"><a class="btn btn-default" href="#" id="sendlist"><i class="fa-solid fa-envelope"></i> Send list</a></div>
46
        <div class="btn-group"><a class="btn btn-default" href="#" id="sendlist"><i class="fa-solid fa-envelope"></i> Send list</a></div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+1 lines)
Lines 290-295 OPAC: Link Here
290
                mods: MODS
290
                mods: MODS
291
                ris: RIS
291
                ris: RIS
292
                isbd: ISBD
292
                isbd: ISBD
293
                custom: XSL - Simple Export
293
        -
294
        -
294
            - pref: OpacSeparateHoldings
295
            - pref: OpacSeparateHoldings
295
              choices:
296
              choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt (+3 lines)
Lines 63-68 Link Here
63
                            [% FOREACH csv_profile IN csv_profiles %]
63
                            [% FOREACH csv_profile IN csv_profiles %]
64
                                <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>
64
                                <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>
65
                            [% END %]
65
                            [% END %]
66
                            [% FOREACH xsl_export IN xsl_exports %]
67
                                <li><a href="/cgi-bin/koha/basket/downloadcart.pl?format=xsl.[% xsl_export.value | uri %]&amp;bib_list=[% bib_list | uri %]">XSL - [% xsl_export.filename | html %]</a></li>
68
                            [% END %]
66
                            </ul>
69
                            </ul>
67
                        </div>
70
                        </div>
68
                        <a class="btn btn-default" href="basket.pl" id="print_cart"><i class="fa fa-print"></i> Print</a>
71
                        <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 (-1 / +4 lines)
Lines 1095-1101 Link Here
1095
        <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
1095
        <option data-toggle="modal" data-target="#exportModal_">Dublin Core</option>
1096
        <option value="marcxml">MARCXML</option>
1096
        <option value="marcxml">MARCXML</option>
1097
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
1097
        <option value="marc8">MARC (non-Unicode/MARC-8)</option>
1098
        <option value="utf8">MARC (Unicode/UTF-8)</option>    </select>
1098
        <option value="utf8">MARC (Unicode/UTF-8)</option>
1099
        [% FOREACH filesOption IN filesOptions %]
1100
            <option value="[% filesOption.value | html %]">XSL -[% filesOption.filename | html %]</option>
1101
        [% END %]</select>
1099
        <input type="submit" name="save" class="btn btn-primary" value="Download record" /></td>
1102
        <input type="submit" name="save" class="btn btn-primary" value="Download record" /></td>
1100
  </tr>
1103
  </tr>
1101
  <tr><td>
1104
  <tr><td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/downloadshelf.tt (+3 lines)
Lines 42-47 Link Here
42
	    [% FOREACH csv_profile IN csv_profiles %]
42
	    [% FOREACH csv_profile IN csv_profiles %]
43
	    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
43
	    <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
44
	    [% END %]
44
	    [% END %]
45
        [% FOREACH xsl_export IN xsl_exports %]
46
            <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
47
        [% END %]
45
	</select>
48
	</select>
46
	</li></ol>
49
	</li></ol>
47
	</fieldset>
50
	</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 (-22 / +28 lines)
Lines 66-95 Link Here
66
        <li>
66
        <li>
67
            <div id="export">
67
            <div id="export">
68
                <div class="dropdown">
68
                <div class="dropdown">
69
                    <a id="format" class="btn btn-link btn-lg dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Save record <b class="caret"></b></a>
69
                    <a id="format" class="btn btn-link btn-lg dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-fw fa-download"></i> Save record <b class="caret"></b></a>
70
                    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="format">
70
                        <ul class="dropdown-menu pull-left" role="menu" aria-labelledby="format">
71
                        [% FOREACH option IN export_options %]
71
                            [% FOREACH option IN export_options %]
72
                            [% IF option == 'dc' %]
72
                                [% IF option == 'dc' %]
73
                                <a class="dropdown-item" href="#" data-toggle="modal" data-target="#exportModal_">Dublin Core</a>
73
                                    <li><a role="menuitem" href="#" data-toggle="modal" data-target="#exportModal_">Dublin Core</a></li>
74
                            [% ELSE %]
74
                                [% ELSIF option != 'custom' %]
75
                                <a class="dropdown-item" href="/cgi-bin/koha/opac-export.pl?op=export&amp;bib=[% biblio.biblionumber | html %]&amp;format=[% option | html %]">
75
                                <li>
76
                                    [% SWITCH option %]
76
                                    <a role="menuitem" href="/cgi-bin/koha/opac-export.pl?op=export&amp;bib=[% biblio.biblionumber | html %]&amp;format=[% option | html %]">
77
                                        [% CASE 'bibtex' %]<span>BIBTEX</span>
77
                                        [% SWITCH option %]
78
                                        [% CASE 'endnote' %]<span>EndNote</span>
78
                                            [% CASE 'bibtex' %]BIBTEX
79
                                        [% CASE 'marcxml' %]<span>MARCXML</span>
79
                                            [% CASE 'endnote' %]EndNote
80
                                        [% CASE 'marc8' %]<span>MARC (non-Unicode/MARC-8)</span>
80
                                            [% CASE 'marcxml' %]MARCXML
81
                                        [% CASE 'utf8' %]<span>MARC (Unicode/UTF-8)</span>
81
                                            [% CASE 'marc8' %]MARC (non-Unicode/MARC-8)
82
                                        [% CASE 'marcstd' %]<span>MARC (Unicode/UTF-8, Standard)</span>
82
                                            [% CASE 'utf8' %]MARC (Unicode/UTF-8)
83
                                        [% CASE 'mods' %]<span>MODS (XML)</span>
83
                                            [% CASE 'marcstd' %]MARC (Unicode/UTF-8, Standard)
84
                                        [% CASE 'ris' %]<span>RIS</span>
84
                                            [% CASE 'mods' %]MODS (XML)
85
                                        [% CASE 'isbd' %]<span>ISBD</span>
85
                                            [% CASE 'ris' %]RIS
86
                                            [% CASE 'isbd' %]ISBD
87
                                        [% END %]
88
                                    </a>
89
                                </li>
90
                                [% ELSE %]
91
                                    [% FOREACH filesOption IN filesOptions %]
92
                                        <li><a role="menuitem" href="/cgi-bin/koha/opac-export.pl?format=[% filesOption.format | html %]&amp;op=exportxsl&amp;file=[% filesOption.value | html %]&amp;bib=[% biblionumber | html %]">XSL - [% filesOption.filename | html %]</a></li>
86
                                    [% END %]
93
                                    [% END %]
87
                                </a>
94
                                [% END %]
88
                            [% END %]
95
                            [% END %]
89
                        [% END %]
96
                        </ul>
90
                    </div> <!-- /.dropdown-menu -->
97
                </div>
91
                </div> <!-- /.dropdown -->
98
            </div>
92
            </div> <!-- /#export -->
93
        </li>
99
        </li>
94
    [% END %]
100
    [% END %]
95
101
(-)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 | html %]">XSL - [% xsl_export.filename | html %]</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 70-75 Link Here
70
                                            [% FOREACH csv_profile IN csv_profiles %]
70
                                            [% FOREACH csv_profile IN csv_profiles %]
71
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
71
                                            <option value="[% csv_profile.export_format_id | html %]">CSV - [% csv_profile.profile | html %]</option>
72
                                            [% END %]
72
                                            [% END %]
73
                                            [% FOREACH xsl_export IN xsl_exports %]
74
                                                <option value="xsl.[% xsl_export.value | html %]">XSL - [% xsl_export.filename | html %]</option>
75
                                            [% END %]
73
                                        </select>
76
                                        </select>
74
                                        <span class="required">Required</span>
77
                                        <span class="required">Required</span>
75
                                    </fieldset>
78
                                    </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 103-108 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
103
    }
103
    }
104
);
104
);
105
105
106
#### ADD CUSTOM XSLT
107
$template->param(filesOptions => CustomXSLTExportList(1));
108
106
my $patron = Koha::Patrons->find( $borrowernumber );
109
my $patron = Koha::Patrons->find( $borrowernumber );
107
110
108
my $biblio = Koha::Biblios->find( $biblionumber );
111
my $biblio = Koha::Biblios->find( $biblionumber );
(-)a/opac/opac-downloadcart.pl (+8 lines)
Lines 28-33 use C4::Output qw( output_html_with_http_headers ); Link Here
28
use C4::Record;
28
use C4::Record;
29
use C4::Ris qw( marc2ris );
29
use C4::Ris qw( marc2ris );
30
use Koha::Biblios;
30
use Koha::Biblios;
31
use C4::XSLT;
32
31
use Koha::CsvProfiles;
33
use Koha::CsvProfiles;
32
use Koha::RecordProcessor;
34
use Koha::RecordProcessor;
33
35
Lines 114-124 if ($bib_list && $format) { Link Here
114
                $extension = "txt";
116
                $extension = "txt";
115
                $type      = "text/plain";
117
                $type      = "text/plain";
116
            }
118
            }
119
            elsif ($format =~ /^xsl\.(.*)$/) {
120
                $output .= XSLTParse4Display($biblio, $record, 'OPACXSLTCustomExport', 1, undef, undef, $1, '');
121
            }
117
        }
122
        }
118
    }
123
    }
119
124
120
    # If it was a CSV export we change the format after the export so the file extension is fine
125
    # If it was a CSV export we change the format after the export so the file extension is fine
121
    $format = "csv" if ($format =~ m/^\d+$/);
126
    $format = "csv" if ($format =~ m/^\d+$/);
127
    $format = "html" if ($format =~ /^xsl\./);
122
128
123
    print $query->header(
129
    print $query->header(
124
                               -type => ($type) ? $type : 'application/octet-stream',
130
                               -type => ($type) ? $type : 'application/octet-stream',
Lines 138-142 if ($bib_list && $format) { Link Here
138
        ),
144
        ),
139
        bib_list => $bib_list,
145
        bib_list => $bib_list,
140
    );
146
    );
147
    $template->param(bib_list => $bib_list);
148
    $template->param(xsl_exports => CustomXSLTExportList());
141
    output_html_with_http_headers $query, $cookie, $template->output;
149
    output_html_with_http_headers $query, $cookie, $template->output;
142
}
150
}
(-)a/opac/opac-downloadshelf.pl (-2 / +8 lines)
Lines 27-32 use C4::Output qw( output_html_with_http_headers ); Link Here
27
use C4::Record;
27
use C4::Record;
28
use C4::Ris qw( marc2ris );
28
use C4::Ris qw( marc2ris );
29
use Koha::Biblios;
29
use Koha::Biblios;
30
use C4::XSLT;
31
30
use Koha::CsvProfiles;
32
use Koha::CsvProfiles;
31
use Koha::RecordProcessor;
33
use Koha::RecordProcessor;
32
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
Lines 122-134 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
122
                    });
124
                    });
123
                    $extension = "txt";
125
                    $extension = "txt";
124
                    $type      = "text/plain";
126
                    $type      = "text/plain";
125
                }
127
                }elsif ($format =~ /^xsl\.(.*)$/){
128
                         $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, undef, $1, '', 1);
129
                    }
126
            }
130
            }
127
        }
131
        }
128
132
129
        # If it was a CSV export we change the format after the export so the file extension is fine
133
        # If it was a CSV export we change the format after the export so the file extension is fine
130
        $format = "csv" if ($format =~ m/^\d+$/);
134
        $format = "csv" if ($format =~ m/^\d+$/);
131
135
        $format = "html" if ($format =~ /^xsl\./);
132
        print $query->header(
136
        print $query->header(
133
                                   -type => ($type) ? $type : 'application/octet-stream',
137
                                   -type => ($type) ? $type : 'application/octet-stream',
134
            -'Content-Transfer-Encoding' => 'binary',
138
            -'Content-Transfer-Encoding' => 'binary',
Lines 154-159 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { Link Here
154
            ),
158
            ),
155
            shelf => $shelf,
159
            shelf => $shelf,
156
        );
160
        );
161
        $template->param(xsl_exports => CustomXSLTExportList());
162
        $template->param( shelf => $shelf );
157
        output_html_with_http_headers $query, $cookie, $template->output;
163
        output_html_with_http_headers $query, $cookie, $template->output;
158
    }
164
    }
159
165
(-)a/opac/opac-export.pl (+11 lines)
Lines 31-36 use CGI qw ( -utf8 ); Link Here
31
use C4::Auth;
31
use C4::Auth;
32
use C4::Ris qw( marc2ris );
32
use C4::Ris qw( marc2ris );
33
use Koha::Biblios;
33
use Koha::Biblios;
34
use C4::XSLT;
35
34
use Koha::RecordProcessor;
36
use Koha::RecordProcessor;
35
37
36
my $query = CGI->new;
38
my $query = CGI->new;
Lines 137-142 elsif ( $format =~ /isbd/ ) { Link Here
137
    });
139
    });
138
    $format = 'isbd';
140
    $format = 'isbd';
139
}
141
}
142
elsif ($format =~ /html/ ) {
143
    if ($biblionumber){
144
        my $xslFile = $query->param("file");
145
        $marc = C4::Biblio::GetMarcBiblio({biblionumber => $biblionumber});
146
        my @hiddenitems;
147
148
        $marc = XSLTParse4Display($biblionumber, $marc, 'OPACXSLTCustomExport', 1, \@hiddenitems, undef, $xslFile, undef);
149
    }
150
}
140
else {
151
else {
141
    $error= "Format $format is not supported.";
152
    $error= "Format $format is not supported.";
142
}
153
}
(-)a/virtualshelves/downloadshelf.pl (-1 / +6 lines)
Lines 25-30 use C4::Auth qw( get_template_and_user ); Link Here
25
use C4::Output qw( output_html_with_http_headers );
25
use C4::Output qw( output_html_with_http_headers );
26
use C4::Record;
26
use C4::Record;
27
use C4::Ris qw( marc2ris );
27
use C4::Ris qw( marc2ris );
28
use C4::XSLT;
29
28
30
29
use Koha::Biblios;
31
use Koha::Biblios;
30
use Koha::CsvProfiles;
32
use Koha::CsvProfiles;
Lines 79-90 if ($shelfid && $format) { Link Here
79
                    elsif ($format eq 'bibtex') {
81
                    elsif ($format eq 'bibtex') {
80
                        $output .= marc2bibtex($record, $biblionumber);
82
                        $output .= marc2bibtex($record, $biblionumber);
81
                    }
83
                    }
84
                    elsif ($format =~ /^xsl\.(.*)$/){
85
                        $output .= XSLTParse4Display($biblionumber, $record, 'XSLTCustomExport', 1, undef, ,'',$1,'');
86
                    }
82
                }
87
                }
83
            }
88
            }
84
89
85
            # If it was a CSV export we change the format after the export so the file extension is fine
90
            # 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+$/);
91
            $format = "csv" if ($format =~ m/^\d+$/);
87
92
            $format = "html" if ($format =~ /^xsl\./);
88
            print $query->header(
93
            print $query->header(
89
            -type => 'application/octet-stream',
94
            -type => 'application/octet-stream',
90
            -'Content-Transfer-Encoding' => 'binary',
95
            -'Content-Transfer-Encoding' => 'binary',
(-)a/virtualshelves/shelves.pl (-1 / +1 lines)
Lines 393-398 $template->param( Link Here
393
    print    => scalar $query->param('print') || 0,
393
    print    => scalar $query->param('print') || 0,
394
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ],
394
    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ],
395
    allow_transfer => $allow_transfer,
395
    allow_transfer => $allow_transfer,
396
    xsl_exports => CustomXSLTExportList()
396
);
397
);
397
398
398
output_html_with_http_headers $query, $cookie, $template->output;
399
output_html_with_http_headers $query, $cookie, $template->output;
399
- 

Return to bug 17385