[% END %]
[% IF ( LocalCoverImages ) %]
-<div id="images">
-[% IF ( localimages.0 ) %]
- <p>Click on an image to view it in the image viewer</p>
- <ul class="thumbnails">
-[% FOREACH image IN localimages %]
- [% IF image %]
- <li id="imagenumber-[% image | html %]">
- <a class="thumbnail" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | html %]&imagenumber=[% image | html %]">
- <img alt="remove this image" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image | html %]" />
- [% IF CAN_user_tools_upload_local_cover_images %]
- <span class="remove" title="remove this image">Delete image</span>
+ <div id="images">
+ [% IF ( localimages.0 ) %]
+ <p>Click on an image to view it in the image viewer</p>
+ <ul class="thumbnails">
+ [% FOREACH image IN localimages %]
+ [% IF image %]
+ <li id="imagenumber-[% image | html %]" class="thumbnail">
+ <a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&imagenumber=[% image | uri %]">
+ <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image | uri %]" />
+ </a>
+ [% IF CAN_user_tools_upload_local_cover_images %]
+ <a href="#" class="remove"><i class="fa fa-trash"></i> Delete image</a>
+ [% END %]
+ </li>
+ [% END %]
[% END %]
- </a>
- </li>
- [% END %]
-[% END %]
- </ul>
-[%# ELSE - No image passed JavaScript takes care %]
-[% END %]
-</div>
+ </ul>
+ [% ELSE # - No image passed JavaScript takes care %]
+ No images have been uploaded for this bibliographic record yet.
+ [% END %]
+ [% IF ( CAN_user_tools_upload_local_cover_images ) %]
+ <p>Upload an image file: <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber | uri %]&filetype=image"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a>
+ </p>
+ [% END %]
+ </div>
[% END %]
[% IF ( HTML5MediaEnabled ) %]
[% Asset.js("js/catalog.js") | $raw %]
[% INCLUDE 'greybox.inc' %]
<script>
+ var interface = "[% interface | html %]";
+ var theme = "[% theme | html %]";
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_images() {
$("#bookcoverimg").each(function(i){
}
function removeLocalImage(imagenumber) {
+ var thumbnail = $("#imagenumber-" + imagenumber );
+ var copy = thumbnail.html();
+ thumbnail.html("<div><img style='padding:50px' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /></div>");
$.ajax({
url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + biblionumber + "&imagenumber=" + imagenumber,
success: function(data) {
$(data).each( function(i) {
if ( this.deleted == 1 ) {
- $('#imagenumber-' + this.imagenumber).remove();
+ thumbnail.remove();
+ } else {
+ thumbnail.html( copy );
+ alert(_("An error occurred on deleting this image"));
}
if ( $('ul.thumbnails > li').length == 0 ) {
showNoImageMessage();
});
},
error: function(data) {
+ thumbnail.html( copy );
alert(_("An error occurred on deleting this image"));
}
});
var no_images_msg = _("No images have been uploaded for this bibliographic record yet.");
no_images_msg = '<p>' + no_images_msg + '</p>';
[% IF ( CAN_user_tools_upload_local_cover_images ) %]
- var please_upload = _("Please select the image file to upload. %sUpload%s").format("<a class='btn btn-default btn-xs' href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=" + biblionumber + "&filetype=image'><i class='fa fa-upload' aria-hidden='true'></i> ","</a>");
+ var please_upload = _("Upload an image file: %sUpload%s").format("<a class='btn btn-default btn-xs' href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=" + biblionumber + "&filetype=image'><i class='fa fa-upload' aria-hidden='true'></i> ","</a>");
no_images_msg += "<p id='upload_image'>" + please_upload + '</p>';
[% END %]
$('#images').html(no_images_msg);
$('#bibliodetails').tabs("option", "active", 3);
[% END %]
$('#search-form').focus();
- $('.thumbnails > li > a > span.remove').click(function() {
+ $('.thumbnails > li > .remove').click(function() {
var result = confirm(_("Are you sure you want to delete this cover image?"));
if ( result == true ) {
- var imagenumber = $(this).parent().parent().attr('id').split('-')[1];
+ var imagenumber = $(this).parent().attr('id').split('-')[1];
removeLocalImage(imagenumber);
}
return false;
});
[%# inject no images message %]
- [% IF ( LocalCoverImages && ! localimages.0 ) %]
- showNoImageMessage();
- [% END %]
[% IF LocalCoverImages %]
KOHA.LocalCover.GetCoverFromBibnumber(true);
[% END %]