|
Lines 812-837
Link Here
|
| 812 |
[% END %] |
812 |
[% END %] |
| 813 |
|
813 |
|
| 814 |
[% IF ( LocalCoverImages ) %] |
814 |
[% IF ( LocalCoverImages ) %] |
| 815 |
<div id="images"> |
815 |
<div id="images"> |
| 816 |
[% IF ( localimages.0 ) %] |
816 |
[% IF ( localimages.0 ) %] |
| 817 |
<p>Click on an image to view it in the image viewer</p> |
817 |
<p>Click on an image to view it in the image viewer</p> |
| 818 |
<ul class="thumbnails"> |
818 |
<ul class="thumbnails"> |
| 819 |
[% FOREACH image IN localimages %] |
819 |
[% FOREACH image IN localimages %] |
| 820 |
[% IF image %] |
820 |
[% IF image %] |
| 821 |
<li id="imagenumber-[% image | html %]"> |
821 |
<li id="imagenumber-[% image | html %]" class="thumbnail"> |
| 822 |
<a class="thumbnail" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | html %]&imagenumber=[% image | html %]"> |
822 |
<a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&imagenumber=[% image | uri %]"> |
| 823 |
<img alt="remove this image" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image | html %]" /> |
823 |
<img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image | uri %]" /> |
| 824 |
[% IF CAN_user_tools_upload_local_cover_images %] |
824 |
</a> |
| 825 |
<span class="remove" title="remove this image">Delete image</span> |
825 |
[% IF CAN_user_tools_upload_local_cover_images %] |
|
|
826 |
<a href="#" class="remove"><i class="fa fa-trash"></i> Delete image</a> |
| 827 |
[% END %] |
| 828 |
</li> |
| 829 |
[% END %] |
| 826 |
[% END %] |
830 |
[% END %] |
| 827 |
</a> |
831 |
</ul> |
| 828 |
</li> |
832 |
[% ELSE # - No image passed JavaScript takes care %] |
| 829 |
[% END %] |
833 |
No images have been uploaded for this bibliographic record yet. |
| 830 |
[% END %] |
834 |
[% END %] |
| 831 |
</ul> |
835 |
[% IF ( CAN_user_tools_upload_local_cover_images ) %] |
| 832 |
[%# ELSE - No image passed JavaScript takes care %] |
836 |
<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> |
| 833 |
[% END %] |
837 |
</p> |
| 834 |
</div> |
838 |
[% END %] |
|
|
839 |
</div> |
| 835 |
[% END %] |
840 |
[% END %] |
| 836 |
|
841 |
|
| 837 |
[% IF ( HTML5MediaEnabled ) %] |
842 |
[% IF ( HTML5MediaEnabled ) %] |
|
Lines 904-910
Link Here
|
| 904 |
[% INCLUDE 'catalog-strings.inc' %] |
909 |
[% INCLUDE 'catalog-strings.inc' %] |
| 905 |
[% Asset.js("js/catalog.js") | $raw %] |
910 |
[% Asset.js("js/catalog.js") | $raw %] |
| 906 |
[% INCLUDE 'greybox.inc' %] |
911 |
[% INCLUDE 'greybox.inc' %] |
| 907 |
<script type="text/javascript"> |
912 |
<script> |
|
|
913 |
var interface = "[% interface | html %]"; |
| 914 |
var theme = "[% theme | html %]"; |
| 908 |
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html |
915 |
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html |
| 909 |
function verify_images() { |
916 |
function verify_images() { |
| 910 |
$("#bookcoverimg").each(function(i){ |
917 |
$("#bookcoverimg").each(function(i){ |
|
Lines 937-948
Link Here
|
| 937 |
} |
944 |
} |
| 938 |
|
945 |
|
| 939 |
function removeLocalImage(imagenumber) { |
946 |
function removeLocalImage(imagenumber) { |
|
|
947 |
var thumbnail = $("#imagenumber-" + imagenumber ); |
| 948 |
var copy = thumbnail.html(); |
| 949 |
thumbnail.html("<div><img style='padding:50px' src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /></div>"); |
| 940 |
$.ajax({ |
950 |
$.ajax({ |
| 941 |
url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + biblionumber + "&imagenumber=" + imagenumber, |
951 |
url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + biblionumber + "&imagenumber=" + imagenumber, |
| 942 |
success: function(data) { |
952 |
success: function(data) { |
| 943 |
$(data).each( function(i) { |
953 |
$(data).each( function(i) { |
| 944 |
if ( this.deleted == 1 ) { |
954 |
if ( this.deleted == 1 ) { |
| 945 |
$('#imagenumber-' + this.imagenumber).remove(); |
955 |
thumbnail.remove(); |
|
|
956 |
} else { |
| 957 |
thumbnail.html( copy ); |
| 958 |
alert(_("An error occurred on deleting this image")); |
| 946 |
} |
959 |
} |
| 947 |
if ( $('ul.thumbnails > li').length == 0 ) { |
960 |
if ( $('ul.thumbnails > li').length == 0 ) { |
| 948 |
showNoImageMessage(); |
961 |
showNoImageMessage(); |
|
Lines 950-955
Link Here
|
| 950 |
}); |
963 |
}); |
| 951 |
}, |
964 |
}, |
| 952 |
error: function(data) { |
965 |
error: function(data) { |
|
|
966 |
thumbnail.html( copy ); |
| 953 |
alert(_("An error occurred on deleting this image")); |
967 |
alert(_("An error occurred on deleting this image")); |
| 954 |
} |
968 |
} |
| 955 |
}); |
969 |
}); |
|
Lines 959-965
Link Here
|
| 959 |
var no_images_msg = _("No images have been uploaded for this bibliographic record yet."); |
973 |
var no_images_msg = _("No images have been uploaded for this bibliographic record yet."); |
| 960 |
no_images_msg = '<p>' + no_images_msg + '</p>'; |
974 |
no_images_msg = '<p>' + no_images_msg + '</p>'; |
| 961 |
[% IF ( CAN_user_tools_upload_local_cover_images ) %] |
975 |
[% IF ( CAN_user_tools_upload_local_cover_images ) %] |
| 962 |
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>"); |
976 |
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>"); |
| 963 |
no_images_msg += "<p id='upload_image'>" + please_upload + '</p>'; |
977 |
no_images_msg += "<p id='upload_image'>" + please_upload + '</p>'; |
| 964 |
[% END %] |
978 |
[% END %] |
| 965 |
$('#images').html(no_images_msg); |
979 |
$('#images').html(no_images_msg); |
|
Lines 1042-1061
Link Here
|
| 1042 |
$('#bibliodetails').tabs("option", "active", 3); |
1056 |
$('#bibliodetails').tabs("option", "active", 3); |
| 1043 |
[% END %] |
1057 |
[% END %] |
| 1044 |
$('#search-form').focus(); |
1058 |
$('#search-form').focus(); |
| 1045 |
$('.thumbnails > li > a > span.remove').click(function() { |
1059 |
$('.thumbnails > li > .remove').click(function() { |
| 1046 |
var result = confirm(_("Are you sure you want to delete this cover image?")); |
1060 |
var result = confirm(_("Are you sure you want to delete this cover image?")); |
| 1047 |
|
1061 |
|
| 1048 |
if ( result == true ) { |
1062 |
if ( result == true ) { |
| 1049 |
var imagenumber = $(this).parent().parent().attr('id').split('-')[1]; |
1063 |
var imagenumber = $(this).parent().attr('id').split('-')[1]; |
| 1050 |
removeLocalImage(imagenumber); |
1064 |
removeLocalImage(imagenumber); |
| 1051 |
} |
1065 |
} |
| 1052 |
|
1066 |
|
| 1053 |
return false; |
1067 |
return false; |
| 1054 |
}); |
1068 |
}); |
| 1055 |
[%# inject no images message %] |
1069 |
[%# inject no images message %] |
| 1056 |
[% IF ( LocalCoverImages && ! localimages.0 ) %] |
|
|
| 1057 |
showNoImageMessage(); |
| 1058 |
[% END %] |
| 1059 |
[% IF LocalCoverImages %] |
1070 |
[% IF LocalCoverImages %] |
| 1060 |
KOHA.LocalCover.GetCoverFromBibnumber(true); |
1071 |
KOHA.LocalCover.GetCoverFromBibnumber(true); |
| 1061 |
[% END %] |
1072 |
[% END %] |
| 1062 |
- |
|
|