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

(-)a/installer/data/mysql/atomicupdate/bug-21330.pl (+15 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => '21330',
5
    description => 'Add syspref AuthorityXSLTOpacDetailsDisplay',
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 ('AuthorityXSLTOpacDetailsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','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
('AuthorityXSLTOpacDetailsDisplay','','','Enable XSL stylesheet control over authority details 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 details in the opac interface using XSLT stylesheet at: '
5
            - pref: AuthorityXSLTOpacDetailsDisplay
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-auth-detail.tt (-76 / +80 lines)
Lines 75-163 Link Here
75
                            [% IF count %]<a href="/cgi-bin/koha/opac-search.pl?type=opac&amp;q=[% authid | uri %]&amp;idx=an,phr">Number of records used in: [% count | html %]</a>[% ELSE %]This authority is not used in any records.[% END %]
75
                            [% IF count %]<a href="/cgi-bin/koha/opac-search.pl?type=opac&amp;q=[% authid | uri %]&amp;idx=an,phr">Number of records used in: [% count | html %]</a>[% ELSE %]This authority is not used in any records.[% END %]
76
                        </div>
76
                        </div>
77
77
78
                        <div class="authstanza">
78
                        [% IF html %]
79
                            [% FOREACH authorize IN summary.authorized %]
79
                            [% html | $raw %]
80
                                <div class="heading authorized auth[% seefro.field | html %]">
80
                        [% ELSE %]
81
                                    <span class="label">Preferred form: </span>
81
                            <div class="authstanza">
82
                                    <span class="authorized">[% authorize.heading | html %]</span>
82
                                [% FOREACH authorize IN summary.authorized %]
83
                                    <div class="heading authorized auth[% seefro.field | html %]">
84
                                        <span class="label">Preferred form: </span>
85
                                        <span class="authorized">[% authorize.heading | html %]</span>
86
                                    </div>
87
                                [% END %]
88
                                [% PROCESS otherscript headings=summary.otherscript wantcategory='preferred' %]
89
                            </div>
90
91
                            [% IF summary.seefrom.size %]
92
                                <div class="authstanza seefrom">
93
                                    <div class="authstanzaheading">Used for/see from:</div>
94
                                    <ul class="seefrom">
95
                                        [% FOREACH seefro IN summary.seefrom %]
96
                                            <li class="heading seefrom auth[% seefro.field | html %]">
97
                                                [% IF seefro.type && seefro.type != 'seefrom' %]
98
                                                    <span class="label">[% PROCESS authtypelabel type=seefro.type | trim %]:</span>
99
                                                [% END %]
100
                                                <span class="seefrom">[% PROCESS authheadingdisplay heading=seefro.heading search=seefrosearch authid=seefro.authid %]</span>
101
                                            </li>
102
                                        [% END %]
103
                                        [% PROCESS otherscript headings=summary.otherscript wantcategory='seefrom' %]
104
                                    </ul>
83
                                </div>
105
                                </div>
84
                            [% END %]
106
                            [% END %]
85
                            [% PROCESS otherscript headings=summary.otherscript wantcategory='preferred' %]
86
                        </div>
87
107
88
                        [% IF summary.seefrom.size %]
108
                            [% IF summary.seealso.size %]
89
                            <div class="authstanza seefrom">
109
                                <div class="authstanza seealso">
90
                                <div class="authstanzaheading">Used for/see from:</div>
110
                                    <div class="authstanzaheading">See also:</div>
91
                                <ul class="seefrom">
111
                                    <ul class="seelso">
92
                                    [% FOREACH seefro IN summary.seefrom %]
112
                                        [% FOREACH seeals IN summary.seealso %]
93
                                        <li class="heading seefrom auth[% seefro.field | html %]">
113
                                            <li class="heading seealso auth[% seeals.field | html %]">
94
                                            [% IF seefro.type && seefro.type != 'seefrom' %]
114
                                                [% IF seeals.type && seeals.type != 'seealso' %]
95
                                                <span class="label">[% PROCESS authtypelabel type=seefro.type | trim %]:</span>
115
                                                    <span class="label">[% PROCESS authtypelabel type=seeals.type | trim %]:</span>
96
                                            [% END %]
116
                                                [% END %]
97
                                            <span class="seefrom">[% PROCESS authheadingdisplay heading=seefro.heading search=seefrosearch authid=seefro.authid %]</span>
117
                                                <span class="seealso">[% PROCESS authheadingdisplay heading=seeals.heading search=seeals.search authid=seeals.authid %]</span>
98
                                        </li>
118
                                            </li>
99
                                    [% END %]
119
                                        [% END %]
100
                                    [% PROCESS otherscript headings=summary.otherscript wantcategory='seefrom' %]
120
                                        [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %]
101
                                </ul>
121
                                    </ul>
102
                            </div>
122
                                </div>
103
                        [% END %]
123
                            [% END %]
104
124
105
                        [% IF summary.seealso.size %]
125
                            [% IF marcflavour == 'UNIMARC' && summary.otherscript %]
106
                            <div class="authstanza seealso">
126
                                <div class="authstanza">
107
                                <div class="authstanzaheading">See also:</div>
127
                                    <div class="authstanzaheading">Other forms:</div>
108
                                <ul class="seelso">
128
                                    <ul>
109
                                    [% FOREACH seeals IN summary.seealso %]
129
                                        [% FOREACH otherscrip IN summary.otherscript %]
110
                                        <li class="heading seealso auth[% seeals.field | html %]">
130
                                            <li>
111
                                            [% IF seeals.type && seeals.type != 'seealso' %]
131
                                                [% PROCESS language lang=otherscrip.lang | trim %]:
112
                                                <span class="label">[% PROCESS authtypelabel type=seeals.type | trim %]:</span>
132
                                                <span class="otherscript">[% otherscrip.term | html %]</span>
113
                                            [% END %]
133
                                            </li>
114
                                            <span class="seealso">[% PROCESS authheadingdisplay heading=seeals.heading search=seeals.search authid=seeals.authid %]</span>
134
                                        [% END %]
115
                                        </li>
135
                                    </ul>
116
                                    [% END %]
136
                                </div>
117
                                    [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %]
137
                            [% END %]
118
                                </ul>
119
                            </div>
120
                        [% END %]
121
138
122
                        [% IF marcflavour == 'UNIMARC' && summary.otherscript %]
139
                            [% IF ( MARCURLS ) %]
123
                            <div class="authstanza">
140
                                <div class="authstanza online_resources">
124
                                <div class="authstanzaheading">Other forms:</div>
141
                                    <span class="label">Online resources:</span>
125
                                <ul>
142
                                    <ul>
126
                                    [% FOREACH otherscrip IN summary.otherscript %]
143
                                        [% FOREACH MARCurl IN MARCURLS %]
127
                                        <li>
144
                                            <li>[% IF ( MARCurl.part ) %][% MARCurl.part | html %]<br />[% END %]
128
                                            [% PROCESS language lang=otherscrip.lang | trim %]:
145
                                                [% IF ( Koha.Preference('OPACURLOpenInNewWindow') ) %]
129
                                            <span class="otherscript">[% otherscrip.term | html %]</span>
146
                                                    <a href="[% MARCurl.MARCURL | url %]" title="[% MARCurl.MARCURL | html %]" target="_blank" rel="noreferrer">
130
                                        </li>
147
                                                [% ELSE %]
131
                                    [% END %]
148
                                                    <a href="[% MARCurl.MARCURL | url %]" title="[% MARCurl.MARCURL | html %]">
132
                                </ul>
149
                                                [% END %]
133
                            </div>
150
                                                [% MARCurl.linktext | html %]</a>
151
                                                [% IF ( MARCurl.notes ) %]
152
                                                    <ul>
153
                                                        [% FOREACH note IN MARCurl.notes %]
154
                                                            <li>[% note.note | html %]</li>
155
                                                        [% END %]
156
                                                    </ul>
157
                                                [% END %]
158
                                            </li>
159
                                        [% END # /FOREACH MARCURLS %]
160
                                    </ul>
161
                                </div>
162
                            [% END # / IF MARCURLS %]
134
                        [% END %]
163
                        [% END %]
135
164
136
                        [% IF ( MARCURLS ) %]
137
                            <div class="authstanza online_resources">
138
                                <span class="label">Online resources:</span>
139
                                <ul>
140
                                    [% FOREACH MARCurl IN MARCURLS %]
141
                                        <li>[% IF ( MARCurl.part ) %][% MARCurl.part | html %]<br />[% END %]
142
                                            [% IF ( Koha.Preference('OPACURLOpenInNewWindow') ) %]
143
                                                <a href="[% MARCurl.MARCURL | url %]" title="[% MARCurl.MARCURL | html %]" target="_blank" rel="noreferrer">
144
                                            [% ELSE %]
145
                                                <a href="[% MARCurl.MARCURL | url %]" title="[% MARCurl.MARCURL | html %]">
146
                                            [% END %]
147
                                            [% MARCurl.linktext | html %]</a>
148
                                            [% IF ( MARCurl.notes ) %]
149
                                                <ul>
150
                                                    [% FOREACH note IN MARCurl.notes %]
151
                                                        <li>[% note.note | html %]</li>
152
                                                    [% END %]
153
                                                </ul>
154
                                            [% END %]
155
                                        </li>
156
                                    [% END # /FOREACH MARCURLS %]
157
                                </ul>
158
                            </div>
159
                        [% END # / IF MARCURLS %]
160
161
                        <div id="authdescriptions" class="toptabs">
165
                        <div id="authdescriptions" class="toptabs">
162
                            <ul class="nav nav-tabs" role="tablist">
166
                            <ul class="nav nav-tabs" role="tablist">
163
                                <li id="tab_descriptions" class="nav-item" role="presentation">
167
                                <li id="tab_descriptions" class="nav-item" role="presentation">
(-)a/opac/opac-authoritiesdetail.pl (-3 / +21 lines)
Lines 41-46 use Modern::Perl; Link Here
41
use C4::Auth qw( get_template_and_user );
41
use C4::Auth qw( get_template_and_user );
42
use C4::Biblio qw( GetMarcUrls );
42
use C4::Biblio qw( GetMarcUrls );
43
use C4::Context;
43
use C4::Context;
44
use C4::Languages;
44
use C4::Output qw( output_html_with_http_headers );
45
use C4::Output qw( output_html_with_http_headers );
45
use C4::AuthoritiesMarc qw( GetAuthority BuildSummary GetTagsLabels GenerateHierarchy );
46
use C4::AuthoritiesMarc qw( GetAuthority BuildSummary GetTagsLabels GenerateHierarchy );
46
use CGI qw ( -utf8 );
47
use CGI qw ( -utf8 );
Lines 48-53 use C4::Koha; Link Here
48
49
49
use Koha::Authorities;
50
use Koha::Authorities;
50
use Koha::Authority::Types;
51
use Koha::Authority::Types;
52
use Koha::XSLT::Base;
51
53
52
my $query = CGI->new;
54
my $query = CGI->new;
53
55
Lines 166-173 if ($show_marc) { Link Here
166
    }
168
    }
167
    $template->param( "Tab0XX" => \@loop_data );
169
    $template->param( "Tab0XX" => \@loop_data );
168
} else {
170
} else {
169
    my $summary = BuildSummary($record, $authid, $authtypecode);
171
    my $AuthorityXSLTOpacDetailsDisplay = C4::Context->preference('AuthorityXSLTOpacDetailsDisplay');
170
    $template->{VARS}->{'summary'} = $summary;
172
    if ($AuthorityXSLTOpacDetailsDisplay) {
173
        my $lang = C4::Languages::getlanguage();
174
175
        my $xsl = $AuthorityXSLTOpacDetailsDisplay;
176
177
        $xsl =~ s/\{langcode\}/$lang/g;
178
        $xsl =~ s/\{authtypecode\}/$authtypecode/g;
179
        my $xslt_engine = Koha::XSLT::Base->new;
180
        my $output = $xslt_engine->transform({ xml => $authority->marcxml, file => $xsl });
181
        if ($xslt_engine->err) {
182
            warn "XSL transformation failed ($xsl): " . $xslt_engine->err;
183
            next;
184
        }
185
        $template->param(html => $output);
186
    } else {
187
        my $summary = BuildSummary($record, $authid, $authtypecode);
188
        $template->param(summary => $summary);
189
    }
171
190
172
    if ( C4::Context->preference('OPACAuthorIdentifiers') ) {
191
    if ( C4::Context->preference('OPACAuthorIdentifiers') ) {
173
        my $authority = Koha::Authorities->find($authid);
192
        my $authority = Koha::Authorities->find($authid);
174
- 

Return to bug 21330