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