From 1ef4b549f1190a4b08815c2ea08448b17c46375c Mon Sep 17 00:00:00 2001 From: jeremy breuillard Date: Mon, 7 Feb 2022 12:00:00 +0100 Subject: [PATCH] Bug 21330: Allow XSLT for authority detail view in OPAC This patch adds a syspref that allow to customize the authority detail view in OPAC with XSLT. Test plan: 1. Make sure to have at least one or more authorities 2. OPAC: Home > Authority search(Submit) > Authority search results 3. Click details on a result and notice the view 4. Apply patch 5. INTRA: Home > Administration > System preferences ->find "AuthorityXSLTOpacDetailsDisplay" 6. Write the path where your file is. You can try with the XSLT for biblio for instance: .../koha/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl 7. Save changes 8. Repeat 2-3 and notice the display Signed-off-by: David Nind --- .../data/mysql/atomicupdate/bug-21330.pl | 15 ++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../admin/preferences/staff_interface.pref | 5 + .../bootstrap/en/modules/opac-auth-detail.tt | 156 +++++++++--------- opac/opac-authoritiesdetail.pl | 23 ++- 5 files changed, 122 insertions(+), 78 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug-21330.pl diff --git a/installer/data/mysql/atomicupdate/bug-21330.pl b/installer/data/mysql/atomicupdate/bug-21330.pl new file mode 100644 index 0000000000..fb1f231bf0 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-21330.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => '21330', + description => 'Add syspref AuthorityXSLTOpacDetailsDisplay', + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) + VALUES ('AuthorityXSLTOpacDetailsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free') + }); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 98eced6bc0..df77f523c4 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -72,6 +72,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'), ('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'), ('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'), +('AuthorityXSLTOpacDetailsDisplay','','','Enable XSL stylesheet control over authority details page in the OPAC','Free'), ('AuthorityXSLTOpacResultsDisplay','','','Enable XSL stylesheet control over authority results page in the OPAC','Free'), ('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free'), ('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref index 0e5bb27f4c..2952e363dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref @@ -1,5 +1,10 @@ Staff interface: Appearance: + - + - 'Display authority details in the opac interface using XSLT stylesheet at: ' + - pref: AuthorityXSLTOpacDetailsDisplay + class: file + - '
Options:{langcode} will be replaced with current interface language and {authtypecode} will be replaced by the authority type code' - - 'Display authority results in the staff interface using XSLT stylesheet at: ' - pref: AuthorityXSLTResultsDisplay diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt index a84b103784..4711b0f1ac 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt @@ -75,89 +75,93 @@ [% IF count %]Number of records used in: [% count | html %][% ELSE %]This authority is not used in any records.[% END %] -
- [% FOREACH authorize IN summary.authorized %] -
- Preferred form: - [% authorize.heading | html %] + [% IF html %] + [% html | $raw %] + [% ELSE %] +
+ [% FOREACH authorize IN summary.authorized %] +
+ Preferred form: + [% authorize.heading | html %] +
+ [% END %] + [% PROCESS otherscript headings=summary.otherscript wantcategory='preferred' %] +
+ + [% IF summary.seefrom.size %] +
+
Used for/see from:
+
    + [% FOREACH seefro IN summary.seefrom %] +
  • + [% IF seefro.type && seefro.type != 'seefrom' %] + [% PROCESS authtypelabel type=seefro.type | trim %]: + [% END %] + [% PROCESS authheadingdisplay heading=seefro.heading search=seefrosearch authid=seefro.authid %] +
  • + [% END %] + [% PROCESS otherscript headings=summary.otherscript wantcategory='seefrom' %] +
[% END %] - [% PROCESS otherscript headings=summary.otherscript wantcategory='preferred' %] -
- [% IF summary.seefrom.size %] -
-
Used for/see from:
-
    - [% FOREACH seefro IN summary.seefrom %] -
  • - [% IF seefro.type && seefro.type != 'seefrom' %] - [% PROCESS authtypelabel type=seefro.type | trim %]: - [% END %] - [% PROCESS authheadingdisplay heading=seefro.heading search=seefrosearch authid=seefro.authid %] -
  • - [% END %] - [% PROCESS otherscript headings=summary.otherscript wantcategory='seefrom' %] -
-
- [% END %] + [% IF summary.seealso.size %] +
+
See also:
+
    + [% FOREACH seeals IN summary.seealso %] +
  • + [% IF seeals.type && seeals.type != 'seealso' %] + [% PROCESS authtypelabel type=seeals.type | trim %]: + [% END %] + [% PROCESS authheadingdisplay heading=seeals.heading search=seeals.search authid=seeals.authid %] +
  • + [% END %] + [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %] +
+
+ [% END %] - [% IF summary.seealso.size %] -
-
See also:
-
    - [% FOREACH seeals IN summary.seealso %] -
  • - [% IF seeals.type && seeals.type != 'seealso' %] - [% PROCESS authtypelabel type=seeals.type | trim %]: - [% END %] - [% PROCESS authheadingdisplay heading=seeals.heading search=seeals.search authid=seeals.authid %] -
  • - [% END %] - [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %] -
-
- [% END %] + [% IF marcflavour == 'UNIMARC' && summary.otherscript %] +
+
Other forms:
+
    + [% FOREACH otherscrip IN summary.otherscript %] +
  • + [% PROCESS language lang=otherscrip.lang | trim %]: + [% otherscrip.term | html %] +
  • + [% END %] +
+
+ [% END %] - [% IF marcflavour == 'UNIMARC' && summary.otherscript %] -
-
Other forms:
-
    - [% FOREACH otherscrip IN summary.otherscript %] -
  • - [% PROCESS language lang=otherscrip.lang | trim %]: - [% otherscrip.term | html %] -
  • - [% END %] -
-
+ [% IF ( MARCURLS ) %] +
+ Online resources: +
    + [% FOREACH MARCurl IN MARCURLS %] +
  • [% IF ( MARCurl.part ) %][% MARCurl.part | html %]
    [% END %] + [% IF ( Koha.Preference('OPACURLOpenInNewWindow') ) %] + + [% ELSE %] + + [% END %] + [% MARCurl.linktext | html %] + [% IF ( MARCurl.notes ) %] +
      + [% FOREACH note IN MARCurl.notes %] +
    • [% note.note | html %]
    • + [% END %] +
    + [% END %] +
  • + [% END # /FOREACH MARCURLS %] +
+
+ [% END # / IF MARCURLS %] [% END %] - [% IF ( MARCURLS ) %] -
- Online resources: -
    - [% FOREACH MARCurl IN MARCURLS %] -
  • [% IF ( MARCurl.part ) %][% MARCurl.part | html %]
    [% END %] - [% IF ( Koha.Preference('OPACURLOpenInNewWindow') ) %] - - [% ELSE %] - - [% END %] - [% MARCurl.linktext | html %] - [% IF ( MARCurl.notes ) %] -
      - [% FOREACH note IN MARCurl.notes %] -
    • [% note.note | html %]
    • - [% END %] -
    - [% END %] -
  • - [% END # /FOREACH MARCURLS %] -
-
- [% END # / IF MARCURLS %] -