Bug 13119 - Use XSLT to display tagged titles in the OPAC
authorOwen Leonard <oleonard@myacpl.org>
Tue, 21 Oct 2014 16:52:54 +0000 (12:52 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 4 Jan 2015 14:28:11 +0000 (11:28 -0300)
This patch updates the display of a logged-in user's tagged titles to
use the same XSLT stylesheet used by search results and Lists. This
would make for a more consistent display of information.

Unrelated change: Corrected "My tags" header to read "Your tags,"
consistent with sidebar navigation.

To test you should have multiple titles in your catalog which you have
tagged in the OPAC.

- Set the OPACXSLTResultsDisplay system preference to 'default'
- Log in to the OPAC and view the "your tags" page.
- Confirm that title information is displayed correctly. Compare to
  search results.
- Empty the OPACXSLTResultsDisplay system preference and reload the
  "your tags" page. The display should revert to the old view, showing
  title, subtitle (if any) and author (if any).
- Set the OPACXSLTResultsDisplay to a custom path pointing to a custom
  XSL file and confirm that the list of your tagged titles changes
  accordingly.

Note: A follow-up will add "action" links ("place hold," "add to cart,"
etc) consistent with other pages.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
Works as described. opac-tag.pl page displays tagged titles the same way as
result & list pages.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
opac/opac-tags.pl

index 2811bd0..b9a7072 100644 (file)
 
                         [% IF ( MY_TAGS ) %]
                         <form method="post" action="opac-tags.pl">
-                            <h2>My Tags</h2>
+                            <h2>Your tags</h2>
                             <table id="mytagst" class="table table-bordered table-striped">
                                 <thead><tr><th>Term</th><th>Title</th><th>Date added</th><th>Delete</th></tr></thead>
                                 <tbody>
                                                 <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">
                                             [% MY_TAG.term |html %]</a></td>
                                             <td>
-                                                <span class="tdlabel">Title:</span>
-                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber %]">
-                                                [% MY_TAG.title |html %][% IF ( MY_TAG.subtitle ) %][% FOREACH subtitle IN MY_TAG.subtitle %] [% subtitle.subfield |html %][% END %][% END %]</a> [% IF ( MY_TAG.author ) %]by [% MY_TAG.author %][% END %]</td>
+                                                [% IF ( MY_TAG.XSLTBloc ) %]
+                                                    [% MY_TAG.XSLTBloc %]
+                                                [% ELSE %]
+                                                    <span class="tdlabel">Title:</span>
+                                                    <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% MY_TAG.biblionumber %]">
+                                                        [% MY_TAG.title |html %]
+                                                        [% IF ( MY_TAG.subtitle ) %]
+                                                            [% FOREACH subtitle IN MY_TAG.subtitle %]
+                                                                [% subtitle.subfield |html %]
+                                                            [% END %]
+                                                        [% END %]
+                                                    </a>
+                                                    [% IF ( MY_TAG.author ) %]
+                                                        by [% MY_TAG.author %]
+                                                    [% END %]
+                                                [% END # /IF MY_TAG.XSLTBloc %]
+                                            </td>
                                             <td>
                                                 <span title="[% MY_TAG.date_created %]">
                                                     <span class="tdlabel">Date added:</span>
index 6c402a5..5a058d2 100755 (executable)
@@ -42,6 +42,7 @@ use C4::Output qw(:html :ajax pagination_bar);
 use C4::Scrubber;
 use C4::Biblio;
 use C4::Tags qw(add_tag get_approval_rows get_tag_rows remove_tag stratify_tags);
+use C4::XSLT;
 
 use Data::Dumper;
 
@@ -232,6 +233,9 @@ if ($loggedinuser) {
         $_->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $_->{biblionumber} ) );
         $_->{title} = $biblio->{title};
         $_->{author} = $biblio->{author};
+        if (C4::Context->preference("OPACXSLTResultsDisplay")) {
+            $_->{XSLTBloc} = XSLTParse4Display($_->{biblionumber}, $record, "OPACXSLTResultsDisplay");
+        }
                my $date = $_->{date_created} || '';
                $date =~ /\s+(\d{2}\:\d{2}\:\d{2})/;
                $_->{time_created_display} = $1;