From 3c6435e3a8c40f0c27babaa08a8898129b5f5406 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 4 May 2015 15:43:23 +0200 Subject: [PATCH] Fixed issue with "Save" button and "Show text = 0". Hide "Preview" button when "Show text = 0". --- scripts/dnd.js | 7 +++++-- src/elogd.c | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/dnd.js b/scripts/dnd.js index bba8d03d..930e0149 100644 --- a/scripts/dnd.js +++ b/scripts/dnd.js @@ -70,15 +70,18 @@ function asend() { // get all form fields var f = new FormData(document.form1); + var t; // append text for CKEDITOR and textarea, respectively if (typeof f.delete == 'function') // not avalable in all browsers f.delete("Text"); if (typeof(CKEDITOR) != 'undefined') t = CKEDITOR.instances.Text.getData(); - else + else if (document.form1.Text != undefined) t = document.form1.Text.value; - f.append("Text", t); + + if (t != undefined) + f.append("Text", t); // add jcmd f.append("jcmd", "Save"); diff --git a/src/elogd.c b/src/elogd.c index fe9bca10..00b52280 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -10435,7 +10435,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL loc("Submit")); rsprintf("\n", loc("Save")); - rsprintf("\n", + + if (!getcfg(lbs->name, "Show text", str, sizeof(str)) || atoi(str) == 1) + rsprintf("\n", loc("Preview")); rsprintf("\n", loc("Back")); @@ -11948,8 +11950,11 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL loc("Submit")); rsprintf("\n", loc("Save")); - rsprintf("\n", + + if (!getcfg(lbs->name, "Show text", str, sizeof(str)) || atoi(str) == 1) + rsprintf("\n", loc("Preview")); + rsprintf("\n", loc("Back"));