View | Details | Raw Unified | Return to bug 32680
Collapse All | Expand All

(-)a/Koha/Template/Plugin/KohaPlugins.pm (+52 lines)
Lines 230-233 sub get_plugins_intranet_catalog_biblio_tab { Link Here
230
    return $tabs;
230
    return $tabs;
231
}
231
}
232
232
233
=head3 get_plugins_intranet_cover_images
234
235
[% KohaPlugins. get_plugins_intranet_cover_images %]
236
237
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.
238
239
=cut
240
241
sub get_plugins_intranet_cover_images {
242
    return q{} unless C4::Context->config("enable_plugins");
243
244
    my $p = Koha::Plugins->new();
245
246
    return q{} unless $p;
247
248
    my @plugins = $p->GetPlugins(
249
        {
250
            method => 'intranet_cover_images',
251
        }
252
    );
253
254
    my @data = map { $_->intranet_cover_images || q{} } @plugins;
255
256
    return join( "\n", @data );
257
}
258
259
=head3 get_plugins_opac_cover_images
260
261
[% KohaPlugins. get_plugins_opac_cover_images %]
262
263
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.
264
265
=cut
266
267
sub get_plugins_opac_cover_images {
268
    return q{} unless C4::Context->config("enable_plugins");
269
270
    my $p = Koha::Plugins->new();
271
272
    return q{} unless $p;
273
274
    my @plugins = $p->GetPlugins(
275
        {
276
            method => 'opac_cover_images',
277
        }
278
    );
279
280
    my @data = map { $_->opac_cover_images || q{} } @plugins;
281
282
    return join( "\n", @data );
283
}
284
233
1;
285
1;
(-)a/catalogue/detail.pl (-3 / +4 lines)
Lines 60-65 use Koha::Recalls; Link Here
60
use Koha::SearchEngine::Search;
60
use Koha::SearchEngine::Search;
61
use Koha::SearchEngine::QueryBuilder;
61
use Koha::SearchEngine::QueryBuilder;
62
use Koha::Serial::Items;
62
use Koha::Serial::Items;
63
use Koha::Template::Plugin::KohaPlugins;
63
64
64
my $query = CGI->new();
65
my $query = CGI->new();
65
66
Lines 686-694 $template->param(found1 => scalar $query->param('found1') ); Link Here
686
687
687
$template->param(biblio => $biblio);
688
$template->param(biblio => $biblio);
688
689
689
my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js;
690
my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images;
690
if(index($intranet_js_plugins, "Cover Image Plugin") != -1){
691
if($intranet_cover_images_plugins){
691
    $template->param( Cover_Images_Required => 1 )
692
    $template->param( CoverImagesRequired => 1 )
692
}
693
}
693
694
694
output_html_with_http_headers $query, $cookie, $template->output;
695
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/catalogue/search.pl (-3 / +4 lines)
Lines 158-163 use Koha::SearchEngine::QueryBuilder; Link Here
158
use Koha::Virtualshelves;
158
use Koha::Virtualshelves;
159
use Koha::SearchFields;
159
use Koha::SearchFields;
160
use Koha::SearchFilters;
160
use Koha::SearchFilters;
161
use Koha::Template::Plugin::KohaPlugins;
161
162
162
use URI::Escape;
163
use URI::Escape;
163
use JSON qw( decode_json encode_json );
164
use JSON qw( decode_json encode_json );
Lines 779-787 my $some_public_shelves = Koha::Virtualshelves->get_some_shelves( Link Here
779
    }
780
    }
780
);
781
);
781
782
782
my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js;
783
my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images;
783
if(index($intranet_js_plugins, "Cover Image Plugin") != -1){
784
if($intranet_cover_images_plugins){
784
    $template->param( Cover_Images_Required => 1 )
785
    $template->param( CoverImagesRequired => 1 )
785
}
786
}
786
787
787
788
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-3 / +6 lines)
Lines 114-120 Link Here
114
        <span class="Z3988" title="[% ocoins | html %]"></span>
114
        <span class="Z3988" title="[% ocoins | html %]"></span>
115
    [% END %]
115
    [% END %]
116
116
117
    [% IF ( Cover_Images_Required || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
117
    [% IF ( CoverImagesRequired || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
118
        <div id="catalogue_detail_biblio" class="col-xs-9">
118
        <div id="catalogue_detail_biblio" class="col-xs-9">
119
    [% ELSE %]
119
    [% ELSE %]
120
        <div id="catalogue_detail_biblio" class="col-xs-12">
120
        <div id="catalogue_detail_biblio" class="col-xs-12">
Lines 204-213 Link Here
204
        [% END %]
204
        [% END %]
205
        </div> [%# .page-section %]
205
        </div> [%# .page-section %]
206
206
207
        [% IF ( Cover_Images_Required || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
207
        [% IF ( CoverImagesRequired || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
208
        </div>
208
        </div>
209
            <div class="col-xs-3 bookcoverimg">
209
            <div class="col-xs-3 bookcoverimg">
210
                <div id="biblio-cover-slider" class="cover-slider cover_images_required">
210
                <div id="biblio-cover-slider" class="cover-slider cover_images_required" data-isbn="[% normalized_isbn | html %]">
211
                    [% IF ( LocalCoverImages ) %]
211
                    [% IF ( LocalCoverImages ) %]
212
                        [% IF localimages.count %]
212
                        [% IF localimages.count %]
213
                            [% FOREACH image IN localimages %]
213
                            [% FOREACH image IN localimages %]
Lines 2398-2402 Note that permanent location is a code, and location may be an authval. Link Here
2398
            });
2398
            });
2399
        [% END %]
2399
        [% END %]
2400
    </script>
2400
    </script>
2401
    [% IF ( CoverImagesRequired ) %]
2402
        [% KohaPlugins.get_plugins_intranet_cover_images | $raw %]  
2403
    [% END %]
2401
[% END %]
2404
[% END %]
2402
[% INCLUDE 'intranet-bottom.inc' %]
2405
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-4 / +7 lines)
Lines 4-9 Link Here
4
[% USE Koha %]
4
[% USE Koha %]
5
[% USE Biblio %]
5
[% USE Biblio %]
6
[% USE KohaDates %]
6
[% USE KohaDates %]
7
[% USE KohaPlugins %]
8
[% USE To %]
7
[% PROCESS 'i18n.inc' %]
9
[% PROCESS 'i18n.inc' %]
8
[% SET footerjs = 1 %]
10
[% SET footerjs = 1 %]
9
[% USE AuthorisedValues %]
11
[% USE AuthorisedValues %]
Lines 449-455 Link Here
449
                                <table>
451
                                <table>
450
                                    <thead>
452
                                    <thead>
451
                                    <tr>
453
                                    <tr>
452
                                        [% IF ( Cover_Images_Required || AmazonCoverImages  || LocalCoverImages || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
454
                                        [% IF ( CoverImagesRequired || AmazonCoverImages  || LocalCoverImages || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
453
                                            <th>&nbsp;</th>
455
                                            <th>&nbsp;</th>
454
                                        [% END %]
456
                                        [% END %]
455
                                        <th colspan="2">Results</th>
457
                                        <th colspan="2">Results</th>
Lines 461-469 Link Here
461
                                    <tbody>
463
                                    <tbody>
462
                                    [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
464
                                    [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
463
                                        <tr id="row[% SEARCH_RESULT.biblionumber | html %]">
465
                                        <tr id="row[% SEARCH_RESULT.biblionumber | html %]">
464
                                            [% IF ( Cover_Images_Required || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
466
                                            [% IF ( CoverImagesRequired || AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
465
    <td class="bookcoverimg">
467
    <td class="bookcoverimg">
466
        <div id="cover-slides-[% SEARCH_RESULT.biblionumber | html %]" class="cover-slides search_cover_images_required" data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]">
468
        <div id="cover-slides-[% SEARCH_RESULT.biblionumber | html %]" class="cover-slides cover_images_required" data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]" data-isbn="[% To.json(SEARCH_RESULT.normalized_isbn) | $raw %]" data-processedbiblio="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber | $raw %]">
467
            [% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
469
            [% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
468
                <div id="local-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image local-coverimg">
470
                <div id="local-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image local-coverimg">
469
                    <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]">
471
                    <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]">
Lines 781-787 Link Here
781
    [% Asset.css("css/humanmsg.css") | $raw %]
783
    [% Asset.css("css/humanmsg.css") | $raw %]
782
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
784
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
783
    [% INCLUDE 'select2.inc' %]
785
    [% INCLUDE 'select2.inc' %]
784
    [% IF ( Cover_Images_Required ) %]
786
    [% IF ( CoverImagesRequired ) %]
785
        <script>
787
        <script>
786
            const search_results = {};
788
            const search_results = {};
787
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
789
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
Lines 926-931 Link Here
926
        [% END %]
928
        [% END %]
927
    </script>
929
    </script>
928
    [% Asset.js("js/pages/results.js") | $raw %]
930
    [% Asset.js("js/pages/results.js") | $raw %]
931
    [% KohaPlugins.get_plugins_intranet_cover_images | $raw %]
929
[% END %]
932
[% END %]
930
933
931
[% INCLUDE 'intranet-bottom.inc' %]
934
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-5 / +4 lines)
Lines 6-11 Link Here
6
[% USE Branches %]
6
[% USE Branches %]
7
[% USE TablesSettings %]
7
[% USE TablesSettings %]
8
[% USE AuthorisedValues %]
8
[% USE AuthorisedValues %]
9
[% USE KohaPlugins %]
9
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %]
10
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %]
10
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %]
11
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %]
11
[% IF Koha.Preference('AmazonAssocTag') %]
12
[% IF Koha.Preference('AmazonAssocTag') %]
Lines 59-65 Link Here
59
60
60
                    <div class="bookcover">
61
                    <div class="bookcover">
61
62
62
                        <div id="biblio-cover-slider" class="cover-slider cover_images_required">
63
                        <div id="biblio-cover-slider" class="cover-slider cover_images_required" data-isbn="[% normalized_isbn | html %]">
63
                            [% IF ( OPACLocalCoverImages ) %]
64
                            [% IF ( OPACLocalCoverImages ) %]
64
                                [% IF localimages.count %]
65
                                [% IF localimages.count %]
65
                                    [% FOREACH image IN localimages %]
66
                                    [% FOREACH image IN localimages %]
Lines 1454-1463 Link Here
1454
        [% Asset.js("js/ratings.js") | $raw %]
1455
        [% Asset.js("js/ratings.js") | $raw %]
1455
    [% END %]
1456
    [% END %]
1456
1457
1457
    [% IF ( Cover_Images_Required ) %]
1458
    [% IF ( CoverImagesRequired ) %]
1458
        <script>
1459
        [% KohaPlugins.get_plugins_opac_cover_images | $raw %]
1459
            var normalized_isbn = "[% normalized_isbn %]";   
1460
        </script>
1461
    [% END %]
1460
    [% END %]
1462
1461
1463
    [% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %][% END %]
1462
    [% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %][% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-20 / +11 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaPlugins %]
5
[% USE To %]
4
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
6
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
5
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
7
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
6
8
Lines 341-353 Link Here
341
343
342
                                            [% # Cell 4: Search result details and controls %]
344
                                            [% # Cell 4: Search result details and controls %]
343
                                            <td class="bibliocol">
345
                                            <td class="bibliocol">
344
                                                <div class="coverimages search_cover_images_required itemtype_[% SEARCH_RESULT.itemtype | html %]">
346
                                                [% IF ( SEARCH_RESULT.title ) %]
347
                                                    [% img_title = SEARCH_RESULT.title %]
348
                                                [% ELSE %]
349
                                                    [% img_title = SEARCH_RESULT.biblionumber %]
350
                                                [% END %]
351
                                                <div class="coverimages cover_images_required itemtype_[% SEARCH_RESULT.itemtype | html %]" data-isbn="[% To.json(SEARCH_RESULT.normalized_isbn) | $raw %]" data-imgtitle="[% img_title | html %]">
345
                                                    <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
352
                                                    <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
346
                                                        [% IF ( SEARCH_RESULT.title ) %]
353
                                                        
347
                                                            [% img_title = SEARCH_RESULT.title %]
348
                                                        [% ELSE %]
349
                                                            [% img_title = SEARCH_RESULT.biblionumber %]
350
                                                        [% END %]
351
                                                        [% IF ( OPACLocalCoverImages ) %]
354
                                                        [% IF ( OPACLocalCoverImages ) %]
352
                                                            <span title="[% img_title | html %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
355
                                                            <span title="[% img_title | html %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
353
                                                        [% END %]
356
                                                        [% END %]
Lines 587-606 Link Here
587
    [% IF OpenLibraryCovers || OpenLibrarySearch %]
590
    [% IF OpenLibraryCovers || OpenLibrarySearch %]
588
        [% Asset.js("js/openlibrary.js") | $raw %]
591
        [% Asset.js("js/openlibrary.js") | $raw %]
589
    [% END %]
592
    [% END %]
590
    [% IF ( Cover_Images_Required ) %]
593
    [% IF ( CoverImagesRequired ) %]
591
        <script>
594
        [% KohaPlugins.get_plugins_opac_cover_images | $raw %]
592
            const search_results = {};
593
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
594
                var cover_index = "[% loop.count %]";
595
                search_results[cover_index] = {};
596
                search_results[cover_index].isbn = "[% SEARCH_RESULT.normalized_isbn | html %]";
597
                [% IF SEARCH_RESULT.img_title %]
598
                    search_results[cover_index].img_title = "[% SEARCH_RESULT.img_title | html %]";
599
                [% ELSE %]
600
                    search_results[cover_index].img_title = "[% SEARCH_RESULT.biblionumber | html %]";
601
                [% END %]
602
            [% END %]   
603
        </script>
604
    [% END %]
595
    [% END %]
605
    <script>
596
    <script>
606
        [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %]
597
        [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) %]
(-)a/opac/opac-detail.pl (-3 / +4 lines)
Lines 83-88 use Koha::Serial::Items; Link Here
83
use Koha::SearchEngine::Search;
83
use Koha::SearchEngine::Search;
84
use Koha::SearchEngine::QueryBuilder;
84
use Koha::SearchEngine::QueryBuilder;
85
use Koha::Util::MARC;
85
use Koha::Util::MARC;
86
use Koha::Template::Plugin::KohaPlugins;
86
87
87
use JSON qw( decode_json );
88
use JSON qw( decode_json );
88
89
Lines 1242-1250 if ( C4::Context->preference('OPACAuthorIdentifiers') ) { Link Here
1242
    $template->param( author_identifiers => \@author_identifiers );
1243
    $template->param( author_identifiers => \@author_identifiers );
1243
}
1244
}
1244
1245
1245
my $opac_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_opac_js;
1246
my $opac_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_opac_cover_images;
1246
if(index($opac_js_plugins, "Cover Image Plugin") != -1){
1247
if($opac_cover_images_plugins){
1247
    $template->param( Cover_Images_Required => 1 )
1248
    $template->param( CoverImagesRequired => 1 )
1248
}
1249
}
1249
1250
1250
output_html_with_http_headers $query, $cookie, $template->output;
1251
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-4 / +4 lines)
Lines 64-69 use Koha::Library::Groups; Link Here
64
use Koha::Patrons;
64
use Koha::Patrons;
65
use Koha::Plugins;
65
use Koha::Plugins;
66
use Koha::SearchFields;
66
use Koha::SearchFields;
67
use Koha::Template::Plugin::KohaPlugins;
67
68
68
use POSIX qw(ceil floor strftime);
69
use POSIX qw(ceil floor strftime);
69
use URI::Escape;
70
use URI::Escape;
Lines 924-932 if ($offset == 0) { Link Here
924
    $template->param(firstPage => 1);
925
    $template->param(firstPage => 1);
925
}
926
}
926
927
927
my $opac_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_opac_js;
928
my $opac_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_opac_cover_images;
928
if(index($opac_js_plugins, "Cover Image Plugin") != -1){
929
if($opac_cover_images_plugins){
929
    $template->param( Cover_Images_Required => 1 )
930
    $template->param( CoverImagesRequired => 1 )
930
}
931
}
931
932
932
    $template->param( borrowernumber    => $borrowernumber);
933
    $template->param( borrowernumber    => $borrowernumber);
933
- 

Return to bug 32680