@@ -, +, @@ structures --- Koha/Template/Plugin/KohaPlugins.pm | 52 +++++++++++++++++++ catalogue/detail.pl | 7 +-- catalogue/search.pl | 7 +-- .../prog/en/modules/catalogue/detail.tt | 9 ++-- .../prog/en/modules/catalogue/results.tt | 11 ++-- .../bootstrap/en/modules/opac-detail.tt | 9 ++-- .../bootstrap/en/modules/opac-results.tt | 31 ++++------- opac/opac-detail.pl | 7 +-- opac/opac-search.pl | 7 +-- 9 files changed, 96 insertions(+), 44 deletions(-) --- a/Koha/Template/Plugin/KohaPlugins.pm +++ a/Koha/Template/Plugin/KohaPlugins.pm @@ -230,4 +230,56 @@ sub get_plugins_intranet_catalog_biblio_tab { return $tabs; } +=head3 get_plugins_intranet_cover_images + +[% KohaPlugins. get_plugins_intranet_cover_images %] + +This method collects the output of all plugins for injecting cover images into the intranet template and appends it to the javascript at the bottom of the page. + +=cut + +sub get_plugins_intranet_cover_images { + return q{} unless C4::Context->config("enable_plugins"); + + my $p = Koha::Plugins->new(); + + return q{} unless $p; + + my @plugins = $p->GetPlugins( + { + method => 'intranet_cover_images', + } + ); + + my @data = map { $_->intranet_cover_images || q{} } @plugins; + + return join( "\n", @data ); +} + +=head3 get_plugins_opac_cover_images + +[% KohaPlugins. get_plugins_opac_cover_images %] + +This method collects the output of all plugins for injecting cover images into the opac template and appends it to the javascript at the bottom of the page. + +=cut + +sub get_plugins_opac_cover_images { + return q{} unless C4::Context->config("enable_plugins"); + + my $p = Koha::Plugins->new(); + + return q{} unless $p; + + my @plugins = $p->GetPlugins( + { + method => 'opac_cover_images', + } + ); + + my @data = map { $_->opac_cover_images || q{} } @plugins; + + return join( "\n", @data ); +} + 1; --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -60,6 +60,7 @@ use Koha::Recalls; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; use Koha::Serial::Items; +use Koha::Template::Plugin::KohaPlugins; my $query = CGI->new(); @@ -686,9 +687,9 @@ $template->param(found1 => scalar $query->param('found1') ); $template->param(biblio => $biblio); -my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js; -if(index($intranet_js_plugins, "Cover Image Plugin") != -1){ - $template->param( Cover_Images_Required => 1 ) +my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images; +if($intranet_cover_images_plugins){ + $template->param( CoverImagesRequired => 1 ) } output_html_with_http_headers $query, $cookie, $template->output; --- a/catalogue/search.pl +++ a/catalogue/search.pl @@ -158,6 +158,7 @@ use Koha::SearchEngine::QueryBuilder; use Koha::Virtualshelves; use Koha::SearchFields; use Koha::SearchFilters; +use Koha::Template::Plugin::KohaPlugins; use URI::Escape; use JSON qw( decode_json encode_json ); @@ -779,9 +780,9 @@ my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( } ); -my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js; -if(index($intranet_js_plugins, "Cover Image Plugin") != -1){ - $template->param( Cover_Images_Required => 1 ) +my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images; +if($intranet_cover_images_plugins){ + $template->param( CoverImagesRequired => 1 ) } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -114,7 +114,7 @@ [% END %] - [% IF ( Cover_Images_Required || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %] + [% IF ( CoverImagesRequired || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
[% ELSE %]
@@ -204,10 +204,10 @@ [% END %]
[%# .page-section %] - [% IF ( Cover_Images_Required || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %] + [% IF ( CoverImagesRequired || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
-
+
[% IF ( LocalCoverImages ) %] [% IF localimages.count %] [% FOREACH image IN localimages %] @@ -2398,5 +2398,8 @@ Note that permanent location is a code, and location may be an authval. }); [% END %] + [% IF ( CoverImagesRequired ) %] + [% KohaPlugins.get_plugins_intranet_cover_images | $raw %] + [% END %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -4,6 +4,8 @@ [% USE Koha %] [% USE Biblio %] [% USE KohaDates %] +[% USE KohaPlugins %] +[% USE To %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] [% USE AuthorisedValues %] @@ -449,7 +451,7 @@ - [% IF ( Cover_Images_Required || AmazonCoverImages || LocalCoverImages || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %] + [% IF ( CoverImagesRequired || AmazonCoverImages || LocalCoverImages || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %] [% END %] @@ -461,9 +463,9 @@ [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] - [% IF ( Cover_Images_Required || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %] + [% IF ( CoverImagesRequired || AmazonCoverImages || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
 Results
-
+
[% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
@@ -781,7 +783,7 @@ [% Asset.css("css/humanmsg.css") | $raw %] [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] [% INCLUDE 'select2.inc' %] - [% IF ( Cover_Images_Required ) %] + [% IF ( CoverImagesRequired ) %] [% Asset.js("js/pages/results.js") | $raw %] + [% KohaPlugins.get_plugins_intranet_cover_images | $raw %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -6,6 +6,7 @@ [% USE Branches %] [% USE TablesSettings %] [% USE AuthorisedValues %] +[% USE KohaPlugins %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] [% IF Koha.Preference('AmazonAssocTag') %] @@ -59,7 +60,7 @@
-
+
[% IF ( OPACLocalCoverImages ) %] [% IF localimages.count %] [% FOREACH image IN localimages %] @@ -1454,10 +1455,8 @@ [% Asset.js("js/ratings.js") | $raw %] [% END %] - [% IF ( Cover_Images_Required ) %] - + [% IF ( CoverImagesRequired ) %] + [% KohaPlugins.get_plugins_opac_cover_images | $raw %] [% END %] [% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %][% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -1,6 +1,8 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] +[% USE KohaPlugins %] +[% USE To %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %] @@ -341,13 +343,14 @@ [% # Cell 4: Search result details and controls %]
-
+ [% IF ( SEARCH_RESULT.title ) %] + [% img_title = SEARCH_RESULT.title %] + [% ELSE %] + [% img_title = SEARCH_RESULT.biblionumber %] + [% END %] +
- [% IF ( SEARCH_RESULT.title ) %] - [% img_title = SEARCH_RESULT.title %] - [% ELSE %] - [% img_title = SEARCH_RESULT.biblionumber %] - [% END %] + [% IF ( OPACLocalCoverImages ) %] [% END %] @@ -587,20 +590,8 @@ [% IF OpenLibraryCovers || OpenLibrarySearch %] [% Asset.js("js/openlibrary.js") | $raw %] [% END %] - [% IF ( Cover_Images_Required ) %] - + [% IF ( CoverImagesRequired ) %] + [% KohaPlugins.get_plugins_opac_cover_images | $raw %] [% END %]