@@ -, +, @@ - action - biblionumber (used for checking imagenumber validity) - imagenumber (repeatable) - Open the detail page fr a biblionumber containing one or more cover images, go to its images tab. - Apply the patch, reload the page, go to the images tab. - Thumbnails should look better than before ;-) - An 'X' button should show below each cover. - Clicking the 'X' button should trigger an alert message asking for confirmation. a) Cancel: nothing happens, reload the page and check nothing got deleted. b) Accept: the deleted image should be gone, reload the page to check it doesn't exist anymore and is not a browser/DOM manipulation trick. - Signoff --- .../intranet-tmpl/prog/en/css/staff-global.css | 4 + .../prog/en/modules/catalogue/detail.tt | 46 ++++++++++-- svc/cover_images | 77 ++++++++++++++++++++ 3 files changed, 120 insertions(+), 7 deletions(-) create mode 100755 svc/cover_images --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -1398,6 +1398,10 @@ li.email { margin : auto; } +.thumbnails > li { + list-style-type: none; +} + #searchresults ul li { font-size : 90%; list-style : url(../../img/item-bullet.gif); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -52,11 +52,36 @@ function verify_images() { }); } - $(document).ready(function() { + function removeLocalImage(imagenumber) { + + $.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(); + } + }); + } + }); + + } + + $(document).ready(function() { $('#bibliodetails').tabs(); $('#search-form').focus(); + $('.thumbnails > li > a > span').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]; + removeLocalImage(imagenumber); + } + + return false; + }); + }); - }); [% IF ( AmazonCoverImages ) %]$(window).load(function() { verify_images(); });[% END %] @@ -693,15 +718,22 @@ function verify_images() { [% IF ( LocalCoverImages ) %]
Click on an image to view it in the image viewer
+Click on an image to view it in the image viewer
+No images have been uploaded for this bibliographic record yet. Please upload one.
+No images have been uploaded for this bibliographic record yet. Please upload one.
[% END %] [% END %]