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 697-711 function verify_images() { Link Here
697
[% IF ( LocalCoverImages ) %]
722
[% IF ( LocalCoverImages ) %]
698
<div id="images">
723
<div id="images">
699
[% IF ( localimages.0 ) %]
724
[% IF ( localimages.0 ) %]
700
<p>Click on an image to view it in the image viewer</p>
725
    <p>Click on an image to view it in the image viewer</p>
726
    <ul class="thumbnails">
701
[% FOREACH image IN localimages %]
727
[% FOREACH image IN localimages %]
702
[% IF image %]
728
    [% IF image %]
703
<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>
729
        <li id="imagenumber-[% image %]">
704
[% END %]
730
            <a class="thumbnail" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&amp;imagenumber=[% image %]">
731
                <img alt="" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image %]" />
732
                <span class="remove">&times;</span>
733
            </a>
734
        </li>
735
    [% END %]
705
[% END %]
736
[% END %]
737
    </ul>
706
[% ELSE %]
738
[% ELSE %]
707
[% IF ( CAN_user_tools_upload_local_cover_images ) %]
739
[% IF ( CAN_user_tools_upload_local_cover_images ) %]
708
<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>
740
    <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>
709
[% END %]
741
[% END %]
710
[% END %]
742
[% END %]
711
</div>
743
</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