Bugzilla – Attachment 52176 Details for
Bug 15485
Allow choosing different XSLTs for lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15485: Use lists-specific XSLT sysprefs
Bug-15485-Use-lists-specific-XSLT-sysprefs.patch (text/plain), 4.85 KB, created by
Tomás Cohen Arazi
on 2016-06-08 03:15:13 UTC
(
hide
)
Description:
Bug 15485: Use lists-specific XSLT sysprefs
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2016-06-08 03:15:13 UTC
Size:
4.85 KB
patch
obsolete
>From 0021631843d6dc3bb7470436bd69121b82b6506f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 7 Jun 2016 23:58:38 -0300 >Subject: [PATCH] Bug 15485: Use lists-specific XSLT sysprefs > >This patch makes the shelves.pl (staff) and opac-shelves.pl scripts >use the new sysprefs for specifying custom XSLTs for lists display. > >XSLT.pm is patched so it defaults to the corresponding *Results.xsl >files if none is specified. > >To test: >- Create a list >- Open the list in the staff interface >- On a new tab, open the list in the OPAC. >- Apply this patches >=== default behaviour >- Open the list (both opac and staff) on new tabs >=> SUCCESS: They look exactly the same (hint: the syspref is set to '' > so it should fallback to using the one we were using. >=== using the new functionality >- Create custom XSLTs for lists, for example: > $ cd /home/vagrant/kohaclone/koha-tmpl/opac-tmpl/bootstrap/en/xslt > $ cp MARC21slim2OPACResults.xsl MARC21slim2OPACLists.xsl >- Edit your sysprefs, setting OPACXSLTListsDisplay to: > /home/vagrant/kohaclone/koha-tmpl/opac-tmpl/bootstrap/{langcode}/xslt/MARC21slim2OPACLists.xsl >- Reload the OPAC list view >=> SUCCESS: Looks exactly as before >- Make some minor tweak (for example in line 423 replace > <xsl:text> </xsl:text> >for > <xsl:text> BLAH </xsl:text> >- Reload the list >=> SUCCESS: BLAH shows in several places on the title. >- Repeat for the staff interface >- Sign off :-D > >So we can now set custom XSLTs for lists. > >Sponsored-by: Carnegie Stout Library >--- > C4/XSLT.pm | 12 ++++++++++++ > opac/opac-shelves.pl | 4 ++-- > virtualshelves/shelves.pl | 4 ++-- > 3 files changed, 16 insertions(+), 4 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index a2bbaab..f5cd4ee 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -217,6 +217,18 @@ sub XSLTParse4Display { > $theme = C4::Context->preference("opacthemes"); > $xslfile = C4::Context->preference('marcflavour') . > "slim2OPACResults.xsl"; >+ } elsif ($xslsyspref eq 'XSLTListsDisplay') { >+ # Lists default to *Results.xslt >+ $htdocs = C4::Context->config('intrahtdocs'); >+ $theme = C4::Context->preference("template"); >+ $xslfile = C4::Context->preference('marcflavour') . >+ "slim2intranetResults.xsl"; >+ } elsif ($xslsyspref eq 'OPACXSLTListsDisplay') { >+ # Lists default to *Results.xslt >+ $htdocs = C4::Context->config('opachtdocs'); >+ $theme = C4::Context->preference("opacthemes"); >+ $xslfile = C4::Context->preference('marcflavour') . >+ "slim2OPACResults.xsl"; > } > $xslfilename = _get_best_default_xslt_filename($htdocs, $theme, $lang, $xslfile); > } >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 6e5052d..7ebef65 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -248,7 +248,7 @@ if ( $op eq 'view' ) { > > my $borrower = GetMember( borrowernumber => $loggedinuser ); > >- my $xslfile = C4::Context->preference('OPACXSLTResultsDisplay'); >+ my $xslfile = C4::Context->preference('OPACXSLTListsDisplay'); > my $lang = $xslfile ? C4::Languages::getlanguage() : undef; > my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef; > >@@ -259,7 +259,7 @@ if ( $op eq 'view' ) { > my $record = GetMarcBiblio($biblionumber); > > if ( $xslfile ) { >- $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay", >+ $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTListsDisplay", > 1, undef, $sysxml, $xslfile, $lang); > } > >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index 14bd34b..d58cf7b 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -215,7 +215,7 @@ if ( $op eq 'view' ) { > > my $borrower = GetMember( borrowernumber => $loggedinuser ); > >- my $xslfile = C4::Context->preference('XSLTResultsDisplay'); >+ my $xslfile = C4::Context->preference('XSLTListsDisplay') || 'default'; > my $lang = $xslfile ? C4::Languages::getlanguage() : undef; > my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef; > >@@ -226,7 +226,7 @@ if ( $op eq 'view' ) { > my $record = GetMarcBiblio($biblionumber); > > if ( $xslfile ) { >- $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "XSLTResultsDisplay", >+ $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "XSLTListsDisplay", > 1, undef, $sysxml, $xslfile, $lang); > } > >-- >2.8.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15485
:
52175
|
52176
|
52314
|
52315
|
52320
|
52321
|
52398
|
52701
|
52738
|
52739
|
52740
|
52741
|
52742
|
52743