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

(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+4 lines)
Lines 1398-1403 li.email { Link Here
1398
	margin : auto;
1398
	margin : auto;
1399
}
1399
}
1400
1400
1401
.thumbnails > li {
1402
    list-style-type: none;
1403
}
1404
1401
#searchresults ul li {
1405
#searchresults ul li {
1402
	font-size : 90%;
1406
	font-size : 90%;
1403
	list-style : url(../../img/item-bullet.gif);
1407
	list-style : url(../../img/item-bullet.gif);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-7 / +39 lines)
Lines 52-62 function verify_images() { Link Here
52
        });
52
        });
53
}
53
}
54
54
55
     $(document).ready(function() {
55
    function removeLocalImage(imagenumber) {
56
57
        $.ajax({
58
            url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + [% biblionumber %] + "&imagenumber=" + imagenumber,
59
            success: function(data) {
60
                $(data).each( function(i) {
61
                    if ( this.deleted == 1 ) {
62
                        $('#imagenumber-' + this.imagenumber).remove();
63
                    }
64
                });
65
            }
66
        });
67
68
    }
69
70
    $(document).ready(function() {
56
        $('#bibliodetails').tabs();
71
        $('#bibliodetails').tabs();
57
        $('#search-form').focus();
72
        $('#search-form').focus();
73
        $('.thumbnails > li > a > span').click(function() {
74
            var result = confirm(_("Are you sure you want to delete this cover image?"));
75
76
            if ( result == true ) {
77
                var imagenumber = $(this).parent().parent().attr('id').split('-')[1];
78
                removeLocalImage(imagenumber);
79
            }
80
81
            return false;
82
        });
83
    });
58
84
59
     });
60
     [% IF ( AmazonCoverImages ) %]$(window).load(function() {
85
     [% IF ( AmazonCoverImages ) %]$(window).load(function() {
61
        verify_images();
86
        verify_images();
62
     });[% END %]
87
     });[% END %]
Lines 693-707 function verify_images() { Link Here
693
[% IF ( LocalCoverImages ) %]
718
[% IF ( LocalCoverImages ) %]
694
<div id="images">
719
<div id="images">
695
[% IF ( localimages.0 ) %]
720
[% IF ( localimages.0 ) %]
696
<p>Click on an image to view it in the image viewer</p>
721
    <p>Click on an image to view it in the image viewer</p>
722
    <ul class="thumbnails">
697
[% FOREACH image IN localimages %]
723
[% FOREACH image IN localimages %]
698
[% IF image %]
724
    [% IF image %]
699
<a class="localimage" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&amp;imagenumber=[% image %]"><img alt="" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image %]" /></a>
725
        <li id="imagenumber-[% image %]">
700
[% END %]
726
            <a class="thumbnail" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&amp;imagenumber=[% image %]">
727
                <img alt="" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image %]" />
728
                <span class="remove">&times;</span>
729
            </a>
730
        </li>
731
    [% END %]
701
[% END %]
732
[% END %]
733
    </ul>
702
[% ELSE %]
734
[% ELSE %]
703
[% IF ( CAN_user_tools_upload_local_cover_images ) %]
735
[% IF ( CAN_user_tools_upload_local_cover_images ) %]
704
<p>No images have been uploaded for this bibliographic record yet. Please <a href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&amp;filetype=image'>upload</a> one.</p>
736
    <p>No images have been uploaded for this bibliographic record yet. Please <a href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&amp;filetype=image'>upload</a> one.</p>
705
[% END %]
737
[% END %]
706
[% END %]
738
[% END %]
707
</div>
739
</div>
(-)a/svc/cover_images (-1 / +77 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2013 Universidad Nacional de Cordoba
4
#                Tomas Cohen Arazi
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
22
use Modern::Perl;
23
24
use CGI;
25
use C4::Auth qw/check_cookie_auth/;
26
use C4::Images;
27
use JSON qw/to_json/;
28
29
my $input = new CGI;
30
31
my ( $auth_status, $sessionID ) =
32
        check_cookie_auth(
33
            $input->cookie('CGISESSID'),
34
            { tools => 'upload_local_cover_images' } );
35
36
if ( $auth_status ne "ok" ) {
37
    exit 0;
38
}
39
40
my $action       = $input->param('action');
41
my $biblionumber = $input->param('biblionumber');
42
my @imagenumbers = $input->param('imagenumber');
43
44
# Array to store the reponse JSON
45
my $response = [];
46
47
if ( $action eq "delete" ) {
48
    # Build a hash of valid imagenumbers fr the given biblionumber
49
    my %valid_imagenumbers = map {$_ => 1} ListImagesForBiblio($biblionumber);
50
51
    foreach my $imagenumber ( @imagenumbers ) {
52
        if ( exists( $valid_imagenumbers{ $imagenumber } ) ) {
53
            DelImage($imagenumber);
54
            push @$response, {
55
                imagenumber => $imagenumber,
56
                deleted => 1
57
            };
58
        } else {
59
            push @$response, {
60
                imagenumber => $imagenumber,
61
                deleted => 0,
62
                error => "MSG_INVALID_IMAGENUMBER"
63
            };
64
        }
65
    }
66
} else {
67
    # invalid action
68
    exit 0;
69
}
70
71
binmode STDOUT, ":encoding(UTF-8)";
72
print $input->header(
73
    -type => 'application/json',
74
    -charset => 'UTF-8'
75
);
76
77
print to_json( $response );

Return to bug 7813