From 10ff53662d38a01aa0fb35f04135b93330df5995 Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Fri, 22 Mar 2024 21:47:18 +0000 Subject: [PATCH] Bug 36154: Add the ability for some pages to be able to use images comming from plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch adds images in the list page in staff interface and make the summary page(opac-user), the list pages (opac-shelves.pl, shelves.pl) and the Checkout history page (opac-readingrecord.pl) to be able to display images comming from plugin. To test 1. Log in to the staff interface 2. Make sure the system preference LocalCoverImages has «Show» value 3. Create a nwalist 4.1. Click on «More» menu then click on «List» and click on «New List» 4. Search for a record and add a local image to it 5. Add the record to the list created on step 4.1 6. Check the list ----> The image is not displayed 7. Apply the patch 8. Check the list again ----> the image is now display in a new column named «Cover» --- .../prog/en/modules/virtualshelves/shelves.tt | 22 +++++++++++++++++++ .../bootstrap/en/includes/shelfbrowser.inc | 18 +++++++-------- .../en/modules/opac-readingrecord.tt | 5 ++++- .../bootstrap/en/modules/opac-shelves.tt | 3 +++ .../bootstrap/en/modules/opac-user.tt | 15 ++++++++----- virtualshelves/shelves.pl | 1 + 6 files changed, 47 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index e82cf2f618..67e44fdca0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -5,8 +5,10 @@ [% USE KohaDates %] [% USE AuthorisedValues %] [% USE Branches %] +[% USE KohaPlugins %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] +[% SET CoverImagePlugins = KohaPlugins.get_plugins_intranet_cover_images %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% IF op == 'view' %] @@ -287,6 +289,9 @@ [% UNLESS ( item_level_itypes ) %] <th>Item type</th> [% END %] + [% IF ( CoverImagePlugins || LocalCoverImages || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL'))) %] + <th>Cover</th> + [% END %] [% IF sortfield == 'title' %] <th class="sorting_[% direction | html %]"> [% ELSE %] @@ -332,6 +337,22 @@ <span class="itypetext">[% itemsloo.description | html %]</span> </td> [% END %] + [% IF LocalCoverImages %] + <td> + <span title="[% img_title | html %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span> + <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=[% itemsloo.biblionumber | uri %]" alt="Local cover image" /> + </td> + [% ELSIF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') && (custom_cover_image_url = itemsloo.biblio_object.custom_cover_image_url) %] + <td> + [% IF custom_cover_image_url %] + <a class="custom_cover_image" href="[% PROCESS biblio_a_href biblionumber => itemsloo.biblionumber %]"> + <img alt="Custom cover image" src="[% custom_cover_image_url | url %]" /></a> + [% END %] + </td> + [% ELSE %] + <td> + </td> + [% END %] <td> [% IF ( itemsloo.XSLTBloc ) %] [% itemsloo.XSLTBloc | $raw %] @@ -614,6 +635,7 @@ [% IF op == 'view' %] [% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] [% END %] + [% CoverImagePlugins | $raw %] <script> var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?"); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc index 78c6139142..0c6abe0614 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc @@ -28,11 +28,17 @@ [% img_title = item.biblionumber %] [% END %] - [% IF ( OPACLocalCoverImages || OPACAmazonCoverImages || ( SyndeticsEnabled && SyndeticsCoverImages ) || GoogleJackets || BakerTaylorEnabled || ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) || ( Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') ) ) %] + [% IF ( OPACLocalCoverImages || OPACAmazonCoverImages || ( SyndeticsEnabled && SyndeticsCoverImages ) || GoogleJackets || BakerTaylorEnabled || ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) || ( Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') ) || CoverImagePlugins ) %] <a class="shelfbrowser_cover" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% item.biblionumber | uri %]&shelfbrowse_itemnumber=[% item.itemnumber | uri %]#shelfbrowser"> [% IF ( OPACLocalCoverImages ) %] <div title="[% img_title | html %]" class="[% item.biblionumber | html %] thumbnail-shelfbrowser" id="local-thumbnail-shelf-[% item.biblionumber | html %]"></div> - [% END %] + [% ELSIF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') AND (custom_cover_image_url = item.biblio_object.custom_cover_image_url) %] + [% IF custom_cover_image_url %] + <span class="custom_cover_image"> + <img alt="Cover image" src="[% custom_cover_image_url | url %]" /> + </span> + [% END %] + [% ELSE %] [% IF ( OPACAmazonCoverImages ) %] [% IF ( item.browser_normalized_isbn ) %] <img src="https://images-na.ssl-images-amazon.com/images/P/[% item.browser_normalized_isbn | html %].01._AA75_PU_PU-5_.jpg" alt="" /> @@ -70,15 +76,7 @@ <span class="no-image">No cover image available</span> [% END %] [% END %] - [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %] - [% SET custom_cover_image_url = item.biblio_object.custom_cover_image_url %] - [% IF custom_cover_image_url %] - <span class="custom_cover_image"> - <img alt="Cover image" src="[% custom_cover_image_url | url %]" /> - </span> - [% END %] [% END %] - </a> [% END %] </td> diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt index 63d678209f..15eeaf09a5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt @@ -5,8 +5,10 @@ [% USE AdditionalContents %] [% USE Asset %] [% USE Price %] +[% USE KohaPlugins %] [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] +[% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] [% INCLUDE 'doc-head-open.inc' %] <title>Your checkout history › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog [% INCLUDE 'doc-head-close.inc' %] @@ -139,7 +141,7 @@ [% END %] [% issuetype | html %] - + [% SET normalized_isbn = biblio.normalized_isbn %] [% IF OPACAmazonCoverImages %] [% IF normalized_isbn %] @@ -227,6 +229,7 @@ [% BLOCK jsinclude %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] +[% CoverImagePlugins | $raw %]