[Koha-patches] [PATCH] Bug 5830 Using XSLT on OPAC Lists page

Frédéric Demians f.demians at tamil.fr
Fri Mar 4 18:20:05 CET 2011


On OPAC Lists page (opac-shelves.pl), biblio records are now displayed
accordingly to OPACXSLTResultsDisplay system preference.
---
 C4/VirtualShelves/Page.pm                          |    7 ++++++-
 .../opac-tmpl/prog/en/modules/opac-shelves.tmpl    |    6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index 66c614d..3614c24 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -35,6 +35,7 @@ use C4::Tags qw(get_tags);
 use Exporter;
 use Data::Dumper;
 use C4::Csv;
+use C4::XSLT;
 
 use vars qw($debug @EXPORT @ISA $VERSION);
 
@@ -201,7 +202,11 @@ sub shelfpage ($$$$$) {
                 }
                 ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset );
                 for my $this_item (@$items) {
-                    my $record = GetMarcBiblio( $this_item->{'biblionumber'} );
+                    my $biblionumber = $this_item->{'biblionumber'};
+                    my $record = GetMarcBiblio($biblionumber);
+                    $this_item->{XSLTBloc} =
+                        XSLTParse4Display($biblionumber, $record, 'Results', 'opac')
+                            if C4::Context->preference("OPACXSLTResultsDisplay");
 
                     # the virtualshelfcontents table does not store these columns nor are they retrieved from the items
                     # and itemtypes tables, so I'm commenting them out for now to quiet the log -crn
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
index 1e1d2d5..4646365 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -249,6 +249,10 @@ $(function() {
                         </td>
                     <!-- /TMPL_UNLESS -->
                         <td>
+                        <!-- TMPL_IF NAME="XSLTBloc" -->
+                         <!-- TMPL_VAR NAME="XSLTBloc" -->
+                        <!-- TMPL_ELSE -->
+
                                 <!-- TMPL_IF name="BiblioDefaultViewmarc" --><a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->" title="View details for this title">
                                 <!-- TMPL_ELSE -->
                                 <!-- TMPL_IF name="BiblioDefaultViewisbd" --><a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->" title="View details for this title">
@@ -272,7 +276,7 @@ $(function() {
         (<!-- TMPL_VAR NAME="itemcallnumber" -->)<!-- TMPL_IF NAME="__LAST__" -->.<!-- TMPL_ELSE -->,<!-- /TMPL_IF -->
           <!-- /TMPL_IF -->
           <!-- /TMPL_LOOP --><!-- TMPL_ELSE -->This record has no items.<!-- /TMPL_IF --></span>
-
+            <!-- /TMPL_IF -->
         <!-- TMPL_IF NAME="TagsEnabled" -->
                 <!-- TMPL_IF NAME="TagsShowOnList" -->
                 <!-- TMPL_IF NAME="TagLoop" -->
-- 
1.7.4



More information about the Koha-patches mailing list