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

(-)a/Koha/Template/Plugin/KohaPlugins.pm (+52 lines)
Lines 194-197 sub get_plugins_intranet_catalog_biblio_tab { Link Here
194
    return $tabs;
194
    return $tabs;
195
}
195
}
196
196
197
=head3 get_plugins_intranet_cover_images
198
199
[% KohaPlugins. get_plugins_intranet_cover_images %]
200
201
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.
202
203
=cut
204
205
sub get_plugins_intranet_cover_images {
206
    return q{} unless C4::Context->config("enable_plugins");
207
208
    my $p = Koha::Plugins->new();
209
210
    return q{} unless $p;
211
212
    my @plugins = $p->GetPlugins(
213
        {
214
            method => 'intranet_cover_images',
215
        }
216
    );
217
218
    my @data = map { $_->intranet_cover_images || q{} } @plugins;
219
220
    return join( "\n", @data );
221
}
222
223
=head3 get_plugins_opac_cover_images
224
225
[% KohaPlugins. get_plugins_opac_cover_images %]
226
227
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.
228
229
=cut
230
231
sub get_plugins_opac_cover_images {
232
    return q{} unless C4::Context->config("enable_plugins");
233
234
    my $p = Koha::Plugins->new();
235
236
    return q{} unless $p;
237
238
    my @plugins = $p->GetPlugins(
239
        {
240
            method => 'opac_cover_images',
241
        }
242
    );
243
244
    my @data = map { $_->opac_cover_images || q{} } @plugins;
245
246
    return join( "\n", @data );
247
}
248
197
1;
249
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 684-692 $template->param(found1 => scalar $query->param('found1') ); Link Here
684
685
685
$template->param(biblio => $biblio);
686
$template->param(biblio => $biblio);
686
687
687
my $intranet_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_js;
688
my $intranet_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_intranet_cover_images;
688
if(index($intranet_js_plugins, "Cover Image Plugin") != -1){
689
if($intranet_cover_images_plugins){
689
    $template->param( Cover_Images_Required => 1 )
690
    $template->param( CoverImagesRequired => 1 )
690
}
691
}
691
692
692
output_html_with_http_headers $query, $cookie, $template->output;
693
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 (-8 / +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 1310-1320 Note that permanent location is a code, and location may be an authval. Link Here
1310
    [% Asset.js("js/recalls.js") | $raw %]
1310
    [% Asset.js("js/recalls.js") | $raw %]
1311
    [% Asset.js("js/coce.js") | $raw %]
1311
    [% Asset.js("js/coce.js") | $raw %]
1312
    [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1312
    [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
1313
    [% IF ( Cover_Images_Required ) %]
1314
        <script>
1315
            var normalized_isbn = "[% normalized_isbn %]";   
1316
        </script>
1317
    [% END %]
1318
    <script>
1313
    <script>
1319
        var interface = "[% interface | html %]";
1314
        var interface = "[% interface | html %]";
1320
        var theme = "[% theme | html %]";
1315
        var theme = "[% theme | html %]";
Lines 2220-2224 Note that permanent location is a code, and location may be an authval. Link Here
2220
            });
2215
            });
2221
        [% END %]
2216
        [% END %]
2222
    </script>
2217
    </script>
2218
    [% IF ( CoverImagesRequired ) %]
2219
        [% KohaPlugins.get_plugins_intranet_cover_images | $raw %]  
2220
    [% END %]
2223
[% END %]
2221
[% END %]
2224
[% INCLUDE 'intranet-bottom.inc' %]
2222
[% 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 / +7 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 1447-1456 Link Here
1447
        [% Asset.js("js/ratings.js") | $raw %]
1448
        [% Asset.js("js/ratings.js") | $raw %]
1448
    [% END %]
1449
    [% END %]
1449
1450
1450
    [% IF ( Cover_Images_Required ) %]
1451
    [% IF ( CoverImagesRequired ) %]
1451
        <script>
1452
        // <script>
1452
            var normalized_isbn = "[% normalized_isbn %]";   
1453
        //     var normalized_isbn = "[% normalized_isbn %]";   
1453
        </script>
1454
        // </script>
1455
        [% KohaPlugins.get_plugins_opac_cover_images | $raw %]
1454
    [% END %]
1456
    [% END %]
1455
1457
1456
    [% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %][% END %]
1458
    [% 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 915-923 if ($offset == 0) { Link Here
915
    $template->param(firstPage => 1);
916
    $template->param(firstPage => 1);
916
}
917
}
917
918
918
my $opac_js_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_opac_js;
919
my $opac_cover_images_plugins = Koha::Template::Plugin::KohaPlugins->get_plugins_opac_cover_images;
919
if(index($opac_js_plugins, "Cover Image Plugin") != -1){
920
if($opac_cover_images_plugins){
920
    $template->param( Cover_Images_Required => 1 )
921
    $template->param( CoverImagesRequired => 1 )
921
}
922
}
922
923
923
    $template->param( borrowernumber    => $borrowernumber);
924
    $template->param( borrowernumber    => $borrowernumber);
924
- 

Return to bug 32680