Bug 1633 introduced the possibility of local cover images, but without the means to delete images once they have been added.
*** Bug 9119 has been marked as a duplicate of this bug. ***
So if you upload an image that you don't like, you have no means of getting rid of it except by replacing it with something else? Seems like there really should be an option to delete an image. I'm going to bump up the importance a little.
I agree - we need to be able to remove them.
So, how is the ability to delete the local cover image different/similar from the ability to delete the image of the patron? There should not be that much difference in code.
(In reply to comment #4) > So, how is the ability to delete the local cover image different/similar > from the ability to delete the image of the patron? There should not be that > much difference in code. A great learning exercise would be to look .. then send a patch implementing the feature :)
Created attachment 20761 [details] [review] Bug 7813: Ability to delete local cover images This patch adds the ability to delete local cover images from the detail page. It adds a 'x' button to trigger the deletion. It occurs using a new SVC script called cover_images that accepts the following parameters: - action - biblionumber (used for checking imagenumber validity) - imagenumber (repeatable) It then deletes all valid images passed and returns a JSON object containing the imagenumbers and the deletion status (1/0). The operation is triggered using jQuery.ajax, and with the response the corresponding images get deleted. Note: currently one image is deleted at a time, but the code is there to be used. To test: - 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 Note: check having more cover images than those that fit the width and see it wraps fine. Any comments are welcome, this is WIP. Thanks To+ P.S. I chose not to implement every possible action on the svc script, but another bug could be filled for more improvements. Sponsored-by: Universidad Nacional de Cordoba
Created attachment 20763 [details] [review] Bug 7813: Ability to delete local cover images This patch adds the ability to delete local cover images from the detail page. It adds a 'x' button to trigger the deletion. It occurs using a new SVC script called cover_images that accepts the following parameters: - action - biblionumber (used for checking imagenumber validity) - imagenumber (repeatable) It then deletes all valid images passed and returns a JSON object containing the imagenumbers and the deletion status (1/0). The operation is triggered using jQuery.ajax, and with the response the corresponding images get deleted. Note: currently one image is deleted at a time, but the code is there to be used. To test: - 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 Note: check having more cover images than those that fit the width and see it wraps fine. Any comments are welcome, this is WIP. Thanks To+ P.S. I chose not to implement every possible action on the svc script, but another bug could be filled for more improvements. Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: David Cook <dcook@prosentient.com.au> Works as described. This is a nice addition!
Alas, when I try in 3.8.0 (after manually merging the patch with the code), I get this error: Uncaught Syntax error, unrecognized expression: [{"imagenumber":"13","deleted":1}] jquery.js:19 F.filter jquery.js:19 F jquery.js:19 F jquery.js:19 o.fn.o.find jquery.js:12 jQuery.fn.find jquery.hotkeys.min.js:1 o.fn.o.init jquery.js:12 l.jQuery.l.$ jquery.js:12 $.ajax.success detail.pl?biblionumber=179:102 I jquery.js:19 N jquery.js:19 Maybe I made a mistake doing the merge? Or maybe an older version of jQuery has a harder time processing JSON but that seems strange...
(In reply to David Cook from comment #8) > Alas, when I try in 3.8.0 (after manually merging the patch with the code), > I get this error: > > Uncaught Syntax error, unrecognized expression: > [{"imagenumber":"13","deleted":1}] jquery.js:19 > > Maybe I made a mistake doing the merge? Or maybe an older version of jQuery > has a harder time processing JSON but that seems strange... I'm not sure about that one, but it might be due to: - wrong jquery version (incorrectly processing the application/json content-type) - wrong JSON Perl library (not outputting the right format) I'd like to note that I used bootstrap on this patch, and there are some visual gli-glitches when merging into 3.8.x.
Created attachment 21272 [details] [review] 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.
Hi Tomás, I think this followup improves yours. Could you have a look at it and add a signoff if you agree?
Created attachment 21275 [details] [review] 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. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> I like the ehancements to the original patch and work as expected.
Marked as Passed QA.
Created attachment 21276 [details] [review] Bug 7813: Ability to delete local cover images This patch adds the ability to delete local cover images from the detail page. It adds a 'x' button to trigger the deletion. It occurs using a new SVC script called cover_images that accepts the following parameters: - action - biblionumber (used for checking imagenumber validity) - imagenumber (repeatable) It then deletes all valid images passed and returns a JSON object containing the imagenumbers and the deletion status (1/0). The operation is triggered using jQuery.ajax, and with the response the corresponding images get deleted. Note: currently one image is deleted at a time, but the code is there to be used. To test: - 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 Note: check having more cover images than those that fit the width and see it wraps fine. Any comments are welcome, this is WIP. Thanks To+ P.S. I chose not to implement every possible action on the svc script, but another bug could be filled for more improvements. Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 21277 [details] [review] 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. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> I like the ehancements to the original patch and work as expected. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Pushed to master, along with a follow-up that replaces the "×" symbol with more descriptive text to make it easier for users and translators. Thanks, Tomás and Jonathan!
This patch has been pushed to 3.12.x, will be in 3.12.7. Long standing usability bug solved :-D