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

(-)a/installer/data/mysql/atomicupdate/bug-30036.pl (+15 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => '30036',
5
    description => 'Add syspref AuthorityXSLTOpacResultsDisplay',
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{
11
            INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`)
12
            VALUES ('AuthorityXSLTOpacResultsDisplay','','','Enable XSL stylesheet control over authority results page display on opac','Free')
13
        });
14
    },
15
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 70-75 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
70
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'),
70
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'),
71
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
71
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
72
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
72
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
73
('AuthorityXSLTOpacResultsDisplay','','','Enable XSL stylesheet control over authority results page display on opac','Free'),
73
('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free'),
74
('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free'),
74
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
75
('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'),
75
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
76
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref (+5 lines)
Lines 1-5 Link Here
1
Staff interface:
1
Staff interface:
2
    Appearance:
2
    Appearance:
3
        -
4
            - 'Display authority results in the opac interface using XSLT stylesheet at: '
5
            - pref: AuthorityXSLTOpacResultsDisplay
6
              class: file
7
            - '<br />Options:<ul><li>Put a path to define a xslt file</li><li>Put an URL for an external specific stylesheet.</li></ul>{langcode} will be replaced with current interface language and {authtypecode} will be replaced by the authority type code'
3
        -
8
        -
4
            - 'Display authority results in the staff interface using XSLT stylesheet at: '
9
            - 'Display authority results in the staff interface using XSLT stylesheet at: '
5
            - pref: AuthorityXSLTResultsDisplay
10
            - pref: AuthorityXSLTResultsDisplay
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authoritiessearchresultlist.tt (-1 / +7 lines)
Lines 106-112 Link Here
106
                                    <tbody>
106
                                    <tbody>
107
                                        [% FOREACH resul IN result %]
107
                                        [% FOREACH resul IN result %]
108
                                            <tr>
108
                                            <tr>
109
                                                <td>[% PROCESS authresult summary=resul.summary %]</td>
109
                                                <td>
110
                                                    [% IF resul.html %]
111
                                                        [% resul.html | $raw %]
112
                                                    [% ELSE %]
113
                                                        [% PROCESS authresult summary=resul.summary authid=resul.authid %]
114
                                                    [% END %]
115
                                                </td>
110
                                                <td><a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% resul.authid | uri %]">Details</a>
116
                                                <td><a href="/cgi-bin/koha/opac-authoritiesdetail.pl?authid=[% resul.authid | uri %]">Details</a>
111
                                                <td>[% resul.authtype | html %]</td>
117
                                                <td>[% resul.authtype | html %]</td>
112
                                                [% UNLESS ( resul.isEDITORS ) %]
118
                                                [% UNLESS ( resul.isEDITORS ) %]
(-)a/opac/opac-authorities-home.pl (-1 / +23 lines)
Lines 28-33 use C4::Context; Link Here
28
use C4::Output qw( pagination_bar output_html_with_http_headers );
28
use C4::Output qw( pagination_bar output_html_with_http_headers );
29
use C4::Koha;
29
use C4::Koha;
30
use C4::Search::History;
30
use C4::Search::History;
31
use C4::Languages;
32
use Koha::XSLT::Base;
31
33
32
use Koha::Authority::Types;
34
use Koha::Authority::Types;
33
use Koha::SearchEngine::Search;
35
use Koha::SearchEngine::Search;
Lines 100-105 if ( $op eq "do_search" ) { Link Here
100
        $to = $startfrom * $resultsperpage;
102
        $to = $startfrom * $resultsperpage;
101
    }
103
    }
102
104
105
    my $AuthorityXSLTOpacResultsDisplay = C4::Context->preference('AuthorityXSLTOpacResultsDisplay');
106
    if ($results && $AuthorityXSLTOpacResultsDisplay) {
107
        my $lang = C4::Languages::getlanguage();
108
        foreach my $result (@$results) {
109
            my $authority = Koha::Authorities->find($result->{authid});
110
            next unless $authority;
111
            my $authtypecode = $authority->authtypecode;
112
            my $xsl = $AuthorityXSLTOpacResultsDisplay;
113
114
            $xsl =~ s/\{langcode\}/$lang/g;
115
            $xsl =~ s/\{authtypecode\}/$authtypecode/g;
116
            my $xslt_engine = Koha::XSLT::Base->new;
117
            my $output = $xslt_engine->transform({ xml => $authority->marcxml, file => $xsl });
118
            if ($xslt_engine->err) {
119
                warn "XSL transformation failed ($xsl): " . $xslt_engine->err;
120
                next;
121
            }
122
            $result->{html} = $output;
123
        }
124
    }
125
103
    $template->param( result => $results ) if $results;
126
    $template->param( result => $results ) if $results;
104
127
105
    $template->param(
128
    $template->param(
106
- 

Return to bug 30036