Bugzilla – Attachment 103379 Details for
Bug 11426
Make HighlightOwnItemsOnOPAC work with XSLT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11426: [POC] Make HighlightOwnItemsOnOPAC work with XSLT
Bug-11426-POC-Make-HighlightOwnItemsOnOPAC-work-wi.patch (text/plain), 5.16 KB, created by
Jonathan Druart
on 2020-04-21 14:23:48 UTC
(
hide
)
Description:
Bug 11426: [POC] Make HighlightOwnItemsOnOPAC work with XSLT
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-04-21 14:23:48 UTC
Size:
5.16 KB
patch
obsolete
>From 2538187aba67e19e11c585cc2a7d6f5f2b488ee5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 21 Apr 2020 16:20:24 +0200 >Subject: [PATCH] Bug 11426: [POC] Make HighlightOwnItemsOnOPAC work with XSLT > >This xsl syntax is insane. We should add this ugly choose test all over >this xsl file, then also in the detail page (with the class highlight-row-detail). > >Note that the non-XSLT view use HighlightOwnItemsOnOPACWhich that can be >'OpacURLBranch'. In that case we should not test >logged_in_user_branchcode, but $ENV{BRANCHCODE}. However since we use >plack this feature may have been lost. >--- > C4/XSLT.pm | 7 +++++++ > .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 14 ++++++++++++-- > 2 files changed, 19 insertions(+), 2 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 1b3941c7fb..c35742a80d 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -266,6 +266,11 @@ sub XSLTParse4Display { > $variables->{OpenURLResolverURL} = $biblio->get_openurl; > } > } >+ >+ if ( C4::Context->userenv ) { >+ $variables->{logged_in_user_branchcode} = C4::Context->userenv->{branch} >+ } >+ > my $varxml = "<variables>\n"; > while (my ($key, $value) = each %$variables) { > $varxml .= "<variable name=\"$key\">$value</variable>\n"; >@@ -356,6 +361,7 @@ sub buildKohaItemsNamespace { > $status = "available"; > } > my $homebranch = xml_escape($branches{$item->homebranch}); >+ my $homebranchcode = xml_escape($item->homebranch); > my $holdingbranch = xml_escape($branches{$item->holdingbranch}); > my $location = xml_escape($item->location && exists $shelflocations->{$item->location} ? $shelflocations->{$item->location} : $item->location); > my $ccode = xml_escape($item->ccode && exists $ccodes->{$item->ccode} ? $ccodes->{$item->ccode} : $item->ccode); >@@ -364,6 +370,7 @@ sub buildKohaItemsNamespace { > $xml .= > "<item>" > . "<homebranch>$homebranch</homebranch>" >+ . "<homebranchcode>$homebranchcode</homebranchcode>" > . "<holdingbranch>$holdingbranch</holdingbranch>" > . "<location>$location</location>" > . "<ccode>$ccode</ccode>" >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index d29fdceaee..43cdcdc6d3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -35,6 +35,7 @@ > <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/> > <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/> > <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/> >+ <xsl:variable name="logged_in_user_branchcode" select="marc:variables/marc:variable[@name='logged_in_user_branchcode']"/> > <xsl:variable name="leader" select="marc:leader"/> > <xsl:variable name="leader6" select="substring($leader,7,1)"/> > <xsl:variable name="leader7" select="substring($leader,8,1)"/> >@@ -1262,11 +1263,20 @@ > <xsl:when test="$OPACResultsLibrary='homebranch'"> > <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> > <span class="ItemSummary"> >- <span class="ItemBranch"><xsl:value-of select="items:homebranch"/> </span> >+ <xsl:choose> >+ <xsl:when test="$logged_in_user_branchcode = items:homebranchcode"> >+ <span class="highlight-row-results"> >+ <span class="ItemBranch"><xsl:value-of select="items:homebranch"/> </span> >+ </span> >+ </xsl:when> >+ <xsl:otherwise> >+ <span class="ItemBranch"><xsl:value-of select="items:homebranch"/> </span> >+ </xsl:otherwise> >+ </xsl:choose> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> > <span class="CallNumberAndLabel"> > <span class="LabelCallNumber">Call number: </span> >- <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span> >+ <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/></span> > </span> > </xsl:if> > <xsl:text> (</xsl:text> >-- >2.20.1
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 11426
:
94631
| 103379