From 805e2504fe386b81664bc2e8402a94cffe95d367 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Fri, 20 Sep 2013 13:06:48 +0200
Subject: [PATCH] Bug 7813: Followup Ability to delete local cover images

This patch:
- displays a js alert if a problem occurred on deleting the
image on the server.
- adds a class for the new span (in order to avoid future problem, if
  someone adds a new span).
- adds a title for the [x] link.
- deal with the upload_local_cover_images permission (don't display the
  delete link if the logged in user does not have it).
- changes the license version.
---
 .../prog/en/modules/catalogue/detail.tt            |   11 ++++++---
 svc/cover_images                                   |   25 ++++++++++----------
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index 903f1ad..684151a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -62,6 +62,9 @@ function verify_images() {
                         $('#imagenumber-' + this.imagenumber).remove();
                     }
                 });
+            },
+            error: function(data) {
+                alert(_("An error occurred on deleting this image"));
             }
         });
 
@@ -70,7 +73,7 @@ function verify_images() {
     $(document).ready(function() {
         $('#bibliodetails').tabs();
         $('#search-form').focus();
-        $('.thumbnails > li > a > span').click(function() {
+        $('.thumbnails > li > a > span.remove').click(function() {
             var result = confirm(_("Are you sure you want to delete this cover image?"));
 
             if ( result == true ) {
@@ -728,8 +731,10 @@ function verify_images() {
     [% IF image %]
         <li id="imagenumber-[% image %]">
             <a class="thumbnail" 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 %]" />
-                <span class="remove">&times;</span>
+                <img alt="remove this image" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image %]" />
+                [% IF CAN_user_tools_upload_local_cover_images %]
+                  <span class="remove" title="remove this image">&times;</span>
+                [% END %]
             </a>
         </li>
     [% END %]
diff --git a/svc/cover_images b/svc/cover_images
index d3a3c45..ff29503 100755
--- a/svc/cover_images
+++ b/svc/cover_images
@@ -1,23 +1,22 @@
 #!/usr/bin/perl
 
-# Copyright 2013 Universidad Nacional de Cordoba
-#                Tomas Cohen Arazi
-#
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Copyright 2013 Universidad Nacional de Cordoba
+#                Tomas Cohen Arazi
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
 
-- 
1.7.10.4