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

(-)a/catalogue/detail.pl (+6 lines)
Lines 37-42 use C4::External::Amazon; Link Here
37
use C4::Search;		# enabled_staff_search_views
37
use C4::Search;		# enabled_staff_search_views
38
use C4::VirtualShelves;
38
use C4::VirtualShelves;
39
use C4::XSLT;
39
use C4::XSLT;
40
use C4::Images;
40
41
41
# use Smart::Comments;
42
# use Smart::Comments;
42
43
Lines 384-389 if ( C4::Context->preference("AmazonEnabled") == 1 ) { Link Here
384
    }
385
    }
385
}
386
}
386
387
388
if ( C4::Context->preference("LocalCoverImages") == 1 ) {
389
    my @images = ListImagesForBiblio($biblionumber);
390
    $template->{VARS}->{localimages} = \@images;
391
}
392
387
# Get OPAC URL
393
# Get OPAC URL
388
if (C4::Context->preference('OPACBaseURL')){
394
if (C4::Context->preference('OPACBaseURL')){
389
     $template->param( OpacUrl => C4::Context->preference('OPACBaseURL') );
395
     $template->param( OpacUrl => C4::Context->preference('OPACBaseURL') );
(-)a/catalogue/image.pl (+108 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#
3
# based on patronimage.pl
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
#
21
#
22
23
use strict;
24
use warnings;
25
26
use CGI; #qw(:standard escapeHTML);
27
use C4::Context;
28
use C4::Images;
29
30
$|=1;
31
32
my $DEBUG = 1;
33
my $data = new CGI;
34
my $imagenumber;
35
36
=head1 NAME
37
38
image.pl - Script for retrieving and formatting local cover images for display
39
40
=head1 SYNOPSIS
41
42
<img src="image.pl?imagenumber=X" />
43
<img src="image.pl?biblionumber=X" />
44
<img src="image.pl?imagenumber=X&thumbnail=1" />
45
<img src="image.pl?biblionumber=X&thumbnail=1" />
46
47
=head1 DESCRIPTION
48
49
This script, when called from within HTML and passed a valid imagenumber or
50
biblionumber, will retrieve the image data associated with that biblionumber
51
if one exists, format it in proper HTML format and pass it back to be displayed.
52
If the parameter thumbnail has been provided, a thumbnail will be returned
53
rather than the full-size image. When a biblionumber is provided rather than an
54
imagenumber, a random image is selected.
55
56
=cut
57
58
if (defined $data->param('imagenumber')) {
59
    $imagenumber = $data->param('imagenumber');
60
} elsif (defined $data->param('biblionumber')) {
61
    my @imagenumbers = ListImagesForBiblio($data->param('biblionumber'));
62
    if (@imagenumbers) {
63
        $imagenumber = $imagenumbers[0];
64
    } else {
65
        warn "No images for this biblio" if $DEBUG;
66
        error();
67
    }
68
} else {
69
    $imagenumber = shift;
70
}
71
72
if ($imagenumber) {
73
    warn "imagenumber passed in: $imagenumber" if $DEBUG;
74
    my $imagedata = RetrieveImage($imagenumber);
75
76
    error() unless $imagedata;
77
78
    if ($imagedata) {
79
        my $image;
80
        if ($data->param('thumbnail')) {
81
            $image = $imagedata->{'thumbnail'};
82
        } else {
83
            $image = $imagedata->{'imagefile'};
84
        }
85
        print $data->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -expires => 'now', -Content_Length => length ($image)), $image;
86
        exit;
87
    } else {
88
        warn "No image exists for $imagenumber" if $DEBUG;
89
        error();
90
    }
91
} else {
92
    error();
93
}
94
95
error();
96
97
sub error {
98
    print $data->header ( -status=> '404', -expires => 'now' );
99
    exit;
100
}
101
102
=head1 AUTHOR
103
104
Chris Nighswonger cnighswonger <at> foundations <dot> edu
105
106
modified for local cover images by Koustubha Kale kmkale <at> anantcorp <dot> com
107
108
=cut
(-)a/catalogue/imageviewer.pl (+51 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2011 C & P Bibliography Services
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use CGI;
24
use C4::Auth;
25
use C4::Biblio;
26
use C4::Output;
27
use C4::Images;
28
29
my $query = new CGI;
30
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
31
    {
32
        template_name   => "catalogue/imageviewer.tmpl",
33
        query           => $query,
34
        type            => "intranet",
35
        authnotrequired => 0,
36
        flagsrequired   => { catalogue => 1 },
37
    }
38
);
39
40
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
41
my ($count, $biblio) = GetBiblio($biblionumber);
42
43
if (C4::Context->preference("LocalCoverImages")) {
44
    my @images = ListImagesForBiblio($biblionumber);
45
    $template->{VARS}->{'LocalCoverImages'} = 1;
46
    $template->{VARS}->{'images'} = \@images;
47
}
48
49
$template->{VARS}->{'biblio'} = $biblio;
50
51
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+3 lines)
Lines 2133-2135 div.pager input.pagedisplay { Link Here
2133
	font-weight: bold;
2133
	font-weight: bold;
2134
	text-align : center;
2134
	text-align : center;
2135
}
2135
}
2136
.localimage {
2137
    padding: .3em;
2138
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (+8 lines)
Lines 99-101 Link Here
99
    [% IF ( virtualshelves || intranetbookbag ) %]
99
    [% IF ( virtualshelves || intranetbookbag ) %]
100
        <script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js"></script>
100
        <script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js"></script>
101
    [% END %]
101
    [% END %]
102
[% IF LocalCoverImages %]
103
<script type="text/javascript" language="javascript" src="[% themelang %]/js/localcovers.js"></script>
104
<script type="text/javascript" language="javascript">
105
//<![CDATA[
106
var NO_LOCAL_JACKET = _("No cover image available");
107
//]]>
108
</script>
109
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js (+44 lines)
Line 0 Link Here
1
if (typeof KOHA == "undefined" || !KOHA) {
2
    var KOHA = {};
3
}
4
5
/**
6
 * A namespace for local cover related functions.
7
 */
8
KOHA.LocalCover = {
9
10
11
    /**
12
     * Search all:
13
     *    <div title="biblionumber" id="isbn" class="openlibrary-thumbnail"></div>
14
     * or
15
     *    <div title="biblionumber" id="isbn" class="openlibrary-thumbnail-preview"></div>
16
     * and run a search with all collected isbns to Open Library Book Search.
17
     * The result is asynchronously returned by OpenLibrary and catched by
18
     * olCallBack().
19
     */
20
    GetCoverFromBibnumber: function(uselink) {
21
        $("div [id^=local-thumbnail]").each(function(i) {
22
            var mydiv = this;
23
            var message = document.createElement("span");
24
            $(message).attr("class","no-image");
25
            $(message).html(NO_LOCAL_JACKET);
26
            $(mydiv).append(message);
27
            var img = $("<img />").attr('src',
28
                '/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class"))
29
                .load(function () {
30
                    if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
31
                    } else {
32
                        if (uselink) {
33
                            var a = $("<a />").attr('href', '/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=' + $(mydiv).attr("class"));
34
                            $(a).append(img);
35
                            $(mydiv).append(a);
36
                        } else {
37
                            $(mydiv).append(img);
38
                        }
39
                        $(mydiv).children('.no-image').remove();
40
                    }
41
                })
42
        });
43
    }
44
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (+12 lines)
Lines 233-238 function verify_images() { Link Here
233
[% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#subscriptions">Subscriptions</a></li>[% END %]
233
[% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#subscriptions">Subscriptions</a></li>[% END %]
234
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#editions">Editions</a></li>[% END %][% END %]
234
[% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#editions">Editions</a></li>[% END %][% END %]
235
[% IF ( AmazonSimilarItems ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#related">Related Titles</a></li>[% END %]
235
[% IF ( AmazonSimilarItems ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#related">Related Titles</a></li>[% END %]
236
[% IF ( LocalCoverImages ) %]<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber %]#images">Images</a></li>[% END %]
236
 </ul>
237
 </ul>
237
238
238
<div id="holdings">
239
<div id="holdings">
Lines 524-529 function verify_images() { Link Here
524
</div>
525
</div>
525
[% END %][% END %]
526
[% END %][% END %]
526
527
528
[% IF ( LocalCoverImages ) %]
529
<div id="images">
530
<div>Click on an image to view it in the image viewer</div>
531
[% FOREACH image IN localimages %]
532
[% IF image %]
533
<span class="localimage"><a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&imagenumber=[% image %]"><img alt="img" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image %]" /></a></span>
534
[% END %]
535
[% END %]
536
</div>
537
[% END %]
538
527
</div><!-- /bibliodetails -->
539
</div><!-- /bibliodetails -->
528
540
529
<div class="yui-g" id="export" style="margin-top: 1em;">
541
<div class="yui-g" id="export" style="margin-top: 1em;">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt (+43 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog &rsaquo; Images for: [% biblio.title |html %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/JavaScript" language="JavaScript">
5
//<![CDATA[
6
7
$(document).ready(function(){
8
    showCover($('.thumbnail').attr('id'));
9
});
10
11
function showCover(img) {
12
    $('.thumbnail').attr('class', 'thumbnail');
13
    $('#largeCoverImg').attr('src', '/cgi-bin/koha/catalogue/image.pl?imagenumber=' + img);
14
    $('#' + img + '.thumbnail').attr('class', 'thumbnail selected');
15
}
16
//]]>
17
</script>
18
<style type="text/css">
19
img.thumbnail {
20
    border-style: solid;
21
    border-width: 3px;
22
    border-color: white;
23
}
24
25
img.selected {
26
    border-color: black;
27
}
28
</style>
29
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
30
<body id="imageviewer">
31
<div id="largeCover"><img id="largeCoverImg" alt="Large view" /></div>
32
[% IF LocalCoverImages == 1 %]
33
[% FOREACH img IN images %]
34
[% IF img %]
35
<a href='#' onclick='showCover([% img %])'><img class='thumbnail' id='[% img %]' src='/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img %]&thumbnail=1' alt='Image'/></a>
36
[% END %]
37
[% END %]
38
[% biblio.title %] [% biblio.author %]
39
[% ELSE %]
40
Unfortunately, images are not enabled for this catalog at this time.
41
[% END %]
42
</body>
43
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt (-1 / +1 lines)
Lines 109-115 function CheckForm(f) { Link Here
109
    <legend>Options</legend>
109
    <legend>Options</legend>
110
    <ol>
110
    <ol>
111
      <li class="checkbox">
111
      <li class="checkbox">
112
        <input type="checkbox" id="replace" name="replace" [% IF AllowMultipleCovers == 0 %]checked="checked" disabled="disabled"[% END %] />
112
        <input type="checkbox" id="replace" name="replace" [% IF AllowMultipleCovers == 0 %]checked="checked" disabled="disabled"[% END %] value="1" />
113
        <label for="replace">Replace existing covers</label>
113
        <label for="replace">Replace existing covers</label>
114
      </li>
114
      </li>
115
    </ol>
115
    </ol>
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc (+9 lines)
Lines 98-103 var NO_OL_JACKET = _("No cover image available"); Link Here
98
</script>
98
</script>
99
[% END %]
99
[% END %]
100
100
101
[% IF OPACLocalCoverImages %]
102
<script type="text/javascript" language="javascript" src="[% themelang %]/js/localcovers.js"></script>
103
<script type="text/javascript" language="javascript">
104
//<![CDATA[
105
var NO_LOCAL_JACKET = _("No cover image available");
106
//]]>
107
</script>
108
[% END %]
109
101
[% IF ( BakerTaylorEnabled ) %]<script type="text/javascript" language="javascript" src="[% themelang %]/js/bakertaylorimages.js"></script>
110
[% IF ( BakerTaylorEnabled ) %]<script type="text/javascript" language="javascript" src="[% themelang %]/js/bakertaylorimages.js"></script>
102
<script type="text/javascript" language="javascript">
111
<script type="text/javascript" language="javascript">
103
	//<![CDATA[
112
	//<![CDATA[
(-)a/koha-tmpl/opac-tmpl/prog/en/js/localcovers.js (+44 lines)
Line 0 Link Here
1
if (typeof KOHA == "undefined" || !KOHA) {
2
    var KOHA = {};
3
}
4
5
/**
6
 * A namespace for local cover related functions.
7
 */
8
KOHA.LocalCover = {
9
10
11
    /**
12
     * Search all:
13
     *    <div title="biblionumber" id="isbn" class="openlibrary-thumbnail"></div>
14
     * or
15
     *    <div title="biblionumber" id="isbn" class="openlibrary-thumbnail-preview"></div>
16
     * and run a search with all collected isbns to Open Library Book Search.
17
     * The result is asynchronously returned by OpenLibrary and catched by
18
     * olCallBack().
19
     */
20
    GetCoverFromBibnumber: function(uselink) {
21
        $("div [id^=local-thumbnail]").each(function(i) {
22
            var mydiv = this;
23
            var message = document.createElement("span");
24
            $(message).attr("class","no-image");
25
            $(message).html(NO_LOCAL_JACKET);
26
            $(mydiv).append(message);
27
            var img = $("<img />").attr('src',
28
                '/cgi-bin/koha/opac-image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class"))
29
                .load(function () {
30
                    if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
31
                    } else {
32
                        if (uselink) {
33
                            var a = $("<a />").attr('href', '/cgi-bin/koha/opac-imageviewer.pl?biblionumber=' + $(mydiv).attr("class"));
34
                            $(a).append(img);
35
                            $(mydiv).append(a);
36
                        } else {
37
                            $(mydiv).append(img);
38
                        }
39
                        $(mydiv).children('.no-image').remove();
40
                    }
41
                })
42
        });
43
    }
44
};
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+18 lines)
Lines 39-44 Link Here
39
	[% IF OpenLibraryCovers %]
39
	[% IF OpenLibraryCovers %]
40
	KOHA.OpenLibrary.GetCoverFromIsbn();
40
	KOHA.OpenLibrary.GetCoverFromIsbn();
41
	[% END %]
41
	[% END %]
42
	[% IF OPACLocalCoverImages %]
43
	KOHA.LocalCover.GetCoverFromBibnumber(true);
44
	[% END %]
42
        [% IF ( NovelistSelectProfile ) %]
45
        [% IF ( NovelistSelectProfile ) %]
43
        novSelect.loadContentForISBN('[% normalized_isbn %]','[% NovelistSelectProfile %]', '[% NovelistSelectPassword %]', function(d){});
46
        novSelect.loadContentForISBN('[% normalized_isbn %]','[% NovelistSelectProfile %]', '[% NovelistSelectPassword %]', function(d){});
44
        [% END %]
47
        [% END %]
Lines 224-229 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
224
    <div id="catalogue_detail_biblio">
227
    <div id="catalogue_detail_biblio">
225
228
226
    <div id="bookcover">
229
    <div id="bookcover">
230
    [% IF ( OPACLocalCoverImages ) %]<div style="block" title="[% biblionumber |url %]" class="[% biblionumber %]" id="local-thumbnail-preview"></div>[% END %]
227
    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( OPACurlOpenInNewWindow ) %]<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="Cover Image" /></a>[% ELSE %]<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="Cover Image" /></a>[% END %][% END %][% END %]
231
    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( OPACurlOpenInNewWindow ) %]<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="Cover Image" /></a>[% ELSE %]<a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link"><img border="0" src="http://images.amazon.com/images/P/[% normalized_isbn %].01.MZZZZZZZ.jpg" alt="Cover Image" /></a>[% END %][% END %][% END %]
228
232
229
    [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %][% IF ( using_https ) %]
233
    [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %][% IF ( using_https ) %]
Lines 543-548 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
543
		[% ELSE %]<li>[% END %]
547
		[% ELSE %]<li>[% END %]
544
		<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#serialcollection">Serial Collection</a></li>
548
		<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#serialcollection">Serial Collection</a></li>
545
    [% END %]
549
    [% END %]
550
551
    [% IF ( OPACLocalCoverImages ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#images">Images</a></li>[% END %]
546
</ul>
552
</ul>
547
553
548
[% IF ( serialcollection ) %]
554
[% IF ( serialcollection ) %]
Lines 983-988 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
983
[% END %]
989
[% END %]
984
990
985
991
992
[% IF ( OPACLocalCoverImages ) %]
993
<div id="images">
994
<div>Click on an image to view it in the image viewer</div>
995
[% FOREACH image IN localimages %]
996
[% IF image %]
997
<span class="localimage"><a href="/cgi-bin/koha/opac-imageviewer.pl?biblionumber=[% biblionumber %]&imagenumber=[% image %]"><img alt="img" src="/cgi-bin/koha/opac-image.pl?thumbnail=1&imagenumber=[% image %]" /></a></span>
998
[% END %]
999
[% END %]
1000
</div>
1001
[% END %]
1002
1003
986
</div>
1004
</div>
987
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
1005
[% IF ( NovelistSelectProfile ) %][% IF ( NovelistSelectView == 'below' ) %]
988
<div id="NovelistSelect">
1006
<div id="NovelistSelect">
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-imageviewer.tt (+43 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog &rsaquo; Images for: [% biblio.title |html %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/JavaScript" language="JavaScript">
5
//<![CDATA[
6
7
$(document).ready(function(){
8
    showCover($('.thumbnail').attr('id'));
9
});
10
11
function showCover(img) {
12
    $('.thumbnail').attr('class', 'thumbnail');
13
    $('#largeCoverImg').attr('src', '/cgi-bin/koha/opac-image.pl?imagenumber=' + img);
14
    $('#' + img + '.thumbnail').attr('class', 'thumbnail selected');
15
}
16
//]]>
17
</script>
18
<style type="text/css">
19
img.thumbnail {
20
    border-style: solid;
21
    border-width: 3px;
22
    border-color: white;
23
}
24
25
img.selected {
26
    border-color: black;
27
}
28
</style>
29
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
30
<body id="opac-imageviewer">
31
<div id="largeCover"><img id="largeCoverImg" alt="Large view" /></div>
32
[% IF OPACLocalCoverImages == 1 %]
33
[% FOREACH img IN images %]
34
[% IF img %]
35
<a href='#' onclick='showCover([% img %])'><img class='thumbnail' id='[% img %]' src='/cgi-bin/koha/opac-image.pl?imagenumber=[% img %]&thumbnail=1' alt='Image'/></a>
36
[% END %]
37
[% END %]
38
[% biblio.title %] [% biblio.author %]
39
[% ELSE %]
40
Unfortunately, images are not enabled for this catalog at this time.
41
[% END %]
42
</body>
43
</html>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+2 lines)
Lines 229-234 $(document).ready(function(){ Link Here
229
        [% END %]
229
        [% END %]
230
    [% END %][% END %]
230
    [% END %][% END %]
231
    [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
231
    [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
232
	[% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
232
    [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
233
    [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
233
});
234
});
234
//]]>
235
//]]>
Lines 528-533 $(document).ready(function(){ Link Here
528
				</span>
529
				</span>
529
				</td><td>
530
				</td><td>
530
					<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
531
					<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
532
            [% IF ( OPACLocalCoverImages ) %]<div style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber %]" id="local-thumbnail[% loop.count %]"></div>[% END %]
531
                    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %][% END %]
533
                    [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %][% END %]
532
534
533
					[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
535
					[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
(-)a/opac/opac-detail.pl (+11 lines)
Lines 45-50 use C4::Charset; Link Here
45
use MARC::Record;
45
use MARC::Record;
46
use MARC::Field;
46
use MARC::Field;
47
use List::MoreUtils qw/any none/;
47
use List::MoreUtils qw/any none/;
48
use C4::Images;
48
49
49
BEGIN {
50
BEGIN {
50
	if (C4::Context->preference('BakerTaylorEnabled')) {
51
	if (C4::Context->preference('BakerTaylorEnabled')) {
Lines 690-695 if (scalar(@serialcollections) > 0) { Link Here
690
	serialcollections => \@serialcollections);
691
	serialcollections => \@serialcollections);
691
}
692
}
692
693
694
# Local cover Images stuff
695
if (C4::Context->preference("OPACLocalCoverImages")){
696
		$template->param(OPACLocalCoverImages => 1);
697
}
698
693
# Amazon.com Stuff
699
# Amazon.com Stuff
694
if ( C4::Context->preference("OPACAmazonEnabled") ) {
700
if ( C4::Context->preference("OPACAmazonEnabled") ) {
695
    $template->param( AmazonTld => get_amazon_tld() );
701
    $template->param( AmazonTld => get_amazon_tld() );
Lines 915-918 my $defaulttab = Link Here
915
        ? 'serialcollection' : 'subscription';
921
        ? 'serialcollection' : 'subscription';
916
$template->param('defaulttab' => $defaulttab);
922
$template->param('defaulttab' => $defaulttab);
917
923
924
if (C4::Context->preference('OPACLocalCoverImages') == 1) {
925
    my @images = ListImagesForBiblio($biblionumber);
926
    $template->{VARS}->{localimages} = \@images;
927
}
928
918
output_html_with_http_headers $query, $cookie, $template->output;
929
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-image.pl (+108 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#
3
# based on patronimage.pl
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
#
21
#
22
23
use strict;
24
use warnings;
25
26
use CGI; #qw(:standard escapeHTML);
27
use C4::Context;
28
use C4::Images;
29
30
$|=1;
31
32
my $DEBUG = 1;
33
my $data = new CGI;
34
my $imagenumber;
35
36
=head1 NAME
37
38
opac-image.pl - Script for retrieving and formatting local cover images for display
39
40
=head1 SYNOPSIS
41
42
<img src="opac-image.pl?imagenumber=X" />
43
<img src="opac-image.pl?biblionumber=X" />
44
<img src="opac-image.pl?imagenumber=X&thumbnail=1" />
45
<img src="opac-image.pl?biblionumber=X&thumbnail=1" />
46
47
=head1 DESCRIPTION
48
49
This script, when called from within HTML and passed a valid imagenumber or
50
biblionumber, will retrieve the image data associated with that biblionumber
51
if one exists, format it in proper HTML format and pass it back to be displayed.
52
If the parameter thumbnail has been provided, a thumbnail will be returned
53
rather than the full-size image. When a biblionumber is provided rather than an
54
imagenumber, a random image is selected.
55
56
=cut
57
58
if (defined $data->param('imagenumber')) {
59
    $imagenumber = $data->param('imagenumber');
60
} elsif (defined $data->param('biblionumber')) {
61
    my @imagenumbers = ListImagesForBiblio($data->param('biblionumber'));
62
    if (@imagenumbers) {
63
        $imagenumber = $imagenumbers[0];
64
    } else {
65
        warn "No images for this biblio" if $DEBUG;
66
        error();
67
    }
68
} else {
69
    $imagenumber = shift;
70
}
71
72
if ($imagenumber) {
73
    warn "imagenumber passed in: $imagenumber" if $DEBUG;
74
    my $imagedata = RetrieveImage($imagenumber);
75
76
    error() unless $imagedata;
77
78
    if ($imagedata) {
79
        my $image;
80
        if ($data->param('thumbnail')) {
81
            $image = $imagedata->{'thumbnail'};
82
        } else {
83
            $image = $imagedata->{'imagefile'};
84
        }
85
        print $data->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -expires => 'now', -Content_Length => length ($image)), $image;
86
        exit;
87
    } else {
88
        warn "No image exists for $imagenumber" if $DEBUG;
89
        error();
90
    }
91
} else {
92
    error();
93
}
94
95
error();
96
97
sub error {
98
    print $data->header ( -status=> '404', -expires => 'now' );
99
    exit;
100
}
101
102
=head1 AUTHOR
103
104
Chris Nighswonger cnighswonger <at> foundations <dot> edu
105
106
modified for local cover images by Koustubha Kale kmkale <at> anantcorp <dot> com
107
108
=cut
(-)a/opac/opac-imageviewer.pl (+51 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2011 C & P Bibliography Services
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use CGI;
24
use C4::Auth;
25
use C4::Biblio;
26
use C4::Output;
27
use C4::Images;
28
29
my $query = new CGI;
30
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
31
    {
32
        template_name   => "opac-imageviewer.tmpl",
33
        query           => $query,
34
        type            => "opac",
35
        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
36
        flagsrequired   => { borrow => 1 },
37
    }
38
);
39
40
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
41
my ($count, $biblio) = GetBiblio($biblionumber);
42
43
if (C4::Context->preference("OPACLocalCoverImages")) {
44
    my @images = ListImagesForBiblio($biblionumber);
45
    $template->{VARS}->{'OPACLocalCoverImages'} = 1;
46
    $template->{VARS}->{'images'} = \@images;
47
}
48
49
$template->{VARS}->{'biblio'} = $biblio;
50
51
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (+4 lines)
Lines 616-621 for (my $i=0;$i<@servers;$i++) { Link Here
616
            $template->param(SEARCH_RESULTS => \@newresults,
616
            $template->param(SEARCH_RESULTS => \@newresults,
617
                                OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay") eq "itemdetails"?1:0),
617
                                OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay") eq "itemdetails"?1:0),
618
                            );
618
                            );
619
	    if (C4::Context->preference("OPACLocalCoverImages")){
620
		$template->param(OPACLocalCoverImages => 1);
621
		$template->param(OPACLocalCoverImagesPriority => C4::Context->preference("OPACLocalCoverImagesPriority"));
622
	    }
619
            ## Build the page numbers on the bottom of the page
623
            ## Build the page numbers on the bottom of the page
620
            my @page_numbers;
624
            my @page_numbers;
621
            # total number of pages there will be
625
            # total number of pages there will be
(-)a/tools/upload-cover-image.pl (-2 / +2 lines)
Lines 66-72 my ($template, $loggedinuser, $cookie) Link Here
66
my $filetype            = $input->param('filetype');
66
my $filetype            = $input->param('filetype');
67
my $biblionumber        = $input->param('biblionumber');
67
my $biblionumber        = $input->param('biblionumber');
68
my $uploadfilename      = $input->param('uploadfile');
68
my $uploadfilename      = $input->param('uploadfile');
69
my $replace             = $input->param('replace');
69
my $replace             = !C4::Context->preference("AllowMultipleCovers") || $input->param('replace');
70
my $op                  = $input->param('op');
70
my $op                  = $input->param('op');
71
my %cookies             = parse CGI::Cookie($cookie);
71
my %cookies             = parse CGI::Cookie($cookie);
72
my $sessionID           = $cookies{'CGISESSID'}->value;
72
my $sessionID           = $cookies{'CGISESSID'}->value;
Lines 78-83 $template->{VARS}->{'biblionumber'} = $biblionumber; Link Here
78
78
79
my $total = 0;
79
my $total = 0;
80
80
81
81
if ($fileID) {
82
if ($fileID) {
82
    my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID);
83
    my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID);
83
    if ($filetype eq 'image') {
84
    if ($filetype eq 'image') {
84
- 

Return to bug 1633