From 4c184eb83f9eb90f62db7ef3344d3b3b3d0eabd8 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Wed, 8 Nov 2017 16:16:38 +0100 Subject: [PATCH] Added confirmation dialog before deleting an attachment --- scripts/im.js | 14 ++++++++------ src/elogd.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/im.js b/scripts/im.js index 4f6c2bce..540f1a98 100644 --- a/scripts/im.js +++ b/scripts/im.js @@ -47,9 +47,11 @@ function onReady() delete imReq; } -function deleteAtt(idx) -{ - submitted = true; - document.form1.smcmd.value='delatt'+idx; - document.form1.submit(); -} \ No newline at end of file +function deleteAtt(idx, str) +{ + if (confirm(str) == true) { + submitted = true; + document.form1.smcmd.value='delatt'+idx; + document.form1.submit(); + } +} diff --git a/src/elogd.c b/src/elogd.c index ff94ccf9..01e02db0 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -11942,7 +11942,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL sprintf(str, "im('att'+'%d','%s','%s','rotright');", index, thumb_name, att[index]); ricon("rotright", loc("Rotate right"), str); rsprintf(" \n"); - sprintf(str, "deleteAtt('%d')", index); + sprintf(str, "deleteAtt('%d','%s')", index, loc("Are you sure to delete the attachment?")); ricon("delatt", loc("Delete attachment"), str); rsprintf("  \n");